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

Conversation

will-v-pi
Copy link

Currently, if you compile with -DPICO_FLASH_SIZE_BYTES="(2 * 1024 * 1024)", that modified flash size is only used in CMake (when generating the linker script) and doesn't propogate through to the compilation. To set it for the compilation you need to add a separate target_compile_definitions(my_exe INTERFACE PICO_FLASH_SIZE_BYTES=${PICO_FLASH_SIZE_BYTES}) to your CMakeLists.txt file.

This PR changes this behaviour, so pico_cmake_set_default values that have been overridden (eg with -DPICO_... or set(PICO_...) will propogate through to the compilation. If the default value isn't modified then the behaviour is not changed, and you can still use target_compile_definitions to set the values for compilation only.

Adds a PICO_BOARD_CMAKE_OVERRIDES common scope variable, to contain any pico_cmake_set_default CMake variables which have been overwritten. This is populated when reading the board header, and then read when compiling pico_base_headers.

Also add pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1 to board headers to enable/disable the E10 abs-block fix, and modify check_board_header.py to support this. This allows specifying -DPICO_RP2350_A2_SUPPORTED=0 to CMake to prevent the creation of an abs_block, for example this could be used when you are not planning on dragging & dropping your UF2 into partition tables.

…e 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants