Add extra delays when cold-booting the UAV (#517)
[betaflight.git] / src / main / target / stm32_flash_f411.ld
bloba3d834a188f5ea7918d713cdb9851f84213028a4
1 /*
2 *****************************************************************************
3 **
4 **  File        : stm32_flash.ld
5 **
6 **  Abstract    : Linker script for STM32F11 Device with
7 **                512KByte FLASH, 128KByte 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. Distribution of this file (unmodified or modified) is not
24 **  permitted. Atollic AB permit registered Atollic TrueSTUDIO(R) users the
25 **  rights to distribute the assembled, compiled & linked contents of this
26 **  file as part of an application binary file, provided that it is built
27 **  using the Atollic TrueSTUDIO(R) toolchain.
29 *****************************************************************************
32 /* Entry Point */
33 ENTRY(Reset_Handler)
35 /* Generate a link error if heap and stack don't fit into RAM */
36 _Min_Heap_Size = 0x2000;      /* required amount of heap  */
37 _Min_Stack_Size = 0x4000; /* required amount of stack */
39 /* Specify the memory areas */
42 0x08000000 to 0x08080000 512kb full flash,
43 0x08000000 to 0x08060000 384kb firmware,
44 0x08060000 to 0x08080000 128kb config,
47 MEMORY
49         FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 0x00080000 
50         RAM (rwx)       : ORIGIN = 0x20000000, LENGTH = 0x00020000
51         MEMORY_B1 (rx)  : ORIGIN = 0x60000000, LENGTH = 0K
54 REGION_ALIAS("CCSRAM", RAM);
55 REGION_ALIAS("SRAM", RAM);
58 /* Section Definitions */
59 SECTIONS
61   /* The program code and other data goes into FLASH */
62   .text :
63   {
64     PROVIDE (isr_vector_table_base = .);
65     KEEP(*(.isr_vector)) /* Startup code */
66     . = ALIGN(4);
67     *(.text)           /* .text sections (code) */
68     *(.text*)          /* .text* sections (code) */
69     *(.rodata)         /* .rodata sections (constants, strings, etc.) */
70     *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
71     *(.glue_7)         /* glue arm to thumb code */
72     *(.glue_7t)        /* glue thumb to arm code */
73     *(.eh_frame)
75     KEEP (*(.init))
76     KEEP (*(.fini))
78     . = ALIGN(4);
79     _etext = .;        /* define a global symbols at end of code */
80   } >FLASH
83    .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
84     .ARM : {
85     __exidx_start = .;
86       *(.ARM.exidx*)
87       __exidx_end = .;
88     } >FLASH
90   .preinit_array     :
91   {
92     PROVIDE_HIDDEN (__preinit_array_start = .);
93     KEEP (*(.preinit_array*))
94     PROVIDE_HIDDEN (__preinit_array_end = .);
95   } >FLASH
96   .init_array :
97   {
98     PROVIDE_HIDDEN (__init_array_start = .);
99     KEEP (*(SORT(.init_array.*)))
100     KEEP (*(.init_array*))
101     PROVIDE_HIDDEN (__init_array_end = .);
102   } >FLASH
103   .fini_array :
104   {
105     PROVIDE_HIDDEN (__fini_array_start = .);
106     KEEP (*(.fini_array*))
107     KEEP (*(SORT(.fini_array.*)))
108     PROVIDE_HIDDEN (__fini_array_end = .);
109   } >FLASH
112   /* used by the startup to initialize data */
113   _sidata = .;
115   /*
116    * Place the IRQ/bootstrap stack at the bottom of SRAM so that an overflow
117    * results in a hard fault.
118    */
119   .istack (NOLOAD) :
120   {
121     . = ALIGN(4);
122     _irq_stack_end = . ;
123     *(.irqstack)
124     _irq_stack_top = . ;
125   } > RAM
127   /* Initialized data sections goes into RAM, load LMA copy after code */
128   .data : 
129   {
130     . = ALIGN(4);
131     _sdata = .;        /* create a global symbol at data start */
132     *(.data)           /* .data sections */
133     *(.data*)          /* .data* sections */
135     . = ALIGN(4);
136     _edata = .;        /* define a global symbol at data end */
137   } >RAM AT> FLASH
139   /* Uninitialized data section */
140   . = ALIGN(4);
141   .bss :
142   {
143     /* This is used by the startup in order to initialize the .bss secion */
144     _sbss = .;         /* define a global symbol at bss start */
145     __bss_start__ = _sbss;
146     *(.bss)
147     *(.bss*)
148     *(COMMON)
150     . = ALIGN(4);
151     _ebss = .;         /* define a global symbol at bss end */
152     __bss_end__ = _ebss;
153   } >RAM
155   /* User_heap_stack section, used to check that there is enough RAM left */
156   ._user_heap_stack :
157   {
158     . = ALIGN(4);
159     PROVIDE ( end = . );
160     PROVIDE ( _end = . );
161     . = . + _Min_Heap_Size;
162     . = . + _Min_Stack_Size;
163     . = ALIGN(4);
164   } >RAM
166   /* MEMORY_bank1 section, code must be located here explicitly            */
167   /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
168   .memory_b1_text :
169   {
170     *(.mb1text)        /* .mb1text sections (code) */
171     *(.mb1text*)       /* .mb1text* sections (code)  */
172     *(.mb1rodata)      /* read-only data (constants) */
173     *(.mb1rodata*)
174   } >MEMORY_B1
176   /* Remove information from the standard libraries */
177   /DISCARD/ :
178   {
179     libc.a ( * )
180     libm.a ( * )
181     libgcc.a ( * )
182   }
184   .ARM.attributes 0 : { *(.ARM.attributes) }