Skip to content

Properly respect setting PICO_DEFAULT_BINARY_TYPE #2381

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

Merged
merged 2 commits into from
Apr 3, 2025
Merged
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
18 changes: 18 additions & 0 deletions src/rp2_common/pico_standard_link/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ if (NOT TARGET pico_standard_link)
set_target_properties(${TARGET} PROPERTIES PICO_TARGET_BINARY_TYPE ${TYPE})
endfunction()

# slightly messy as we support both the preferred PICO_DEFAULT_BINARY_TYPE and the individual variables
if (NOT PICO_DEFAULT_BINARY_TYPE)
if (PICO_NO_FLASH)
set(PICO_DEFAULT_BINARY_TYPE no_flash)
Expand All @@ -40,6 +41,23 @@ if (NOT TARGET pico_standard_link)
else()
set(PICO_DEFAULT_BINARY_TYPE default)
endif()
else()
# we must set the individual variables here, as they are used in generator expressions,
# but also for our checks below
if (PICO_DEFAULT_BINARY_TYPE STREQUAL no_flash)
set(PICO_NO_FLASH 1)
endif()
if (PICO_DEFAULT_BINARY_TYPE STREQUAL blocked_ram)
set(PICO_USE_BLOCKED_RAM 1)
endif()
if (PICO_DEFAULT_BINARY_TYPE STREQUAL copy_to_ram)
set(PICO_COPY_TO_RAM 1)
endif()
endif()
if ((PICO_NO_FLASH AND PICO_USE_BLOCKED_RAM) OR
(PICO_USE_BLOCKED_RAM AND PICO_COPY_TO_RAM) OR
(PICO_COPY_TO_RAM AND PICO_NO_FLASH))
message(FATAL_ERROR "Conflicting binary types specified amongst PICO_DEFAULT_BINARY_TYPE, PICO_NO_FLASH, PICO_USE_BLOCKED_RAM and PICO_COPY_TO_RAM")
endif()

# todo only needed if not using a custom linker script
Expand Down
Loading