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

Changed requirements for cmake set(PICO_BOARD) in SDK 2.0.0 #411

Open
slimhazard opened this issue Sep 11, 2024 · 2 comments
Open

Changed requirements for cmake set(PICO_BOARD) in SDK 2.0.0 #411

slimhazard opened this issue Sep 11, 2024 · 2 comments

Comments

@slimhazard
Copy link

This came up in the SDK forum, where @kilograham asked for a pico-feedback issue, so that it can be better documented.

https://forums.raspberrypi.com/viewtopic.php?t=376508&sid=19c9d2fc64cb0e6ba4d4cac25787e270

Prior to version 2.0.0, it was sufficient to call set(PICO_BOARD) in CMakeLists.txt before invoking pico_sdk_init(). The set() call could come after including the SDK import code:

include(pico_sdk_import.cmake)

project(myproject C CXX ASM)
# [...]
set(PICO_BOARD pico_w)

pico_sdk_init()

That would lead to a successful build for a PicoW.

But as of 2.0.0, that same code leads to this output from cmake:

Defaulting platform (PICO_PLATFORM) to 'rp2040' since not specified.
Defaulting target board (PICO_BOARD) to 'pico' since not specified.

And then the build fails for a PicoW.

Evidently it's now necessary to set PICO_BOARD before including the SDK import code:

set(PICO_BOARD pico_w)
include(pico_sdk_import.cmake)

project(myproject C CXX ASM)
# [...]

pico_sdk_init()

With that, cmake output confirms that the build is set for a PicoW, and the build succeeds.

@kilograham
Copy link

Note we didn't notice this change, as we always tend to pass PICO_BOARD to CMake either on the command line or from the env, or from the IDE

@slimhazard
Copy link
Author

@Memotech-Bill pointed out in the forum that this also came up in an SDK issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants