1*e8380792SMatthias Ringwald/* 2*e8380792SMatthias Ringwald****************************************************************************** 3*e8380792SMatthias Ringwald** 4*e8380792SMatthias Ringwald 5*e8380792SMatthias Ringwald** File : LinkerScript.ld 6*e8380792SMatthias Ringwald** 7*e8380792SMatthias Ringwald** Author : Auto-generated by Ac6 System Workbench 8*e8380792SMatthias Ringwald** 9*e8380792SMatthias Ringwald** Abstract : Linker script for STM32L073RZTx series 10*e8380792SMatthias Ringwald** 192Kbytes FLASH and 20Kbytes RAM 11*e8380792SMatthias Ringwald** 12*e8380792SMatthias Ringwald** Set heap size, stack size and stack location according 13*e8380792SMatthias Ringwald** to application requirements. 14*e8380792SMatthias Ringwald** 15*e8380792SMatthias Ringwald** Set memory bank area and size if external memory is used. 16*e8380792SMatthias Ringwald** 17*e8380792SMatthias Ringwald** Target : STMicroelectronics STM32 18*e8380792SMatthias Ringwald** 19*e8380792SMatthias Ringwald** Distribution: The file is distributed “as is,” without any warranty 20*e8380792SMatthias Ringwald** of any kind. 21*e8380792SMatthias Ringwald** 22*e8380792SMatthias Ringwald***************************************************************************** 23*e8380792SMatthias Ringwald** @attention 24*e8380792SMatthias Ringwald** 25*e8380792SMatthias Ringwald** <h2><center>© COPYRIGHT(c) 2014 Ac6</center></h2> 26*e8380792SMatthias Ringwald** 27*e8380792SMatthias Ringwald** Redistribution and use in source and binary forms, with or without modification, 28*e8380792SMatthias Ringwald** are permitted provided that the following conditions are met: 29*e8380792SMatthias Ringwald** 1. Redistributions of source code must retain the above copyright notice, 30*e8380792SMatthias Ringwald** this list of conditions and the following disclaimer. 31*e8380792SMatthias Ringwald** 2. Redistributions in binary form must reproduce the above copyright notice, 32*e8380792SMatthias Ringwald** this list of conditions and the following disclaimer in the documentation 33*e8380792SMatthias Ringwald** and/or other materials provided with the distribution. 34*e8380792SMatthias Ringwald** 3. Neither the name of Ac6 nor the names of its contributors 35*e8380792SMatthias Ringwald** may be used to endorse or promote products derived from this software 36*e8380792SMatthias Ringwald** without specific prior written permission. 37*e8380792SMatthias Ringwald** 38*e8380792SMatthias Ringwald** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 39*e8380792SMatthias Ringwald** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 40*e8380792SMatthias Ringwald** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 41*e8380792SMatthias Ringwald** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 42*e8380792SMatthias Ringwald** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 43*e8380792SMatthias Ringwald** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 44*e8380792SMatthias Ringwald** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 45*e8380792SMatthias Ringwald** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 46*e8380792SMatthias Ringwald** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 47*e8380792SMatthias Ringwald** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48*e8380792SMatthias Ringwald** 49*e8380792SMatthias Ringwald***************************************************************************** 50*e8380792SMatthias Ringwald*/ 51*e8380792SMatthias Ringwald 52*e8380792SMatthias Ringwald/* Entry Point */ 53*e8380792SMatthias RingwaldENTRY(Reset_Handler) 54*e8380792SMatthias Ringwald 55*e8380792SMatthias Ringwald/* Highest address of the user mode stack */ 56*e8380792SMatthias Ringwald_estack = 0x20005000; /* end of RAM */ 57*e8380792SMatthias Ringwald/* Generate a link error if heap and stack don't fit into RAM */ 58*e8380792SMatthias Ringwald_Min_Heap_Size = 0x200; /* required amount of heap */ 59*e8380792SMatthias Ringwald_Min_Stack_Size = 0x400; /* required amount of stack */ 60*e8380792SMatthias Ringwald 61*e8380792SMatthias Ringwald/* Specify the memory areas */ 62*e8380792SMatthias RingwaldMEMORY 63*e8380792SMatthias Ringwald{ 64*e8380792SMatthias RingwaldRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K 65*e8380792SMatthias RingwaldFLASH (rx) : ORIGIN = 0x8000000, LENGTH = 192K 66*e8380792SMatthias Ringwald} 67*e8380792SMatthias Ringwald 68*e8380792SMatthias Ringwald/* Define output sections */ 69*e8380792SMatthias RingwaldSECTIONS 70*e8380792SMatthias Ringwald{ 71*e8380792SMatthias Ringwald /* The startup code goes first into FLASH */ 72*e8380792SMatthias Ringwald .isr_vector : 73*e8380792SMatthias Ringwald { 74*e8380792SMatthias Ringwald . = ALIGN(4); 75*e8380792SMatthias Ringwald KEEP(*(.isr_vector)) /* Startup code */ 76*e8380792SMatthias Ringwald . = ALIGN(4); 77*e8380792SMatthias Ringwald } >FLASH 78*e8380792SMatthias Ringwald 79*e8380792SMatthias Ringwald /* The program code and other data goes into FLASH */ 80*e8380792SMatthias Ringwald .text : 81*e8380792SMatthias Ringwald { 82*e8380792SMatthias Ringwald . = ALIGN(4); 83*e8380792SMatthias Ringwald *(.text) /* .text sections (code) */ 84*e8380792SMatthias Ringwald *(.text*) /* .text* sections (code) */ 85*e8380792SMatthias Ringwald *(.glue_7) /* glue arm to thumb code */ 86*e8380792SMatthias Ringwald *(.glue_7t) /* glue thumb to arm code */ 87*e8380792SMatthias Ringwald *(.eh_frame) 88*e8380792SMatthias Ringwald 89*e8380792SMatthias Ringwald KEEP (*(.init)) 90*e8380792SMatthias Ringwald KEEP (*(.fini)) 91*e8380792SMatthias Ringwald 92*e8380792SMatthias Ringwald . = ALIGN(4); 93*e8380792SMatthias Ringwald _etext = .; /* define a global symbols at end of code */ 94*e8380792SMatthias Ringwald } >FLASH 95*e8380792SMatthias Ringwald 96*e8380792SMatthias Ringwald /* Constant data goes into FLASH */ 97*e8380792SMatthias Ringwald .rodata : 98*e8380792SMatthias Ringwald { 99*e8380792SMatthias Ringwald . = ALIGN(4); 100*e8380792SMatthias Ringwald *(.rodata) /* .rodata sections (constants, strings, etc.) */ 101*e8380792SMatthias Ringwald *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 102*e8380792SMatthias Ringwald . = ALIGN(4); 103*e8380792SMatthias Ringwald } >FLASH 104*e8380792SMatthias Ringwald 105*e8380792SMatthias Ringwald .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH 106*e8380792SMatthias Ringwald .ARM : { 107*e8380792SMatthias Ringwald __exidx_start = .; 108*e8380792SMatthias Ringwald *(.ARM.exidx*) 109*e8380792SMatthias Ringwald __exidx_end = .; 110*e8380792SMatthias Ringwald } >FLASH 111*e8380792SMatthias Ringwald 112*e8380792SMatthias Ringwald .preinit_array : 113*e8380792SMatthias Ringwald { 114*e8380792SMatthias Ringwald PROVIDE_HIDDEN (__preinit_array_start = .); 115*e8380792SMatthias Ringwald KEEP (*(.preinit_array*)) 116*e8380792SMatthias Ringwald PROVIDE_HIDDEN (__preinit_array_end = .); 117*e8380792SMatthias Ringwald } >FLASH 118*e8380792SMatthias Ringwald .init_array : 119*e8380792SMatthias Ringwald { 120*e8380792SMatthias Ringwald PROVIDE_HIDDEN (__init_array_start = .); 121*e8380792SMatthias Ringwald KEEP (*(SORT(.init_array.*))) 122*e8380792SMatthias Ringwald KEEP (*(.init_array*)) 123*e8380792SMatthias Ringwald PROVIDE_HIDDEN (__init_array_end = .); 124*e8380792SMatthias Ringwald } >FLASH 125*e8380792SMatthias Ringwald .fini_array : 126*e8380792SMatthias Ringwald { 127*e8380792SMatthias Ringwald PROVIDE_HIDDEN (__fini_array_start = .); 128*e8380792SMatthias Ringwald KEEP (*(SORT(.fini_array.*))) 129*e8380792SMatthias Ringwald KEEP (*(.fini_array*)) 130*e8380792SMatthias Ringwald PROVIDE_HIDDEN (__fini_array_end = .); 131*e8380792SMatthias Ringwald } >FLASH 132*e8380792SMatthias Ringwald 133*e8380792SMatthias Ringwald /* used by the startup to initialize data */ 134*e8380792SMatthias Ringwald _sidata = LOADADDR(.data); 135*e8380792SMatthias Ringwald 136*e8380792SMatthias Ringwald /* Initialized data sections goes into RAM, load LMA copy after code */ 137*e8380792SMatthias Ringwald .data : 138*e8380792SMatthias Ringwald { 139*e8380792SMatthias Ringwald . = ALIGN(4); 140*e8380792SMatthias Ringwald _sdata = .; /* create a global symbol at data start */ 141*e8380792SMatthias Ringwald *(.data) /* .data sections */ 142*e8380792SMatthias Ringwald *(.data*) /* .data* sections */ 143*e8380792SMatthias Ringwald 144*e8380792SMatthias Ringwald . = ALIGN(4); 145*e8380792SMatthias Ringwald _edata = .; /* define a global symbol at data end */ 146*e8380792SMatthias Ringwald } >RAM AT> FLASH 147*e8380792SMatthias Ringwald 148*e8380792SMatthias Ringwald 149*e8380792SMatthias Ringwald /* Uninitialized data section */ 150*e8380792SMatthias Ringwald . = ALIGN(4); 151*e8380792SMatthias Ringwald .bss : 152*e8380792SMatthias Ringwald { 153*e8380792SMatthias Ringwald /* This is used by the startup in order to initialize the .bss secion */ 154*e8380792SMatthias Ringwald _sbss = .; /* define a global symbol at bss start */ 155*e8380792SMatthias Ringwald __bss_start__ = _sbss; 156*e8380792SMatthias Ringwald *(.bss) 157*e8380792SMatthias Ringwald *(.bss*) 158*e8380792SMatthias Ringwald *(COMMON) 159*e8380792SMatthias Ringwald 160*e8380792SMatthias Ringwald . = ALIGN(4); 161*e8380792SMatthias Ringwald _ebss = .; /* define a global symbol at bss end */ 162*e8380792SMatthias Ringwald __bss_end__ = _ebss; 163*e8380792SMatthias Ringwald } >RAM 164*e8380792SMatthias Ringwald 165*e8380792SMatthias Ringwald /* User_heap_stack section, used to check that there is enough RAM left */ 166*e8380792SMatthias Ringwald ._user_heap_stack : 167*e8380792SMatthias Ringwald { 168*e8380792SMatthias Ringwald . = ALIGN(8); 169*e8380792SMatthias Ringwald PROVIDE ( end = . ); 170*e8380792SMatthias Ringwald PROVIDE ( _end = . ); 171*e8380792SMatthias Ringwald . = . + _Min_Heap_Size; 172*e8380792SMatthias Ringwald . = . + _Min_Stack_Size; 173*e8380792SMatthias Ringwald . = ALIGN(8); 174*e8380792SMatthias Ringwald } >RAM 175*e8380792SMatthias Ringwald 176*e8380792SMatthias Ringwald 177*e8380792SMatthias Ringwald 178*e8380792SMatthias Ringwald /* Remove information from the standard libraries */ 179*e8380792SMatthias Ringwald /DISCARD/ : 180*e8380792SMatthias Ringwald { 181*e8380792SMatthias Ringwald libc.a ( * ) 182*e8380792SMatthias Ringwald libm.a ( * ) 183*e8380792SMatthias Ringwald libgcc.a ( * ) 184*e8380792SMatthias Ringwald } 185*e8380792SMatthias Ringwald 186*e8380792SMatthias Ringwald .ARM.attributes 0 : { *(.ARM.attributes) } 187*e8380792SMatthias Ringwald} 188*e8380792SMatthias Ringwald 189*e8380792SMatthias Ringwald 190