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:
170:e95d10626187
mbed library. Release version 164

Who changed what in which revision?

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