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:
156:ff21514d8981
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 ** Processors: MKL82Z128VLH7
AnnaBridge 156:ff21514d8981 4 ** MKL82Z128VLK7
AnnaBridge 156:ff21514d8981 5 ** MKL82Z128VLL7
AnnaBridge 156:ff21514d8981 6 ** MKL82Z128VMC7
AnnaBridge 156:ff21514d8981 7 ** MKL82Z128VMP7
AnnaBridge 156:ff21514d8981 8 **
AnnaBridge 156:ff21514d8981 9 ** Compiler: IAR ANSI C/C++ Compiler for ARM
AnnaBridge 156:ff21514d8981 10 ** Reference manual: KL82P121M72SF0RM, Rev.2 November 2015
AnnaBridge 156:ff21514d8981 11 ** Version: rev. 1.5, 2015-09-24
AnnaBridge 156:ff21514d8981 12 ** Build: b160406
AnnaBridge 156:ff21514d8981 13 **
AnnaBridge 156:ff21514d8981 14 ** Abstract:
AnnaBridge 156:ff21514d8981 15 ** Linker file for the IAR ANSI C/C++ Compiler for ARM
AnnaBridge 156:ff21514d8981 16 **
AnnaBridge 156:ff21514d8981 17 ** Copyright (c) 2016 Freescale Semiconductor, Inc.
AnnaBridge 156:ff21514d8981 18 ** All rights reserved.
AnnaBridge 156:ff21514d8981 19 **
AnnaBridge 156:ff21514d8981 20 ** Redistribution and use in source and binary forms, with or without modification,
AnnaBridge 156:ff21514d8981 21 ** are permitted provided that the following conditions are met:
AnnaBridge 156:ff21514d8981 22 **
AnnaBridge 156:ff21514d8981 23 ** o Redistributions of source code must retain the above copyright notice, this list
AnnaBridge 156:ff21514d8981 24 ** of conditions and the following disclaimer.
AnnaBridge 156:ff21514d8981 25 **
AnnaBridge 156:ff21514d8981 26 ** o Redistributions in binary form must reproduce the above copyright notice, this
AnnaBridge 156:ff21514d8981 27 ** list of conditions and the following disclaimer in the documentation and/or
AnnaBridge 156:ff21514d8981 28 ** other materials provided with the distribution.
AnnaBridge 156:ff21514d8981 29 **
AnnaBridge 156:ff21514d8981 30 ** o Neither the name of Freescale Semiconductor, Inc. nor the names of its
AnnaBridge 156:ff21514d8981 31 ** contributors may be used to endorse or promote products derived from this
AnnaBridge 156:ff21514d8981 32 ** software without specific prior written permission.
AnnaBridge 156:ff21514d8981 33 **
AnnaBridge 156:ff21514d8981 34 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
AnnaBridge 156:ff21514d8981 35 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
AnnaBridge 156:ff21514d8981 36 ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AnnaBridge 156:ff21514d8981 37 ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
AnnaBridge 156:ff21514d8981 38 ** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
AnnaBridge 156:ff21514d8981 39 ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
AnnaBridge 156:ff21514d8981 40 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
AnnaBridge 156:ff21514d8981 41 ** ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
AnnaBridge 156:ff21514d8981 42 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
AnnaBridge 156:ff21514d8981 43 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AnnaBridge 156:ff21514d8981 44 **
AnnaBridge 156:ff21514d8981 45 ** http: www.freescale.com
AnnaBridge 156:ff21514d8981 46 ** mail: support@freescale.com
AnnaBridge 156:ff21514d8981 47 **
AnnaBridge 156:ff21514d8981 48 ** ###################################################################
AnnaBridge 156:ff21514d8981 49 */
AnnaBridge 156:ff21514d8981 50 define symbol __ram_vector_table__ = 1;
AnnaBridge 156:ff21514d8981 51
AnnaBridge 156:ff21514d8981 52 /* Heap 1/4 of ram and stack 1/8 */
AnnaBridge 156:ff21514d8981 53 define symbol __stack_size__=0x3000;
AnnaBridge 156:ff21514d8981 54 define symbol __heap_size__=0x6000;
AnnaBridge 156:ff21514d8981 55
AnnaBridge 156:ff21514d8981 56 define symbol __ram_vector_table_size__ = isdefinedsymbol(__ram_vector_table__) ? 0x00000140 : 0;
AnnaBridge 156:ff21514d8981 57 define symbol __ram_vector_table_offset__ = isdefinedsymbol(__ram_vector_table__) ? 0x0000013F : 0;
AnnaBridge 156:ff21514d8981 58
AnnaBridge 156:ff21514d8981 59 define symbol m_interrupts_start = 0x00000000;
AnnaBridge 156:ff21514d8981 60 define symbol m_interrupts_end = 0x0000013F;
AnnaBridge 156:ff21514d8981 61
AnnaBridge 156:ff21514d8981 62 define symbol m_bootloader_config_start = 0x000003C0;
AnnaBridge 156:ff21514d8981 63 define symbol m_bootloader_config_end = 0x000003FF;
AnnaBridge 156:ff21514d8981 64
AnnaBridge 156:ff21514d8981 65 define symbol m_flash_config_start = 0x00000400;
AnnaBridge 156:ff21514d8981 66 define symbol m_flash_config_end = 0x0000040F;
AnnaBridge 156:ff21514d8981 67
AnnaBridge 156:ff21514d8981 68 define symbol m_text_start = 0x00000410;
AnnaBridge 156:ff21514d8981 69 define symbol m_text_end = 0x0001FFFF;
AnnaBridge 156:ff21514d8981 70
AnnaBridge 156:ff21514d8981 71 define symbol m_interrupts_ram_start = 0x1FFFA000;
AnnaBridge 156:ff21514d8981 72 define symbol m_interrupts_ram_end = 0x1FFFA000 + __ram_vector_table_offset__;
AnnaBridge 156:ff21514d8981 73
AnnaBridge 156:ff21514d8981 74 define symbol m_data_start = m_interrupts_ram_start + __ram_vector_table_size__;
AnnaBridge 156:ff21514d8981 75 define symbol m_data_end = 0x20011FFF;
AnnaBridge 156:ff21514d8981 76
AnnaBridge 156:ff21514d8981 77 if (isdefinedsymbol(__usb_use_usbram__)) {
AnnaBridge 156:ff21514d8981 78 define symbol m_usb_sram_start = 0x40100000;
AnnaBridge 156:ff21514d8981 79 define symbol m_usb_sram_end = 0x401007FF;
AnnaBridge 156:ff21514d8981 80 }
AnnaBridge 156:ff21514d8981 81
AnnaBridge 156:ff21514d8981 82 /* USB BDT size */
AnnaBridge 156:ff21514d8981 83 define symbol usb_bdt_size = 0x200;
AnnaBridge 156:ff21514d8981 84 /* Sizes */
AnnaBridge 156:ff21514d8981 85 if (isdefinedsymbol(__stack_size__)) {
AnnaBridge 156:ff21514d8981 86 define symbol __size_cstack__ = __stack_size__;
AnnaBridge 156:ff21514d8981 87 } else {
AnnaBridge 156:ff21514d8981 88 define symbol __size_cstack__ = 0x0400;
AnnaBridge 156:ff21514d8981 89 }
AnnaBridge 156:ff21514d8981 90
AnnaBridge 156:ff21514d8981 91 if (isdefinedsymbol(__heap_size__)) {
AnnaBridge 156:ff21514d8981 92 define symbol __size_heap__ = __heap_size__;
AnnaBridge 156:ff21514d8981 93 } else {
AnnaBridge 156:ff21514d8981 94 define symbol __size_heap__ = 0x0400;
AnnaBridge 156:ff21514d8981 95 }
AnnaBridge 156:ff21514d8981 96
AnnaBridge 156:ff21514d8981 97 define exported symbol __VECTOR_TABLE = m_interrupts_start;
AnnaBridge 156:ff21514d8981 98 define exported symbol __VECTOR_RAM = isdefinedsymbol(__ram_vector_table__) ? m_interrupts_ram_start : m_interrupts_start;
AnnaBridge 156:ff21514d8981 99 define exported symbol __RAM_VECTOR_TABLE_SIZE = __ram_vector_table_size__;
AnnaBridge 156:ff21514d8981 100
AnnaBridge 156:ff21514d8981 101 define memory mem with size = 4G;
AnnaBridge 156:ff21514d8981 102 define region m_bootloader_config_region = mem:[from m_bootloader_config_start to m_bootloader_config_end];
AnnaBridge 156:ff21514d8981 103 define region m_flash_config_region = mem:[from m_flash_config_start to m_flash_config_end];
AnnaBridge 156:ff21514d8981 104 define region TEXT_region = mem:[from m_interrupts_start to m_interrupts_end]
AnnaBridge 156:ff21514d8981 105 | mem:[from m_text_start to m_text_end];
AnnaBridge 156:ff21514d8981 106 define region DATA_region = mem:[from m_data_start to m_data_end-__size_cstack__];
AnnaBridge 156:ff21514d8981 107 define region CSTACK_region = mem:[from m_data_end-__size_cstack__+1 to m_data_end];
AnnaBridge 156:ff21514d8981 108 define region m_interrupts_ram_region = mem:[from m_interrupts_ram_start to m_interrupts_ram_end];
AnnaBridge 156:ff21514d8981 109
AnnaBridge 156:ff21514d8981 110 define block CSTACK with alignment = 8, size = __size_cstack__ { };
AnnaBridge 156:ff21514d8981 111 define block HEAP with alignment = 8, size = __size_heap__ { };
AnnaBridge 156:ff21514d8981 112 define block RW { readwrite };
AnnaBridge 156:ff21514d8981 113 define block ZI { zi };
AnnaBridge 156:ff21514d8981 114
AnnaBridge 156:ff21514d8981 115 /* regions for USB */
AnnaBridge 156:ff21514d8981 116 if (isdefinedsymbol(__usb_use_usbram__)) {
AnnaBridge 156:ff21514d8981 117 define region USB_BDT_region = mem:[from m_usb_sram_start to m_usb_sram_start + usb_bdt_size - 1];
AnnaBridge 156:ff21514d8981 118 define region USB_SRAM_region = mem:[from m_usb_sram_start + usb_bdt_size to m_usb_sram_end];
AnnaBridge 156:ff21514d8981 119 place in USB_BDT_region { section m_usb_bdt };
AnnaBridge 156:ff21514d8981 120 place in USB_SRAM_region { section m_usb_global };
AnnaBridge 156:ff21514d8981 121 }
AnnaBridge 156:ff21514d8981 122
AnnaBridge 156:ff21514d8981 123 initialize by copy { readwrite, section .textrw };
AnnaBridge 156:ff21514d8981 124 if (isdefinedsymbol(__usb_use_usbram__)) {
AnnaBridge 156:ff21514d8981 125 do not initialize { section .noinit, section m_usb_bdt, section m_usb_global };
AnnaBridge 156:ff21514d8981 126 } else {
AnnaBridge 156:ff21514d8981 127 do not initialize { section .noinit };
AnnaBridge 156:ff21514d8981 128 }
AnnaBridge 156:ff21514d8981 129
AnnaBridge 156:ff21514d8981 130 place at address mem: m_interrupts_start { readonly section .intvec };
AnnaBridge 156:ff21514d8981 131 place in m_bootloader_config_region { section BootloaderConfig };
AnnaBridge 156:ff21514d8981 132 place in m_flash_config_region { section FlashConfig };
AnnaBridge 156:ff21514d8981 133 place in TEXT_region { readonly };
AnnaBridge 156:ff21514d8981 134 place in DATA_region { block RW };
AnnaBridge 156:ff21514d8981 135 place in DATA_region { block ZI };
AnnaBridge 156:ff21514d8981 136 place in DATA_region { last block HEAP };
AnnaBridge 156:ff21514d8981 137 place in CSTACK_region { block CSTACK };
AnnaBridge 156:ff21514d8981 138 place in m_interrupts_ram_region { section m_interrupts_ram };
AnnaBridge 156:ff21514d8981 139