Skip to content

Commit 5114e61

Browse files
committed
Fix review comments
And address other build issues that occur if cyw43 is supported but the cyw43-driver does not exist.
1 parent b152b52 commit 5114e61

File tree

12 files changed

+52
-28
lines changed

12 files changed

+52
-28
lines changed

CMakeLists.txt

+1-5
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ function(add_subdirectory_exclude_platforms NAME)
4343
endfunction()
4444

4545
# Add blink example
46-
if (PICO_CYW43_SUPPORTED AND NOT TARGET pico_cyw43_arch)
47-
message("Wi-Fi driver is not available")
48-
else()
49-
add_subdirectory_exclude_platforms(blink)
50-
endif()
46+
add_subdirectory_exclude_platforms(blink)
5147
add_subdirectory_exclude_platforms(blink_simple)
5248

5349
# Add hello world example

adc/CMakeLists.txt

+1-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ if (TARGET hardware_adc)
55
add_subdirectory_exclude_platforms(joystick_display)
66
add_subdirectory_exclude_platforms(onboard_temperature)
77
add_subdirectory_exclude_platforms(microphone_adc)
8-
if (PICO_CYW43_SUPPORTED AND NOT TARGET pico_cyw43_arch)
9-
message("Skipping read_vsys for Pico W as support is not available")
10-
else()
11-
add_subdirectory_exclude_platforms(read_vsys)
12-
endif()
8+
add_subdirectory_exclude_platforms(read_vsys)
139
else()
1410
message("Skipping ADC examples as hardware_adc is unavailable on this platform")
1511
endif()

