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:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 129:0ab6a29f35bf 1 /*******************************************************************************
<> 129:0ab6a29f35bf 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
<> 129:0ab6a29f35bf 3 *
<> 129:0ab6a29f35bf 4 * Permission is hereby granted, free of charge, to any person obtaining a
<> 129:0ab6a29f35bf 5 * copy of this software and associated documentation files (the "Software"),
<> 129:0ab6a29f35bf 6 * to deal in the Software without restriction, including without limitation
<> 129:0ab6a29f35bf 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
<> 129:0ab6a29f35bf 8 * and/or sell copies of the Software, and to permit persons to whom the
<> 129:0ab6a29f35bf 9 * Software is furnished to do so, subject to the following conditions:
<> 129:0ab6a29f35bf 10 *
<> 129:0ab6a29f35bf 11 * The above copyright notice and this permission notice shall be included
<> 129:0ab6a29f35bf 12 * in all copies or substantial portions of the Software.
<> 129:0ab6a29f35bf 13 *
<> 129:0ab6a29f35bf 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
<> 129:0ab6a29f35bf 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
<> 129:0ab6a29f35bf 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
<> 129:0ab6a29f35bf 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
<> 129:0ab6a29f35bf 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
<> 129:0ab6a29f35bf 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
<> 129:0ab6a29f35bf 20 * OTHER DEALINGS IN THE SOFTWARE.
<> 129:0ab6a29f35bf 21 *
<> 129:0ab6a29f35bf 22 * Except as contained in this notice, the name of Maxim Integrated
<> 129:0ab6a29f35bf 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
<> 129:0ab6a29f35bf 24 * Products, Inc. Branding Policy.
<> 129:0ab6a29f35bf 25 *
<> 129:0ab6a29f35bf 26 * The mere transfer of this software does not imply any licenses
<> 129:0ab6a29f35bf 27 * of trade secrets, proprietary technology, copyrights, patents,
<> 129:0ab6a29f35bf 28 * trademarks, maskwork rights, or any other form of intellectual
<> 129:0ab6a29f35bf 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
<> 129:0ab6a29f35bf 30 * ownership rights.
<> 129:0ab6a29f35bf 31 *******************************************************************************
<> 129:0ab6a29f35bf 32 */
<> 129:0ab6a29f35bf 33
<> 129:0ab6a29f35bf 34 MEMORY
<> 129:0ab6a29f35bf 35 {
<> 129:0ab6a29f35bf 36 FLASH (rx) : ORIGIN = 0x00010000, LENGTH = 0x00070000
<> 129:0ab6a29f35bf 37 RAM (rwx) : ORIGIN = 0x20003100, LENGTH = 0x00024F00
<> 129:0ab6a29f35bf 38 }
<> 129:0ab6a29f35bf 39
<> 129:0ab6a29f35bf 40 /* Linker script to place sections and symbol values. Should be used together
<> 129:0ab6a29f35bf 41 * with other linker script that defines memory regions FLASH and RAM.
<> 129:0ab6a29f35bf 42 * It references following symbols, which must be defined in code:
<> 129:0ab6a29f35bf 43 * Reset_Handler : Entry of reset handler
<> 129:0ab6a29f35bf 44 *
<> 129:0ab6a29f35bf 45 * It defines following symbols, which code can use without definition:
<> 129:0ab6a29f35bf 46 * __exidx_start
<> 129:0ab6a29f35bf 47 * __exidx_end
<> 129:0ab6a29f35bf 48 * __etext
<> 129:0ab6a29f35bf 49 * __data_start__
<> 129:0ab6a29f35bf 50 * __preinit_array_start
<> 129:0ab6a29f35bf 51 * __preinit_array_end
<> 129:0ab6a29f35bf 52 * __init_array_start
<> 129:0ab6a29f35bf 53 * __init_array_end
<> 129:0ab6a29f35bf 54 * __fini_array_start
<> 129:0ab6a29f35bf 55 * __fini_array_end
<> 129:0ab6a29f35bf 56 * __data_end__
<> 129:0ab6a29f35bf 57 * __bss_start__
<> 129:0ab6a29f35bf 58 * __bss_end__
<> 129:0ab6a29f35bf 59 * __end__
<> 129:0ab6a29f35bf 60 * end
<> 129:0ab6a29f35bf 61 * __HeapLimit
<> 129:0ab6a29f35bf 62 * __StackLimit
<> 129:0ab6a29f35bf 63 * __StackTop
<> 129:0ab6a29f35bf 64 * __stack
<> 129:0ab6a29f35bf 65 */
<> 129:0ab6a29f35bf 66 ENTRY(Reset_Handler)
<> 129:0ab6a29f35bf 67
<> 129:0ab6a29f35bf 68 SECTIONS
<> 129:0ab6a29f35bf 69 {
<> 129:0ab6a29f35bf 70 .text :
<> 129:0ab6a29f35bf 71 {
<> 129:0ab6a29f35bf 72 KEEP(*(.isr_vector))
<> 129:0ab6a29f35bf 73 *(.text*)
<> 129:0ab6a29f35bf 74
<> 129:0ab6a29f35bf 75 KEEP(*(.init))
<> 129:0ab6a29f35bf 76 KEEP(*(.fini))
<> 129:0ab6a29f35bf 77
<> 129:0ab6a29f35bf 78 /* .ctors */
<> 129:0ab6a29f35bf 79 *crtbegin.o(.ctors)
<> 129:0ab6a29f35bf 80 *crtbegin?.o(.ctors)
<> 129:0ab6a29f35bf 81 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
<> 129:0ab6a29f35bf 82 *(SORT(.ctors.*))
<> 129:0ab6a29f35bf 83 *(.ctors)
<> 129:0ab6a29f35bf 84
<> 129:0ab6a29f35bf 85 /* .dtors */
<> 129:0ab6a29f35bf 86 *crtbegin.o(.dtors)
<> 129:0ab6a29f35bf 87 *crtbegin?.o(.dtors)
<> 129:0ab6a29f35bf 88 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
<> 129:0ab6a29f35bf 89 *(SORT(.dtors.*))
<> 129:0ab6a29f35bf 90 *(.dtors)
<> 129:0ab6a29f35bf 91
<> 129:0ab6a29f35bf 92 *(.rodata*)
<> 129:0ab6a29f35bf 93
<> 129:0ab6a29f35bf 94 KEEP(*(.eh_frame*))
<> 129:0ab6a29f35bf 95 } > FLASH
<> 129:0ab6a29f35bf 96
<> 129:0ab6a29f35bf 97 .ARM.extab :
<> 129:0ab6a29f35bf 98 {
<> 129:0ab6a29f35bf 99 *(.ARM.extab* .gnu.linkonce.armextab.*)
<> 129:0ab6a29f35bf 100 } > FLASH
<> 129:0ab6a29f35bf 101
<> 129:0ab6a29f35bf 102 __exidx_start = .;
<> 129:0ab6a29f35bf 103 .ARM.exidx :
<> 129:0ab6a29f35bf 104 {
<> 129:0ab6a29f35bf 105 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
<> 129:0ab6a29f35bf 106 } > FLASH
<> 129:0ab6a29f35bf 107 __exidx_end = .;
<> 129:0ab6a29f35bf 108
<> 129:0ab6a29f35bf 109 __etext = .;
<> 129:0ab6a29f35bf 110
<> 129:0ab6a29f35bf 111 .data : AT (__etext)
<> 129:0ab6a29f35bf 112 {
<> 129:0ab6a29f35bf 113 __data_start__ = .;
<> 129:0ab6a29f35bf 114 *(vtable)
<> 129:0ab6a29f35bf 115 *(.data*)
<> 129:0ab6a29f35bf 116
AnnaBridge 171:3a7713b1edbc 117 . = ALIGN(8);
<> 129:0ab6a29f35bf 118 /* preinit data */
<> 129:0ab6a29f35bf 119 PROVIDE_HIDDEN (__preinit_array_start = .);
<> 129:0ab6a29f35bf 120 KEEP(*(.preinit_array))
<> 129:0ab6a29f35bf 121 PROVIDE_HIDDEN (__preinit_array_end = .);
<> 129:0ab6a29f35bf 122
AnnaBridge 171:3a7713b1edbc 123 . = ALIGN(8);
<> 129:0ab6a29f35bf 124 /* init data */
<> 129:0ab6a29f35bf 125 PROVIDE_HIDDEN (__init_array_start = .);
<> 129:0ab6a29f35bf 126 KEEP(*(SORT(.init_array.*)))
<> 129:0ab6a29f35bf 127 KEEP(*(.init_array))
<> 129:0ab6a29f35bf 128 PROVIDE_HIDDEN (__init_array_end = .);
<> 129:0ab6a29f35bf 129
<> 129:0ab6a29f35bf 130
AnnaBridge 171:3a7713b1edbc 131 . = ALIGN(8);
<> 129:0ab6a29f35bf 132 /* finit data */
<> 129:0ab6a29f35bf 133 PROVIDE_HIDDEN (__fini_array_start = .);
<> 129:0ab6a29f35bf 134 KEEP(*(SORT(.fini_array.*)))
<> 129:0ab6a29f35bf 135 KEEP(*(.fini_array))
<> 129:0ab6a29f35bf 136 PROVIDE_HIDDEN (__fini_array_end = .);
<> 129:0ab6a29f35bf 137
AnnaBridge 171:3a7713b1edbc 138 . = ALIGN(8);
<> 129:0ab6a29f35bf 139 /* All data end */
<> 129:0ab6a29f35bf 140 __data_end__ = .;
<> 129:0ab6a29f35bf 141
<> 129:0ab6a29f35bf 142 } > RAM
<> 129:0ab6a29f35bf 143
<> 129:0ab6a29f35bf 144 .bss :
<> 129:0ab6a29f35bf 145 {
<> 129:0ab6a29f35bf 146 __bss_start__ = .;
<> 129:0ab6a29f35bf 147 *(.bss*)
<> 129:0ab6a29f35bf 148 *(COMMON)
<> 129:0ab6a29f35bf 149 __bss_end__ = .;
<> 129:0ab6a29f35bf 150 } > RAM
<> 129:0ab6a29f35bf 151
<> 129:0ab6a29f35bf 152 .heap :
<> 129:0ab6a29f35bf 153 {
<> 129:0ab6a29f35bf 154 __end__ = .;
<> 129:0ab6a29f35bf 155 end = __end__;
<> 129:0ab6a29f35bf 156 *(.heap*)
<> 129:0ab6a29f35bf 157 __HeapLimit = .;
<> 129:0ab6a29f35bf 158 } > RAM
<> 129:0ab6a29f35bf 159
<> 129:0ab6a29f35bf 160 /* .stack_dummy section doesn't contains any symbols. It is only
<> 129:0ab6a29f35bf 161 * used for linker to calculate size of stack sections, and assign
<> 129:0ab6a29f35bf 162 * values to stack symbols later */
<> 129:0ab6a29f35bf 163 .stack_dummy :
<> 129:0ab6a29f35bf 164 {
<> 129:0ab6a29f35bf 165 *(.stack)
<> 129:0ab6a29f35bf 166 } > RAM
<> 129:0ab6a29f35bf 167
<> 129:0ab6a29f35bf 168 /* Set stack top to end of RAM, and stack limit move down by
<> 129:0ab6a29f35bf 169 * size of stack_dummy section */
<> 129:0ab6a29f35bf 170 __StackTop = ORIGIN(RAM) + LENGTH(RAM);
<> 129:0ab6a29f35bf 171 __StackLimit = __StackTop - SIZEOF(.stack_dummy);
<> 129:0ab6a29f35bf 172 PROVIDE(__stack = __StackTop);
<> 129:0ab6a29f35bf 173
<> 129:0ab6a29f35bf 174 /* Check if data + heap + stack exceeds RAM limit */
<> 129:0ab6a29f35bf 175 ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
<> 129:0ab6a29f35bf 176 }