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:
Fri May 11 16:51:14 2018 +0100
Revision:
167:84c0a372a020
Parent:
93:e188a91d3eaa
Child:
171:3a7713b1edbc
mbed library. Release version 162

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