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:
Kojto
Date:
Wed Jul 19 16:46:19 2017 +0100
Revision:
147:a97add6d7e64
Parent:
133:99b5ccf27215
Release 147 of the mbed library.

Who changed what in which revision?

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