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