pico-sdk icon indicating copy to clipboard operation
pico-sdk copied to clipboard

Make spacer sections allocatable

Open will-v-pi opened this issue 5 months ago • 10 comments

As raised in #2513, the current way of specifying stack and heap space means that on GCC the space is not included in --print-memory-usage, because they are not marked as allocatable in order to maintain compatibility with linker scripts prior to 1.5.1 which don't KEEP the .stack and .heap sections.

This changes that default to mark them as allocatable, and adds a new CMake function to parse the linker script and check for compatibility, and enables a workaround if not compatible.

This means if you:

  • KEEP the sections - they show up in --print-memory-usage, and the binary runs fine
  • Don't KEEP the sections - they don't show up in --print-memory-usage, and CMake raises warnings at the configure stage explaining the incompatibility, but the binary still runs fine

will-v-pi avatar Jun 11 '25 10:06 will-v-pi