Cosmetics
[opentx.git] / radio / src / targets / horus / stm32_ramboot.ld
blobd7fa9d338c26abb4f738c985f86a7d6cb8f19c32
1 /*
2 *****************************************************************************
3 **
4 **  File        : stm32f4_flash.ld
5 **
6 **  Abstract    : Linker script for STM32F439 Device with
7 **                2MByte FLASH, 192KByte SRAM, 64KByte CCM
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 = 0x20030000;    /* end of 192K RAM */
24 _heap_end = 0xD0800000;  /* end of 8192K SDRAM */
26 /* Generate a link error if heap and stack don't fit into RAM */
27 _Min_Heap_Size = 0;      /* required amount of heap  */
28 _Main_Stack_Size = 1024; /* required amount of stack for interrupt stack (Main stack) */
30 /* Main stack end */
31 _main_stack_start = _estack - _Main_Stack_Size;
33 /* Specify the memory areas */
34 MEMORY
36   FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 2048K
37   RAM (xrw)       : ORIGIN = 0x20000000, LENGTH = 192K
38   CCM (xrw)       : ORIGIN = 0x10000000, LENGTH = 64K
39   MEMORY_B1 (rx)  : ORIGIN = 0x60000000, LENGTH = 0K
40   SDRAM(xrw)      : ORIGIN = 0xD0000000, LENGTH = 8192K
43 /* Define output sections */
44 SECTIONS
46   /* The startup code goes first into FLASH */
48   /* The program code and other data goes into FLASH */
49   .text :
50   {
51     . = ALIGN(4);
52     KEEP(*(.isr_vector)) /* Startup code */
53     KEEP(*(.version))
54     KEEP(*(.bootversiondata))
55     . = ALIGN(4);      /* Align the start of the text part */
56     *(.text)           /* .text sections (code) */
57     *(.text*)          /* .text* sections (code) */
58     *(.rodata)         /* .rodata sections (constants, strings, etc.) */
59     *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
60     *(.glue_7)         /* glue arm to thumb code */
61     *(.glue_7t)        /* glue thumb to arm code */
62     *(.eh_frame)
64     KEEP (*(.init))
65     KEEP (*(.fini))
67     . = ALIGN(4);
68     _etext = .;        /* define a global symbols at end of code */
69   } >FLASH
71   .ARM.extab   :
72   { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
73     .ARM : {
74     __exidx_start = .;
75       *(.ARM.exidx*)
76       __exidx_end = .;
77   } >FLASH
79   .preinit_array     :
80   {
81     PROVIDE_HIDDEN (__preinit_array_start = .);
82     KEEP (*(.preinit_array*))
83     PROVIDE_HIDDEN (__preinit_array_end = .);
84   } >FLASH
86   .init_array :
87   {
88     PROVIDE_HIDDEN (__init_array_start = .);
89     KEEP (*(SORT(.init_array.*)))
90     KEEP (*(.init_array*))
91     PROVIDE_HIDDEN (__init_array_end = .);
92   } >FLASH
94   .fini_array :
95   {
96     PROVIDE_HIDDEN (__fini_array_start = .);
97     KEEP (*(.fini_array*))
98     KEEP (*(SORT(.fini_array.*)))
99     PROVIDE_HIDDEN (__fini_array_end = .);
100   } >FLASH
102   /* used by the startup to initialize data */
103   _sidata = .;
105   /* Initialized data sections goes into RAM, load LMA copy after code */
106   .data : AT ( _sidata )
107   {
108     . = ALIGN(4);
109     _sdata = .;        /* create a global symbol at data start */
110     *(.data)           /* .data sections */
111     *(.data*)          /* .data* sections */
112     . = ALIGN(4);
113     _edata = .;        /* define a global symbol at data end */
114   } >CCM
116   /* Uninitialized data section */
117   . = ALIGN(4);
118   .bss :
119   {
120     /* This is used by the startup in order to initialize the .bss secion */
121     _sbss = .;         /* define a global symbol at bss start */
122     /* __bss_start__ = _sbss; */
123     *(.bss)
124     *(.bss*)
125     *(COMMON)
126     . = ALIGN(4);
127     _ebss = .;         /* define a global symbol at bss end */
128   } >CCM
130   /* Non-zeroed data section */
131   . = ALIGN(4);
132   .noinit (NOLOAD) :
133   {
134     *(.noinit)
135   } >CCM
137   /* collect all uninitialized .ccm sections */
138   .ram (NOLOAD) :
139   {
140     . = ALIGN(4);
141     _sram = .;
142     *(.ram)
143   } >RAM
145   /* User_heap_stack section, used to check that there is enough RAM left */
146   ._user_heap_stack :
147   {
148     . = ALIGN(4);
149     . = . + _Min_Heap_Size;
150     . = . + _Main_Stack_Size;
151     . = ALIGN(4);
152   } >RAM
154   /* MEMORY_bank1 section, code must be located here explicitly            */
155   /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
156   .memory_b1_text :
157   {
158     *(.mb1text)        /* .mb1text sections (code) */
159     *(.mb1text*)       /* .mb1text* sections (code)  */
160     *(.mb1rodata)      /* read-only data (constants) */
161     *(.mb1rodata*)
162   } >MEMORY_B1
163   
164   .sdram (NOLOAD) :
165   {
166     *(.sdram)
167     *(.sdram*)
168     *(.sdram_rodata)
169     *(.sdram_rodata*)
170     . = ALIGN(4);
171     _eram = .;
172   } >SDRAM
174   PROVIDE ( end = _eram );
175   PROVIDE ( _end = _eram );
176   
177   /* Remove information from the standard libraries */
178   /DISCARD/ :
179   {
180     libc.a ( * )
181     libm.a ( * )
182     libgcc.a ( * )
183   }
185   .ARM.attributes 0 : { *(.ARM.attributes) }