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