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:
127:25aea2a3f4e3
Release 147 of the mbed library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 122:f9eeca106725 1 /*
Kojto 122:f9eeca106725 2 * BEETLE CMSIS Library
Kojto 122:f9eeca106725 3 */
Kojto 122:f9eeca106725 4 /*
Kojto 122:f9eeca106725 5 * Copyright (c) 2009-2016 ARM Limited. All rights reserved.
Kojto 122:f9eeca106725 6 *
Kojto 122:f9eeca106725 7 * SPDX-License-Identifier: Apache-2.0
Kojto 122:f9eeca106725 8 *
Kojto 122:f9eeca106725 9 * Licensed under the Apache License, Version 2.0 (the License); you may
Kojto 122:f9eeca106725 10 * not use this file except in compliance with the License.
Kojto 122:f9eeca106725 11 * You may obtain a copy of the License at
Kojto 122:f9eeca106725 12 *
Kojto 122:f9eeca106725 13 * http://www.apache.org/licenses/LICENSE-2.0
Kojto 122:f9eeca106725 14 *
Kojto 122:f9eeca106725 15 * Unless required by applicable law or agreed to in writing, software
Kojto 122:f9eeca106725 16 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
Kojto 122:f9eeca106725 17 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Kojto 122:f9eeca106725 18 * See the License for the specific language governing permissions and
Kojto 122:f9eeca106725 19 * limitations under the License.
Kojto 122:f9eeca106725 20 */
Kojto 122:f9eeca106725 21 /*
Kojto 122:f9eeca106725 22 * This file is derivative of CMSIS V5.00 gcc_arm.ld
Kojto 122:f9eeca106725 23 */
Kojto 122:f9eeca106725 24 /* Linker script for mbed BEETLE SoC */
Kojto 122:f9eeca106725 25
Kojto 122:f9eeca106725 26 /* Linker script to configure memory regions. */
Kojto 122:f9eeca106725 27 MEMORY
Kojto 122:f9eeca106725 28 {
Kojto 122:f9eeca106725 29 VECTORS (rx) : ORIGIN = 0x00000000, LENGTH = 0x00000400
Kojto 122:f9eeca106725 30 FLASH (rx) : ORIGIN = 0x00000400, LENGTH = 0x00040000 - 0x00000400
<> 127:25aea2a3f4e3 31 RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00020000
Kojto 122:f9eeca106725 32 }
Kojto 122:f9eeca106725 33
Kojto 122:f9eeca106725 34 /* Linker script to place sections and symbol values. Should be used together
Kojto 122:f9eeca106725 35 * with other linker script that defines memory regions FLASH and RAM.
Kojto 122:f9eeca106725 36 * It references following symbols, which must be defined in code:
Kojto 122:f9eeca106725 37 * Reset_Handler : Entry of reset handler
Kojto 122:f9eeca106725 38 *
Kojto 122:f9eeca106725 39 * It defines following symbols, which code can use without definition:
Kojto 122:f9eeca106725 40 * __exidx_start
Kojto 122:f9eeca106725 41 * __exidx_end
Kojto 122:f9eeca106725 42 * __etext
Kojto 122:f9eeca106725 43 * __data_start__
Kojto 122:f9eeca106725 44 * __preinit_array_start
Kojto 122:f9eeca106725 45 * __preinit_array_end
Kojto 122:f9eeca106725 46 * __init_array_start
Kojto 122:f9eeca106725 47 * __init_array_end
Kojto 122:f9eeca106725 48 * __fini_array_start
Kojto 122:f9eeca106725 49 * __fini_array_end
Kojto 122:f9eeca106725 50 * __data_end__
Kojto 122:f9eeca106725 51 * __bss_start__
Kojto 122:f9eeca106725 52 * __bss_end__
Kojto 122:f9eeca106725 53 * __end__
Kojto 122:f9eeca106725 54 * end
Kojto 122:f9eeca106725 55 * __HeapLimit
Kojto 122:f9eeca106725 56 * __StackLimit
Kojto 122:f9eeca106725 57 * __StackTop
Kojto 122:f9eeca106725 58 * __stack
Kojto 122:f9eeca106725 59 */
Kojto 122:f9eeca106725 60 ENTRY(Reset_Handler)
Kojto 122:f9eeca106725 61
<> 127:25aea2a3f4e3 62 /* Heap 1/4 of ram and stack 1/8 */
<> 127:25aea2a3f4e3 63 __stack_size__ = 0x4000;
<> 127:25aea2a3f4e3 64 __heap_size__ = 0x8000;
<> 127:25aea2a3f4e3 65
<> 127:25aea2a3f4e3 66 HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
<> 127:25aea2a3f4e3 67 STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
<> 127:25aea2a3f4e3 68
<> 127:25aea2a3f4e3 69 /* Size of the vector table in SRAM */
<> 127:25aea2a3f4e3 70 M_VECTOR_RAM_SIZE = 0x140;
<> 127:25aea2a3f4e3 71
Kojto 122:f9eeca106725 72 SECTIONS
Kojto 122:f9eeca106725 73 {
Kojto 122:f9eeca106725 74 .isr_vector :
Kojto 122:f9eeca106725 75 {
Kojto 122:f9eeca106725 76 __vector_table = .;
Kojto 122:f9eeca106725 77 KEEP(*(.vector_table))
Kojto 122:f9eeca106725 78 . = ALIGN(4);
Kojto 122:f9eeca106725 79 } > VECTORS
Kojto 122:f9eeca106725 80
<> 127:25aea2a3f4e3 81 /* Note: The uVisor expects this section at a fixed location, as specified
<> 127:25aea2a3f4e3 82 by the porting process configuration parameter: FLASH_OFFSET. */
<> 127:25aea2a3f4e3 83 __UVISOR_TEXT_OFFSET = 0x0;
<> 127:25aea2a3f4e3 84 __UVISOR_TEXT_START = ORIGIN(FLASH) + __UVISOR_TEXT_OFFSET;
<> 127:25aea2a3f4e3 85 .text __UVISOR_TEXT_START :
Kojto 122:f9eeca106725 86 {
<> 127:25aea2a3f4e3 87 /* uVisor code and data */
<> 127:25aea2a3f4e3 88 . = ALIGN(4);
<> 127:25aea2a3f4e3 89 __uvisor_main_start = .;
<> 127:25aea2a3f4e3 90 *(.uvisor.main)
<> 127:25aea2a3f4e3 91 __uvisor_main_end = .;
Kojto 122:f9eeca106725 92
Kojto 122:f9eeca106725 93 *(.text*)
Kojto 122:f9eeca106725 94
Kojto 122:f9eeca106725 95 KEEP(*(.init))
Kojto 122:f9eeca106725 96 KEEP(*(.fini))
Kojto 122:f9eeca106725 97
Kojto 122:f9eeca106725 98 /* .ctors */
Kojto 122:f9eeca106725 99 *crtbegin.o(.ctors)
Kojto 122:f9eeca106725 100 *crtbegin?.o(.ctors)
Kojto 122:f9eeca106725 101 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
Kojto 122:f9eeca106725 102 *(SORT(.ctors.*))
Kojto 122:f9eeca106725 103 *(.ctors)
Kojto 122:f9eeca106725 104
Kojto 122:f9eeca106725 105 /* .dtors */
Kojto 122:f9eeca106725 106 *crtbegin.o(.dtors)
Kojto 122:f9eeca106725 107 *crtbegin?.o(.dtors)
Kojto 122:f9eeca106725 108 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
Kojto 122:f9eeca106725 109 *(SORT(.dtors.*))
Kojto 122:f9eeca106725 110 *(.dtors)
Kojto 122:f9eeca106725 111
Kojto 122:f9eeca106725 112 *(.rodata*)
Kojto 122:f9eeca106725 113
Kojto 122:f9eeca106725 114 KEEP(*(.eh_frame*))
Kojto 122:f9eeca106725 115 } > FLASH
Kojto 122:f9eeca106725 116
Kojto 122:f9eeca106725 117 .ARM.extab :
Kojto 122:f9eeca106725 118 {
Kojto 122:f9eeca106725 119 *(.ARM.extab* .gnu.linkonce.armextab.*)
Kojto 122:f9eeca106725 120 } > FLASH
Kojto 122:f9eeca106725 121
Kojto 122:f9eeca106725 122 __exidx_start = .;
Kojto 122:f9eeca106725 123 .ARM.exidx :
Kojto 122:f9eeca106725 124 {
Kojto 122:f9eeca106725 125 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
Kojto 122:f9eeca106725 126 } > FLASH
Kojto 122:f9eeca106725 127 __exidx_end = .;
Kojto 122:f9eeca106725 128
<> 127:25aea2a3f4e3 129 .cordio :
<> 127:25aea2a3f4e3 130 {
<> 127:25aea2a3f4e3 131 *CORDIO_RO_2.1.o
<> 127:25aea2a3f4e3 132 *TRIM_2.1.o
<> 127:25aea2a3f4e3 133 } > FLASH
<> 127:25aea2a3f4e3 134
<> 127:25aea2a3f4e3 135 .interrupts_ram :
<> 127:25aea2a3f4e3 136 {
<> 127:25aea2a3f4e3 137 . = ALIGN(4);
<> 127:25aea2a3f4e3 138 __VECTOR_RAM__ = .;
<> 127:25aea2a3f4e3 139 __interrupts_ram_start__ = .; /* Create a global symbol at data start */
<> 127:25aea2a3f4e3 140 . += M_VECTOR_RAM_SIZE;
<> 127:25aea2a3f4e3 141 . = ALIGN(4);
<> 127:25aea2a3f4e3 142 __interrupts_ram_end__ = .; /* Define a global symbol at data end */
<> 127:25aea2a3f4e3 143 } > RAM
<> 127:25aea2a3f4e3 144
<> 127:25aea2a3f4e3 145 /* ensure that uvisor bss is at the beginning of memory */
<> 127:25aea2a3f4e3 146 /* Note: The uVisor expects this section at a fixed location, as specified by
<> 127:25aea2a3f4e3 147 * the porting process configuration parameter: SRAM_OFFSET. */
<> 127:25aea2a3f4e3 148 __UVISOR_SRAM_OFFSET = 0x140;
<> 127:25aea2a3f4e3 149 __UVISOR_BSS_START = ORIGIN(RAM) + __UVISOR_SRAM_OFFSET;
<> 127:25aea2a3f4e3 150 .uvisor.bss __UVISOR_BSS_START (NOLOAD):
<> 127:25aea2a3f4e3 151 {
<> 127:25aea2a3f4e3 152 . = ALIGN(32);
<> 127:25aea2a3f4e3 153 __uvisor_bss_start = .;
Kojto 122:f9eeca106725 154
<> 127:25aea2a3f4e3 155 /* protected uvisor main bss */
<> 127:25aea2a3f4e3 156 . = ALIGN(32);
<> 127:25aea2a3f4e3 157 __uvisor_bss_main_start = .;
<> 127:25aea2a3f4e3 158 KEEP(*(.keep.uvisor.bss.main))
<> 127:25aea2a3f4e3 159 . = ALIGN(32);
<> 127:25aea2a3f4e3 160 __uvisor_bss_main_end = .;
<> 127:25aea2a3f4e3 161
<> 127:25aea2a3f4e3 162 /* protected uvisor secure boxes bss */
<> 127:25aea2a3f4e3 163 . = ALIGN(32);
<> 127:25aea2a3f4e3 164 __uvisor_bss_boxes_start = .;
<> 127:25aea2a3f4e3 165 KEEP(*(.keep.uvisor.bss.boxes))
<> 127:25aea2a3f4e3 166 . = ALIGN(32);
<> 127:25aea2a3f4e3 167 __uvisor_bss_boxes_end = .;
<> 127:25aea2a3f4e3 168
<> 127:25aea2a3f4e3 169 . = ALIGN((1 << LOG2CEIL(LENGTH(RAM))) / 8);
<> 127:25aea2a3f4e3 170 __uvisor_bss_end = .;
<> 127:25aea2a3f4e3 171 } > RAM
<> 127:25aea2a3f4e3 172
<> 127:25aea2a3f4e3 173 /* Heap space for the page allocator */
<> 127:25aea2a3f4e3 174 .page_heap (NOLOAD) :
Kojto 122:f9eeca106725 175 {
<> 127:25aea2a3f4e3 176 . = ALIGN(32);
<> 127:25aea2a3f4e3 177 __uvisor_page_start = .;
<> 127:25aea2a3f4e3 178 KEEP(*(.keep.uvisor.page_heap))
<> 127:25aea2a3f4e3 179 . = ALIGN(32);
<> 127:25aea2a3f4e3 180 __uvisor_page_end = .;
<> 127:25aea2a3f4e3 181 } > RAM
<> 127:25aea2a3f4e3 182
<> 127:25aea2a3f4e3 183 .data :
<> 127:25aea2a3f4e3 184 {
<> 127:25aea2a3f4e3 185 PROVIDE(__etext = LOADADDR(.data));
<> 127:25aea2a3f4e3 186 . = ALIGN(4);
Kojto 122:f9eeca106725 187 __data_start__ = .;
Kojto 122:f9eeca106725 188 *(vtable)
<> 127:25aea2a3f4e3 189 *(.data)
Kojto 122:f9eeca106725 190 *(.data*)
Kojto 122:f9eeca106725 191
Kojto 122:f9eeca106725 192 . = ALIGN(4);
Kojto 122:f9eeca106725 193 /* preinit data */
Kojto 122:f9eeca106725 194 PROVIDE (__preinit_array_start = .);
Kojto 122:f9eeca106725 195 KEEP(*(.preinit_array))
Kojto 122:f9eeca106725 196 PROVIDE (__preinit_array_end = .);
Kojto 122:f9eeca106725 197
Kojto 122:f9eeca106725 198 . = ALIGN(4);
Kojto 122:f9eeca106725 199 /* init data */
Kojto 122:f9eeca106725 200 PROVIDE (__init_array_start = .);
Kojto 122:f9eeca106725 201 KEEP(*(SORT(.init_array.*)))
Kojto 122:f9eeca106725 202 KEEP(*(.init_array))
Kojto 122:f9eeca106725 203 PROVIDE (__init_array_end = .);
Kojto 122:f9eeca106725 204
Kojto 122:f9eeca106725 205
Kojto 122:f9eeca106725 206 . = ALIGN(4);
Kojto 122:f9eeca106725 207 /* finit data */
Kojto 122:f9eeca106725 208 PROVIDE (__fini_array_start = .);
Kojto 122:f9eeca106725 209 KEEP(*(SORT(.fini_array.*)))
Kojto 122:f9eeca106725 210 KEEP(*(.fini_array))
Kojto 122:f9eeca106725 211 PROVIDE (__fini_array_end = .);
Kojto 122:f9eeca106725 212
Kojto 122:f9eeca106725 213 . = ALIGN(4);
Kojto 122:f9eeca106725 214 /* All data end */
Kojto 122:f9eeca106725 215 __data_end__ = .;
Kojto 122:f9eeca106725 216
<> 127:25aea2a3f4e3 217 } > RAM AT > FLASH
<> 127:25aea2a3f4e3 218
<> 127:25aea2a3f4e3 219 /* uvisor configuration data */
<> 127:25aea2a3f4e3 220 .uvisor.secure :
<> 127:25aea2a3f4e3 221 {
<> 127:25aea2a3f4e3 222 . = ALIGN(32);
<> 127:25aea2a3f4e3 223 __uvisor_secure_start = .;
<> 127:25aea2a3f4e3 224
<> 127:25aea2a3f4e3 225 /* uvisor secure boxes configuration tables */
<> 127:25aea2a3f4e3 226 . = ALIGN(32);
<> 127:25aea2a3f4e3 227 __uvisor_cfgtbl_start = .;
<> 127:25aea2a3f4e3 228 KEEP(*(.keep.uvisor.cfgtbl))
<> 127:25aea2a3f4e3 229 . = ALIGN(32);
<> 127:25aea2a3f4e3 230 __uvisor_cfgtbl_end = .;
<> 127:25aea2a3f4e3 231
<> 127:25aea2a3f4e3 232 __uvisor_cfgtbl_ptr_start = .;
<> 127:25aea2a3f4e3 233 KEEP(*(.keep.uvisor.cfgtbl_ptr_first))
<> 127:25aea2a3f4e3 234 KEEP(*(.keep.uvisor.cfgtbl_ptr))
<> 127:25aea2a3f4e3 235 __uvisor_cfgtbl_ptr_end = .;
<> 127:25aea2a3f4e3 236
<> 127:25aea2a3f4e3 237 /* Pointers to all boxes register gateways. These are grouped here to allow
<> 127:25aea2a3f4e3 238 * discoverability and firmware verification. */
<> 127:25aea2a3f4e3 239 __uvisor_register_gateway_ptr_start = .;
<> 127:25aea2a3f4e3 240 KEEP(*(.keep.uvisor.register_gateway_ptr))
<> 127:25aea2a3f4e3 241 __uvisor_register_gateway_ptr_end = .;
<> 127:25aea2a3f4e3 242
<> 127:25aea2a3f4e3 243 . = ALIGN(32);
<> 127:25aea2a3f4e3 244 __uvisor_secure_end = .;
<> 127:25aea2a3f4e3 245 } > FLASH
<> 127:25aea2a3f4e3 246
<> 127:25aea2a3f4e3 247 /* From now on you can insert any other SRAM region. */
<> 127:25aea2a3f4e3 248
<> 127:25aea2a3f4e3 249 .uninitialized (NOLOAD):
<> 127:25aea2a3f4e3 250 {
<> 127:25aea2a3f4e3 251 . = ALIGN(32);
<> 127:25aea2a3f4e3 252 __uninitialized_start = .;
<> 127:25aea2a3f4e3 253 *(.uninitialized)
<> 127:25aea2a3f4e3 254 KEEP(*(.keep.uninitialized))
<> 127:25aea2a3f4e3 255 . = ALIGN(32);
<> 127:25aea2a3f4e3 256 __uninitialized_end = .;
Kojto 122:f9eeca106725 257 } > RAM
Kojto 122:f9eeca106725 258
Kojto 122:f9eeca106725 259 .bss :
Kojto 122:f9eeca106725 260 {
<> 127:25aea2a3f4e3 261 . = ALIGN(4);
<> 127:25aea2a3f4e3 262 __START_BSS = .;
Kojto 122:f9eeca106725 263 __bss_start__ = .;
<> 127:25aea2a3f4e3 264 *(.bss)
Kojto 122:f9eeca106725 265 *(.bss*)
Kojto 122:f9eeca106725 266 *(COMMON)
<> 127:25aea2a3f4e3 267 . = ALIGN(4);
Kojto 122:f9eeca106725 268 __bss_end__ = .;
<> 127:25aea2a3f4e3 269 __END_BSS = .;
<> 127:25aea2a3f4e3 270
Kojto 122:f9eeca106725 271 } > RAM
Kojto 122:f9eeca106725 272
Kojto 122:f9eeca106725 273 bss_size = __bss_end__ - __bss_start__;
Kojto 122:f9eeca106725 274
Kojto 122:f9eeca106725 275 .heap :
Kojto 122:f9eeca106725 276 {
<> 127:25aea2a3f4e3 277 . = ALIGN(8);
<> 127:25aea2a3f4e3 278 __uvisor_heap_start = .;
Kojto 122:f9eeca106725 279 __end__ = .;
<> 127:25aea2a3f4e3 280 PROVIDE(end = .);
<> 127:25aea2a3f4e3 281 __HeapBase = .;
<> 127:25aea2a3f4e3 282 . += HEAP_SIZE;
Kojto 122:f9eeca106725 283 __HeapLimit = .;
<> 127:25aea2a3f4e3 284 __heap_limit = .; /* Add for _sbrk */
<> 127:25aea2a3f4e3 285 __uvisor_heap_end = .;
Kojto 122:f9eeca106725 286 } > RAM
Kojto 122:f9eeca106725 287
Kojto 122:f9eeca106725 288 /* Set stack top to end of RAM, and stack limit move down by
Kojto 122:f9eeca106725 289 * size of stack_dummy section */
Kojto 122:f9eeca106725 290 __StackTop = ORIGIN(RAM) + LENGTH(RAM);
<> 127:25aea2a3f4e3 291 __StackLimit = __StackTop - STACK_SIZE;
Kojto 122:f9eeca106725 292 PROVIDE(__stack = __StackTop);
Kojto 122:f9eeca106725 293
Kojto 122:f9eeca106725 294 /* Check if data + heap + stack exceeds RAM limit */
Kojto 122:f9eeca106725 295 ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
<> 127:25aea2a3f4e3 296 /* Provide physical memory boundaries for uVisor. */
<> 127:25aea2a3f4e3 297 __uvisor_flash_start = ORIGIN(VECTORS);
<> 127:25aea2a3f4e3 298 __uvisor_flash_end = ORIGIN(FLASH) + LENGTH(FLASH);
<> 127:25aea2a3f4e3 299 __uvisor_sram_start = ORIGIN(RAM);
<> 127:25aea2a3f4e3 300 __uvisor_sram_end = ORIGIN(RAM) + LENGTH(RAM);
Kojto 122:f9eeca106725 301
Kojto 122:f9eeca106725 302 } /* End of sections */