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