adc/read_vsys/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
if (PICO_CYW43_SUPPORTED AND NOT TARGET pico_cyw43_arch)
2+
message("Skipping read_vsys as Wi-Fi driver is not available")
3+
return()
4+
endif()
5+
16
add_library(power_status_adc INTERFACE)
27
target_sources(power_status_adc INTERFACE
38
${CMAKE_CURRENT_LIST_DIR}/power_status.c

binary_info/blink_any/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
if (PICO_CYW43_SUPPORTED AND NOT TARGET pico_cyw43_arch)
2+
return()
3+
endif()
14
if (NOT PICO_CYW43_SUPPORTED)
25
message("Only building blink_any for non W boards as PICO_CYW43_SUPPORTED is not set")
36
endif()

blink/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
if (PICO_CYW43_SUPPORTED AND NOT TARGET pico_cyw43_arch)
2+
message("Skipping blink examples as Wi-Fi driver is not available")
3+
return()
4+
endif()
5+
16
add_executable(blink
27
blink.c
38
)

freertos/hello_freertos/CMakeLists.txt

+20-8
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@ target_link_libraries(${TARGET_NAME} PRIVATE
1111
pico_stdlib
1212
)
1313
if(PICO_CYW43_SUPPORTED)
14-
# For led support on pico_w
15-
target_link_libraries(${TARGET_NAME} PRIVATE
16-
pico_cyw43_arch_none
17-
)
14+
if (TARGET pico_cyw43_arch)
15+
# For led support on Wi-Fi boards
16+
target_link_libraries(${TARGET_NAME} PRIVATE
17+
pico_cyw43_arch_none
18+
)
19+
else()
20+
target_compile_definitions(${TARGET_NAME} PRIVATE
21+
USE_LED=0
22+
)
23+
endif()
1824
endif()
1925
target_compile_definitions(${TARGET_NAME} PRIVATE
2026
configNUMBER_OF_CORES=1
@@ -34,9 +40,15 @@ target_link_libraries(${TARGET_NAME} PRIVATE
3440
pico_stdlib
3541
)
3642
if(PICO_CYW43_SUPPORTED)
37-
# For led support on pico_w
38-
target_link_libraries(${TARGET_NAME} PRIVATE
39-
pico_cyw43_arch_none
40-
)
43+
if (TARGET pico_cyw43_arch)
44+
# For led support on Wi-Fi boards
45+
target_link_libraries(${TARGET_NAME} PRIVATE
46+
pico_cyw43_arch_none
47+
)
48+
else()
49+
target_compile_definitions(${TARGET_NAME} PRIVATE
50+
USE_LED=0
51+
)
52+
endif()
4153
endif()
4254
pico_add_extra_outputs(${TARGET_NAME})

freertos/hello_freertos/hello_freertos.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,16 @@
99
#include "pico/stdlib.h"
1010
#include "pico/multicore.h"
1111

12+
// Whether to flash the led
13+
#ifndef USE_LED
14+
#define USE_LED 1
15+
#endif
16+
17+
#if USE_LED
1218
#ifdef CYW43_WL_GPIO_LED_PIN
1319
#include "pico/cyw43_arch.h"
1420
#endif
21+
#endif
1522

1623
#include "FreeRTOS.h"
1724
#include "task.h"
@@ -21,10 +28,6 @@
2128
#define RUN_FREE_RTOS_ON_CORE 0
2229
#endif
2330

24-
// Whether to flash the led
25-
#ifndef USE_LED
26-
#define USE_LED 1
27-
#endif
2831

2932
// Whether to busy wait in the led thread
3033
#ifndef LED_BUSY_WAIT

pico_w/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12)
22

33
if (PICO_CYW43_SUPPORTED) # set by PICO_BOARD=pico_w
44
if (NOT TARGET pico_cyw43_arch)
5-
message("Skipping Pico W examples as support is not available")
5+
message("Skipping Wi-Fi examples as support is not available")
66
else()
77

88
if (DEFINED ENV{WIFI_SSID} AND (NOT WIFI_SSID))
@@ -20,7 +20,7 @@ if (PICO_CYW43_SUPPORTED) # set by PICO_BOARD=pico_w
2020

2121
add_subdirectory(wifi)
2222
if (NOT TARGET pico_btstack_base)
23-
message("Skipping Pico W Bluetooth examples as support is not available")
23+
message("Skipping Bluetooth examples as support is not available")
2424
else()
2525
add_subdirectory(bt)
2626
endif()

pico_w/bt/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set(BTSTACK_3RD_PARTY_PATH ${BTSTACK_ROOT}/3rd-party)
66
set(BT_EXAMPLE_COMMON_DIR "${CMAKE_CURRENT_LIST_DIR}")
77

88
if (NOT PICO_EXTRAS_PATH)
9-
message("Skipping some Pico W BTstack examples that require pico-extras")
9+
message("Skipping some BTstack examples that require pico-extras")
1010
else()
1111
add_library(pico_btstack_audio_example INTERFACE)
1212
target_sources(pico_btstack_audio_example INTERFACE

pico_w/wifi/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ add_subdirectory_exclude_platforms(wifi_scan)
66
add_subdirectory_exclude_platforms(access_point)
77

88
if ("${WIFI_SSID}" STREQUAL "")
9-
message("Skipping some Pico W examples as WIFI_SSID is not defined")
9+
message("Skipping some Wi-Fi examples as WIFI_SSID is not defined")
1010
elseif ("${WIFI_PASSWORD}" STREQUAL "")
11-
message("Skipping some Pico W examples as WIFI_PASSWORD is not defined")
11+
message("Skipping some Wi-Fi examples as WIFI_PASSWORD is not defined")
1212
else()
1313
add_subdirectory_exclude_platforms(freertos)
1414
add_subdirectory_exclude_platforms(httpd)

pico_w/wifi/blink/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
if (PICO_CYW43_SUPPORTED AND NOT TARGET pico_cyw43_arch)
2+
return()
3+
endif()
4+
15
add_executable(picow_blink
26
picow_blink.c
37
)

pico_w/wifi/freertos/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
if (NOT FREERTOS_KERNEL_PATH AND NOT DEFINED ENV{FREERTOS_KERNEL_PATH})
2-
message("Skipping Pico W FreeRTOS examples as FREERTOS_KERNEL_PATH not defined")
2+
message("Skipping Wi-Fi FreeRTOS examples as FREERTOS_KERNEL_PATH not defined")
33
else()
44
include(FreeRTOS_Kernel_import.cmake)
55

0 commit comments

Comments
 (0)