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
* Default to allocating spacer sections (stack & heap), with PICO_CRT0_ALLOCATE_SPACERS config option to disable the behaviour
* Add pico_check_linker_script function to check for compatibility of custom linker scripts
* tweak error message
---------
Co-authored-by: Graham Sanderson <[email protected]>
Copy file name to clipboardExpand all lines: src/rp2_common/pico_crt0/crt0.S
+8-2Lines changed: 8 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -582,10 +582,16 @@ runtime_init:
582
582
//
583
583
// Strictly the most correct thing to do (as .stack and .heap are unreferenced) is to mark them as "a",and also KEEP, which
584
584
// 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 thatdo not KEEP the sections, type=bool, default=1, advanced=true, group=pico_crt0
if ((${STACK_FOUND}GREATER-1) ANDNOT (${KEEP_STACK_FOUND}GREATER-1))
51
+
message(WARNING"Linker script ${LDSCRIPT} does not KEEP the .stack section - replace `*(.stack*)` with `KEEP(*(.stack*))`")
52
+
set(PICO_CRT0_ALLOCATE_SPACERSFALSE)
53
+
endif()
54
+
if ((${HEAP_FOUND}GREATER-1) ANDNOT (${KEEP_HEAP_FOUND}GREATER-1))
55
+
message(WARNING"Linker script ${LDSCRIPT} does not KEEP the .heap section - replace `*(.heap*)` with `KEEP(*(.heap*))`")
56
+
set(PICO_CRT0_ALLOCATE_SPACERSFALSE)
57
+
endif()
58
+
if (NOT${PICO_CRT0_ALLOCATE_SPACERS})
59
+
message(WARNING"Linker script ${LDSCRIPT} is incompatible with certain Pico SDK >2.1.1 features; setting PICO_CRT0_ALLOCATE_SPACERS=0 as a workaround")
0 commit comments