Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propogate changed pico_cmake_set_default values to the compilation #2034

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmake/generic_board.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions pico_sdk_init.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/adafruit_feather_rp2350.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/datanoisetv_rp2350_dsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/defcon32_badge.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/gen4_rp2350_24.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/gen4_rp2350_24ct.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/gen4_rp2350_24t.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/gen4_rp2350_28.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/gen4_rp2350_28ct.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/gen4_rp2350_28t.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/gen4_rp2350_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/gen4_rp2350_32ct.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/gen4_rp2350_32t.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/gen4_rp2350_35.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/gen4_rp2350_35ct.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/gen4_rp2350_35t.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/hellbender_2350A_devboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/melopero_perpetuo_rp2350_lora.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/phyx_rick_tny_rp2350.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/pico2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/pimoroni_pga2350.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/pimoroni_pico_plus2_rp2350.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/pimoroni_plasma2350.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/pimoroni_tiny2350.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/seeed_xiao_rp2350.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/solderparty_rp2350_stamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/solderparty_rp2350_stamp_xl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/sparkfun_promicro_rp2350.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/switchscience_picossci2_micro.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/boards/include/boards/switchscience_picossci2_tiny.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/common/pico_base_headers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions tools/check_board_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading