Target_Freescale: Set the heap size and limit

pull/9571/head
Deepika 2019-02-06 17:26:00 -06:00 committed by deepikabhavnani
parent 5e4dcaba71
commit e03455a920
17 changed files with 175 additions and 36 deletions

View File

@ -147,6 +147,7 @@ SECTIONS
__end__ = .;
end = __end__;
*(.heap*)
. = ORIGIN(RAM) + LENGTH(RAM) - STACK_SIZE;
__HeapLimit = .;
} > RAM

View File

@ -148,6 +148,7 @@ SECTIONS
__end__ = .;
end = __end__;
*(.heap*)
. = ORIGIN(RAM) + LENGTH(RAM) - STACK_SIZE;
__HeapLimit = .;
} > RAM

View File

@ -138,6 +138,7 @@ SECTIONS
__end__ = .;
end = __end__;
*(.heap*)
.= ORIGIN(RAM) + LENGTH(RAM) - STACK_SIZE;
__HeapLimit = .;
} > RAM

View File

@ -147,6 +147,7 @@ SECTIONS
__end__ = .;
end = __end__;
*(.heap*)
.= ORIGIN(RAM) + LENGTH(RAM) - STACK_SIZE;
__HeapLimit = .;
} > RAM

View File

@ -0,0 +1,160 @@
/* Linker script for mbed LPC1768 */
#if !defined(MBED_BOOT_STACK_SIZE)
#define MBED_BOOT_STACK_SIZE 0x400
#endif
STACK_SIZE = MBED_BOOT_STACK_SIZE;
/* Linker script to configure memory regions. */
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 128K
RAM (rwx) : ORIGIN = 0x1FFFF0C0, LENGTH = 0x3F40
}
/* Linker script to place sections and symbol values. Should be used together
* with other linker script that defines memory regions FLASH and RAM.
* It references following symbols, which must be defined in code:
* Reset_Handler : Entry of reset handler
*
* It defines following symbols, which code can use without definition:
* __exidx_start
* __exidx_end
* __etext
* __data_start__
* __preinit_array_start
* __preinit_array_end
* __init_array_start
* __init_array_end
* __fini_array_start
* __fini_array_end
* __data_end__
* __bss_start__
* __bss_end__
* __end__
* end
* __HeapLimit
* __StackLimit
* __StackTop
* __stack
*/
ENTRY(Reset_Handler)
SECTIONS
{
.text :
{
KEEP(*(.isr_vector))
*(.text.Reset_Handler)
*(.text.SystemInit)
/* Only vectors and code running at reset are safe to be in first 512
bytes since RAM can be mapped into this area for RAM based interrupt
vectors. */
. = 0x00000200;
*(.text*)
KEEP(*(.init))
KEEP(*(.fini))
/* .ctors */
*crtbegin.o(.ctors)
*crtbegin?.o(.ctors)
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
*(SORT(.ctors.*))
*(.ctors)
/* .dtors */
*crtbegin.o(.dtors)
*crtbegin?.o(.dtors)
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
*(SORT(.dtors.*))
*(.dtors)
*(.rodata*)
KEEP(*(.eh_frame*))
} > FLASH
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > FLASH
__exidx_start = .;
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > FLASH
__exidx_end = .;
__etext = .;
.data : AT (__etext)
{
__data_start__ = .;
*(vtable)
*(.data*)
. = ALIGN(8);
/* preinit data */
PROVIDE (__preinit_array_start = .);
KEEP(*(.preinit_array))
PROVIDE (__preinit_array_end = .);
. = ALIGN(8);
/* init data */
PROVIDE (__init_array_start = .);
KEEP(*(SORT(.init_array.*)))
KEEP(*(.init_array))
PROVIDE (__init_array_end = .);
. = ALIGN(8);
/* finit data */
PROVIDE (__fini_array_start = .);
KEEP(*(SORT(.fini_array.*)))
KEEP(*(.fini_array))
PROVIDE (__fini_array_end = .);
. = ALIGN(8);
/* All data end */
__data_end__ = .;
} > RAM
.bss :
{
__bss_start__ = .;
*(.bss*)
*(COMMON)
__bss_end__ = .;
} > RAM
.heap :
{
__end__ = .;
end = __end__;
*(.heap*)
. = ORIGIN(RAM) + LENGTH(RAM) - STACK_SIZE;
__HeapLimit = .;
} > RAM
/* .stack_dummy section doesn't contains any symbols. It is only
* used for linker to calculate size of stack sections, and assign
* values to stack symbols later */
.stack_dummy :
{
*(.stack)
} > RAM
/* Set stack top to end of RAM, and stack limit move down by
* size of stack_dummy section */
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
__StackLimit = __StackTop - STACK_SIZE;
PROVIDE(__stack = __StackTop);
/* Check if data + heap + stack exceeds RAM limit */
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
}

View File

@ -147,6 +147,7 @@ SECTIONS
__end__ = .;
end = __end__;
*(.heap*)
. = ORIGIN(RAM) + LENGTH(RAM) - STACK_SIZE;
__HeapLimit = .;
} > RAM

View File

@ -147,6 +147,7 @@ SECTIONS
__end__ = .;
end = __end__;
*(.heap*)
. = ORIGIN(RAM) + LENGTH(RAM) - STACK_SIZE;
__HeapLimit = .;
} > RAM

View File

@ -67,7 +67,6 @@ __heap_size__ = 0x6000;
#define MBED_APP_SIZE 0x200000
#endif
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
M_CRASH_DATA_RAM_SIZE = 0x100;
@ -253,7 +252,7 @@ SECTIONS
__end__ = .;
PROVIDE(end = .);
__HeapBase = .;
. += HEAP_SIZE;
. = ORIGIN(m_data_2) + LENGTH(m_data_2) - STACK_SIZE;
__HeapLimit = .;
__heap_limit = .; /* Add for _sbrk */
} > m_data_2

