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