From 8dd081e8744dcd2c6eb827c52de32342f2cba745 Mon Sep 17 00:00:00 2001 From: Matthew Selby Date: Mon, 2 Jun 2025 15:51:49 +0100 Subject: [PATCH] PICO: Update linker script for stack symbols. --- src/platform/PICO/link/pico_rp2350.ld | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/platform/PICO/link/pico_rp2350.ld b/src/platform/PICO/link/pico_rp2350.ld index 27babd6e94..f02977181b 100644 --- a/src/platform/PICO/link/pico_rp2350.ld +++ b/src/platform/PICO/link/pico_rp2350.ld @@ -248,7 +248,7 @@ SECTIONS *(.scratch_y.*) . = ALIGN(4); __scratch_y_end__ = .; - } > SCRATCH_Y AT > FLASH + } > SCRATCH_Y AT > FLASH =0xa5a5a5a5 /* BF: want to fill with STACK_FILL_CHAR to allow stack check - this doesn't seem to do it */ __scratch_y_source__ = LOADADDR(.scratch_y); /* .stack*_dummy section doesn't contains any symbols. It is only @@ -306,6 +306,14 @@ SECTIONS __StackBottom = __StackTop - SIZEOF(.stack_dummy); PROVIDE(__stack = __StackTop); + /* BetaFlight: + * &_estack == Highest address of the user mode stack + * &_Min_Stack_Size = "required" (guaranteed) amount of stack + * We have all of SCRATCH_Y available uncontested for stack, length 4k = 0x1000 + */ + _estack = __StackTop; + _Min_Stack_Size = 0x1000; + /* picolibc and LLVM */ PROVIDE (__heap_start = __end__); PROVIDE (__heap_end = __HeapLimit);