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

SDK • Controlling cmake behaviour/output using -Dvar=value

$
0
0
Some background:

I have a number of different RP2xxx boards from different vendors. As well as the official Pico/PicoW/Pico2/Pico2W, there are some which have PSRAM, others with bigger flash sizes, and so on.

I know that if it's in the board header file, I can see the definition in code at compile time. however, I want to be able to do something slightly different, which is to use some details when running cmake.

I would like to reserve some flash at the end of the space. This will obviously reduce the available code size, so I need to have a modified .ld file, but obviously this will vary from board to board.

In CMakeLists.txt I can examine environment variables. Am I able to reference variables set on the command line similarly, so I can determine which custom .ld file to specify in pico_set_linker_script ?

Statistics: Posted by SteveSpencer — Sat Dec 13, 2025 11:05 am



Viewing all articles
Browse latest Browse all 8374

Trending Articles