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