Skip to content

Commit b8f5b4f

Browse files
committed
Default to allocating spacer sections (stack & heap), with PICO_CRT0_ALLOCATE_SPACERS config option to disable the behaviour
1 parent a1faacf commit b8f5b4f

File tree

1 file changed

+8
-2
lines changed
  • src/rp2_common/pico_crt0

1 file changed

+8
-2
lines changed

src/rp2_common/pico_crt0/crt0.S

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,10 +582,16 @@ runtime_init:
582582
//
583583
// Strictly the most correct thing to do (as .stack and .heap are unreferenced) is to mark them as "a", and also KEEP, which
584584
// works correctly for both GCC and Clang, however doing so may break anyone who already has custom linker scripts without
585-
// the KEEP. Therefore we will only add the "a" on Clang, but will also use KEEP to our own linker scripts.
585+
// the KEEP. Therefore we add a define of PICO_CRT0_ALLOCATE_SPACERS to switch between the old and new behaviour, so anyone
586+
// with custom linker scripts without the KEEP can set it to 0 (or update their linker script).
587+
588+
// PICO_CONFIG: PICO_CRT0_ALLOCATE_SPACERS, Set spacer sections as allocatable. This makes them appear in print-memory-usage but is incompatible with linker scripts that do not KEEP the sections, type=bool, default=1, advanced=true, group=pico_crt0
589+
#ifndef PICO_CRT0_ALLOCATE_SPACERS
590+
#define PICO_CRT0_ALLOCATE_SPACERS 1
591+
#endif
586592

587593
.macro spacer_section name
588-
#if PICO_ASSEMBLER_IS_CLANG
594+
#if PICO_CRT0_ALLOCATE_SPACERS
589595
.section \name, "a"
590596
#else
591597
.section \name

0 commit comments

Comments
 (0)