Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4146

SDK • Re: How to turn off optimization, and other debugging tips?

$
0
0
Thank you for your responses.
It seems you have to set these from the command line, not in CMakeLists.txt:
I'm using VSCode, and it isn't clear to me how to change the command line passed into cmake. With other IDEs it's simple to do through the project properties, but of course there are no project properties. Any suggestion?
You can force it locally using gcc directives at the very beginning of the C file (never in a function, neither in main):
This looks like a good way to turn it off for specific functions or files, but is there a way to do it for the entire program when debugging? I could use this to turn it off on specific functions I'm trying to debug.
To clean in VSCode - go to CMake tab (on the left) above Pico extension.
Then Project Outline ... you'll find Clean All Projects ... kinda tricky for the first time, this was the way before Pico module.
I would have never found that! Unfortunately clean fails, here's the output:

Code:

[main] Building folder: c:/Users/Ryan/rpi_pico/build clean[main] Configuring project: rpi_pico [proc] Executing command: C:\Users\Ryan/.pico-sdk/cmake/v3.28.6/bin/cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=C:\Users\Ryan/.pico-sdk/toolchain/13_2_Rel1/bin/arm-none-eabi-gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\Users\Ryan/.pico-sdk/toolchain/13_2_Rel1/bin/arm-none-eabi-gcc.exe -DCMAKE_TOOLCHAIN_FILE:FILEPATH=C:/Users/Ryan/.pico-sdk/sdk/2.0.0/cmake/preload/toolchains/pico_arm_gcc.cmake -DPython3_EXECUTABLE:STRING=C:/Users/Ryan/.pico-sdk/python/3.12.1/python.exe --no-warn-unused-cli "-SC:/Users/Ryan/rpi_pico" "-Bc:/Users/Ryan/rpi_pico/build" -G Ninja[cmake] Not searching for unused variables given on the command line.[cmake] PICO_SDK_PATH is C:/Users/Ryan/.pico-sdk/sdk/2.0.0[cmake] Target board (PICO_BOARD) is 'winglight_eol_board'.[cmake] Using board configuration from C:/Users/Ryan/rpi_pico/winglight_eol_board.h[cmake] Pico Platform (PICO_PLATFORM) is 'rp2040'.[cmake] CMake Error at C:/Users/Ryan/.pico-sdk/sdk/2.0.0/cmake/pico_pre_load_toolchain.cmake:67 (message):[cmake]   CMAKE_TOOLCHAIN_FILE was previously defined to[cmake]   C:/Users/Ryan/.pico-sdk/sdk/2.0.0/cmake/preload/toolchains/pico_arm_cortex_m0plus_gcc.cmake,[cmake]   and now is being changed to[cmake]   C:/Users/Ryan/.pico-sdk/sdk/2.0.0/cmake/preload/toolchains/pico_arm_gcc.cmake.[cmake]   You need to delete the CMake cache and reconfigure if you want to switch[cmake]   compiler.  The best practice is to use separate build directories for[cmake]   different platforms or compilers.[cmake] Call Stack (most recent call first):[cmake]   C:/Users/Ryan/.pico-sdk/sdk/2.0.0/pico_sdk_init.cmake:91 (include)[cmake]   pico_sdk_import.cmake:84 (include)[cmake]   CMakeLists.txt:27 (include)[cmake] [cmake] [cmake] -- Configuring incomplete, errors occurred![proc] The command: C:\Users\Ryan/.pico-sdk/cmake/v3.28.6/bin/cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=C:\Users\Ryan/.pico-sdk/toolchain/13_2_Rel1/bin/arm-none-eabi-gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\Users\Ryan/.pico-sdk/toolchain/13_2_Rel1/bin/arm-none-eabi-gcc.exe -DCMAKE_TOOLCHAIN_FILE:FILEPATH=C:/Users/Ryan/.pico-sdk/sdk/2.0.0/cmake/preload/toolchains/pico_arm_gcc.cmake -DPython3_EXECUTABLE:STRING=C:/Users/Ryan/.pico-sdk/python/3.12.1/python.exe --no-warn-unused-cli "-SC:/Users/Ryan/rpi_pico" "-Bc:/Users/Ryan/rpi_pico/build" -G Ninja exited with code: 1
After this point, compiling fails as well with the same error (output below). I restored the build directory from a backup to get it working again. Any ideas?

Code:

Executing task: C:\Users\Ryan/.pico-sdk/ninja/v1.12.1/ninja.exe -C C:\Users\Ryan\rpi_pico/build ninja: Entering directory `C:\Users\Ryan\rpi_pico/build'[0/1] Re-running CMake...PICO_SDK_PATH is C:/Users/Ryan/.pico-sdk/sdk/2.0.0Target board (PICO_BOARD) is 'winglight_eol_board'.Using board configuration from C:/Users/Ryan/rpi_pico/winglight_eol_board.hPico Platform (PICO_PLATFORM) is 'rp2040'.CMake Error at C:/Users/Ryan/.pico-sdk/sdk/2.0.0/cmake/pico_pre_load_toolchain.cmake:67 (message):  CMAKE_TOOLCHAIN_FILE was previously defined to  C:/Users/Ryan/.pico-sdk/sdk/2.0.0/cmake/preload/toolchains/pico_arm_cortex_m0plus_gcc.cmake,  and now is being changed to  C:/Users/Ryan/.pico-sdk/sdk/2.0.0/cmake/preload/toolchains/pico_arm_gcc.cmake.  You need to delete the CMake cache and reconfigure if you want to switch  compiler.  The best practice is to use separate build directories for  different platforms or compilers.Call Stack (most recent call first):  C:/Users/Ryan/.pico-sdk/sdk/2.0.0/pico_sdk_init.cmake:91 (include)  pico_sdk_import.cmake:84 (include)  CMakeLists.txt:27 (include)-- Configuring incomplete, errors occurred!ninja: error: rebuilding 'build.ninja': subcommand failedFAILED: build.ninjaC:\Users\Ryan\.pico-sdk\cmake\v3.28.6\bin\cmake.exe --regenerate-during-build -S"C:\Users\Ryan\rpi_pico" -B"C:\Users\Ryan\rpi_pico\build" *  The terminal process "C:\Users\Ryan\.pico-sdk\ninja\v1.12.1\ninja.exe '-C', 'C:\Users\Ryan\rpi_pico/build'" terminated with exit code: 1.  *  Terminal will be reused by tasks, press any key to close it. 

Statistics: Posted by patterrr — Wed Sep 11, 2024 4:15 am



Viewing all articles
Browse latest Browse all 4146

Trending Articles