REVONANO Milestones update
[librepilot.git] / flight / pios / stm32f10x / link_STM3210E_OP_BL_sections.ld
blobeabe17a83c01c09eb869ed408077f3112fa78d1f
1 /* This is the size of the stack for early init and for all FreeRTOS IRQs */
2 _irq_stack_size = 0x800;
4 /* Check valid alignment for VTOR */
5 ASSERT(ORIGIN(BL_FLASH) == ALIGN(ORIGIN(BL_FLASH), 0x80), "Start of memory region flash not aligned for startup vector table");
7 /*
8 this sends all unreferenced IRQHandlers to reset
9 */
12 PROVIDE (   Undefined_Handler = 0 ) ;
13 PROVIDE (   SWI_Handler = 0 ) ;
14 PROVIDE (   IRQ_Handler = 0 ) ;
15 PROVIDE (   Prefetch_Handler = 0 ) ;
16 PROVIDE (   Abort_Handler = 0 ) ;
17 PROVIDE (   FIQ_Handler = 0 ) ;
19 PROVIDE (   NMI_Handler = 0 ) ;
20 PROVIDE (   HardFault_Handler = 0 ) ;
21 PROVIDE (   MemManage_Handler = 0 ) ;
22 PROVIDE (   BusFault_Handler = 0 ) ;
23 PROVIDE (   UsageFault_Handler = 0 ) ;
24 PROVIDE (   vPortSVCHandler = 0 ) ;
25 PROVIDE (   DebugMon_Handler = 0 ) ;
26 PROVIDE (   xPortPendSVHandler = 0 ) ;
27 PROVIDE (   xPortSysTickHandler = 0 ) ;
29 PROVIDE (   WWDG_IRQHandler = 0 ) ;
30 PROVIDE (   PVD_IRQHandler = 0 ) ;
31 PROVIDE (   TAMPER_IRQHandler = 0 ) ;
32 PROVIDE (   RTC_IRQHandler = 0 ) ;
33 PROVIDE (   FLASH_IRQHandler = 0 ) ;
34 PROVIDE (   RCC_IRQHandler = 0 ) ;
35 PROVIDE (   EXTI0_IRQHandler = 0 ) ;
36 PROVIDE (   EXTI1_IRQHandler = 0 ) ;
37 PROVIDE (   EXTI2_IRQHandler = 0 ) ;
38 PROVIDE (   EXTI3_IRQHandler = 0 ) ;
39 PROVIDE (   EXTI4_IRQHandler = 0 ) ;
40 PROVIDE (   DMAChannel1_IRQHandler = 0 ) ;
41 PROVIDE (   DMAChannel2_IRQHandler = 0 ) ;
42 PROVIDE (   DMAChannel3_IRQHandler = 0 ) ;
43 PROVIDE (   DMAChannel4_IRQHandler = 0 ) ;
44 PROVIDE (   DMAChannel5_IRQHandler = 0 ) ;
45 PROVIDE (   DMAChannel6_IRQHandler = 0 ) ;
46 PROVIDE (   DMAChannel7_IRQHandler = 0 ) ;
47 PROVIDE (   ADC_IRQHandler = 0 ) ;
48 PROVIDE (   USB_HP_CAN1_TX_IRQHandler = 0 ) ;
49 PROVIDE (   USB_LP_CAN1_RX0_IRQHandler = 0 ) ;
50 PROVIDE (   CAN1_RX1_IRQHandler = 0 ) ;
51 PROVIDE (   CAN1_SCE_IRQHandler = 0 ) ;
52 PROVIDE (   EXTI9_5_IRQHandler = 0 ) ;
53 PROVIDE (   TIM1_BRK_IRQHandler = 0 ) ;
54 PROVIDE (   TIM1_UP_IRQHandler = 0 ) ;
55 PROVIDE (   TIM1_TRG_COM_IRQHandler = 0 ) ;
56 PROVIDE (   TIM1_CC_IRQHandler = 0 ) ;
57 PROVIDE (   TIM2_IRQHandler = 0 ) ;
58 PROVIDE (   TIM3_IRQHandler = 0 ) ;
59 PROVIDE (   TIM4_IRQHandler = 0 ) ;
60 PROVIDE (   I2C1_EV_IRQHandler = 0 ) ;
61 PROVIDE (   I2C1_ER_IRQHandler = 0 ) ;
62 PROVIDE (   I2C2_EV_IRQHandler = 0 ) ;
63 PROVIDE (   I2C2_ER_IRQHandler = 0 ) ;
64 PROVIDE (   SPI1_IRQHandler = 0 ) ;
65 PROVIDE (   SPI2_IRQHandler = 0 ) ;
66 PROVIDE (   USART1_IRQHandler = 0 ) ;
67 PROVIDE (   USART2_IRQHandler = 0 ) ;
68 PROVIDE (   USART3_IRQHandler = 0 ) ;
69 PROVIDE (   EXTI15_10_IRQHandler = 0 ) ;
70 PROVIDE (   RTCAlarm_IRQHandler = 0 ) ;
71 PROVIDE (   USBWakeUp_IRQHandler = 0 ) ;
72 PROVIDE (   TIM8_BRK_IRQHandler = 0 ) ;
73 PROVIDE (   TIM8_UP_IRQHandler = 0 ) ;
74 PROVIDE (   TIM8_TRG_COM_IRQHandler = 0 ) ;
75 PROVIDE (   TIM8_CC_IRQHandler = 0 ) ;
76 PROVIDE (   ADC3_IRQHandler = 0 ) ;
77 PROVIDE (   FSMC_IRQHandler = 0 ) ;
78 PROVIDE (   SDIO_IRQHandler = 0 ) ;
79 PROVIDE (   TIM5_IRQHandler = 0 ) ;
80 PROVIDE (   SPI3_IRQHandler = 0 ) ;
81 PROVIDE (   UART4_IRQHandler = 0 ) ;
82 PROVIDE (   UART5_IRQHandler = 0 ) ;
83 PROVIDE (   TIM6_IRQHandler = 0 ) ;
84 PROVIDE (   TIM7_IRQHandler = 0 ) ;
85 PROVIDE (   DMA2_Channel1_IRQHandler = 0 ) ;
86 PROVIDE (   DMA2_Channel2_IRQHandler = 0 ) ;
87 PROVIDE (   DMA2_Channel3_IRQHandler = 0 ) ;
88 PROVIDE (   DMA2_Channel4_5_IRQHandler = 0 ) ;
92 /******************************************************************************/
93 /*                       Peripheral memory map                                */
94 /******************************************************************************/
95 /*this allows to compile the ST lib in "non-debug" mode*/
98 /* Peripheral and SRAM base address in the alias region */
99 PERIPH_BB_BASE        = 0x42000000;
100 SRAM_BB_BASE          = 0x22000000;
102 /* Peripheral and SRAM base address in the bit-band region */
103 SRAM_BASE             = 0x20000000;
104 PERIPH_BASE           = 0x40000000;
106 /* Flash registers base address */
107 PROVIDE ( FLASH_BASE            = 0x40022000);
108 /* Flash Option Bytes base address */
109 PROVIDE ( OB_BASE               = 0x1FFFF800);
111 /* Peripheral memory map */
112 APB1PERIPH_BASE      = PERIPH_BASE  ;
113 APB2PERIPH_BASE      = (PERIPH_BASE + 0x10000) ;
114 AHBPERIPH_BASE       = (PERIPH_BASE + 0x20000) ;
116 PROVIDE ( TIM2            = (APB1PERIPH_BASE + 0x0000) ) ;
117 PROVIDE ( TIM3            = (APB1PERIPH_BASE + 0x0400) ) ;
118 PROVIDE ( TIM4            = (APB1PERIPH_BASE + 0x0800) ) ;
119 PROVIDE ( RTC             = (APB1PERIPH_BASE + 0x2800) ) ;
120 PROVIDE ( WWDG            = (APB1PERIPH_BASE + 0x2C00) ) ;
121 PROVIDE ( IWDG            = (APB1PERIPH_BASE + 0x3000) ) ;
122 PROVIDE ( SPI2            = (APB1PERIPH_BASE + 0x3800) ) ;
123 PROVIDE ( USART2          = (APB1PERIPH_BASE + 0x4400) ) ;
124 PROVIDE ( USART3          = (APB1PERIPH_BASE + 0x4800) ) ;
125 PROVIDE ( I2C1            = (APB1PERIPH_BASE + 0x5400) ) ;
126 PROVIDE ( I2C2            = (APB1PERIPH_BASE + 0x5800) ) ;
127 PROVIDE ( CAN             = (APB1PERIPH_BASE + 0x6400) ) ;
128 PROVIDE ( BKP             = (APB1PERIPH_BASE + 0x6C00) ) ;
129 PROVIDE ( PWR             = (APB1PERIPH_BASE + 0x7000) ) ;
131 PROVIDE ( AFIO            = (APB2PERIPH_BASE + 0x0000) ) ;
132 PROVIDE ( EXTI            = (APB2PERIPH_BASE + 0x0400) ) ;
133 PROVIDE ( GPIOA           = (APB2PERIPH_BASE + 0x0800) ) ;
134 PROVIDE ( GPIOB           = (APB2PERIPH_BASE + 0x0C00) ) ;
135 PROVIDE ( GPIOC           = (APB2PERIPH_BASE + 0x1000) ) ;
136 PROVIDE ( GPIOD           = (APB2PERIPH_BASE + 0x1400) ) ;
137 PROVIDE ( GPIOE           = (APB2PERIPH_BASE + 0x1800) ) ;
138 PROVIDE ( ADC1            = (APB2PERIPH_BASE + 0x2400) ) ;
139 PROVIDE ( ADC2            = (APB2PERIPH_BASE + 0x2800) ) ;
140 PROVIDE ( TIM1            = (APB2PERIPH_BASE + 0x2C00) ) ;
141 PROVIDE ( SPI1            = (APB2PERIPH_BASE + 0x3000) ) ;
142 PROVIDE ( USART1          = (APB2PERIPH_BASE + 0x3800) ) ;
144 PROVIDE ( DMA             = (AHBPERIPH_BASE + 0x0000) ) ;
145 PROVIDE ( DMA_Channel1    = (AHBPERIPH_BASE + 0x0008) ) ;
146 PROVIDE ( DMA_Channel2    = (AHBPERIPH_BASE + 0x001C) ) ;
147 PROVIDE ( DMA_Channel3    = (AHBPERIPH_BASE + 0x0030) ) ;
148 PROVIDE ( DMA_Channel4    = (AHBPERIPH_BASE + 0x0044) ) ;
149 PROVIDE ( DMA_Channel5    = (AHBPERIPH_BASE + 0x0058) ) ;
150 PROVIDE ( DMA_Channel6    = (AHBPERIPH_BASE + 0x006C) ) ;
151 PROVIDE ( DMA_Channel7    = (AHBPERIPH_BASE + 0x0080) ) ;
152 PROVIDE ( RCC             = (AHBPERIPH_BASE + 0x1000) ) ;
154 /* System Control Space memory map */
155 SCS_BASE              = 0xE000E000;
157 PROVIDE ( SysTick         = (SCS_BASE + 0x0010) ) ;
158 PROVIDE ( NVIC            = (SCS_BASE + 0x0100) ) ;
159 PROVIDE ( SCB             = (SCS_BASE + 0x0D00) ) ;
162 /* Sections Definitions */
164 SECTIONS
166     /* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */
167     .isr_vector :
168     {
169         PROVIDE (pios_isr_vector_table_base = .);
170         KEEP(*(.isr_vector))            /* Startup code */
171         . = ALIGN(4);
172     } > BL_FLASH
174     /* for some STRx devices, the beginning of the startup code is stored in the .flashtext section, which goes to FLASH */
175     .flashtext :
176     {
177         . = ALIGN(4);
178         *(.flashtext)            /* Startup code */
179         . = ALIGN(4);
180     } > BL_FLASH
182     /* the program code is stored in the .text section, which goes to Flash */
183     .text :
184     {
185             . = ALIGN(4);
186             
187         *(.text)                   /* remaining code */
188         *(.text.*)                   /* remaining code */
189         *(.rodata)                 /* read-only data (constants) */
190         *(.rodata*)
191         *(.glue_7)
192         *(.glue_7t)
194             . = ALIGN(4);
195          _etext = .;
196             /* This is used by the startup in order to initialize the .data secion */
197          _sidata = _etext;
198     } > BL_FLASH
199     
201     /* 
202      * This stack is used both as the initial sp during early init as well as ultimately
203      * being used as the STM32's MSP (Main Stack Pointer) which is the same stack that
204      * is used for _all_ interrupt handlers.  The end of this stack should be placed
205      * against the lowest address in RAM so that a stack overrun results in a hard fault
206      * at the first access beyond the end of the stack.
207      */
208     .irq_stack :
209     {
210          . = ALIGN(4);
211          _irq_stack_end = . ;
212          . = . + _irq_stack_size ;
213          . = ALIGN(4);
214          _irq_stack_top = . - 4 ;
215          _init_stack_top = _irq_stack_top;
216          . = ALIGN(4);
217     } >RAM
218         
220     /* This is the initialized data section
221     The program executes knowing that the data is in the RAM
222     but the loader puts the initial values in the FLASH (inidata).
223     It is one task of the startup to copy the initial values from FLASH to RAM. */
224     .data  : AT ( _sidata )
225     {
226             . = ALIGN(4);
227         /* This is used by the startup in order to initialize the .data secion */
228         _sdata = . ;
229         
230         *(.data)
231         *(.data.*)
232             . = ALIGN(4);
233             /* This is used by the startup in order to initialize the .data secion */
234          _edata = . ;
235     } >RAM
236     
237     
239     /* This is the uninitialized data section */
240     .bss :
241     {
242             . = ALIGN(4);
243         /* This is used by the startup in order to initialize the .bss secion */
244         _sbss = .;
245         
246         *(.bss)
247         *(COMMON)
248         
249             . = ALIGN(4);
250             /* This is used by the startup in order to initialize the .bss secion */
251          _ebss = . ;
252     } >RAM
253     
254     PROVIDE ( end = _ebss );
255     PROVIDE ( _end = _ebss );
257     /* this is the FLASH Bank1 */
258     /* the C or assembly source must explicitly place the code or data there
259     using the "section" attribute */
260     .b1text :
261     {
262         *(.b1text)                   /* remaining code */
263         *(.b1rodata)                 /* read-only data (constants) */
264         *(.b1rodata*)
265     } >FLASHB1
266     
267     /* this is the EXTMEM */
268     /* the C or assembly source must explicitly place the code or data there
269     using the "section" attribute */
270     
271     /* EXTMEM Bank0 */
272     .eb0text :
273     {
274         *(.eb0text)                   /* remaining code */
275         *(.eb0rodata)                 /* read-only data (constants) */
276         *(.eb0rodata*)
277     } >EXTMEMB0
278     
279     /* EXTMEM Bank1 */
280     .eb1text :
281     {
282         *(.eb1text)                   /* remaining code */
283         *(.eb1rodata)                 /* read-only data (constants) */
284         *(.eb1rodata*)
285     } >EXTMEMB1
286     
287     /* EXTMEM Bank2 */
288     .eb2text :
289     {
290         *(.eb2text)                   /* remaining code */
291         *(.eb2rodata)                 /* read-only data (constants) */
292         *(.eb2rodata*)
293     } >EXTMEMB2
294     
295     /* EXTMEM Bank0 */
296     .eb3text :
297     {
298         *(.eb3text)                   /* remaining code */
299         *(.eb3rodata)                 /* read-only data (constants) */
300         *(.eb3rodata*)
301     } >EXTMEMB3
302     
303     __exidx_start = .;
304     __exidx_end = .;
305     
306     .boardinfo :
307     {
308         . = ALIGN(4);
309         KEEP(*(.boardinfo))
310         . = ALIGN(4);
311     } > BD_INFO
313     /* after that it's only debugging information. */
314     
315     /* remove the debugging information from the standard libraries */
316     /DISCARD/ :
317     {
318      libc.a ( * )
319      libm.a ( * )
320      libgcc.a ( * )
321      }
323     /* Stabs debugging sections.  */
324     .stab          0 : { *(.stab) }
325     .stabstr       0 : { *(.stabstr) }
326     .stab.excl     0 : { *(.stab.excl) }
327     .stab.exclstr  0 : { *(.stab.exclstr) }
328     .stab.index    0 : { *(.stab.index) }
329     .stab.indexstr 0 : { *(.stab.indexstr) }
330     .comment       0 : { *(.comment) }
331     /* DWARF debug sections.
332        Symbols in the DWARF debugging sections are relative to the beginning
333        of the section so we begin them at 0.  */
334     /* DWARF 1 */
335     .debug          0 : { *(.debug) }
336     .line           0 : { *(.line) }
337     /* GNU DWARF 1 extensions */
338     .debug_srcinfo  0 : { *(.debug_srcinfo) }
339     .debug_sfnames  0 : { *(.debug_sfnames) }
340     /* DWARF 1.1 and DWARF 2 */
341     .debug_aranges  0 : { *(.debug_aranges) }
342     .debug_pubnames 0 : { *(.debug_pubnames) }
343     /* DWARF 2 */
344     .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
345     .debug_abbrev   0 : { *(.debug_abbrev) }
346     .debug_line     0 : { *(.debug_line) }
347     .debug_frame    0 : { *(.debug_frame) }
348     .debug_str      0 : { *(.debug_str) }
349     .debug_loc      0 : { *(.debug_loc) }
350     .debug_macinfo  0 : { *(.debug_macinfo) }
351     /* SGI/MIPS DWARF 2 extensions */
352     .debug_weaknames 0 : { *(.debug_weaknames) }
353     .debug_funcnames 0 : { *(.debug_funcnames) }
354     .debug_typenames 0 : { *(.debug_typenames) }
355     .debug_varnames  0 : { *(.debug_varnames) }