ENTRY(Reset_Handler)
__STACK_SIZE = 0x400;
__HEAP_SIZE = 5K;
MEMORY
{
FLASH (rx) : ORIGIN = 0x0000, LENGTH = 44K
RAM (rw) : ORIGIN = 0xB000, LENGTH = 20K
}
privileged_functions_region_size = 30K;
privileged_data_region_size = 5K;
FLASH_segment_start = ORIGIN( FLASH );
FLASH_segment_end = FLASH_segment_start + LENGTH( FLASH );
SRAM_segment_start = ORIGIN( RAM );
SRAM_segment_end = SRAM_segment_start + LENGTH( RAM );
privileged_functions_start = FLASH_segment_start;
privileged_functions_end = FLASH_segment_start + privileged_functions_region_size;
privileged_data_start = ORIGIN( RAM);
privileged_data_end = ORIGIN( RAM) + privileged_data_region_size;
SECTIONS
{
.privileged_functions :
{
. = ALIGN(4);
KEEP(*(.vectors))
. = ALIGN(4);
(privileged_functions)
. = ALIGN(4);
FILL(0xDEAD);
/ En placed after the region reserved for
* privileged kernel code. /
/ Note that dot (.) actually refers to the byte offset from the start of
* the current section (.privileged_functionsure that non-privileged code iss in this case). As a result,
* setting dot (.) to a value sets the size of the section. */
} >FLASH
.text :
{
. = ALIGN(4);
syscalls_flash_start = .;
*(freertos_system_calls)
syscalls_flash_end = .;
. = ALIGN(4);
*(.text*)
*(.text*) /* .text* sections (code) */
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
*(.eh_frame)
KEEP(*(.init))
KEEP(*(.fini))
*(.rodata*)
} > FLASH
.ARM.extab :
{
(.ARM.extab .gnu.linkonce.armextab.*)
} > FLASH
__exidx_start = .;
.ARM.exidx :
{
(.ARM.exidx .gnu.linkonce.armexidx.*)
} > FLASH
__exidx_end = .;
.copy.table :
{
. = ALIGN(4);
copy_table_start = .;
LONG (__etext)
LONG (__data_start__)
LONG ((__data_end__ - __data_start__) / 4)
/* Add each additional data section here */
/*
LONG (__etext2)
LONG (data2_start)
LONG ((data2_end - data2_start) / 4)
*/
copy_table_end = .;
} > FLASH
.zero.table :
{
. = ALIGN(4);
zero_table_start = .;
/* Add each additional bss section here */
LONG (bss_start)
LONG ((bss_end - bss_start) / 4)
/*
LONG (bss2_start)
LONG ((bss2_end - bss2_start) / 4)
*/
zero_table_end = .;
} > FLASH
/**
- Location counter can end up 2byte aligned with narrow Thumb code but
- __etext is assumed by startup code to be the LMA of a section in RAM
- which must be 4byte aligned
*/
__etext = ALIGN (4);
.privileged_data :
{
. = ALIGN(4);
data_start = .;
(privileged_data)
. = ALIGN(4);
FILL(0xDEAD);
/ Ensure that non-privileged data is placed after the region reserved for
* privileged kernel data. /
/ Note that dot (.) actually refers to the byte offset from the start of
* the current section (.privileged_data in this case). As a result, setting
* dot (.) to a value sets the size of the section. */
. = privileged_data_region_size;
} >RAM AT > FLASH
.data :
{
. = ALIGN(4);
*(vtable)
*(.data)
(.data.)
. = ALIGN(4);
/* preinit data */
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP(*(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
. = ALIGN(4);
/* init data */
PROVIDE_HIDDEN (__init_array_start = .);
KEEP(*(SORT(.init_array.*)))
KEEP(*(.init_array))
PROVIDE_HIDDEN (__init_array_end = .);
. = ALIGN(4);
/* finit data */
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP(*(SORT(.fini_array.*)))
KEEP(*(.fini_array))
PROVIDE_HIDDEN (__fini_array_end = .);
KEEP(*(.jcr*))
. = ALIGN(4);
/* All data end */
__data_end__ = .;
} > RAM AT> FLASH
/*
- Secondary data section, optional
- Remember to add each additional data section
- to the .copy.table above to asure proper
- initialization during startup.
/
/
__etext2 = ALIGN (4);
.data2 : AT (__etext2)
{
. = ALIGN(4);
data2_start = .;
*(.data2)
(.data2.)
. = ALIGN(4);
data2_end = .;
} > RAM2
*/
.bss :
{
. = ALIGN(4);
bss_start = .;
*(.bss)
(.bss.)
*(COMMON)
. = ALIGN(4);
bss_end = .;
} > RAM AT > RAM
/*
- Secondary bss section, optional
- Remember to add each additional bss section
- to the .zero.table above to asure proper
- initialization during startup.
/
/
.bss2 :
{
. = ALIGN(4);
bss2_start = .;
*(.bss2)
(.bss2.)
. = ALIGN(4);
bss2_end = .;
} > RAM2 AT > RAM2
*/
.heap (COPY) :
{
. = ALIGN(8);
end = .;
PROVIDE(end = .);
. = . + __HEAP_SIZE;
. = ALIGN(8);
__HeapLimit = .;
} > RAM
.stack (ORIGIN(RAM) + LENGTH(RAM) - __STACK_SIZE) (COPY) :
{
. = ALIGN(8);
__StackLimit = .;
. = . + __STACK_SIZE;
. = ALIGN(8);
__StackTop = .;
} > RAM
PROVIDE(__stack = __StackTop);
/* Check if data + heap + stack exceeds RAM limit */
ASSERT(__StackLimit >= __HeapLimit, “Region RAM overflowed with stack”)
}