Skip to content

Commit aafa688

Browse files
committed
Sometimes an Arduino sketch needs to reset the MCU, but still wants to have some variables to be able to survive.
The bootloader itself uses very little RAM and excludes by default the last 4 bytes of RAM from use by the stack. To allow sketches using a modified linker script to take the same approach, the changed bootloader linker script excludes the last 1 KByte of RAM from stack.
1 parent efcc5c9 commit aafa688

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bootloaders/zero/bootloader_samd21x18.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
MEMORY
2828
{
2929
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x2000 /* First 8KB used by bootloader */
30-
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000-0x0004 /* 4 bytes used by bootloader to keep data between resets */
30+
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000-0x0400 /* last 4 bytes used by bootloader to keep data between resets, but reserves 1024 bytes for sketches to have same possibility */
3131
}
3232

3333
/* Linker script to place sections and symbol values. Should be used together

0 commit comments

Comments
 (0)