ads1115 only

Fork of mbed by mbed official

Committer:
Kojto
Date:
Fri Aug 19 10:17:11 2016 +0100
Revision:
124:2241e3a39974
Release 124 of the mbed library

Changes:

- new targets - KL27Z, K66F
- deprecate macro - add since argument
- override new and delete operators to trap errors
- Maxim - i2c and dac bugfixes
- STM - STM32F4 - serial flow enablement, enable async serial
- pwm and analog definition clean-up
- Nordic - NRF51 - fix for overflow in the ticket

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 124:2241e3a39974 1 /*
Kojto 124:2241e3a39974 2 ** ###################################################################
Kojto 124:2241e3a39974 3 ** Processors: MK66FN2M0VLQ18
Kojto 124:2241e3a39974 4 ** MK66FN2M0VMD18
Kojto 124:2241e3a39974 5 **
Kojto 124:2241e3a39974 6 ** Compiler: GNU C Compiler
Kojto 124:2241e3a39974 7 ** Reference manual: K66P144M180SF5RMV2, Rev. 1, Mar 2015
Kojto 124:2241e3a39974 8 ** Version: rev. 3.0, 2015-03-25
Kojto 124:2241e3a39974 9 ** Build: b151217
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) 2015 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
Kojto 124:2241e3a39974 53 /* Heap 1/4 of ram and stack 1/8 */
Kojto 124:2241e3a39974 54 __stack_size__ = 0x8000;
Kojto 124:2241e3a39974 55 __heap_size__ = 0x10000;
Kojto 124:2241e3a39974 56
Kojto 124:2241e3a39974 57 HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0400;
Kojto 124:2241e3a39974 58 STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
Kojto 124:2241e3a39974 59 M_VECTOR_RAM_SIZE = DEFINED(__ram_vector_table__) ? 0x0400 : 0x0;
Kojto 124:2241e3a39974 60
Kojto 124:2241e3a39974 61 /* Specify the memory areas */
Kojto 124:2241e3a39974 62 MEMORY
Kojto 124:2241e3a39974 63 {
Kojto 124:2241e3a39974 64 m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
Kojto 124:2241e3a39974 65 m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
Kojto 124:2241e3a39974 66 m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x001FFBF0
Kojto 124:2241e3a39974 67 m_data (RW) : ORIGIN = 0x1FFF0000, LENGTH = 0x00010000
Kojto 124:2241e3a39974 68 m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00030000
Kojto 124:2241e3a39974 69 }
Kojto 124:2241e3a39974 70
Kojto 124:2241e3a39974 71 /* Define output sections */
Kojto 124:2241e3a39974 72 SECTIONS
Kojto 124:2241e3a39974 73 {
Kojto 124:2241e3a39974 74 /* The startup code goes first into internal flash */
Kojto 124:2241e3a39974 75 .interrupts :
Kojto 124:2241e3a39974 76 {
Kojto 124:2241e3a39974 77 __VECTOR_TABLE = .;
Kojto 124:2241e3a39974 78 . = ALIGN(4);
Kojto 124:2241e3a39974 79 KEEP(*(.isr_vector)) /* Startup code */
Kojto 124:2241e3a39974 80 . = ALIGN(4);
Kojto 124:2241e3a39974 81 } > m_interrupts
Kojto 124:2241e3a39974 82
Kojto 124:2241e3a39974 83 .flash_config :
Kojto 124:2241e3a39974 84 {
Kojto 124:2241e3a39974 85 . = ALIGN(4);
Kojto 124:2241e3a39974 86 KEEP(*(.FlashConfig)) /* Flash Configuration Field (FCF) */
Kojto 124:2241e3a39974 87 . = ALIGN(4);
Kojto 124:2241e3a39974 88 } > m_flash_config
Kojto 124:2241e3a39974 89
Kojto 124:2241e3a39974 90 /* The program code and other data goes into internal flash */
Kojto 124:2241e3a39974 91 .text :
Kojto 124:2241e3a39974 92 {
Kojto 124:2241e3a39974 93 . = ALIGN(4);
Kojto 124:2241e3a39974 94 *(.text) /* .text sections (code) */
Kojto 124:2241e3a39974 95 *(.text*) /* .text* sections (code) */
Kojto 124:2241e3a39974 96 *(.rodata) /* .rodata sections (constants, strings, etc.) */
Kojto 124:2241e3a39974 97 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
Kojto 124:2241e3a39974 98 *(.glue_7) /* glue arm to thumb code */
Kojto 124:2241e3a39974 99 *(.glue_7t) /* glue thumb to arm code */
Kojto 124:2241e3a39974 100 *(.eh_frame)
Kojto 124:2241e3a39974 101 KEEP (*(.init))
Kojto 124:2241e3a39974 102 KEEP (*(.fini))
Kojto 124:2241e3a39974 103 . = ALIGN(4);
Kojto 124:2241e3a39974 104 } > m_text
Kojto 124:2241e3a39974 105
Kojto 124:2241e3a39974 106 .ARM.extab :
Kojto 124:2241e3a39974 107 {
Kojto 124:2241e3a39974 108 *(.ARM.extab* .gnu.linkonce.armextab.*)
Kojto 124:2241e3a39974 109 } > m_text
Kojto 124:2241e3a39974 110
Kojto 124:2241e3a39974 111 .ARM :
Kojto 124:2241e3a39974 112 {
Kojto 124:2241e3a39974 113 __exidx_start = .;
Kojto 124:2241e3a39974 114 *(.ARM.exidx*)
Kojto 124:2241e3a39974 115 __exidx_end = .;
Kojto 124:2241e3a39974 116 } > m_text
Kojto 124:2241e3a39974 117
Kojto 124:2241e3a39974 118 .ctors :
Kojto 124:2241e3a39974 119 {
Kojto 124:2241e3a39974 120 __CTOR_LIST__ = .;
Kojto 124:2241e3a39974 121 /* gcc uses crtbegin.o to find the start of
Kojto 124:2241e3a39974 122 the constructors, so we make sure it is
Kojto 124:2241e3a39974 123 first. Because this is a wildcard, it
Kojto 124:2241e3a39974 124 doesn't matter if the user does not
Kojto 124:2241e3a39974 125 actually link against crtbegin.o; the
Kojto 124:2241e3a39974 126 linker won't look for a file to match a
Kojto 124:2241e3a39974 127 wildcard. The wildcard also means that it
Kojto 124:2241e3a39974 128 doesn't matter which directory crtbegin.o
Kojto 124:2241e3a39974 129 is in. */
Kojto 124:2241e3a39974 130 KEEP (*crtbegin.o(.ctors))
Kojto 124:2241e3a39974 131 KEEP (*crtbegin?.o(.ctors))
Kojto 124:2241e3a39974 132 /* We don't want to include the .ctor section from
Kojto 124:2241e3a39974 133 from the crtend.o file until after the sorted ctors.
Kojto 124:2241e3a39974 134 The .ctor section from the crtend file contains the
Kojto 124:2241e3a39974 135 end of ctors marker and it must be last */
Kojto 124:2241e3a39974 136 KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
Kojto 124:2241e3a39974 137 KEEP (*(SORT(.ctors.*)))
Kojto 124:2241e3a39974 138 KEEP (*(.ctors))
Kojto 124:2241e3a39974 139 __CTOR_END__ = .;
Kojto 124:2241e3a39974 140 } > m_text
Kojto 124:2241e3a39974 141
Kojto 124:2241e3a39974 142 .dtors :
Kojto 124:2241e3a39974 143 {
Kojto 124:2241e3a39974 144 __DTOR_LIST__ = .;
Kojto 124:2241e3a39974 145 KEEP (*crtbegin.o(.dtors))
Kojto 124:2241e3a39974 146 KEEP (*crtbegin?.o(.dtors))
Kojto 124:2241e3a39974 147 KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
Kojto 124:2241e3a39974 148 KEEP (*(SORT(.dtors.*)))
Kojto 124:2241e3a39974 149 KEEP (*(.dtors))
Kojto 124:2241e3a39974 150 __DTOR_END__ = .;
Kojto 124:2241e3a39974 151 } > m_text
Kojto 124:2241e3a39974 152
Kojto 124:2241e3a39974 153 .preinit_array :
Kojto 124:2241e3a39974 154 {
Kojto 124:2241e3a39974 155 PROVIDE_HIDDEN (__preinit_array_start = .);
Kojto 124:2241e3a39974 156 KEEP (*(.preinit_array*))
Kojto 124:2241e3a39974 157 PROVIDE_HIDDEN (__preinit_array_end = .);
Kojto 124:2241e3a39974 158 } > m_text
Kojto 124:2241e3a39974 159
Kojto 124:2241e3a39974 160 .init_array :
Kojto 124:2241e3a39974 161 {
Kojto 124:2241e3a39974 162 PROVIDE_HIDDEN (__init_array_start = .);
Kojto 124:2241e3a39974 163 KEEP (*(SORT(.init_array.*)))
Kojto 124:2241e3a39974 164 KEEP (*(.init_array*))
Kojto 124:2241e3a39974 165 PROVIDE_HIDDEN (__init_array_end = .);
Kojto 124:2241e3a39974 166 } > m_text
Kojto 124:2241e3a39974 167
Kojto 124:2241e3a39974 168 .fini_array :
Kojto 124:2241e3a39974 169 {
Kojto 124:2241e3a39974 170 PROVIDE_HIDDEN (__fini_array_start = .);
Kojto 124:2241e3a39974 171 KEEP (*(SORT(.fini_array.*)))
Kojto 124:2241e3a39974 172 KEEP (*(.fini_array*))
Kojto 124:2241e3a39974 173 PROVIDE_HIDDEN (__fini_array_end = .);
Kojto 124:2241e3a39974 174 } > m_text
Kojto 124:2241e3a39974 175
Kojto 124:2241e3a39974 176 __etext = .; /* define a global symbol at end of code */
Kojto 124:2241e3a39974 177 __DATA_ROM = .; /* Symbol is used by startup for data initialization */
Kojto 124:2241e3a39974 178
Kojto 124:2241e3a39974 179 .interrupts_ram :
Kojto 124:2241e3a39974 180 {
Kojto 124:2241e3a39974 181 . = ALIGN(4);
Kojto 124:2241e3a39974 182 __VECTOR_RAM__ = .;
Kojto 124:2241e3a39974 183 __interrupts_ram_start__ = .; /* Create a global symbol at data start */
Kojto 124:2241e3a39974 184 *(.m_interrupts_ram) /* This is a user defined section */
Kojto 124:2241e3a39974 185 . += M_VECTOR_RAM_SIZE;
Kojto 124:2241e3a39974 186 . = ALIGN(4);
Kojto 124:2241e3a39974 187 __interrupts_ram_end__ = .; /* Define a global symbol at data end */
Kojto 124:2241e3a39974 188 } > m_data
Kojto 124:2241e3a39974 189
Kojto 124:2241e3a39974 190 __VECTOR_RAM = DEFINED(__ram_vector_table__) ? __VECTOR_RAM__ : ORIGIN(m_interrupts);
Kojto 124:2241e3a39974 191 __RAM_VECTOR_TABLE_SIZE_BYTES = DEFINED(__ram_vector_table__) ? (__interrupts_ram_end__ - __interrupts_ram_start__) : 0x0;
Kojto 124:2241e3a39974 192
Kojto 124:2241e3a39974 193 .data : AT(__DATA_ROM)
Kojto 124:2241e3a39974 194 {
Kojto 124:2241e3a39974 195 . = ALIGN(4);
Kojto 124:2241e3a39974 196 __DATA_RAM = .;
Kojto 124:2241e3a39974 197 __data_start__ = .; /* create a global symbol at data start */
Kojto 124:2241e3a39974 198 *(.data) /* .data sections */
Kojto 124:2241e3a39974 199 *(.data*) /* .data* sections */
Kojto 124:2241e3a39974 200 KEEP(*(.jcr*))
Kojto 124:2241e3a39974 201 . = ALIGN(4);
Kojto 124:2241e3a39974 202 __data_end__ = .; /* define a global symbol at data end */
Kojto 124:2241e3a39974 203 } > m_data
Kojto 124:2241e3a39974 204
Kojto 124:2241e3a39974 205 __DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
Kojto 124:2241e3a39974 206 text_end = ORIGIN(m_text) + LENGTH(m_text);
Kojto 124:2241e3a39974 207 ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
Kojto 124:2241e3a39974 208
Kojto 124:2241e3a39974 209 USB_RAM_GAP = DEFINED(__usb_ram_size__) ? __usb_ram_size__ : 0x800;
Kojto 124:2241e3a39974 210 /* Uninitialized data section */
Kojto 124:2241e3a39974 211 .bss :
Kojto 124:2241e3a39974 212 {
Kojto 124:2241e3a39974 213 /* This is used by the startup in order to initialize the .bss section */
Kojto 124:2241e3a39974 214 . = ALIGN(4);
Kojto 124:2241e3a39974 215 __START_BSS = .;
Kojto 124:2241e3a39974 216 __bss_start__ = .;
Kojto 124:2241e3a39974 217 *(.bss)
Kojto 124:2241e3a39974 218 *(.bss*)
Kojto 124:2241e3a39974 219 . = ALIGN(512);
Kojto 124:2241e3a39974 220 USB_RAM_START = .;
Kojto 124:2241e3a39974 221 . += USB_RAM_GAP;
Kojto 124:2241e3a39974 222 *(COMMON)
Kojto 124:2241e3a39974 223 . = ALIGN(4);
Kojto 124:2241e3a39974 224 __bss_end__ = .;
Kojto 124:2241e3a39974 225 __END_BSS = .;
Kojto 124:2241e3a39974 226 } > m_data
Kojto 124:2241e3a39974 227
Kojto 124:2241e3a39974 228 .heap :
Kojto 124:2241e3a39974 229 {
Kojto 124:2241e3a39974 230 . = ALIGN(8);
Kojto 124:2241e3a39974 231 __end__ = .;
Kojto 124:2241e3a39974 232 PROVIDE(end = .);
Kojto 124:2241e3a39974 233 __HeapBase = .;
Kojto 124:2241e3a39974 234 . += HEAP_SIZE;
Kojto 124:2241e3a39974 235 __HeapLimit = .;
Kojto 124:2241e3a39974 236 __heap_limit = .; /* Add for _sbrk */
Kojto 124:2241e3a39974 237 } > m_data_2
Kojto 124:2241e3a39974 238
Kojto 124:2241e3a39974 239 .stack :
Kojto 124:2241e3a39974 240 {
Kojto 124:2241e3a39974 241 . = ALIGN(8);
Kojto 124:2241e3a39974 242 . += STACK_SIZE;
Kojto 124:2241e3a39974 243 } > m_data_2
Kojto 124:2241e3a39974 244
Kojto 124:2241e3a39974 245 m_usb_bdt USB_RAM_START (NOLOAD) :
Kojto 124:2241e3a39974 246 {
Kojto 124:2241e3a39974 247 *(m_usb_bdt)
Kojto 124:2241e3a39974 248 USB_RAM_BDT_END = .;
Kojto 124:2241e3a39974 249 }
Kojto 124:2241e3a39974 250
Kojto 124:2241e3a39974 251 m_usb_global USB_RAM_BDT_END (NOLOAD) :
Kojto 124:2241e3a39974 252 {
Kojto 124:2241e3a39974 253 *(m_usb_global)
Kojto 124:2241e3a39974 254 }
Kojto 124:2241e3a39974 255
Kojto 124:2241e3a39974 256 /* Initializes stack on the end of block */
Kojto 124:2241e3a39974 257 __StackTop = ORIGIN(m_data_2) + LENGTH(m_data_2);
Kojto 124:2241e3a39974 258 __StackLimit = __StackTop - STACK_SIZE;
Kojto 124:2241e3a39974 259 PROVIDE(__stack = __StackTop);
Kojto 124:2241e3a39974 260
Kojto 124:2241e3a39974 261 .ARM.attributes 0 : { *(.ARM.attributes) }
Kojto 124:2241e3a39974 262
Kojto 124:2241e3a39974 263 ASSERT(__StackLimit >= __HeapLimit, "region m_data_2 overflowed with stack and heap")
Kojto 124:2241e3a39974 264 }
Kojto 124:2241e3a39974 265