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:
140:97feb9bacc10
Child:
160:5571c4ff569f
Release 147 of the mbed library.

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
<> 140:97feb9bacc10 19 MEMORY
<> 140:97feb9bacc10 20 {
<> 140:97feb9bacc10 21 FLASH (rx) : ORIGIN = 0x21000, LENGTH = 0xDF000
<> 140:97feb9bacc10 22 RAM (rwx) : ORIGIN = 0x20003288, LENGTH = 0x3cd78
<> 140:97feb9bacc10 23 }
<> 140:97feb9bacc10 24
<> 140:97feb9bacc10 25
<> 140:97feb9bacc10 26 OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
<> 140:97feb9bacc10 27
<> 140:97feb9bacc10 28 /* Linker script to place sections and symbol values. Should be used together
<> 140:97feb9bacc10 29 * with the other linker script that defines memory regions FLASH and RAM.
<> 140:97feb9bacc10 30 * It references the following symbols that must be defined in code:
<> 140:97feb9bacc10 31 * Reset_Handler : Entry of reset handler
<> 140:97feb9bacc10 32 *
<> 140:97feb9bacc10 33 * It defines the following symbols that the code can use without definition:
<> 140:97feb9bacc10 34 * __exidx_start
<> 140:97feb9bacc10 35 * __exidx_end
<> 140:97feb9bacc10 36 * __etext
<> 140:97feb9bacc10 37 * __data_start__
<> 140:97feb9bacc10 38 * __preinit_array_start
<> 140:97feb9bacc10 39 * __preinit_array_end
<> 140:97feb9bacc10 40 * __init_array_start
<> 140:97feb9bacc10 41 * __init_array_end
<> 140:97feb9bacc10 42 * __fini_array_start
<> 140:97feb9bacc10 43 * __fini_array_end
<> 140:97feb9bacc10 44 * __data_end__
<> 140:97feb9bacc10 45 * __bss_start__
<> 140:97feb9bacc10 46 * __bss_end__
<> 140:97feb9bacc10 47 * __end__
<> 140:97feb9bacc10 48 * end
<> 140:97feb9bacc10 49 * __HeapLimit
<> 140:97feb9bacc10 50 * __StackLimit
<> 140:97feb9bacc10 51 * __StackTop
<> 140:97feb9bacc10 52 * __stack
<> 140:97feb9bacc10 53 */
<> 140:97feb9bacc10 54 ENTRY(Reset_Handler)
<> 140:97feb9bacc10 55
<> 140:97feb9bacc10 56
<> 140:97feb9bacc10 57 SECTIONS
<> 140:97feb9bacc10 58 {
<> 140:97feb9bacc10 59 .text :
<> 140:97feb9bacc10 60 {
<> 140:97feb9bacc10 61 KEEP(*(.Vectors))
<> 140:97feb9bacc10 62 *(.text*)
<> 140:97feb9bacc10 63
<> 140:97feb9bacc10 64 KEEP(*(.init))
<> 140:97feb9bacc10 65 KEEP(*(.fini))
<> 140:97feb9bacc10 66
<> 140:97feb9bacc10 67 /* .ctors */
<> 140:97feb9bacc10 68 *crtbegin.o(.ctors)
<> 140:97feb9bacc10 69 *crtbegin?.o(.ctors)
<> 140:97feb9bacc10 70 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
<> 140:97feb9bacc10 71 *(SORT(.ctors.*))
<> 140:97feb9bacc10 72 *(.ctors)
<> 140:97feb9bacc10 73
<> 140:97feb9bacc10 74 /* .dtors */
<> 140:97feb9bacc10 75 *crtbegin.o(.dtors)
<> 140:97feb9bacc10 76 *crtbegin?.o(.dtors)
<> 140:97feb9bacc10 77 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
<> 140:97feb9bacc10 78 *(SORT(.dtors.*))
<> 140:97feb9bacc10 79 *(.dtors)
<> 140:97feb9bacc10 80
<> 140:97feb9bacc10 81 *(.rodata*)
<> 140:97feb9bacc10 82
<> 140:97feb9bacc10 83 KEEP(*(.eh_frame*))
<> 140:97feb9bacc10 84 } > FLASH
<> 140:97feb9bacc10 85
<> 140:97feb9bacc10 86 .ARM.extab :
<> 140:97feb9bacc10 87 {
<> 140:97feb9bacc10 88 *(.ARM.extab* .gnu.linkonce.armextab.*)
<> 140:97feb9bacc10 89 . = ALIGN(4);
<> 140:97feb9bacc10 90 } > FLASH
<> 140:97feb9bacc10 91
<> 140:97feb9bacc10 92 __exidx_start = .;
<> 140:97feb9bacc10 93 .ARM.exidx :
<> 140:97feb9bacc10 94 {
<> 140:97feb9bacc10 95 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
<> 140:97feb9bacc10 96 . = ALIGN(4);
<> 140:97feb9bacc10 97 } > FLASH
<> 140:97feb9bacc10 98 __exidx_end = .;
<> 140:97feb9bacc10 99
<> 140:97feb9bacc10 100 __etext = .;
<> 140:97feb9bacc10 101
<> 140:97feb9bacc10 102 .data : AT (__etext)
<> 140:97feb9bacc10 103 {
<> 140:97feb9bacc10 104 __data_start__ = .;
<> 140:97feb9bacc10 105 *(vtable)
<> 140:97feb9bacc10 106 *(.data*)
<> 140:97feb9bacc10 107
<> 140:97feb9bacc10 108 . = ALIGN(4);
<> 140:97feb9bacc10 109 /* preinit data */
<> 140:97feb9bacc10 110 PROVIDE_HIDDEN (__preinit_array_start = .);
<> 140:97feb9bacc10 111 KEEP(*(.preinit_array))
<> 140:97feb9bacc10 112 PROVIDE_HIDDEN (__preinit_array_end = .);
<> 140:97feb9bacc10 113
<> 140:97feb9bacc10 114 . = ALIGN(4);
<> 140:97feb9bacc10 115 /* init data */
<> 140:97feb9bacc10 116 PROVIDE_HIDDEN (__init_array_start = .);
<> 140:97feb9bacc10 117 KEEP(*(SORT(.init_array.*)))
<> 140:97feb9bacc10 118 KEEP(*(.init_array))
<> 140:97feb9bacc10 119 PROVIDE_HIDDEN (__init_array_end = .);
<> 140:97feb9bacc10 120
<> 140:97feb9bacc10 121
<> 140:97feb9bacc10 122 . = ALIGN(4);
<> 140:97feb9bacc10 123 /* finit data */
<> 140:97feb9bacc10 124 PROVIDE_HIDDEN (__fini_array_start = .);
<> 140:97feb9bacc10 125 KEEP(*(SORT(.fini_array.*)))
<> 140:97feb9bacc10 126 KEEP(*(.fini_array))
<> 140:97feb9bacc10 127 PROVIDE_HIDDEN (__fini_array_end = .);
<> 140:97feb9bacc10 128
<> 140:97feb9bacc10 129 . = ALIGN(4);
<> 140:97feb9bacc10 130 PROVIDE(__start_fs_data = .);
<> 140:97feb9bacc10 131 KEEP(*(.fs_data))
<> 140:97feb9bacc10 132 PROVIDE(__stop_fs_data = .);
<> 140:97feb9bacc10 133
<> 140:97feb9bacc10 134 *(.jcr)
<> 140:97feb9bacc10 135 . = ALIGN(4);
<> 140:97feb9bacc10 136 /* All data end */
<> 140:97feb9bacc10 137 __data_end__ = .;
<> 140:97feb9bacc10 138
<> 140:97feb9bacc10 139 } > RAM
<> 140:97feb9bacc10 140
<> 140:97feb9bacc10 141 __edata = .;
<> 140:97feb9bacc10 142
<> 140:97feb9bacc10 143 .noinit :
<> 140:97feb9bacc10 144 {
<> 140:97feb9bacc10 145 PROVIDE(__start_noinit = .);
<> 140:97feb9bacc10 146 KEEP(*(.noinit))
<> 140:97feb9bacc10 147 PROVIDE(__stop_noinit = .);
<> 140:97feb9bacc10 148 } > RAM
<> 140:97feb9bacc10 149
<> 140:97feb9bacc10 150 .bss :
<> 140:97feb9bacc10 151 {
<> 140:97feb9bacc10 152 . = ALIGN(4);
<> 140:97feb9bacc10 153 __bss_start__ = .;
<> 140:97feb9bacc10 154 *(.bss*)
<> 140:97feb9bacc10 155 *(COMMON)
<> 140:97feb9bacc10 156 . = ALIGN(4);
<> 140:97feb9bacc10 157 __bss_end__ = .;
<> 140:97feb9bacc10 158 } > RAM
<> 140:97feb9bacc10 159
<> 140:97feb9bacc10 160 .heap (NOLOAD):
<> 140:97feb9bacc10 161 {
<> 140:97feb9bacc10 162 __end__ = .;
<> 140:97feb9bacc10 163 end = __end__;
<> 140:97feb9bacc10 164 *(.heap*);
<> 140:97feb9bacc10 165
<> 140:97feb9bacc10 166 /* Expand the heap to reach the stack boundary. */
<> 140:97feb9bacc10 167 ASSERT(. <= (ORIGIN(RAM) + LENGTH(RAM) - 0x800), "heap region overflowed into stack");
<> 140:97feb9bacc10 168 . += (ORIGIN(RAM) + LENGTH(RAM) - 0x800) - .;
<> 140:97feb9bacc10 169 } > RAM
<> 140:97feb9bacc10 170 PROVIDE(__heap_start = ADDR(.heap));
<> 140:97feb9bacc10 171 PROVIDE(__heap_size = SIZEOF(.heap));
<> 140:97feb9bacc10 172 PROVIDE(__mbed_sbrk_start = ADDR(.heap));
<> 140:97feb9bacc10 173 PROVIDE(__mbed_krbs_start = ADDR(.heap) + SIZEOF(.heap));
<> 140:97feb9bacc10 174
<> 140:97feb9bacc10 175 /* .stack_dummy section does not contain any symbols. It is only
<> 140:97feb9bacc10 176 * used for the linker script to calculate the size of stack sections
<> 140:97feb9bacc10 177 * and assign values to stack symbols later. */
<> 140:97feb9bacc10 178 .stack (NOLOAD):
<> 140:97feb9bacc10 179 {
<> 140:97feb9bacc10 180 __StackLimit = .;
<> 140:97feb9bacc10 181 *(.stack*)
<> 140:97feb9bacc10 182 . += (ORIGIN(RAM) + LENGTH(RAM) - .);
<> 140:97feb9bacc10 183 } > RAM
<> 140:97feb9bacc10 184
<> 140:97feb9bacc10 185 /* Set the stack top to the end of RAM and move down the stack limit by
<> 140:97feb9bacc10 186 * the size of the stack_dummy section. */
<> 140:97feb9bacc10 187 __StackTop = ORIGIN(RAM) + LENGTH(RAM);
<> 140:97feb9bacc10 188 __StackLimit = __StackTop - SIZEOF(.stack);
<> 140:97feb9bacc10 189 PROVIDE(__stack = __StackTop);
<> 140:97feb9bacc10 190 }