Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions rp/src/memmap_rp.ld
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,14 @@ SECTIONS



/* stack limit is poorly named, but historically is maximum heap ptr */
__StackLimit = ORIGIN(RAM) + LENGTH(RAM) + LENGTH(ROM_IN_RAM);
/* stack limit is poorly named, but historically is maximum heap ptr.
* Must NOT include ROM_IN_RAM: pico-sdk's _sbrk bounds the heap by
* this symbol, and letting it grow past ORIGIN(ROM_IN_RAM) hands the
* cartridge region (the code the m68k executes over the cart bus) to
* malloc -- FatFs LFN buffers then corrupt it at runtime and the ST
* crashes with bombs. Capped at the RAM/cart boundary so malloc
* fails cleanly instead. */
__StackLimit = ORIGIN(RAM) + LENGTH(RAM);
__StackOneTop = ORIGIN(SCRATCH_X) + LENGTH(SCRATCH_X);
__StackTop = ORIGIN(SCRATCH_Y) + LENGTH(SCRATCH_Y);
__StackOneBottom = __StackOneTop - SIZEOF(.stack1_dummy);
Expand Down