View File

@ -60,9 +60,6 @@ __ram_vector_table__ = 1;
* the stack where main runs is determined via the RTOS. */
__stack_size__ = MBED_BOOT_STACK_SIZE;
__heap_size__ = 0x6000;
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x03C0 : 0x0;
@ -247,7 +244,7 @@ SECTIONS
__end__ = .;
PROVIDE(end = .);
__HeapBase = .;
. += HEAP_SIZE;
. = ORIGIN(m_data_2) + LENGTH(m_data_2) - STACK_SIZE;
__HeapLimit = .;
__heap_limit = .; /* Add for _sbrk */
} > m_data_2

View File

@ -57,13 +57,8 @@ __ram_vector_table__ = 1;
#define MBED_BOOT_STACK_SIZE 0x400
#endif
/* With the RTOS in use, this does not affect the main stack size. The size of
* the stack where main runs is determined via the RTOS. */
__stack_size__ = MBED_BOOT_STACK_SIZE;
/* With the RTOS in use, this does not affect the main heap size. */
__heap_size__ = 0x0;
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0200 : 0x0;
@ -249,7 +244,7 @@ SECTIONS
__end__ = .;
PROVIDE(end = .);
__HeapBase = .;
. += HEAP_SIZE;
. = ORIGIN(m_data) + LENGTH(m_data) - STACK_SIZE;
__HeapLimit = .;
__heap_limit = .; /* Add for _sbrk */
} > m_data

View File

@ -246,7 +246,7 @@ SECTIONS
__end__ = .;
PROVIDE(end = .);
__HeapBase = .;
. += HEAP_SIZE;
. = ORIGIN(m_data) + LENGTH(m_data) - STACK_SIZE;
__HeapLimit = .;
__heap_limit = .; /* Add for _sbrk */
} > m_data

View File

@ -258,7 +258,7 @@ SECTIONS
__end__ = .;
PROVIDE(end = .);
__HeapBase = .;
. += HEAP_SIZE;
. = ORIGIN(m_data) + LENGTH(m_data) - STACK_SIZE;
__HeapLimit = .;
__heap_limit = .; /* Add for _sbrk */
} > m_data

View File

@ -56,8 +56,6 @@ __ram_vector_table__ = 1;
* the stack where main runs is determined via the RTOS. */
__stack_size__ = MBED_BOOT_STACK_SIZE;
__heap_size__ = 0x4000;
#if !defined(MBED_APP_START)
#define MBED_APP_START 0
#endif
@ -66,7 +64,6 @@ __heap_size__ = 0x4000;
#define MBED_APP_SIZE 0x80000
#endif
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
@ -243,7 +240,7 @@ SECTIONS
__end__ = .;
PROVIDE(end = .);
__HeapBase = .;
. += HEAP_SIZE;
. = ORIGIN(m_data_2) + LENGTH(m_data_2) - STACK_SIZE;
__HeapLimit = .;
__heap_limit = .; /* Add for _sbrk */
} > m_data_2

View File

@ -60,13 +60,8 @@ __ram_vector_table__ = 1;
#define MBED_BOOT_STACK_SIZE 0x400
#endif
/* With the RTOS in use, this does not affect the main stack size. The size of
* the stack where main runs is determined via the RTOS. */
__stack_size__ = MBED_BOOT_STACK_SIZE;
__heap_size__ = 0x6000;
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0200 : 0x0;
@ -248,7 +243,7 @@ SECTIONS
__end__ = .;
PROVIDE(end = .);
__HeapBase = .;
. += HEAP_SIZE;
. = ORIGIN(m_data) + LENGTH(m_data) - STACK_SIZE;
__HeapLimit = .;
__heap_limit = .; /* Add for _sbrk */
} > m_data

View File

@ -60,9 +60,6 @@ ENTRY(Reset_Handler)
__ram_vector_table__ = 1;
__stack_size__ = MBED_BOOT_STACK_SIZE;
__heap_size__ = 0x8000;
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
@ -239,7 +236,7 @@ SECTIONS
__end__ = .;
PROVIDE(end = .);
__HeapBase = .;
. += HEAP_SIZE;
. = ORIGIN(m_data_2) + LENGTH(m_data_2) - STACK_SIZE;
__HeapLimit = .;
__heap_limit = .; /* Add for _sbrk */
} > m_data_2

View File

@ -57,7 +57,6 @@ ENTRY(Reset_Handler)
__ram_vector_table__ = 1;
__stack_size__ = MBED_BOOT_STACK_SIZE;
__heap_size__ = 0x10000;
#if !defined(MBED_APP_START)
#define MBED_APP_START 0
@ -67,7 +66,6 @@ __heap_size__ = 0x10000;
#define MBED_APP_SIZE 0x100000
#endif
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x8000;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x10000;
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
@ -258,7 +256,7 @@ SECTIONS
__end__ = .;
PROVIDE(end = .);
__HeapBase = .;
. += HEAP_SIZE;
. = ORIGIN(m_data_2) + LENGTH(m_data_2) - STACK_SIZE;
__HeapLimit = .;
__heap_limit = .; /* Add for _sbrk */
} > m_data_2

View File

@ -65,13 +65,8 @@ __ram_vector_table__ = 1;
#define MBED_BOOT_STACK_SIZE 0x400
#endif
/* With the RTOS in use, this does not affect the main stack size. The size of
* the stack where main runs is determined via the RTOS. */
__stack_size__ = MBED_BOOT_STACK_SIZE;
__heap_size__ = 0x6000;
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
M_CRASH_DATA_RAM_SIZE = 0x100;