The official mbed C/C SDK provides the software platform and libraries to build your applications.

Fork of mbed by mbed official

Committer:
emilmont
Date:
Wed Jan 04 16:29:47 2012 +0000
Revision:
30:3991a86798e3
Parent:
27:7110ebee3484
Add latest ARM GCC toolchain build

Who changed what in which revision?

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