F1 and F3 HAL / LL libraries
[betaflight.git] / lib / main / STM32F1 / Drivers / CMSIS / Device / ST / STM32F1xx / Source / Templates / gcc / linker / STM32F101X6_FLASH.ld
blob7f957b91757988b5f97b6573f73be771c3ce2a64
1 /*
2 *****************************************************************************
3 **
4 **  File        : STM32F101X6_FLASH.ld
5 **
6 **  Abstract    : Linker script for STM32F101x6 Device with
7 **                32KByte FLASH, 6KByte RAM
8 **
9 **                Set heap size, stack size and stack location according
10 **                to application requirements.
12 **                Set memory bank area and size if external memory is used.
14 **  Target      : STMicroelectronics STM32
16 **  Environment : Atollic TrueSTUDIO(R)
18 **  Distribution: The file is distributed “as is,” without any warranty
19 **                of any kind.
21 **  (c)Copyright Atollic AB.
22 **  You may use this file as-is or modify it according to the needs of your
23 **  project. This file may only be built (assembled or compiled and linked)
24 **  using the Atollic TrueSTUDIO(R) product. The use of this file together
25 **  with other tools than Atollic TrueSTUDIO(R) is not permitted.
27 *****************************************************************************
30 /* Entry Point */
31 ENTRY(Reset_Handler)
33 /* Highest address of the user mode stack */
34 _estack = 0x200017FF;    /* end of RAM */
36 /* Generate a link error if heap and stack don't fit into RAM */
37 _Min_Heap_Size = 0x200;      /* required amount of heap  */
38 _Min_Stack_Size = 0x400; /* required amount of stack */
40 /* Specify the memory areas */
41 MEMORY
43 FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 32K
44 RAM (xrw)       : ORIGIN = 0x20000000, LENGTH = 6K
47 /* Define output sections */
48 SECTIONS
50   /* The startup code goes first into FLASH */
51   .isr_vector :
52   {
53     . = ALIGN(4);
54     KEEP(*(.isr_vector)) /* Startup code */
55     . = ALIGN(4);
56   } >FLASH
58   /* The program code and other data goes into FLASH */
59   .text :
60   {
61     . = ALIGN(4);
62     *(.text)           /* .text sections (code) */
63     *(.text*)          /* .text* sections (code) */
64     *(.glue_7)         /* glue arm to thumb code */
65     *(.glue_7t)        /* glue thumb to arm code */
66     *(.eh_frame)
68     KEEP (*(.init))
69     KEEP (*(.fini))
71     . = ALIGN(4);
72     _etext = .;        /* define a global symbols at end of code */
73   } >FLASH
75   /* Constant data goes into FLASH */
76   .rodata :
77   {
78     . = ALIGN(4);
79     *(.rodata)         /* .rodata sections (constants, strings, etc.) */
80     *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
81     . = ALIGN(4);
82   } >FLASH
84   .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
85   .ARM : {
86     __exidx_start = .;
87     *(.ARM.exidx*)
88     __exidx_end = .;
89   } >FLASH
91   .preinit_array     :
92   {
93     PROVIDE_HIDDEN (__preinit_array_start = .);
94     KEEP (*(.preinit_array*))
95     PROVIDE_HIDDEN (__preinit_array_end = .);
96   } >FLASH
97   .init_array :
98   {
99     PROVIDE_HIDDEN (__init_array_start = .);
100     KEEP (*(SORT(.init_array.*)))
101     KEEP (*(.init_array*))
102     PROVIDE_HIDDEN (__init_array_end = .);
103   } >FLASH
104   .fini_array :
105   {
106     PROVIDE_HIDDEN (__fini_array_start = .);
107     KEEP (*(SORT(.fini_array.*)))
108     KEEP (*(.fini_array*))
109     PROVIDE_HIDDEN (__fini_array_end = .);
110   } >FLASH
112   /* used by the startup to initialize data */
113   _sidata = LOADADDR(.data);
115   /* Initialized data sections goes into RAM, load LMA copy after code */
116   .data : 
117   {
118     . = ALIGN(4);
119     _sdata = .;        /* create a global symbol at data start */
120     *(.data)           /* .data sections */
121     *(.data*)          /* .data* sections */
123     . = ALIGN(4);
124     _edata = .;        /* define a global symbol at data end */
125   } >RAM AT> FLASH
127   
128   /* Uninitialized data section */
129   . = ALIGN(4);
130   .bss :
131   {
132     /* This is used by the startup in order to initialize the .bss secion */
133     _sbss = .;         /* define a global symbol at bss start */
134     __bss_start__ = _sbss;
135     *(.bss)
136     *(.bss*)
137     *(COMMON)
139     . = ALIGN(4);
140     _ebss = .;         /* define a global symbol at bss end */
141     __bss_end__ = _ebss;
142   } >RAM
144   /* User_heap_stack section, used to check that there is enough RAM left */
145   ._user_heap_stack :
146   {
147     . = ALIGN(4);
148     PROVIDE ( end = . );
149     PROVIDE ( _end = . );
150     . = . + _Min_Heap_Size;
151     . = . + _Min_Stack_Size;
152     . = ALIGN(4);
153   } >RAM
155   
157   /* Remove information from the standard libraries */
158   /DISCARD/ :
159   {
160     libc.a ( * )
161     libm.a ( * )
162     libgcc.a ( * )
163   }
165   .ARM.attributes 0 : { *(.ARM.attributes) }