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