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