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 Apr 20 11:08:29 2018 +0100
Revision:
166:5aab5a7997ee
Parent:
99:dbbf35b96557
Updating mbed 2 version number

Who changed what in which revision?

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