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

Fork of mbed by mbed official

Committer:
emilio.monti@arm.com
Date:
Thu Jul 12 10:10:08 2012 +0100
Revision:
41:10b9abbe79a6
Child:
44:24d45a770a51
Add export builds

Who changed what in which revision?

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