You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Make sure blink.nim's nimcache directory is empty
$ cd picosdk4nim/examples
$ nim c blink.nim
# Suppose it compiles successfully
$ nim c -d:PicoBoard=pico2 blink.nim...Target board (PICO_BOARD) is 'pico2'.Using board configuration from pico-sdk/src/boards/include/boards/pico2.hCMake Error at pico-sdk/cmake/pico_pre_load_platform.cmake:111 (message): PICO_PLATFORM is specified to be 'rp2040', but PICO_BOARD='pico2' uses 'rp2350' which is incompatible. You need to delete the CMake cache or build directory and reconfigure to proceed. The best practice is to use separate build directories for different platforms.Call Stack (most recent call first): pico-sdk/pico_sdk_init.cmake:87 (include) CMakeLists.txt:6 (include)-- Configuring incomplete, errors occurred!
$ nim c -d:PicoBoard=pico2 -d:PicoPlatform=rp2350-arm-s blink.nim
# No errors from cmake and it looks like compiles successfully.
# But C files are compiled with compile options for RP2040 not for RP2350
# and it likely doesn't work on Raspberry Pi Pico 2
When nim c blink.nim is executed without any cached files, CMake files in Pico SDK detects C compilers and set C compiler paths, C compiler options or other build parameters in cmakeBuildDir/CMakeCache.txt in the cache directory.
As Pico SDK builds binary for Raspberry Pi Pico in default, these build parameters are set for Raspberry Pi Pico.
For example, there is a line CMAKE_C_FLAGS:STRING=-mcpu=cortex-m0plus -mthumb in CMakeCache.txt that is the compile option to build binary for RP2040.
Also there is a line PICO_PLATFORM:STRING=rp2040.
When nim c -d:PicoBoard=pico2 blink.nim is ran, PICO_BOARD:STRING=pico2 in cmakeBuildDir/CMakeCache.txt is changed but PICO_PLATFORM:STRING=rp2040 is not changed.
As Raspberry Pi Pico 2 doesn't has RP2040, it fails to build.
When nim c -d:PicoBoard=pico2 -d:PicoPlatform=rp2350-arm-s blink.nim is ran, PICO_BOARD:STRING=pico2 and PICO_BOARD:STRING=pico2 are updated, but CMAKE_C_FLAGS:STRING=-mcpu=cortex-m0plus -mthumb is not.
It should be CMAKE_CXX_FLAGS:STRING=-mcpu=cortex-m33 -mthumb -march=armv8-m.main+fp+dsp -mfloat-abi=softfp -mcmse for RP2350 ARM core.
The text was updated successfully, but these errors were encountered:
How to reproduce:
When
nim c blink.nim
is executed without any cached files, CMake files in Pico SDK detects C compilers and set C compiler paths, C compiler options or other build parameters incmakeBuildDir/CMakeCache.txt
in the cache directory.As Pico SDK builds binary for Raspberry Pi Pico in default, these build parameters are set for Raspberry Pi Pico.
For example, there is a line
CMAKE_C_FLAGS:STRING=-mcpu=cortex-m0plus -mthumb
inCMakeCache.txt
that is the compile option to build binary for RP2040.Also there is a line
PICO_PLATFORM:STRING=rp2040
.When
nim c -d:PicoBoard=pico2 blink.nim
is ran,PICO_BOARD:STRING=pico2
incmakeBuildDir/CMakeCache.txt
is changed butPICO_PLATFORM:STRING=rp2040
is not changed.As Raspberry Pi Pico 2 doesn't has RP2040, it fails to build.
When
nim c -d:PicoBoard=pico2 -d:PicoPlatform=rp2350-arm-s blink.nim
is ran,PICO_BOARD:STRING=pico2
andPICO_BOARD:STRING=pico2
are updated, butCMAKE_C_FLAGS:STRING=-mcpu=cortex-m0plus -mthumb
is not.It should be
CMAKE_CXX_FLAGS:STRING=-mcpu=cortex-m33 -mthumb -march=armv8-m.main+fp+dsp -mfloat-abi=softfp -mcmse
for RP2350 ARM core.The text was updated successfully, but these errors were encountered: