Update the linker file to support single and multiple heap banks

pull/9944/head
Deepika 2019-03-06 13:28:22 -06:00
parent 3593444e93
commit 1a52587c2d
1 changed files with 23 additions and 9 deletions

View File

@ -6,14 +6,14 @@
#define MBED_APP_SIZE 1024k
#endif
M_CRASH_DATA_RAM_SIZE = 0x100;
#if !defined(MBED_BOOT_STACK_SIZE)
#define MBED_BOOT_STACK_SIZE 0x400
#endif
STACK_SIZE = MBED_BOOT_STACK_SIZE;
M_CRASH_DATA_RAM_SIZE = 0x100;
/* Linker script to configure memory regions. */
MEMORY
{
@ -106,7 +106,7 @@ SECTIONS
__CRASH_DATA_RAM_END__ = .; /* Define a global symbol at data end */
} > SRAM2
/* .stack section doesn't contains any symbols. It is only
/* .stack section doesn't contains any symbols. It is only
* used for linker to reserve space for the isr stack section
* WARNING: .stack should come immediately after the last secure memory
* section. This provides stack overflow detection. */
@ -124,6 +124,17 @@ SECTIONS
__StackLimit = ADDR(.stack);
PROVIDE(__stack = __StackTop);
/* Place holder for additional heap */
.heap_0 (COPY):
{
__mbed_sbrk_start_0 = .;
. += (ORIGIN(SRAM2) + LENGTH(SRAM2) - .);
__mbed_krbs_start_0 = .;
} > SRAM2
/* Check if heap exceeds SRAM2 */
ASSERT(__mbed_krbs_start_0 <= (ORIGIN(SRAM2)+LENGTH(SRAM2)), "Heap is too big for SRAM2")
.data : AT (__etext)
{
__data_start__ = .;
@ -144,6 +155,7 @@ SECTIONS
KEEP(*(.init_array))
PROVIDE_HIDDEN (__init_array_end = .);
. = ALIGN(8);
/* finit data */
PROVIDE_HIDDEN (__fini_array_start = .);
@ -156,6 +168,7 @@ SECTIONS
/* All data end */
__data_end__ = .;
_edata = .;
} > SRAM1
/* Check if bss exceeds SRAM1 */
@ -176,17 +189,18 @@ SECTIONS
/* Check if bss exceeds SRAM1 */
ASSERT(__bss_end__ <= (ORIGIN(SRAM1)+LENGTH(SRAM1)), "BSS is too big for SRAM1")
/* Placeholder for default single heap */
.heap (COPY):
{
__end__ = .;
__mbed_sbrk_start_0 = .;
end = __end__;
__mbed_sbrk_start = .;
*(.heap*)
. = (ORIGIN(SRAM2) + LENGTH(SRAM2));
__mbed_krbs_start_0 = .;
__mbed_sbrk_start = __bss_end__;
. = (ORIGIN(SRAM1) + LENGTH(SRAM1));
. += (ORIGIN(SRAM1) + LENGTH(SRAM1) - .);
__mbed_krbs_start = .;
__HeapLimit = .;
} > SRAM2
} > SRAM1
/* Check if heap exceeds SRAM1 */
ASSERT(__HeapLimit <= (ORIGIN(SRAM1)+LENGTH(SRAM1)), "Heap is too big for SRAM1")
}