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:
Anna Bridge
Date:
Wed Jan 17 16:13:02 2018 +0000
Revision:
160:5571c4ff569f
Parent:
140:97feb9bacc10
mbed library. Release version 158

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 140:97feb9bacc10 1 /*
<> 140:97feb9bacc10 2 * Copyright (c) 2015 ARM Limited
<> 140:97feb9bacc10 3 *
<> 140:97feb9bacc10 4 * Licensed under the Apache License, Version 2.0 (the "License");
<> 140:97feb9bacc10 5 * you may not use this file except in compliance with the License.
<> 140:97feb9bacc10 6 * You may obtain a copy of the License at
<> 140:97feb9bacc10 7 *
<> 140:97feb9bacc10 8 * http://www.apache.org/licenses/LICENSE-2.0
<> 140:97feb9bacc10 9 *
<> 140:97feb9bacc10 10 * Unless required by applicable law or agreed to in writing, software
<> 140:97feb9bacc10 11 * distributed under the License is distributed on an "AS IS" BASIS,
<> 140:97feb9bacc10 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 140:97feb9bacc10 13 * See the License for the specific language governing permissions and
<> 140:97feb9bacc10 14 * limitations under the License.
<> 140:97feb9bacc10 15 */
<> 140:97feb9bacc10 16
<> 140:97feb9bacc10 17 /* Linker script to configure memory regions. */
<> 140:97feb9bacc10 18
Anna Bridge 160:5571c4ff569f 19 #if !defined(MBED_APP_START)
Anna Bridge 160:5571c4ff569f 20 #define MBED_APP_START 0x21000
Anna Bridge 160:5571c4ff569f 21 #endif
Anna Bridge 160:5571c4ff569f 22
Anna Bridge 160:5571c4ff569f 23 #if !defined(MBED_APP_SIZE)
Anna Bridge 160:5571c4ff569f 24 #define MBED_APP_SIZE 0xDF000
Anna Bridge 160:5571c4ff569f 25 #endif
Anna Bridge 160:5571c4ff569f 26
<> 140:97feb9bacc10 27 MEMORY
<> 140:97feb9bacc10 28 {
Anna Bridge 160:5571c4ff569f 29 FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
<> 140:97feb9bacc10 30 RAM (rwx) : ORIGIN = 0x20003288, LENGTH = 0x3cd78
<> 140:97feb9bacc10 31 }
<> 140:97feb9bacc10 32
<> 140:97feb9bacc10 33
<> 140:97feb9bacc10 34 OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
<> 140:97feb9bacc10 35
<> 140:97feb9bacc10 36 /* Linker script to place sections and symbol values. Should be used together
<> 140:97feb9bacc10 37 * with the other linker script that defines memory regions FLASH and RAM.
<> 140:97feb9bacc10 38 * It references the following symbols that must be defined in code:
<> 140:97feb9bacc10 39 * Reset_Handler : Entry of reset handler
<> 140:97feb9bacc10 40 *
<> 140:97feb9bacc10 41 * It defines the following symbols that the code can use without definition:
<> 140:97feb9bacc10 42 * __exidx_start
<> 140:97feb9bacc10 43 * __exidx_end
<> 140:97feb9bacc10 44 * __etext
<> 140:97feb9bacc10 45 * __data_start__
<> 140:97feb9bacc10 46 * __preinit_array_start
<> 140:97feb9bacc10 47 * __preinit_array_end
<> 140:97feb9bacc10 48 * __init_array_start
<> 140:97feb9bacc10 49 * __init_array_end
<> 140:97feb9bacc10 50 * __fini_array_start
<> 140:97feb9bacc10 51 * __fini_array_end
<> 140:97feb9bacc10 52 * __data_end__
<> 140:97feb9bacc10 53 * __bss_start__
<> 140:97feb9bacc10 54 * __bss_end__
<> 140:97feb9bacc10 55 * __end__
<> 140:97feb9bacc10 56 * end
<> 140:97feb9bacc10 57 * __HeapLimit
<> 140:97feb9bacc10 58 * __StackLimit
<> 140:97feb9bacc10 59 * __StackTop
<> 140:97feb9bacc10 60 * __stack
<> 140:97feb9bacc10 61 */
<> 140:97feb9bacc10 62 ENTRY(Reset_Handler)
<> 140:97feb9bacc10 63
<> 140:97feb9bacc10 64
<> 140:97feb9bacc10 65 SECTIONS
<> 140:97feb9bacc10 66 {
<> 140:97feb9bacc10 67 .text :
<> 140:97feb9bacc10 68 {
<> 140:97feb9bacc10 69 KEEP(*(.Vectors))
<> 140:97feb9bacc10 70 *(.text*)
<> 140:97feb9bacc10 71
<> 140:97feb9bacc10 72 KEEP(*(.init))
<> 140:97feb9bacc10 73 KEEP(*(.fini))
<> 140:97feb9bacc10 74
<> 140:97feb9bacc10 75 /* .ctors */
<> 140:97feb9bacc10 76 *crtbegin.o(.ctors)
<> 140:97feb9bacc10 77 *crtbegin?.o(.ctors)
<> 140:97feb9bacc10 78 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
<> 140:97feb9bacc10 79 *(SORT(.ctors.*))
<> 140:97feb9bacc10 80 *(.ctors)
<> 140:97feb9bacc10 81
<> 140:97feb9bacc10 82 /* .dtors */
<> 140:97feb9bacc10 83 *crtbegin.o(.dtors)
<> 140:97feb9bacc10 84 *crtbegin?.o(.dtors)
<> 140:97feb9bacc10 85 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
<> 140:97feb9bacc10 86 *(SORT(.dtors.*))
<> 140:97feb9bacc10 87 *(.dtors)
<> 140:97feb9bacc10 88
<> 140:97feb9bacc10 89 *(.rodata*)
<> 140:97feb9bacc10 90
<> 140:97feb9bacc10 91 KEEP(*(.eh_frame*))
<> 140:97feb9bacc10 92 } > FLASH
<> 140:97feb9bacc10 93
<> 140:97feb9bacc10 94 .ARM.extab :
<> 140:97feb9bacc10 95 {
<> 140:97feb9bacc10 96 *(.ARM.extab* .gnu.linkonce.armextab.*)
<> 140:97feb9bacc10 97 . = ALIGN(4);
<> 140:97feb9bacc10 98 } > FLASH
<> 140:97feb9bacc10 99
<> 140:97feb9bacc10 100 __exidx_start = .;
<> 140:97feb9bacc10 101 .ARM.exidx :
<> 140:97feb9bacc10 102 {
<> 140:97feb9bacc10 103 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
<> 140:97feb9bacc10 104 . = ALIGN(4);
<> 140:97feb9bacc10 105 } > FLASH
<> 140:97feb9bacc10 106 __exidx_end = .;
<> 140:97feb9bacc10 107
<> 140:97feb9bacc10 108 __etext = .;
<> 140:97feb9bacc10 109
<> 140:97feb9bacc10 110 .data : AT (__etext)
<> 140:97feb9bacc10 111 {
<> 140:97feb9bacc10 112 __data_start__ = .;
<> 140:97feb9bacc10 113 *(vtable)
<> 140:97feb9bacc10 114 *(.data*)
<> 140:97feb9bacc10 115
<> 140:97feb9bacc10 116 . = ALIGN(4);
<> 140:97feb9bacc10 117 /* preinit data */
<> 140:97feb9bacc10 118 PROVIDE_HIDDEN (__preinit_array_start = .);
<> 140:97feb9bacc10 119 KEEP(*(.preinit_array))
<> 140:97feb9bacc10 120 PROVIDE_HIDDEN (__preinit_array_end = .);
<> 140:97feb9bacc10 121
<> 140:97feb9bacc10 122 . = ALIGN(4);
<> 140:97feb9bacc10 123 /* init data */
<> 140:97feb9bacc10 124 PROVIDE_HIDDEN (__init_array_start = .);
<> 140:97feb9bacc10 125 KEEP(*(SORT(.init_array.*)))
<> 140:97feb9bacc10 126 KEEP(*(.init_array))
<> 140:97feb9bacc10 127 PROVIDE_HIDDEN (__init_array_end = .);
<> 140:97feb9bacc10 128
<> 140:97feb9bacc10 129
<> 140:97feb9bacc10 130 . = ALIGN(4);
<> 140:97feb9bacc10 131 /* finit data */
<> 140:97feb9bacc10 132 PROVIDE_HIDDEN (__fini_array_start = .);
<> 140:97feb9bacc10 133 KEEP(*(SORT(.fini_array.*)))
<> 140:97feb9bacc10 134 KEEP(*(.fini_array))
<> 140:97feb9bacc10 135 PROVIDE_HIDDEN (__fini_array_end = .);
<> 140:97feb9bacc10 136
<> 140:97feb9bacc10 137 . = ALIGN(4);
<> 140:97feb9bacc10 138 PROVIDE(__start_fs_data = .);
<> 140:97feb9bacc10 139 KEEP(*(.fs_data))
<> 140:97feb9bacc10 140 PROVIDE(__stop_fs_data = .);
Anna Bridge 160:5571c4ff569f 141
<> 140:97feb9bacc10 142 *(.jcr)
<> 140:97feb9bacc10 143 . = ALIGN(4);
<> 140:97feb9bacc10 144 /* All data end */
<> 140:97feb9bacc10 145 __data_end__ = .;
<> 140:97feb9bacc10 146
<> 140:97feb9bacc10 147 } > RAM
<> 140:97feb9bacc10 148
<> 140:97feb9bacc10 149 __edata = .;
<> 140:97feb9bacc10 150
<> 140:97feb9bacc10 151 .noinit :
<> 140:97feb9bacc10 152 {
<> 140:97feb9bacc10 153 PROVIDE(__start_noinit = .);
<> 140:97feb9bacc10 154 KEEP(*(.noinit))
<> 140:97feb9bacc10 155 PROVIDE(__stop_noinit = .);
<> 140:97feb9bacc10 156 } > RAM
Anna Bridge 160:5571c4ff569f 157
<> 140:97feb9bacc10 158 .bss :
<> 140:97feb9bacc10 159 {
<> 140:97feb9bacc10 160 . = ALIGN(4);
<> 140:97feb9bacc10 161 __bss_start__ = .;
<> 140:97feb9bacc10 162 *(.bss*)
<> 140:97feb9bacc10 163 *(COMMON)
<> 140:97feb9bacc10 164 . = ALIGN(4);
<> 140:97feb9bacc10 165 __bss_end__ = .;
<> 140:97feb9bacc10 166 } > RAM
<> 140:97feb9bacc10 167
<> 140:97feb9bacc10 168 .heap (NOLOAD):
<> 140:97feb9bacc10 169 {
<> 140:97feb9bacc10 170 __end__ = .;
<> 140:97feb9bacc10 171 end = __end__;
<> 140:97feb9bacc10 172 *(.heap*);
<> 140:97feb9bacc10 173
<> 140:97feb9bacc10 174 /* Expand the heap to reach the stack boundary. */
<> 140:97feb9bacc10 175 ASSERT(. <= (ORIGIN(RAM) + LENGTH(RAM) - 0x800), "heap region overflowed into stack");
<> 140:97feb9bacc10 176 . += (ORIGIN(RAM) + LENGTH(RAM) - 0x800) - .;
<> 140:97feb9bacc10 177 } > RAM
<> 140:97feb9bacc10 178 PROVIDE(__heap_start = ADDR(.heap));
<> 140:97feb9bacc10 179 PROVIDE(__heap_size = SIZEOF(.heap));
<> 140:97feb9bacc10 180 PROVIDE(__mbed_sbrk_start = ADDR(.heap));
<> 140:97feb9bacc10 181 PROVIDE(__mbed_krbs_start = ADDR(.heap) + SIZEOF(.heap));
<> 140:97feb9bacc10 182
<> 140:97feb9bacc10 183 /* .stack_dummy section does not contain any symbols. It is only
<> 140:97feb9bacc10 184 * used for the linker script to calculate the size of stack sections
<> 140:97feb9bacc10 185 * and assign values to stack symbols later. */
<> 140:97feb9bacc10 186 .stack (NOLOAD):
<> 140:97feb9bacc10 187 {
<> 140:97feb9bacc10 188 __StackLimit = .;
<> 140:97feb9bacc10 189 *(.stack*)
<> 140:97feb9bacc10 190 . += (ORIGIN(RAM) + LENGTH(RAM) - .);
<> 140:97feb9bacc10 191 } > RAM
<> 140:97feb9bacc10 192
<> 140:97feb9bacc10 193 /* Set the stack top to the end of RAM and move down the stack limit by
<> 140:97feb9bacc10 194 * the size of the stack_dummy section. */
<> 140:97feb9bacc10 195 __StackTop = ORIGIN(RAM) + LENGTH(RAM);
<> 140:97feb9bacc10 196 __StackLimit = __StackTop - SIZEOF(.stack);
<> 140:97feb9bacc10 197 PROVIDE(__stack = __StackTop);
<> 140:97feb9bacc10 198 }