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:
Thu Nov 08 11:45:42 2018 +0000
Revision:
171:3a7713b1edbc
Parent:
167:84c0a372a020
Child:
172:65be27845400
mbed library. Release version 164

Who changed what in which revision?

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