Skip to content

Commit

Permalink
stm32: In link script, define start of stack separately from heap end.
Browse files Browse the repository at this point in the history
Previously the end of the heap was the start (lowest address) of the stack.
With the changes in this commit these addresses are now independent,
allowing a board to place the heap and stack in separate locations.
  • Loading branch information
chrismas9 authored and dpgeorge committed Jun 14, 2019
1 parent 8b18cfe commit 14cf91f
Show file tree
Hide file tree
Showing 26 changed files with 92 additions and 86 deletions.
8 changes: 4 additions & 4 deletions ports/stm32/boards/PYBD_SF2/f722_qspi.ld
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 16K;

/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = _ram_end - 16K; /* 16k stack */
_heap_end = _sstack;

ENTRY(Reset_Handler)

Expand Down
8 changes: 4 additions & 4 deletions ports/stm32/boards/PYBD_SF6/f767.ld
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 24K;

/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = _ram_end - 24K; /* 24k stack */
_heap_end = _sstack;

ENTRY(Reset_Handler)

Expand Down
6 changes: 4 additions & 2 deletions ports/stm32/boards/STM32F769DISC/f769_qspi.ld
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Define tho top end of the stack */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 32K; /* tunable */

/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = 0x20078000; /* tunable */
_heap_end = _sstack;

ENTRY(Reset_Handler)

Expand Down
8 changes: 4 additions & 4 deletions ports/stm32/boards/stm32f091xc.ld
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
/* Define the stack. The stack is full descending so begins just above last byte above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 6K; /* tunable */

/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = 0x20006800; /* room for a 6k stack */
_heap_end = _sstack;
10 changes: 5 additions & 5 deletions ports/stm32/boards/stm32f401xd.ld
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ MEMORY

/* produce a link error if there is not this amount of RAM for these sections */
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;
_minimum_heap_size = 16K; /* tunable */

/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 16K;

/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = 0x20014000; /* tunable */
_heap_end = _sstack;
8 changes: 4 additions & 4 deletions ports/stm32/boards/stm32f401xe.ld
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 16K; /* tunable */

/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = 0x20014000; /* tunable */
_heap_end = _sstack;
8 changes: 4 additions & 4 deletions ports/stm32/boards/stm32f405.ld
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 16K; /* tunable */

/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = 0x2001c000; /* tunable */
_heap_end = _sstack;
8 changes: 4 additions & 4 deletions ports/stm32/boards/stm32f411.ld
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 16K; /* tunable */

/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = 0x2001c000; /* tunable */
_heap_end = _sstack;
8 changes: 4 additions & 4 deletions ports/stm32/boards/stm32f413xg.ld
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 16K; /* tunable */

/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = _ram_end - 16K; /* 240K, tunable */
_heap_end = _sstack;
8 changes: 4 additions & 4 deletions ports/stm32/boards/stm32f413xh.ld
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 16K; /* tunable */

/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = _ram_end - 16K; /* 240K, tunable */
_heap_end = _sstack;
8 changes: 4 additions & 4 deletions ports/stm32/boards/stm32f429.ld
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 16K; /* tunable */

/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = 0x2002c000; /* tunable */
_heap_end = _sstack;
6 changes: 4 additions & 2 deletions ports/stm32/boards/stm32f439.ld
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* top end of the stack */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 16K; /* tunable */

/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = 0x2002c000; /* tunable */
_heap_end = _sstack;
8 changes: 4 additions & 4 deletions ports/stm32/boards/stm32f722.ld
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 32K; /* tunable */

/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = 0x20038000; /* tunable */
_heap_end = _sstack;
10 changes: 5 additions & 5 deletions ports/stm32/boards/stm32f746.ld
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
GNU linker script for STM32F405
GNU linker script for STM32F746
*/

/* Specify the memory areas */
Expand All @@ -17,13 +17,13 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 16K; /* tunable */

/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = 0x2004c000; /* tunable */
_heap_end = _sstack;
8 changes: 4 additions & 4 deletions ports/stm32/boards/stm32f767.ld
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 32K; /* tunable */

/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = 0x20078000; /* tunable */
_heap_end = _sstack;
8 changes: 4 additions & 4 deletions ports/stm32/boards/stm32f769.ld
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 32K; /* tunable */

/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = 0x20078000; /* tunable */
_heap_end = _sstack;
8 changes: 4 additions & 4 deletions ports/stm32/boards/stm32h743.ld
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Define tho top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 16K; /* tunable */

/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = 0x2407C000; /* tunable */
_heap_end = _sstack;
8 changes: 4 additions & 4 deletions ports/stm32/boards/stm32l432.ld
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Define the top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 6K; /* tunable */

/* RAM extents for the garbage collector */
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = 0x2000A800; /* room for a 6k stack */
_heap_end = _sstack;
8 changes: 4 additions & 4 deletions ports/stm32/boards/stm32l476xe.ld
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Define the top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 16K; /* tunable */

/* RAM extents for the garbage collector */
_ram_fs_cache_start = ORIGIN(FS_CACHE);
_ram_fs_cache_end = ORIGIN(FS_CACHE) + LENGTH(FS_CACHE);
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = 0x20014000; /* tunable */
_heap_end = _sstack;

_flash_fs_start = ORIGIN(FLASH_FS);
_flash_fs_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS);
8 changes: 4 additions & 4 deletions ports/stm32/boards/stm32l476xg.ld
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ MEMORY
_minimum_stack_size = 2K;
_minimum_heap_size = 16K;

/* Define the top end of the stack. The stack is full descending so begins just
above last byte of RAM. Note that EABI requires the stack to be 8-byte
aligned for a call. */
/* Define the stack. The stack is full descending so begins just above last byte
of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */
_estack = ORIGIN(RAM) + LENGTH(RAM);
_sstack = _estack - 16K; /* tunable */

/* RAM extents for the garbage collector */
_ram_fs_cache_start = ORIGIN(FS_CACHE);
_ram_fs_cache_end = ORIGIN(FS_CACHE) + LENGTH(FS_CACHE);
_ram_start = ORIGIN(RAM);
_ram_end = ORIGIN(RAM) + LENGTH(RAM);
_heap_start = _ebss; /* heap starts just after statically allocated memory */
_heap_end = 0x20014000; /* tunable */
_heap_end = _sstack;

_flash_fs_start = ORIGIN(FLASH_FS);
_flash_fs_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS);
Loading

0 comments on commit 14cf91f

Please sign in to comment.