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