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

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

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