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 Sep 06 13:39:34 2018 +0100
Revision:
170:e95d10626187
Parent:
122:f9eeca106725
Child:
171:3a7713b1edbc
mbed library. Release version 163

Who changed what in which revision?

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