ads1115 only

Fork of mbed by mbed official

Committer:
kaoshen
Date:
Tue Jan 17 23:27:32 2017 +0000
Revision:
135:fce8a9387ed1
Parent:
128:9bcdf88f62b0
333 ADS1115 ADC1

Who changed what in which revision?

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