1/* Memory regions.*/ 2MEMORY 3{ 4 FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256K 5 RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K 6} 7 8/* Entry Point */ 9ENTRY(Reset_Handler) 10 11_estack = 0x20000000 + 32K; 12 13/* Define output sections */ 14SECTIONS 15{ 16 .text : 17 { 18 KEEP(*(.isr_vector)) 19 *(.text*) 20 21 KEEP(*(.init)) 22 KEEP(*(.fini)) 23 24 /* .ctors */ 25 *crtbegin.o(.ctors) 26 *crtbegin?.o(.ctors) 27 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) 28 *(SORT(.ctors.*)) 29 *(.ctors) 30 31 /* .dtors */ 32 *crtbegin.o(.dtors) 33 *crtbegin?.o(.dtors) 34 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) 35 *(SORT(.dtors.*)) 36 *(.dtors) 37 38 *(.rodata*) 39 40 KEEP(*(.eh_frame*)) 41 } > FLASH 42 43 .ARM.extab : 44 { 45 *(.ARM.extab* .gnu.linkonce.armextab.*) 46 } > FLASH 47 48 __exidx_start = .; 49 .ARM.exidx : 50 { 51 *(.ARM.exidx* .gnu.linkonce.armexidx.*) 52 } > FLASH 53 __exidx_end = .; 54 __etext = .; 55 56 /* used by the startup to initialize data */ 57 _sidata = __etext; 58 59 .data : AT (__etext) 60 { 61 __data_start__ = .; 62 _sdata = .; 63 *(vtable) 64 *(.data*) 65 66 . = ALIGN(4); 67 /* preinit data */ 68 PROVIDE_HIDDEN (__preinit_array_start = .); 69 KEEP(*(.preinit_array)) 70 PROVIDE_HIDDEN (__preinit_array_end = .); 71 72 . = ALIGN(4); 73 /* init data */ 74 PROVIDE_HIDDEN (__init_array_start = .); 75 KEEP(*(SORT(.init_array.*))) 76 KEEP(*(.init_array)) 77 PROVIDE_HIDDEN (__init_array_end = .); 78 79 80 . = ALIGN(4); 81 /* finit data */ 82 PROVIDE_HIDDEN (__fini_array_start = .); 83 KEEP(*(SORT(.fini_array.*))) 84 KEEP(*(.fini_array)) 85 PROVIDE_HIDDEN (__fini_array_end = .); 86 87 KEEP(*(.jcr*)) 88 . = ALIGN(4); 89 /* All data end */ 90 __data_end__ = .; 91 _edata = .; 92 } > RAM 93 94 .bss : 95 { 96 . = ALIGN(4); 97 __bss_start__ = .; 98 _sbss = .; 99 *(.bss*) 100 *(COMMON) 101 . = ALIGN(4); 102 __bss_end__ = .; 103 _ebss = .; 104 } > RAM 105 106 .heap (COPY): 107 { 108 __end__ = .; 109 PROVIDE(_end = .); 110 PROVIDE(end = .); 111 *(.heap*) 112 __HeapLimit = .; 113 } > RAM 114 115 /* .stack_dummy section doesn't contains any symbols. It is only 116 * used for linker to calculate size of stack sections, and assign 117 * values to stack symbols later */ 118 .stack_dummy (COPY): 119 { 120 *(.stack*) 121 } > RAM 122 123 /* Set stack top to end of RAM, and stack limit move down by 124 * size of stack_dummy section */ 125 __StackTop = ORIGIN(RAM) + LENGTH(RAM); 126 __StackLimit = __StackTop - SIZEOF(.stack_dummy); 127 PROVIDE(__stack = __StackTop); 128 129 /* Check if data + heap + stack exceeds RAM limit */ 130 ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") 131} 132