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 Oct 25 14:40:21 2017 +0100
Revision:
154:fb8e0ae1cceb
Parent:
112:6f327212ef96
Release 154 of the mbed library.

Who changed what in which revision?

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