Cosmetics
[opentx.git] / radio / src / targets / taranis / stm32_ramboot.ld
blob99c731be9bf2eda8b97d0bbb039539d13ccbece9
1 /*
2 *****************************************************************************
3 **
4 **  File        : stm32_flashboot.ld
5 **
6 **  Abstract    : Linker script for STM32F205 Device with
7 **                0.5MByte FLASH, 128KByte SRAM
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 *****************************************************************************
19 /* Entry Point */
20 ENTRY(Reset_Handler)
22 /* Highest address of the user mode stack */
23 _estack = 0x20020000;    /* end of 128K SRAM */
25 /* Generate a link error if heap and stack don't fit into RAM */
26 _Min_Heap_Size = 0;      /* required amount of heap  */
27 _Main_Stack_Size = 1024; /* required amount of stack for interrupt stack (Main stack) */
29 /* Main stack end */
30 _main_stack_start = _estack - _Main_Stack_Size;
32 /* Specify the memory areas */
33 MEMORY
35   FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 512K
36   RAM (xrw)       : ORIGIN = 0x20000000, LENGTH = 128K
37   MEMORY_B1 (rx)  : ORIGIN = 0x60000000, LENGTH = 0K
40 /* Define output sections */
41 SECTIONS
43   /* The startup code goes first into FLASH */
45   /* The program code and other data goes into FLASH */
46   .text :
47   {
48     . = ALIGN(4);
49     KEEP(*(.isr_vector)) /* Startup code */
50     KEEP(*(.version))
51     KEEP(*(.bootversiondata))
52     . = ALIGN(4);      /* Align the start of the text part */
53     *(.text)           /* .text sections (code) */
54     *(.text*)          /* .text* sections (code) */
55     *(.rodata)         /* .rodata sections (constants, strings, etc.) */
56     *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
57     *(.glue_7)         /* glue arm to thumb code */
58     *(.glue_7t)        /* glue thumb to arm code */
59         *(.eh_frame)
61     KEEP (*(.init))
62     KEEP (*(.fini))
64     . = ALIGN(4);
65     _etext = .;        /* define a global symbols at end of code */
66   } >FLASH
69    .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
70     .ARM : {
71     __exidx_start = .;
72       *(.ARM.exidx*)
73       __exidx_end = .;
74     } >FLASH
76   .preinit_array     :
77   {
78     PROVIDE_HIDDEN (__preinit_array_start = .);
79     KEEP (*(.preinit_array*))
80     PROVIDE_HIDDEN (__preinit_array_end = .);
81   } >FLASH
82   .init_array :
83   {
84     PROVIDE_HIDDEN (__init_array_start = .);
85     KEEP (*(SORT(.init_array.*)))
86     KEEP (*(.init_array*))
87     PROVIDE_HIDDEN (__init_array_end = .);
88   } >FLASH
89   .fini_array :
90   {
91     PROVIDE_HIDDEN (__fini_array_start = .);
92     KEEP (*(.fini_array*))
93     KEEP (*(SORT(.fini_array.*)))
94     PROVIDE_HIDDEN (__fini_array_end = .);
95   } >FLASH
97   /* used by the startup to initialize data */
98   _sidata = .;
100   /* Initialized data sections goes into RAM, load LMA copy after code */
101   .data : AT ( _sidata )
102   {
103     . = ALIGN(4);
104     _sdata = .;        /* create a global symbol at data start */
105     *(.data)           /* .data sections */
106     *(.data*)          /* .data* sections */
108     . = ALIGN(4);
109     _edata = .;        /* define a global symbol at data end */
110   } >RAM
112   /* Uninitialized data section */
113   . = ALIGN(4);
114   .bss :
115   {
116     /* This is used by the startup in order to initialize the .bss secion */
117     _sbss = .;         /* define a global symbol at bss start */
118     __bss_start__ = _sbss;
119     *(.bss)
120     *(.bss*)
121     *(COMMON)
123     . = ALIGN(4);
124     _ebss = .;         /* define a global symbol at bss end */
125     __bss_end__ = _ebss;
126   } >RAM
128   PROVIDE ( end = _ebss );
129   PROVIDE ( _end = _ebss );
131   /* User_heap_stack section, used to check that there is enough RAM left */
132   ._user_heap_stack :
133   {
134     . = ALIGN(4);
135     . = . + _Min_Heap_Size;
136     . = . + _Main_Stack_Size;
137     . = ALIGN(4);
138   } >RAM
140   /* MEMORY_bank1 section, code must be located here explicitly            */
141   /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
142   .memory_b1_text :
143   {
144     *(.mb1text)        /* .mb1text sections (code) */
145     *(.mb1text*)       /* .mb1text* sections (code)  */
146     *(.mb1rodata)      /* read-only data (constants) */
147     *(.mb1rodata*)
148   } >MEMORY_B1
150   /* Remove information from the standard libraries */
151   /DISCARD/ :
152   {
153     libc.a ( * )
154     libm.a ( * )
155     libgcc.a ( * )
156   }
158   .ARM.attributes 0 : { *(.ARM.attributes) }