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