The official mbed C/C SDK provides the software platform and libraries to build your applications.
Fork of mbed by
TARGET_ARCH_PRO/TOOLCHAIN_GCC_ARM/LPC1768.ld@99:7f6c6de930c0, 2015-05-03 (annotated)
- Committer:
- Mikchel
- Date:
- Sun May 03 16:04:42 2015 +0000
- Revision:
- 99:7f6c6de930c0
- Parent:
- 85:024bf7f99721
12
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 85:024bf7f99721 | 1 | /* Linker script for mbed LPC1768 */ |
bogdanm | 85:024bf7f99721 | 2 | |
bogdanm | 85:024bf7f99721 | 3 | /* Linker script to configure memory regions. */ |
bogdanm | 85:024bf7f99721 | 4 | MEMORY |
bogdanm | 85:024bf7f99721 | 5 | { |
bogdanm | 85:024bf7f99721 | 6 | FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K |
bogdanm | 85:024bf7f99721 | 7 | RAM (rwx) : ORIGIN = 0x100000C8, LENGTH = (32K - 0xC8) |
bogdanm | 85:024bf7f99721 | 8 | |
bogdanm | 85:024bf7f99721 | 9 | USB_RAM(rwx) : ORIGIN = 0x2007C000, LENGTH = 16K |
bogdanm | 85:024bf7f99721 | 10 | ETH_RAM(rwx) : ORIGIN = 0x20080000, LENGTH = 16K |
bogdanm | 85:024bf7f99721 | 11 | } |
bogdanm | 85:024bf7f99721 | 12 | |
bogdanm | 85:024bf7f99721 | 13 | /* Linker script to place sections and symbol values. Should be used together |
bogdanm | 85:024bf7f99721 | 14 | * with other linker script that defines memory regions FLASH and RAM. |
bogdanm | 85:024bf7f99721 | 15 | * It references following symbols, which must be defined in code: |
bogdanm | 85:024bf7f99721 | 16 | * Reset_Handler : Entry of reset handler |
bogdanm | 85:024bf7f99721 | 17 | * |
bogdanm | 85:024bf7f99721 | 18 | * It defines following symbols, which code can use without definition: |
bogdanm | 85:024bf7f99721 | 19 | * __exidx_start |
bogdanm | 85:024bf7f99721 | 20 | * __exidx_end |
bogdanm | 85:024bf7f99721 | 21 | * __etext |
bogdanm | 85:024bf7f99721 | 22 | * __data_start__ |
bogdanm | 85:024bf7f99721 | 23 | * __preinit_array_start |
bogdanm | 85:024bf7f99721 | 24 | * __preinit_array_end |
bogdanm | 85:024bf7f99721 | 25 | * __init_array_start |
bogdanm | 85:024bf7f99721 | 26 | * __init_array_end |
bogdanm | 85:024bf7f99721 | 27 | * __fini_array_start |
bogdanm | 85:024bf7f99721 | 28 | * __fini_array_end |
bogdanm | 85:024bf7f99721 | 29 | * __data_end__ |
bogdanm | 85:024bf7f99721 | 30 | * __bss_start__ |
bogdanm | 85:024bf7f99721 | 31 | * __bss_end__ |
bogdanm | 85:024bf7f99721 | 32 | * __end__ |
bogdanm | 85:024bf7f99721 | 33 | * end |
bogdanm | 85:024bf7f99721 | 34 | * __HeapLimit |
bogdanm | 85:024bf7f99721 | 35 | * __StackLimit |
bogdanm | 85:024bf7f99721 | 36 | * __StackTop |
bogdanm | 85:024bf7f99721 | 37 | * __stack |
bogdanm | 85:024bf7f99721 | 38 | */ |
bogdanm | 85:024bf7f99721 | 39 | ENTRY(Reset_Handler) |
bogdanm | 85:024bf7f99721 | 40 | |
bogdanm | 85:024bf7f99721 | 41 | SECTIONS |
bogdanm | 85:024bf7f99721 | 42 | { |
bogdanm | 85:024bf7f99721 | 43 | .text : |
bogdanm | 85:024bf7f99721 | 44 | { |
bogdanm | 85:024bf7f99721 | 45 | KEEP(*(.isr_vector)) |
bogdanm | 85:024bf7f99721 | 46 | *(.text*) |
bogdanm | 85:024bf7f99721 | 47 | |
bogdanm | 85:024bf7f99721 | 48 | KEEP(*(.init)) |
bogdanm | 85:024bf7f99721 | 49 | KEEP(*(.fini)) |
bogdanm | 85:024bf7f99721 | 50 | |
bogdanm | 85:024bf7f99721 | 51 | /* .ctors */ |
bogdanm | 85:024bf7f99721 | 52 | *crtbegin.o(.ctors) |
bogdanm | 85:024bf7f99721 | 53 | *crtbegin?.o(.ctors) |
bogdanm | 85:024bf7f99721 | 54 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) |
bogdanm | 85:024bf7f99721 | 55 | *(SORT(.ctors.*)) |
bogdanm | 85:024bf7f99721 | 56 | *(.ctors) |
bogdanm | 85:024bf7f99721 | 57 | |
bogdanm | 85:024bf7f99721 | 58 | /* .dtors */ |
bogdanm | 85:024bf7f99721 | 59 | *crtbegin.o(.dtors) |
bogdanm | 85:024bf7f99721 | 60 | *crtbegin?.o(.dtors) |
bogdanm | 85:024bf7f99721 | 61 | *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) |
bogdanm | 85:024bf7f99721 | 62 | *(SORT(.dtors.*)) |
bogdanm | 85:024bf7f99721 | 63 | *(.dtors) |
bogdanm | 85:024bf7f99721 | 64 | |
bogdanm | 85:024bf7f99721 | 65 | *(.rodata*) |
bogdanm | 85:024bf7f99721 | 66 | |
bogdanm | 85:024bf7f99721 | 67 | KEEP(*(.eh_frame*)) |
bogdanm | 85:024bf7f99721 | 68 | } > FLASH |
bogdanm | 85:024bf7f99721 | 69 | |
bogdanm | 85:024bf7f99721 | 70 | .ARM.extab : |
bogdanm | 85:024bf7f99721 | 71 | { |
bogdanm | 85:024bf7f99721 | 72 | *(.ARM.extab* .gnu.linkonce.armextab.*) |
bogdanm | 85:024bf7f99721 | 73 | } > FLASH |
bogdanm | 85:024bf7f99721 | 74 | |
bogdanm | 85:024bf7f99721 | 75 | __exidx_start = .; |
bogdanm | 85:024bf7f99721 | 76 | .ARM.exidx : |
bogdanm | 85:024bf7f99721 | 77 | { |
bogdanm | 85:024bf7f99721 | 78 | *(.ARM.exidx* .gnu.linkonce.armexidx.*) |
bogdanm | 85:024bf7f99721 | 79 | } > FLASH |
bogdanm | 85:024bf7f99721 | 80 | __exidx_end = .; |
bogdanm | 85:024bf7f99721 | 81 | |
bogdanm | 85:024bf7f99721 | 82 | __etext = .; |
bogdanm | 85:024bf7f99721 | 83 | |
bogdanm | 85:024bf7f99721 | 84 | .data : AT (__etext) |
bogdanm | 85:024bf7f99721 | 85 | { |
bogdanm | 85:024bf7f99721 | 86 | __data_start__ = .; |
bogdanm | 85:024bf7f99721 | 87 | Image$$RW_IRAM1$$Base = .; |
bogdanm | 85:024bf7f99721 | 88 | *(vtable) |
bogdanm | 85:024bf7f99721 | 89 | *(.data*) |
bogdanm | 85:024bf7f99721 | 90 | |
bogdanm | 85:024bf7f99721 | 91 | . = ALIGN(4); |
bogdanm | 85:024bf7f99721 | 92 | /* preinit data */ |
bogdanm | 85:024bf7f99721 | 93 | PROVIDE (__preinit_array_start = .); |
bogdanm | 85:024bf7f99721 | 94 | KEEP(*(.preinit_array)) |
bogdanm | 85:024bf7f99721 | 95 | PROVIDE (__preinit_array_end = .); |
bogdanm | 85:024bf7f99721 | 96 | |
bogdanm | 85:024bf7f99721 | 97 | . = ALIGN(4); |
bogdanm | 85:024bf7f99721 | 98 | /* init data */ |
bogdanm | 85:024bf7f99721 | 99 | PROVIDE (__init_array_start = .); |
bogdanm | 85:024bf7f99721 | 100 | KEEP(*(SORT(.init_array.*))) |
bogdanm | 85:024bf7f99721 | 101 | KEEP(*(.init_array)) |
bogdanm | 85:024bf7f99721 | 102 | PROVIDE (__init_array_end = .); |
bogdanm | 85:024bf7f99721 | 103 | |
bogdanm | 85:024bf7f99721 | 104 | |
bogdanm | 85:024bf7f99721 | 105 | . = ALIGN(4); |
bogdanm | 85:024bf7f99721 | 106 | /* finit data */ |
bogdanm | 85:024bf7f99721 | 107 | PROVIDE (__fini_array_start = .); |
bogdanm | 85:024bf7f99721 | 108 | KEEP(*(SORT(.fini_array.*))) |
bogdanm | 85:024bf7f99721 | 109 | KEEP(*(.fini_array)) |
bogdanm | 85:024bf7f99721 | 110 | PROVIDE (__fini_array_end = .); |
bogdanm | 85:024bf7f99721 | 111 | |
bogdanm | 85:024bf7f99721 | 112 | . = ALIGN(4); |
bogdanm | 85:024bf7f99721 | 113 | /* All data end */ |
bogdanm | 85:024bf7f99721 | 114 | __data_end__ = .; |
bogdanm | 85:024bf7f99721 | 115 | |
bogdanm | 85:024bf7f99721 | 116 | } > RAM |
bogdanm | 85:024bf7f99721 | 117 | |
bogdanm | 85:024bf7f99721 | 118 | |
bogdanm | 85:024bf7f99721 | 119 | .bss : |
bogdanm | 85:024bf7f99721 | 120 | { |
bogdanm | 85:024bf7f99721 | 121 | __bss_start__ = .; |
bogdanm | 85:024bf7f99721 | 122 | *(.bss*) |
bogdanm | 85:024bf7f99721 | 123 | *(COMMON) |
bogdanm | 85:024bf7f99721 | 124 | __bss_end__ = .; |
bogdanm | 85:024bf7f99721 | 125 | Image$$RW_IRAM1$$ZI$$Limit = . ; |
bogdanm | 85:024bf7f99721 | 126 | } > RAM |
bogdanm | 85:024bf7f99721 | 127 | |
bogdanm | 85:024bf7f99721 | 128 | |
bogdanm | 85:024bf7f99721 | 129 | .heap : |
bogdanm | 85:024bf7f99721 | 130 | { |
bogdanm | 85:024bf7f99721 | 131 | __end__ = .; |
bogdanm | 85:024bf7f99721 | 132 | end = __end__; |
bogdanm | 85:024bf7f99721 | 133 | *(.heap*) |
bogdanm | 85:024bf7f99721 | 134 | __HeapLimit = .; |
bogdanm | 85:024bf7f99721 | 135 | } > RAM |
bogdanm | 85:024bf7f99721 | 136 | |
bogdanm | 85:024bf7f99721 | 137 | /* .stack_dummy section doesn't contains any symbols. It is only |
bogdanm | 85:024bf7f99721 | 138 | * used for linker to calculate size of stack sections, and assign |
bogdanm | 85:024bf7f99721 | 139 | * values to stack symbols later */ |
bogdanm | 85:024bf7f99721 | 140 | .stack_dummy : |
bogdanm | 85:024bf7f99721 | 141 | { |
bogdanm | 85:024bf7f99721 | 142 | *(.stack) |
bogdanm | 85:024bf7f99721 | 143 | } > RAM |
bogdanm | 85:024bf7f99721 | 144 | |
bogdanm | 85:024bf7f99721 | 145 | /* Set stack top to end of RAM, and stack limit move down by |
bogdanm | 85:024bf7f99721 | 146 | * size of stack_dummy section */ |
bogdanm | 85:024bf7f99721 | 147 | __StackTop = ORIGIN(RAM) + LENGTH(RAM); |
bogdanm | 85:024bf7f99721 | 148 | __StackLimit = __StackTop - SIZEOF(.stack_dummy); |
bogdanm | 85:024bf7f99721 | 149 | PROVIDE(__stack = __StackTop); |
bogdanm | 85:024bf7f99721 | 150 | |
bogdanm | 85:024bf7f99721 | 151 | /* Check if data + heap + stack exceeds RAM limit */ |
bogdanm | 85:024bf7f99721 | 152 | ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") |
bogdanm | 85:024bf7f99721 | 153 | |
bogdanm | 85:024bf7f99721 | 154 | |
bogdanm | 85:024bf7f99721 | 155 | /* Code can explicitly ask for data to be |
bogdanm | 85:024bf7f99721 | 156 | placed in these higher RAM banks where |
bogdanm | 85:024bf7f99721 | 157 | they will be left uninitialized. |
bogdanm | 85:024bf7f99721 | 158 | */ |
bogdanm | 85:024bf7f99721 | 159 | .AHBSRAM0 (NOLOAD): |
bogdanm | 85:024bf7f99721 | 160 | { |
bogdanm | 85:024bf7f99721 | 161 | Image$$RW_IRAM2$$Base = . ; |
bogdanm | 85:024bf7f99721 | 162 | *(AHBSRAM0) |
bogdanm | 85:024bf7f99721 | 163 | Image$$RW_IRAM2$$ZI$$Limit = .; |
bogdanm | 85:024bf7f99721 | 164 | } > USB_RAM |
bogdanm | 85:024bf7f99721 | 165 | |
bogdanm | 85:024bf7f99721 | 166 | .AHBSRAM1 (NOLOAD): |
bogdanm | 85:024bf7f99721 | 167 | { |
bogdanm | 85:024bf7f99721 | 168 | Image$$RW_IRAM3$$Base = . ; |
bogdanm | 85:024bf7f99721 | 169 | *(AHBSRAM1) |
bogdanm | 85:024bf7f99721 | 170 | Image$$RW_IRAM3$$ZI$$Limit = .; |
bogdanm | 85:024bf7f99721 | 171 | } > ETH_RAM |
bogdanm | 85:024bf7f99721 | 172 | } |