meh
Fork of mbed by
TARGET_LPC1114/TOOLCHAIN_GCC_ARM/LPC1114.ld@118:16969dd821af, 2016-04-05 (annotated)
- Committer:
- ricardobtez
- Date:
- Tue Apr 05 23:51:21 2016 +0000
- Revision:
- 118:16969dd821af
- Parent:
- 81:7d30d6019079
dgdgr
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 81:7d30d6019079 | 1 | /* Linker script for mbed LPC1114 */ |
bogdanm | 81:7d30d6019079 | 2 | |
bogdanm | 81:7d30d6019079 | 3 | /* Linker script to configure memory regions. */ |
bogdanm | 81:7d30d6019079 | 4 | MEMORY |
bogdanm | 81:7d30d6019079 | 5 | { |
bogdanm | 81:7d30d6019079 | 6 | FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 32K |
bogdanm | 81:7d30d6019079 | 7 | RAM (rwx) : ORIGIN = 0x100000C0, LENGTH = 0x0F40 |
bogdanm | 81:7d30d6019079 | 8 | } |
bogdanm | 81:7d30d6019079 | 9 | |
bogdanm | 81:7d30d6019079 | 10 | /* Linker script to place sections and symbol values. Should be used together |
bogdanm | 81:7d30d6019079 | 11 | * with other linker script that defines memory regions FLASH and RAM. |
bogdanm | 81:7d30d6019079 | 12 | * It references following symbols, which must be defined in code: |
bogdanm | 81:7d30d6019079 | 13 | * Reset_Handler : Entry of reset handler |
bogdanm | 81:7d30d6019079 | 14 | * |
bogdanm | 81:7d30d6019079 | 15 | * It defines following symbols, which code can use without definition: |
bogdanm | 81:7d30d6019079 | 16 | * __exidx_start |
bogdanm | 81:7d30d6019079 | 17 | * __exidx_end |
bogdanm | 81:7d30d6019079 | 18 | * __etext |
bogdanm | 81:7d30d6019079 | 19 | * __data_start__ |
bogdanm | 81:7d30d6019079 | 20 | * __preinit_array_start |
bogdanm | 81:7d30d6019079 | 21 | * __preinit_array_end |
bogdanm | 81:7d30d6019079 | 22 | * __init_array_start |
bogdanm | 81:7d30d6019079 | 23 | * __init_array_end |
bogdanm | 81:7d30d6019079 | 24 | * __fini_array_start |
bogdanm | 81:7d30d6019079 | 25 | * __fini_array_end |
bogdanm | 81:7d30d6019079 | 26 | * __data_end__ |
bogdanm | 81:7d30d6019079 | 27 | * __bss_start__ |
bogdanm | 81:7d30d6019079 | 28 | * __bss_end__ |
bogdanm | 81:7d30d6019079 | 29 | * __end__ |
bogdanm | 81:7d30d6019079 | 30 | * end |
bogdanm | 81:7d30d6019079 | 31 | * __HeapLimit |
bogdanm | 81:7d30d6019079 | 32 | * __StackLimit |
bogdanm | 81:7d30d6019079 | 33 | * __StackTop |
bogdanm | 81:7d30d6019079 | 34 | * __stack |
bogdanm | 81:7d30d6019079 | 35 | */ |
bogdanm | 81:7d30d6019079 | 36 | ENTRY(Reset_Handler) |
bogdanm | 81:7d30d6019079 | 37 | |
bogdanm | 81:7d30d6019079 | 38 | SECTIONS |
bogdanm | 81:7d30d6019079 | 39 | { |
bogdanm | 81:7d30d6019079 | 40 | .text : |
bogdanm | 81:7d30d6019079 | 41 | { |
bogdanm | 81:7d30d6019079 | 42 | KEEP(*(.isr_vector)) |
bogdanm | 81:7d30d6019079 | 43 | *(.text.Reset_Handler) |
bogdanm | 81:7d30d6019079 | 44 | *(.text.SystemInit) |
bogdanm | 81:7d30d6019079 | 45 | . = 0x200; |
bogdanm | 81:7d30d6019079 | 46 | *(.text*) |
bogdanm | 81:7d30d6019079 | 47 | |
bogdanm | 81:7d30d6019079 | 48 | KEEP(*(.init)) |
bogdanm | 81:7d30d6019079 | 49 | KEEP(*(.fini)) |
bogdanm | 81:7d30d6019079 | 50 | |
bogdanm | 81:7d30d6019079 | 51 | /* .ctors */ |
bogdanm | 81:7d30d6019079 | 52 | *crtbegin.o(.ctors) |
bogdanm | 81:7d30d6019079 | 53 | *crtbegin?.o(.ctors) |
bogdanm | 81:7d30d6019079 | 54 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) |
bogdanm | 81:7d30d6019079 | 55 | *(SORT(.ctors.*)) |
bogdanm | 81:7d30d6019079 | 56 | *(.ctors) |
bogdanm | 81:7d30d6019079 | 57 | |
bogdanm | 81:7d30d6019079 | 58 | /* .dtors */ |
bogdanm | 81:7d30d6019079 | 59 | *crtbegin.o(.dtors) |
bogdanm | 81:7d30d6019079 | 60 | *crtbegin?.o(.dtors) |
bogdanm | 81:7d30d6019079 | 61 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) |
bogdanm | 81:7d30d6019079 | 62 | *(SORT(.dtors.*)) |
bogdanm | 81:7d30d6019079 | 63 | *(.dtors) |
bogdanm | 81:7d30d6019079 | 64 | |
bogdanm | 81:7d30d6019079 | 65 | *(.rodata*) |
bogdanm | 81:7d30d6019079 | 66 | |
bogdanm | 81:7d30d6019079 | 67 | KEEP(*(.eh_frame*)) |
bogdanm | 81:7d30d6019079 | 68 | } > FLASH |
bogdanm | 81:7d30d6019079 | 69 | |
bogdanm | 81:7d30d6019079 | 70 | .ARM.extab : |
bogdanm | 81:7d30d6019079 | 71 | { |
bogdanm | 81:7d30d6019079 | 72 | *(.ARM.extab* .gnu.linkonce.armextab.*) |
bogdanm | 81:7d30d6019079 | 73 | } > FLASH |
bogdanm | 81:7d30d6019079 | 74 | |
bogdanm | 81:7d30d6019079 | 75 | __exidx_start = .; |
bogdanm | 81:7d30d6019079 | 76 | .ARM.exidx : |
bogdanm | 81:7d30d6019079 | 77 | { |
bogdanm | 81:7d30d6019079 | 78 | *(.ARM.exidx* .gnu.linkonce.armexidx.*) |
bogdanm | 81:7d30d6019079 | 79 | } > FLASH |
bogdanm | 81:7d30d6019079 | 80 | __exidx_end = .; |
bogdanm | 81:7d30d6019079 | 81 | |
bogdanm | 81:7d30d6019079 | 82 | __etext = .; |
bogdanm | 81:7d30d6019079 | 83 | |
bogdanm | 81:7d30d6019079 | 84 | .data : AT (__etext) |
bogdanm | 81:7d30d6019079 | 85 | { |
bogdanm | 81:7d30d6019079 | 86 | __data_start__ = .; |
bogdanm | 81:7d30d6019079 | 87 | *(vtable) |
bogdanm | 81:7d30d6019079 | 88 | *(.data*) |
bogdanm | 81:7d30d6019079 | 89 | |
bogdanm | 81:7d30d6019079 | 90 | . = ALIGN(4); |
bogdanm | 81:7d30d6019079 | 91 | /* preinit data */ |
bogdanm | 81:7d30d6019079 | 92 | PROVIDE (__preinit_array_start = .); |
bogdanm | 81:7d30d6019079 | 93 | KEEP(*(.preinit_array)) |
bogdanm | 81:7d30d6019079 | 94 | PROVIDE (__preinit_array_end = .); |
bogdanm | 81:7d30d6019079 | 95 | |
bogdanm | 81:7d30d6019079 | 96 | . = ALIGN(4); |
bogdanm | 81:7d30d6019079 | 97 | /* init data */ |
bogdanm | 81:7d30d6019079 | 98 | PROVIDE (__init_array_start = .); |
bogdanm | 81:7d30d6019079 | 99 | KEEP(*(SORT(.init_array.*))) |
bogdanm | 81:7d30d6019079 | 100 | KEEP(*(.init_array)) |
bogdanm | 81:7d30d6019079 | 101 | PROVIDE (__init_array_end = .); |
bogdanm | 81:7d30d6019079 | 102 | |
bogdanm | 81:7d30d6019079 | 103 | |
bogdanm | 81:7d30d6019079 | 104 | . = ALIGN(4); |
bogdanm | 81:7d30d6019079 | 105 | /* finit data */ |
bogdanm | 81:7d30d6019079 | 106 | PROVIDE (__fini_array_start = .); |
bogdanm | 81:7d30d6019079 | 107 | KEEP(*(SORT(.fini_array.*))) |
bogdanm | 81:7d30d6019079 | 108 | KEEP(*(.fini_array)) |
bogdanm | 81:7d30d6019079 | 109 | PROVIDE (__fini_array_end = .); |
bogdanm | 81:7d30d6019079 | 110 | |
bogdanm | 81:7d30d6019079 | 111 | . = ALIGN(4); |
bogdanm | 81:7d30d6019079 | 112 | /* All data end */ |
bogdanm | 81:7d30d6019079 | 113 | __data_end__ = .; |
bogdanm | 81:7d30d6019079 | 114 | |
bogdanm | 81:7d30d6019079 | 115 | } > RAM |
bogdanm | 81:7d30d6019079 | 116 | |
bogdanm | 81:7d30d6019079 | 117 | .bss : |
bogdanm | 81:7d30d6019079 | 118 | { |
bogdanm | 81:7d30d6019079 | 119 | __bss_start__ = .; |
bogdanm | 81:7d30d6019079 | 120 | *(.bss*) |
bogdanm | 81:7d30d6019079 | 121 | *(COMMON) |
bogdanm | 81:7d30d6019079 | 122 | __bss_end__ = .; |
bogdanm | 81:7d30d6019079 | 123 | } > RAM |
bogdanm | 81:7d30d6019079 | 124 | |
bogdanm | 81:7d30d6019079 | 125 | .heap : |
bogdanm | 81:7d30d6019079 | 126 | { |
bogdanm | 81:7d30d6019079 | 127 | __end__ = .; |
bogdanm | 81:7d30d6019079 | 128 | end = __end__; |
bogdanm | 81:7d30d6019079 | 129 | *(.heap*) |
bogdanm | 81:7d30d6019079 | 130 | __HeapLimit = .; |
bogdanm | 81:7d30d6019079 | 131 | } > RAM |
bogdanm | 81:7d30d6019079 | 132 | |
bogdanm | 81:7d30d6019079 | 133 | /* .stack_dummy section doesn't contains any symbols. It is only |
bogdanm | 81:7d30d6019079 | 134 | * used for linker to calculate size of stack sections, and assign |
bogdanm | 81:7d30d6019079 | 135 | * values to stack symbols later */ |
bogdanm | 81:7d30d6019079 | 136 | .stack_dummy : |
bogdanm | 81:7d30d6019079 | 137 | { |
bogdanm | 81:7d30d6019079 | 138 | *(.stack) |
bogdanm | 81:7d30d6019079 | 139 | } > RAM |
bogdanm | 81:7d30d6019079 | 140 | |
bogdanm | 81:7d30d6019079 | 141 | /* Set stack top to end of RAM, and stack limit move down by |
bogdanm | 81:7d30d6019079 | 142 | * size of stack_dummy section */ |
bogdanm | 81:7d30d6019079 | 143 | __StackTop = ORIGIN(RAM) + LENGTH(RAM); |
bogdanm | 81:7d30d6019079 | 144 | __StackLimit = __StackTop - SIZEOF(.stack_dummy); |
bogdanm | 81:7d30d6019079 | 145 | PROVIDE(__stack = __StackTop); |
bogdanm | 81:7d30d6019079 | 146 | |
bogdanm | 81:7d30d6019079 | 147 | /* Check if data + heap + stack exceeds RAM limit */ |
bogdanm | 81:7d30d6019079 | 148 | ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") |
bogdanm | 81:7d30d6019079 | 149 | } |