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:
Fri Jun 22 15:38:59 2018 +0100
Revision:
169:a7c7b631e539
Parent:
101:7cff1c4259d7
Child:
171:3a7713b1edbc
mbed library. Release version 162

Who changed what in which revision?

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