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:
<>
Date:
Wed Apr 12 16:07:08 2017 +0100
Revision:
140:97feb9bacc10
Parent:
124:2241e3a39974
Release 140 of the mbed library

Ports for Upcoming Targets

3841: Add nRf52840 target https://github.com/ARMmbed/mbed-os/pull/3841
3992: Introducing UBLOX_C030 platform. https://github.com/ARMmbed/mbed-os/pull/3992

Fixes and Changes

3951: [NUCLEO_F303ZE] Correct ARDUINO pin https://github.com/ARMmbed/mbed-os/pull/3951
4021: Fixing a macro to detect when RTOS was in use for the NRF52840_DK https://github.com/ARMmbed/mbed-os/pull/4021
3979: KW24D: Add missing SPI defines and Arduino connector definitions https://github.com/ARMmbed/mbed-os/pull/3979
3990: UBLOX_C027: construct a ticker-based wait, rather than calling wait_ms(), in the https://github.com/ARMmbed/mbed-os/pull/3990
4003: Fixed OBOE in async serial tx for NRF52 target, fixes #4002 https://github.com/ARMmbed/mbed-os/pull/4003
4012: STM32: Correct I2C master error handling https://github.com/ARMmbed/mbed-os/pull/4012
4020: NUCLEO_L011K4 remove unsupported tool chain files https://github.com/ARMmbed/mbed-os/pull/4020
4065: K66F: Move bss section to m_data_2 Section https://github.com/ARMmbed/mbed-os/pull/4065
4014: Issue 3763: Reduce heap allocation in the GCC linker file https://github.com/ARMmbed/mbed-os/pull/4014
4030: [STM32L0] reduce IAR heap and stack size for small targets https://github.com/ARMmbed/mbed-os/pull/4030
4109: NUCLEO_L476RG : minor serial pin update https://github.com/ARMmbed/mbed-os/pull/4109
3982: Ticker - kl25z bugfix for handling events in the past https://github.com/ARMmbed/mbed-os/pull/3982

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 124:2241e3a39974 1 /*
Kojto 124:2241e3a39974 2 ** ###################################################################
Kojto 124:2241e3a39974 3 ** Processors: MKL43Z256VLH4
Kojto 124:2241e3a39974 4 ** MKL43Z256VMP4
Kojto 124:2241e3a39974 5 **
Kojto 124:2241e3a39974 6 ** Compiler: GNU C Compiler
Kojto 124:2241e3a39974 7 ** Reference manual: KL43P64M48SF6RM, Rev.3, Aug 2014
Kojto 124:2241e3a39974 8 ** Version: rev. 1.6, 2015-07-29
Kojto 124:2241e3a39974 9 ** Build: b160613
Kojto 124:2241e3a39974 10 **
Kojto 124:2241e3a39974 11 ** Abstract:
Kojto 124:2241e3a39974 12 ** Linker file for the GNU C Compiler
Kojto 124:2241e3a39974 13 **
Kojto 124:2241e3a39974 14 ** Copyright (c) 2016 Freescale Semiconductor, Inc.
Kojto 124:2241e3a39974 15 ** All rights reserved.
Kojto 124:2241e3a39974 16 **
Kojto 124:2241e3a39974 17 ** Redistribution and use in source and binary forms, with or without modification,
Kojto 124:2241e3a39974 18 ** are permitted provided that the following conditions are met:
Kojto 124:2241e3a39974 19 **
Kojto 124:2241e3a39974 20 ** o Redistributions of source code must retain the above copyright notice, this list
Kojto 124:2241e3a39974 21 ** of conditions and the following disclaimer.
Kojto 124:2241e3a39974 22 **
Kojto 124:2241e3a39974 23 ** o Redistributions in binary form must reproduce the above copyright notice, this
Kojto 124:2241e3a39974 24 ** list of conditions and the following disclaimer in the documentation and/or
Kojto 124:2241e3a39974 25 ** other materials provided with the distribution.
Kojto 124:2241e3a39974 26 **
Kojto 124:2241e3a39974 27 ** o Neither the name of Freescale Semiconductor, Inc. nor the names of its
Kojto 124:2241e3a39974 28 ** contributors may be used to endorse or promote products derived from this
Kojto 124:2241e3a39974 29 ** software without specific prior written permission.
Kojto 124:2241e3a39974 30 **
Kojto 124:2241e3a39974 31 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
Kojto 124:2241e3a39974 32 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
Kojto 124:2241e3a39974 33 ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 124:2241e3a39974 34 ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
Kojto 124:2241e3a39974 35 ** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
Kojto 124:2241e3a39974 36 ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
Kojto 124:2241e3a39974 37 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
Kojto 124:2241e3a39974 38 ** ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Kojto 124:2241e3a39974 39 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
Kojto 124:2241e3a39974 40 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 124:2241e3a39974 41 **
Kojto 124:2241e3a39974 42 ** http: www.freescale.com
Kojto 124:2241e3a39974 43 ** mail: support@freescale.com
Kojto 124:2241e3a39974 44 **
Kojto 124:2241e3a39974 45 ** ###################################################################
Kojto 124:2241e3a39974 46 */
Kojto 124:2241e3a39974 47
Kojto 124:2241e3a39974 48 /* Entry Point */
Kojto 124:2241e3a39974 49 ENTRY(Reset_Handler)
Kojto 124:2241e3a39974 50
Kojto 124:2241e3a39974 51 __ram_vector_table__ = 1;
Kojto 124:2241e3a39974 52
<> 140:97feb9bacc10 53 /* With the RTOS in use, this does not affect the main stack size. The size of
<> 140:97feb9bacc10 54 * the stack where main runs is determined via the RTOS. */
<> 140:97feb9bacc10 55 __stack_size__ = 0x400;
<> 140:97feb9bacc10 56
<> 140:97feb9bacc10 57 /* This is the guaranteed minimum available heap size for an application. When
<> 140:97feb9bacc10 58 * uVisor is enabled, this is also the maximum available heap size. The
<> 140:97feb9bacc10 59 * HEAP_SIZE value is set by uVisor porters to balance the size of the legacy
<> 140:97feb9bacc10 60 * heap and the page heap in uVisor applications. */
Kojto 124:2241e3a39974 61 __heap_size__ = 0x2800;
Kojto 124:2241e3a39974 62
Kojto 124:2241e3a39974 63 HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
Kojto 124:2241e3a39974 64 STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
Kojto 124:2241e3a39974 65 M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0200 : 0x0;
Kojto 124:2241e3a39974 66
Kojto 124:2241e3a39974 67 /* Specify the memory areas */
Kojto 124:2241e3a39974 68 MEMORY
Kojto 124:2241e3a39974 69 {
Kojto 124:2241e3a39974 70 m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000200
Kojto 124:2241e3a39974 71 m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
Kojto 124:2241e3a39974 72 m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0003FBF0
Kojto 124:2241e3a39974 73 m_data (RW) : ORIGIN = 0x1FFFE000, LENGTH = 0x00008000
Kojto 124:2241e3a39974 74 }
Kojto 124:2241e3a39974 75
Kojto 124:2241e3a39974 76 /* Define output sections */
Kojto 124:2241e3a39974 77 SECTIONS
Kojto 124:2241e3a39974 78 {
Kojto 124:2241e3a39974 79 /* The startup code goes first into internal flash */
Kojto 124:2241e3a39974 80 .interrupts :
Kojto 124:2241e3a39974 81 {
Kojto 124:2241e3a39974 82 __VECTOR_TABLE = .;
Kojto 124:2241e3a39974 83 . = ALIGN(4);
Kojto 124:2241e3a39974 84 KEEP(*(.isr_vector)) /* Startup code */
Kojto 124:2241e3a39974 85 . = ALIGN(4);
Kojto 124:2241e3a39974 86 } > m_interrupts
Kojto 124:2241e3a39974 87
Kojto 124:2241e3a39974 88 .flash_config :
Kojto 124:2241e3a39974 89 {
Kojto 124:2241e3a39974 90 . = ALIGN(4);
Kojto 124:2241e3a39974 91 KEEP(*(.FlashConfig)) /* Flash Configuration Field (FCF) */
Kojto 124:2241e3a39974 92 . = ALIGN(4);
Kojto 124:2241e3a39974 93 } > m_flash_config
Kojto 124:2241e3a39974 94
Kojto 124:2241e3a39974 95 /* The program code and other data goes into internal flash */
Kojto 124:2241e3a39974 96 .text :
Kojto 124:2241e3a39974 97 {
Kojto 124:2241e3a39974 98 . = ALIGN(4);
Kojto 124:2241e3a39974 99 *(.text) /* .text sections (code) */
Kojto 124:2241e3a39974 100 *(.text*) /* .text* sections (code) */
Kojto 124:2241e3a39974 101 *(.rodata) /* .rodata sections (constants, strings, etc.) */
Kojto 124:2241e3a39974 102 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
Kojto 124:2241e3a39974 103 *(.glue_7) /* glue arm to thumb code */
Kojto 124:2241e3a39974 104 *(.glue_7t) /* glue thumb to arm code */
Kojto 124:2241e3a39974 105 *(.eh_frame)
Kojto 124:2241e3a39974 106 KEEP (*(.init))
Kojto 124:2241e3a39974 107 KEEP (*(.fini))
Kojto 124:2241e3a39974 108 . = ALIGN(4);
Kojto 124:2241e3a39974 109 } > m_text
Kojto 124:2241e3a39974 110
Kojto 124:2241e3a39974 111 .ARM.extab :
Kojto 124:2241e3a39974 112 {
Kojto 124:2241e3a39974 113 *(.ARM.extab* .gnu.linkonce.armextab.*)
Kojto 124:2241e3a39974 114 } > m_text
Kojto 124:2241e3a39974 115
Kojto 124:2241e3a39974 116 .ARM :
Kojto 124:2241e3a39974 117 {
Kojto 124:2241e3a39974 118 __exidx_start = .;
Kojto 124:2241e3a39974 119 *(.ARM.exidx*)
Kojto 124:2241e3a39974 120 __exidx_end = .;
Kojto 124:2241e3a39974 121 } > m_text
Kojto 124:2241e3a39974 122
Kojto 124:2241e3a39974 123 .ctors :
Kojto 124:2241e3a39974 124 {
Kojto 124:2241e3a39974 125 __CTOR_LIST__ = .;
Kojto 124:2241e3a39974 126 /* gcc uses crtbegin.o to find the start of
Kojto 124:2241e3a39974 127 the constructors, so we make sure it is
Kojto 124:2241e3a39974 128 first. Because this is a wildcard, it
Kojto 124:2241e3a39974 129 doesn't matter if the user does not
Kojto 124:2241e3a39974 130 actually link against crtbegin.o; the
Kojto 124:2241e3a39974 131 linker won't look for a file to match a
Kojto 124:2241e3a39974 132 wildcard. The wildcard also means that it
Kojto 124:2241e3a39974 133 doesn't matter which directory crtbegin.o
Kojto 124:2241e3a39974 134 is in. */
Kojto 124:2241e3a39974 135 KEEP (*crtbegin.o(.ctors))
Kojto 124:2241e3a39974 136 KEEP (*crtbegin?.o(.ctors))
Kojto 124:2241e3a39974 137 /* We don't want to include the .ctor section from
Kojto 124:2241e3a39974 138 from the crtend.o file until after the sorted ctors.
Kojto 124:2241e3a39974 139 The .ctor section from the crtend file contains the
Kojto 124:2241e3a39974 140 end of ctors marker and it must be last */
Kojto 124:2241e3a39974 141 KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
Kojto 124:2241e3a39974 142 KEEP (*(SORT(.ctors.*)))
Kojto 124:2241e3a39974 143 KEEP (*(.ctors))
Kojto 124:2241e3a39974 144 __CTOR_END__ = .;
Kojto 124:2241e3a39974 145 } > m_text
Kojto 124:2241e3a39974 146
Kojto 124:2241e3a39974 147 .dtors :
Kojto 124:2241e3a39974 148 {
Kojto 124:2241e3a39974 149 __DTOR_LIST__ = .;
Kojto 124:2241e3a39974 150 KEEP (*crtbegin.o(.dtors))
Kojto 124:2241e3a39974 151 KEEP (*crtbegin?.o(.dtors))
Kojto 124:2241e3a39974 152 KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
Kojto 124:2241e3a39974 153 KEEP (*(SORT(.dtors.*)))
Kojto 124:2241e3a39974 154 KEEP (*(.dtors))
Kojto 124:2241e3a39974 155 __DTOR_END__ = .;
Kojto 124:2241e3a39974 156 } > m_text
Kojto 124:2241e3a39974 157
Kojto 124:2241e3a39974 158 .preinit_array :
Kojto 124:2241e3a39974 159 {
Kojto 124:2241e3a39974 160 PROVIDE_HIDDEN (__preinit_array_start = .);
Kojto 124:2241e3a39974 161 KEEP (*(.preinit_array*))
Kojto 124:2241e3a39974 162 PROVIDE_HIDDEN (__preinit_array_end = .);
Kojto 124:2241e3a39974 163 } > m_text
Kojto 124:2241e3a39974 164
Kojto 124:2241e3a39974 165 .init_array :
Kojto 124:2241e3a39974 166 {
Kojto 124:2241e3a39974 167 PROVIDE_HIDDEN (__init_array_start = .);
Kojto 124:2241e3a39974 168 KEEP (*(SORT(.init_array.*)))
Kojto 124:2241e3a39974 169 KEEP (*(.init_array*))
Kojto 124:2241e3a39974 170 PROVIDE_HIDDEN (__init_array_end = .);
Kojto 124:2241e3a39974 171 } > m_text
Kojto 124:2241e3a39974 172
Kojto 124:2241e3a39974 173 .fini_array :
Kojto 124:2241e3a39974 174 {
Kojto 124:2241e3a39974 175 PROVIDE_HIDDEN (__fini_array_start = .);
Kojto 124:2241e3a39974 176 KEEP (*(SORT(.fini_array.*)))
Kojto 124:2241e3a39974 177 KEEP (*(.fini_array*))
Kojto 124:2241e3a39974 178 PROVIDE_HIDDEN (__fini_array_end = .);
Kojto 124:2241e3a39974 179 } > m_text
Kojto 124:2241e3a39974 180
Kojto 124:2241e3a39974 181 __etext = .; /* define a global symbol at end of code */
Kojto 124:2241e3a39974 182 __DATA_ROM = .; /* Symbol is used by startup for data initialization */
Kojto 124:2241e3a39974 183
Kojto 124:2241e3a39974 184 /* reserve MTB memory at the beginning of m_data */
Kojto 124:2241e3a39974 185 .mtb : /* MTB buffer address as defined by the hardware */
Kojto 124:2241e3a39974 186 {
Kojto 124:2241e3a39974 187 . = ALIGN(8);
Kojto 124:2241e3a39974 188 _mtb_start = .;
Kojto 124:2241e3a39974 189 KEEP(*(.mtb_buf)) /* need to KEEP Micro Trace Buffer as not referenced by application */
Kojto 124:2241e3a39974 190 . = ALIGN(8);
Kojto 124:2241e3a39974 191 _mtb_end = .;
Kojto 124:2241e3a39974 192 } > m_data
Kojto 124:2241e3a39974 193
Kojto 124:2241e3a39974 194 .interrupts_ram :
Kojto 124:2241e3a39974 195 {
Kojto 124:2241e3a39974 196 . = ALIGN(4);
Kojto 124:2241e3a39974 197 __VECTOR_RAM__ = .;
Kojto 124:2241e3a39974 198 __interrupts_ram_start__ = .; /* Create a global symbol at data start */
Kojto 124:2241e3a39974 199 *(.m_interrupts_ram) /* This is a user defined section */
Kojto 124:2241e3a39974 200 . += M_VECTOR_RAM_SIZE;
Kojto 124:2241e3a39974 201 . = ALIGN(4);
Kojto 124:2241e3a39974 202 __interrupts_ram_end__ = .; /* Define a global symbol at data end */
Kojto 124:2241e3a39974 203 } > m_data
Kojto 124:2241e3a39974 204
Kojto 124:2241e3a39974 205 __VECTOR_RAM = DEFINED(__ram_vector_table__) ? __VECTOR_RAM__ : ORIGIN(m_interrupts);
Kojto 124:2241e3a39974 206 __RAM_VECTOR_TABLE_SIZE_BYTES = DEFINED(__ram_vector_table__) ? (__interrupts_ram_end__ - __interrupts_ram_start__) : 0x0;
Kojto 124:2241e3a39974 207
Kojto 124:2241e3a39974 208 .data : AT(__DATA_ROM)
Kojto 124:2241e3a39974 209 {
Kojto 124:2241e3a39974 210 . = ALIGN(4);
Kojto 124:2241e3a39974 211 __DATA_RAM = .;
Kojto 124:2241e3a39974 212 __data_start__ = .; /* create a global symbol at data start */
Kojto 124:2241e3a39974 213 *(.data) /* .data sections */
Kojto 124:2241e3a39974 214 *(.data*) /* .data* sections */
Kojto 124:2241e3a39974 215 KEEP(*(.jcr*))
Kojto 124:2241e3a39974 216 . = ALIGN(4);
Kojto 124:2241e3a39974 217 __data_end__ = .; /* define a global symbol at data end */
Kojto 124:2241e3a39974 218 } > m_data
Kojto 124:2241e3a39974 219
Kojto 124:2241e3a39974 220 __DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
Kojto 124:2241e3a39974 221 text_end = ORIGIN(m_text) + LENGTH(m_text);
Kojto 124:2241e3a39974 222 ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
Kojto 124:2241e3a39974 223
Kojto 124:2241e3a39974 224 USB_RAM_GAP = DEFINED(__usb_ram_size__) ? __usb_ram_size__ : 0x00;
Kojto 124:2241e3a39974 225 /* Uninitialized data section */
Kojto 124:2241e3a39974 226 .bss :
Kojto 124:2241e3a39974 227 {
Kojto 124:2241e3a39974 228 /* This is used by the startup in order to initialize the .bss section */
Kojto 124:2241e3a39974 229 . = ALIGN(4);
Kojto 124:2241e3a39974 230 __START_BSS = .;
Kojto 124:2241e3a39974 231 __bss_start__ = .;
Kojto 124:2241e3a39974 232 *(.bss)
Kojto 124:2241e3a39974 233 *(.bss*)
Kojto 124:2241e3a39974 234 . = ALIGN(512);
Kojto 124:2241e3a39974 235 USB_RAM_START = .;
Kojto 124:2241e3a39974 236 . += USB_RAM_GAP;
Kojto 124:2241e3a39974 237 *(COMMON)
Kojto 124:2241e3a39974 238 . = ALIGN(4);
Kojto 124:2241e3a39974 239 __bss_end__ = .;
Kojto 124:2241e3a39974 240 __END_BSS = .;
Kojto 124:2241e3a39974 241 } > m_data
Kojto 124:2241e3a39974 242
Kojto 124:2241e3a39974 243 .heap :
Kojto 124:2241e3a39974 244 {
Kojto 124:2241e3a39974 245 . = ALIGN(8);
Kojto 124:2241e3a39974 246 __end__ = .;
Kojto 124:2241e3a39974 247 PROVIDE(end = .);
Kojto 124:2241e3a39974 248 __HeapBase = .;
Kojto 124:2241e3a39974 249 . += HEAP_SIZE;
Kojto 124:2241e3a39974 250 __HeapLimit = .;
Kojto 124:2241e3a39974 251 __heap_limit = .; /* Add for _sbrk */
Kojto 124:2241e3a39974 252 } > m_data
Kojto 124:2241e3a39974 253
Kojto 124:2241e3a39974 254 .stack :
Kojto 124:2241e3a39974 255 {
Kojto 124:2241e3a39974 256 . = ALIGN(8);
Kojto 124:2241e3a39974 257 . += STACK_SIZE;
Kojto 124:2241e3a39974 258 } > m_data
Kojto 124:2241e3a39974 259
Kojto 124:2241e3a39974 260 m_usb_bdt USB_RAM_START (NOLOAD) :
Kojto 124:2241e3a39974 261 {
Kojto 124:2241e3a39974 262 *(m_usb_bdt)
Kojto 124:2241e3a39974 263 USB_RAM_BDT_END = .;
Kojto 124:2241e3a39974 264 }
Kojto 124:2241e3a39974 265
Kojto 124:2241e3a39974 266 m_usb_global USB_RAM_BDT_END (NOLOAD) :
Kojto 124:2241e3a39974 267 {
Kojto 124:2241e3a39974 268 *(m_usb_global)
Kojto 124:2241e3a39974 269 }
Kojto 124:2241e3a39974 270
Kojto 124:2241e3a39974 271 /* Initializes stack on the end of block */
Kojto 124:2241e3a39974 272 __StackTop = ORIGIN(m_data) + LENGTH(m_data);
Kojto 124:2241e3a39974 273 __StackLimit = __StackTop - STACK_SIZE;
Kojto 124:2241e3a39974 274 PROVIDE(__stack = __StackTop);
Kojto 124:2241e3a39974 275
Kojto 124:2241e3a39974 276 .ARM.attributes 0 : { *(.ARM.attributes) }
Kojto 124:2241e3a39974 277
Kojto 124:2241e3a39974 278 ASSERT(__StackLimit >= __HeapLimit, "region m_data overflowed with stack and heap")
Kojto 124:2241e3a39974 279 }
Kojto 124:2241e3a39974 280