From 22deef63023727b098388b1b9ceb50ac214c2e7f Mon Sep 17 00:00:00 2001 From: William Vinnicombe Date: Mon, 9 Sep 2024 16:05:25 +0100 Subject: [PATCH] Propogate non-default pico_cmake_set_default values through to compile definitions Add PICO_BOARD_CMAKE_OVERRIDES common scope variable, to contain any pico_cmake_set_default CMake variables which have been overwritten. This allows passing CMake arguments to the build, without needing extra target_compile_definitions. Also add pico_cmake_set_default PICO_RP2350_A2_SUPPORTED to enable/disable the E10 abs-block fix --- cmake/generic_board.cmake | 2 ++ pico_sdk_init.cmake | 1 + src/boards/include/boards/adafruit_feather_rp2350.h | 1 + src/boards/include/boards/datanoisetv_rp2350_dsp.h | 1 + src/boards/include/boards/defcon32_badge.h | 1 + src/boards/include/boards/gen4_rp2350_24.h | 1 + src/boards/include/boards/gen4_rp2350_24ct.h | 1 + src/boards/include/boards/gen4_rp2350_24t.h | 1 + src/boards/include/boards/gen4_rp2350_28.h | 1 + src/boards/include/boards/gen4_rp2350_28ct.h | 1 + src/boards/include/boards/gen4_rp2350_28t.h | 1 + src/boards/include/boards/gen4_rp2350_32.h | 1 + src/boards/include/boards/gen4_rp2350_32ct.h | 1 + src/boards/include/boards/gen4_rp2350_32t.h | 1 + src/boards/include/boards/gen4_rp2350_35.h | 1 + src/boards/include/boards/gen4_rp2350_35ct.h | 1 + src/boards/include/boards/gen4_rp2350_35t.h | 1 + src/boards/include/boards/hellbender_2350A_devboard.h | 1 + src/boards/include/boards/ilabs_challenger_rp2350_bconnect.h | 1 + src/boards/include/boards/ilabs_challenger_rp2350_wifi_ble.h | 1 + src/boards/include/boards/melopero_perpetuo_rp2350_lora.h | 1 + src/boards/include/boards/phyx_rick_tny_rp2350.h | 1 + src/boards/include/boards/pico2.h | 1 + src/boards/include/boards/pimoroni_pga2350.h | 1 + src/boards/include/boards/pimoroni_pico_plus2_rp2350.h | 1 + src/boards/include/boards/pimoroni_plasma2350.h | 1 + src/boards/include/boards/pimoroni_tiny2350.h | 1 + src/boards/include/boards/seeed_xiao_rp2350.h | 1 + src/boards/include/boards/solderparty_rp2350_stamp.h | 1 + src/boards/include/boards/solderparty_rp2350_stamp_xl.h | 1 + src/boards/include/boards/sparkfun_promicro_rp2350.h | 1 + .../include/boards/switchscience_picossci2_conta_base.h | 1 + .../include/boards/switchscience_picossci2_dev_board.h | 1 + src/boards/include/boards/switchscience_picossci2_micro.h | 1 + .../include/boards/switchscience_picossci2_rp2350_breakout.h | 1 + src/boards/include/boards/switchscience_picossci2_tiny.h | 1 + src/boards/include/boards/tinycircuits_thumby_color_rp2350.h | 1 + src/common/pico_base_headers/CMakeLists.txt | 5 +++++ tools/CMakeLists.txt | 2 +- tools/check_board_header.py | 4 ++++ 40 files changed, 48 insertions(+), 1 deletion(-) diff --git a/cmake/generic_board.cmake b/cmake/generic_board.cmake index 18d789751..c7fdfe5a0 100644 --- a/cmake/generic_board.cmake +++ b/cmake/generic_board.cmake @@ -26,6 +26,8 @@ if (EXISTS ${PICO_BOARD_HEADER_FILE}) if (LINE MATCHES "^[ \t\]*//[ \t\]*pico_cmake_set_default[ \t\]*([a-zA-Z_][a-zA-Z0-9_]*)[ \t\]*=[ \t\]*(.*)") if (NOT DEFINED "${CMAKE_MATCH_1}") set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") + else() + list(APPEND PICO_BOARD_CMAKE_OVERRIDES ${CMAKE_MATCH_1}) endif() endif() endwhile() diff --git a/pico_sdk_init.cmake b/pico_sdk_init.cmake index 48b44db38..b708b6349 100644 --- a/pico_sdk_init.cmake +++ b/pico_sdk_init.cmake @@ -75,6 +75,7 @@ if (NOT TARGET _pico_sdk_pre_init_marker) PICO_SDK_POST_LIST_FILES PICO_CONFIG_HEADER_FILES PICO_RP2040_CONFIG_HEADER_FILES + PICO_BOARD_CMAKE_OVERRIDES ) macro(pico_promote_common_scope_vars) diff --git a/src/boards/include/boards/adafruit_feather_rp2350.h b/src/boards/include/boards/adafruit_feather_rp2350.h index 36456b9af..20d77478d 100644 --- a/src/boards/include/boards/adafruit_feather_rp2350.h +++ b/src/boards/include/boards/adafruit_feather_rp2350.h @@ -78,6 +78,7 @@ #define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/datanoisetv_rp2350_dsp.h b/src/boards/include/boards/datanoisetv_rp2350_dsp.h index 21ae69779..feb5792c0 100644 --- a/src/boards/include/boards/datanoisetv_rp2350_dsp.h +++ b/src/boards/include/boards/datanoisetv_rp2350_dsp.h @@ -48,6 +48,7 @@ #define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/defcon32_badge.h b/src/boards/include/boards/defcon32_badge.h index 0c5f3d45c..3466fc711 100644 --- a/src/boards/include/boards/defcon32_badge.h +++ b/src/boards/include/boards/defcon32_badge.h @@ -108,6 +108,7 @@ #define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/gen4_rp2350_24.h b/src/boards/include/boards/gen4_rp2350_24.h index dc8b9f899..ec479653e 100644 --- a/src/boards/include/boards/gen4_rp2350_24.h +++ b/src/boards/include/boards/gen4_rp2350_24.h @@ -76,6 +76,7 @@ #define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/gen4_rp2350_24ct.h b/src/boards/include/boards/gen4_rp2350_24ct.h index 39632fac3..71b8f2e66 100644 --- a/src/boards/include/boards/gen4_rp2350_24ct.h +++ b/src/boards/include/boards/gen4_rp2350_24ct.h @@ -76,6 +76,7 @@ #define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/gen4_rp2350_24t.h b/src/boards/include/boards/gen4_rp2350_24t.h index d1bfbf418..df086fae5 100644 --- a/src/boards/include/boards/gen4_rp2350_24t.h +++ b/src/boards/include/boards/gen4_rp2350_24t.h @@ -76,6 +76,7 @@ #define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/gen4_rp2350_28.h b/src/boards/include/boards/gen4_rp2350_28.h index a005be77b..b460b8780 100644 --- a/src/boards/include/boards/gen4_rp2350_28.h +++ b/src/boards/include/boards/gen4_rp2350_28.h @@ -76,6 +76,7 @@ #define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/gen4_rp2350_28ct.h b/src/boards/include/boards/gen4_rp2350_28ct.h index c93126ad2..11153e143 100644 --- a/src/boards/include/boards/gen4_rp2350_28ct.h +++ b/src/boards/include/boards/gen4_rp2350_28ct.h @@ -76,6 +76,7 @@ #define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/gen4_rp2350_28t.h b/src/boards/include/boards/gen4_rp2350_28t.h index 9c3f908bd..c948c9eb1 100644 --- a/src/boards/include/boards/gen4_rp2350_28t.h +++ b/src/boards/include/boards/gen4_rp2350_28t.h @@ -76,6 +76,7 @@ #define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/gen4_rp2350_32.h b/src/boards/include/boards/gen4_rp2350_32.h index 33caaf550..896937744 100644 --- a/src/boards/include/boards/gen4_rp2350_32.h +++ b/src/boards/include/boards/gen4_rp2350_32.h @@ -76,6 +76,7 @@ #define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/gen4_rp2350_32ct.h b/src/boards/include/boards/gen4_rp2350_32ct.h index 839fdc01a..0e137357e 100644 --- a/src/boards/include/boards/gen4_rp2350_32ct.h +++ b/src/boards/include/boards/gen4_rp2350_32ct.h @@ -76,6 +76,7 @@ #define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/gen4_rp2350_32t.h b/src/boards/include/boards/gen4_rp2350_32t.h index 2a1be7d2a..6280f0d7d 100644 --- a/src/boards/include/boards/gen4_rp2350_32t.h +++ b/src/boards/include/boards/gen4_rp2350_32t.h @@ -76,6 +76,7 @@ #define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/gen4_rp2350_35.h b/src/boards/include/boards/gen4_rp2350_35.h index c0e2c0752..d26f53034 100644 --- a/src/boards/include/boards/gen4_rp2350_35.h +++ b/src/boards/include/boards/gen4_rp2350_35.h @@ -76,6 +76,7 @@ #define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/gen4_rp2350_35ct.h b/src/boards/include/boards/gen4_rp2350_35ct.h index 987804799..8576ac503 100644 --- a/src/boards/include/boards/gen4_rp2350_35ct.h +++ b/src/boards/include/boards/gen4_rp2350_35ct.h @@ -76,6 +76,7 @@ #define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/gen4_rp2350_35t.h b/src/boards/include/boards/gen4_rp2350_35t.h index 079143f86..ee8cb2385 100644 --- a/src/boards/include/boards/gen4_rp2350_35t.h +++ b/src/boards/include/boards/gen4_rp2350_35t.h @@ -76,6 +76,7 @@ #define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/hellbender_2350A_devboard.h b/src/boards/include/boards/hellbender_2350A_devboard.h index 404e95647..63753bcca 100644 --- a/src/boards/include/boards/hellbender_2350A_devboard.h +++ b/src/boards/include/boards/hellbender_2350A_devboard.h @@ -91,6 +91,7 @@ // --- RP2350 VARIANT --- #define PICO_RP2350A 1 +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/ilabs_challenger_rp2350_bconnect.h b/src/boards/include/boards/ilabs_challenger_rp2350_bconnect.h index 66a4a7ea3..92d8960b8 100644 --- a/src/boards/include/boards/ilabs_challenger_rp2350_bconnect.h +++ b/src/boards/include/boards/ilabs_challenger_rp2350_bconnect.h @@ -83,6 +83,7 @@ #define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/ilabs_challenger_rp2350_wifi_ble.h b/src/boards/include/boards/ilabs_challenger_rp2350_wifi_ble.h index a88e797c0..1278209b8 100644 --- a/src/boards/include/boards/ilabs_challenger_rp2350_wifi_ble.h +++ b/src/boards/include/boards/ilabs_challenger_rp2350_wifi_ble.h @@ -80,6 +80,7 @@ #define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/melopero_perpetuo_rp2350_lora.h b/src/boards/include/boards/melopero_perpetuo_rp2350_lora.h index cc358de34..e86492b39 100644 --- a/src/boards/include/boards/melopero_perpetuo_rp2350_lora.h +++ b/src/boards/include/boards/melopero_perpetuo_rp2350_lora.h @@ -82,6 +82,7 @@ +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/phyx_rick_tny_rp2350.h b/src/boards/include/boards/phyx_rick_tny_rp2350.h index 7db839540..7012ac141 100644 --- a/src/boards/include/boards/phyx_rick_tny_rp2350.h +++ b/src/boards/include/boards/phyx_rick_tny_rp2350.h @@ -80,6 +80,7 @@ #define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/pico2.h b/src/boards/include/boards/pico2.h index e47dcc547..4dbb232d2 100644 --- a/src/boards/include/boards/pico2.h +++ b/src/boards/include/boards/pico2.h @@ -93,6 +93,7 @@ #define PICO_VSYS_PIN 29 #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/pimoroni_pga2350.h b/src/boards/include/boards/pimoroni_pga2350.h index 9690f130c..f4f0a3d2a 100644 --- a/src/boards/include/boards/pimoroni_pga2350.h +++ b/src/boards/include/boards/pimoroni_pga2350.h @@ -85,6 +85,7 @@ // no PICO_VBUS_PIN // no PICO_VSYS_PIN +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/pimoroni_pico_plus2_rp2350.h b/src/boards/include/boards/pimoroni_pico_plus2_rp2350.h index 13328f308..64669465e 100644 --- a/src/boards/include/boards/pimoroni_pico_plus2_rp2350.h +++ b/src/boards/include/boards/pimoroni_pico_plus2_rp2350.h @@ -99,6 +99,7 @@ #define PICO_VSYS_PIN 43 #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/pimoroni_plasma2350.h b/src/boards/include/boards/pimoroni_plasma2350.h index 8604f023d..44770e443 100644 --- a/src/boards/include/boards/pimoroni_plasma2350.h +++ b/src/boards/include/boards/pimoroni_plasma2350.h @@ -109,6 +109,7 @@ #define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/pimoroni_tiny2350.h b/src/boards/include/boards/pimoroni_tiny2350.h index 09f32e65d..bf00cbdb9 100644 --- a/src/boards/include/boards/pimoroni_tiny2350.h +++ b/src/boards/include/boards/pimoroni_tiny2350.h @@ -89,6 +89,7 @@ #define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/seeed_xiao_rp2350.h b/src/boards/include/boards/seeed_xiao_rp2350.h index 5c5859402..3390dedcc 100644 --- a/src/boards/include/boards/seeed_xiao_rp2350.h +++ b/src/boards/include/boards/seeed_xiao_rp2350.h @@ -142,6 +142,7 @@ #define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/solderparty_rp2350_stamp.h b/src/boards/include/boards/solderparty_rp2350_stamp.h index 64ac474e3..bb2fd7b52 100644 --- a/src/boards/include/boards/solderparty_rp2350_stamp.h +++ b/src/boards/include/boards/solderparty_rp2350_stamp.h @@ -78,6 +78,7 @@ #define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/solderparty_rp2350_stamp_xl.h b/src/boards/include/boards/solderparty_rp2350_stamp_xl.h index 90a17b98c..33233f7d6 100644 --- a/src/boards/include/boards/solderparty_rp2350_stamp_xl.h +++ b/src/boards/include/boards/solderparty_rp2350_stamp_xl.h @@ -78,6 +78,7 @@ #define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/sparkfun_promicro_rp2350.h b/src/boards/include/boards/sparkfun_promicro_rp2350.h index fd12de506..8709e8dca 100644 --- a/src/boards/include/boards/sparkfun_promicro_rp2350.h +++ b/src/boards/include/boards/sparkfun_promicro_rp2350.h @@ -81,6 +81,7 @@ // --- RP2350 VARIANT --- #define PICO_RP2350A 1 +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/switchscience_picossci2_conta_base.h b/src/boards/include/boards/switchscience_picossci2_conta_base.h index 1da3ddfe5..638e47e57 100644 --- a/src/boards/include/boards/switchscience_picossci2_conta_base.h +++ b/src/boards/include/boards/switchscience_picossci2_conta_base.h @@ -79,6 +79,7 @@ #define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/switchscience_picossci2_dev_board.h b/src/boards/include/boards/switchscience_picossci2_dev_board.h index 432d2d9b1..b674362bd 100644 --- a/src/boards/include/boards/switchscience_picossci2_dev_board.h +++ b/src/boards/include/boards/switchscience_picossci2_dev_board.h @@ -80,6 +80,7 @@ #define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/switchscience_picossci2_micro.h b/src/boards/include/boards/switchscience_picossci2_micro.h index 5d664997e..e1ccf359a 100644 --- a/src/boards/include/boards/switchscience_picossci2_micro.h +++ b/src/boards/include/boards/switchscience_picossci2_micro.h @@ -66,6 +66,7 @@ #define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/switchscience_picossci2_rp2350_breakout.h b/src/boards/include/boards/switchscience_picossci2_rp2350_breakout.h index 68d39f926..ec53d1658 100644 --- a/src/boards/include/boards/switchscience_picossci2_rp2350_breakout.h +++ b/src/boards/include/boards/switchscience_picossci2_rp2350_breakout.h @@ -79,6 +79,7 @@ #define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/switchscience_picossci2_tiny.h b/src/boards/include/boards/switchscience_picossci2_tiny.h index f43307cef..f422017bd 100644 --- a/src/boards/include/boards/switchscience_picossci2_tiny.h +++ b/src/boards/include/boards/switchscience_picossci2_tiny.h @@ -79,6 +79,7 @@ #define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024) #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/boards/include/boards/tinycircuits_thumby_color_rp2350.h b/src/boards/include/boards/tinycircuits_thumby_color_rp2350.h index 0a3c14a68..58088e581 100644 --- a/src/boards/include/boards/tinycircuits_thumby_color_rp2350.h +++ b/src/boards/include/boards/tinycircuits_thumby_color_rp2350.h @@ -93,6 +93,7 @@ #define PICO_VSYS_PIN 29 #endif +// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 #ifndef PICO_RP2350_A2_SUPPORTED #define PICO_RP2350_A2_SUPPORTED 1 #endif diff --git a/src/common/pico_base_headers/CMakeLists.txt b/src/common/pico_base_headers/CMakeLists.txt index 57973fea7..89f89b501 100644 --- a/src/common/pico_base_headers/CMakeLists.txt +++ b/src/common/pico_base_headers/CMakeLists.txt @@ -6,6 +6,11 @@ if (NOT TARGET pico_base_headers) target_compile_definitions(pico_base_headers INTERFACE PICO_BOARD="${PICO_BOARD}") + foreach(override ${PICO_BOARD_CMAKE_OVERRIDES}) + target_compile_definitions(pico_base_headers INTERFACE + ${override}=${${override}}) + endforeach() + target_link_libraries(pico_base_headers INTERFACE pico_platform_headers) list(APPEND PICO_SDK_POST_LIST_FILES ${CMAKE_CURRENT_LIST_DIR}/generate_config_header.cmake) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index d7204bc9a..86eee1ee1 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -384,7 +384,7 @@ function(pico_add_uf2_output TARGET) endif() get_target_property(extra_uf2_args ${TARGET} PICOTOOL_EXTRA_UF2_ARGS) - if (1) # TODO: A2 only (Errata RP2350-E9) + if (PICO_RP2350_A2_SUPPORTED) if (NOT extra_uf2_args) set(extra_uf2_args "--abs-block") elseif(NOT "--abs-block" IN_LIST extra_uf2_args) diff --git a/tools/check_board_header.py b/tools/check_board_header.py index 60ff0af5a..3849e146f 100755 --- a/tools/check_board_header.py +++ b/tools/check_board_header.py @@ -374,8 +374,12 @@ def read_defines_from(header_file, defines_dict): else: chip = 'RP2350B' if not board_header.endswith("amethyst_fpga.h"): + if 'PICO_RP2350_A2_SUPPORTED' not in cmake_default_settings: + raise Exception("{} uses chip {} but is missing a pico_cmake_set_default {}".format(board_header, chip, 'PICO_RP2350_A2_SUPPORTED')) if 'PICO_RP2350_A2_SUPPORTED' not in defines: raise Exception("{} uses chip {} but is missing a #define {}".format(board_header, chip, 'PICO_RP2350_A2_SUPPORTED')) + if int(cmake_default_settings['PICO_RP2350_A2_SUPPORTED'].value) != defines['PICO_RP2350_A2_SUPPORTED'].resolved_value: + raise Exception("{} has mismatched pico_cmake_set_default and #define values for {}".format(board_header, 'PICO_RP2350_A2_SUPPORTED')) if defines['PICO_RP2350_A2_SUPPORTED'].resolved_value != 1: raise Exception("{} sets #define {} {} (should be 1)".format(board_header, chip, 'PICO_RP2350_A2_SUPPORTED', defines['PICO_RP2350_A2_SUPPORTED'].resolved_value)) if 'PICO_FLASH_SIZE_BYTES' not in cmake_default_settings: