STM32F3DISCOVERY - Updating L3GD20 alignment defaults. (MJ666)
[betaflight.git] / src / main / target / stm32_flash_f303_256k.ld
blobc231937c1b8e1aff854ec2bd07f0474ce5382839
1 /*
2 *****************************************************************************
3 **
4 **  File        : stm32_flash.ld
5 **
6 **  Abstract    : Linker script for STM32F30x Device with
7 **                256KByte FLASH and 40KByte RAM
8 **
9 *****************************************************************************
12 /* Entry Point */
13 ENTRY(Reset_Handler)
15 /* Highest address of the user mode stack */
16 _estack = 0x2000A000;    /* end of 40K RAM */
18 /* Generate a link error if heap and stack don't fit into RAM */
19 _Min_Heap_Size = 0;      /* required amount of heap  */
20 _Min_Stack_Size = 0x400; /* required amount of stack */
22 /* Specify the memory areas */
23 MEMORY
25   FLASH  (rx)     : ORIGIN = 0x08000000, LENGTH = 254K /* last 2kb used for config storage */
26   RAM    (xrw)    : ORIGIN = 0x20000000, LENGTH = 40K
27   MEMORY_B1 (rx)  : ORIGIN = 0x60000000, LENGTH = 0K
30 /* Define output sections */
31 SECTIONS
33   /* The startup code goes first into FLASH */
34   .isr_vector :
35   {
36     . = ALIGN(4);
37     KEEP(*(.isr_vector)) /* Startup code */
38     . = ALIGN(4);
39   } >FLASH
41   /* The program code and other data goes into FLASH */
42   .text :
43   {
44     . = ALIGN(4);
45     *(.text)           /* .text sections (code) */
46     *(.text*)          /* .text* sections (code) */
47     *(.rodata)         /* .rodata sections (constants, strings, etc.) */
48     *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
49     *(.glue_7)         /* glue arm to thumb code */
50     *(.glue_7t)        /* glue thumb to arm code */
51     *(.eh_frame)
53     KEEP (*(.init))
54     KEEP (*(.fini))
56     . = ALIGN(4);
57     _etext = .;        /* define a global symbols at end of code */
58   } >FLASH
61    .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
62     .ARM : {
63     __exidx_start = .;
64       *(.ARM.exidx*)
65       __exidx_end = .;
66     } >FLASH
68   .preinit_array     :
69   {
70     PROVIDE_HIDDEN (__preinit_array_start = .);
71     KEEP (*(.preinit_array*))
72     PROVIDE_HIDDEN (__preinit_array_end = .);
73   } >FLASH
74   .init_array :
75   {
76     PROVIDE_HIDDEN (__init_array_start = .);
77     KEEP (*(SORT(.init_array.*)))
78     KEEP (*(.init_array*))
79     PROVIDE_HIDDEN (__init_array_end = .);
80   } >FLASH
81   .fini_array :
82   {
83     PROVIDE_HIDDEN (__fini_array_start = .);
84     KEEP (*(.fini_array*))
85     KEEP (*(SORT(.fini_array.*)))
86     PROVIDE_HIDDEN (__fini_array_end = .);
87   } >FLASH
89   /* used by the startup to initialize data */
90   _sidata = .;
92   /* Initialized data sections goes into RAM, load LMA copy after code */
93   .data : 
94   {
95     . = ALIGN(4);
96     _sdata = .;        /* create a global symbol at data start */
97     *(.data)           /* .data sections */
98     *(.data*)          /* .data* sections */
100     . = ALIGN(4);
101     _edata = .;        /* define a global symbol at data end */
102   } >RAM AT> FLASH
104   /* Uninitialized data section */
105   . = ALIGN(4);
106   .bss :
107   {
108     /* This is used by the startup in order to initialize the .bss secion */
109     _sbss = .;         /* define a global symbol at bss start */
110     __bss_start__ = _sbss;
111     *(.bss)
112     *(.bss*)
113     *(COMMON)
115     . = ALIGN(4);
116     _ebss = .;         /* define a global symbol at bss end */
117     __bss_end__ = _ebss;
118   } >RAM
120   /* User_heap_stack section, used to check that there is enough RAM left */
121   ._user_heap_stack :
122   {
123     . = ALIGN(4);
124     PROVIDE ( end = . );
125     PROVIDE ( _end = . );
126     . = . + _Min_Heap_Size;
127     . = . + _Min_Stack_Size;
128     . = ALIGN(4);
129   } >RAM
131   /* MEMORY_bank1 section, code must be located here explicitly            */
132   /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
133   .memory_b1_text :
134   {
135     *(.mb1text)        /* .mb1text sections (code) */
136     *(.mb1text*)       /* .mb1text* sections (code)  */
137     *(.mb1rodata)      /* read-only data (constants) */
138     *(.mb1rodata*)
139   } >MEMORY_B1
141   /* Remove information from the standard libraries */
142   /DISCARD/ :
143   {
144     libc.a ( * )
145     libm.a ( * )
146     libgcc.a ( * )
147   }
149   .ARM.attributes 0 : { *(.ARM.attributes) }