Hilscher netX microcontroller driver  V0.0.5.0
Documentation of the netX driver package
GCC/startup_netx90_app.s
Go to the documentation of this file.
1 /**************************************************************************//**
2  * @file startup_netx90_app.S
3  * @brief CMSIS Cortex-M4 Core Device Startup File for
4  * ARMCM4 Device netx90_app
5  * @version V5.00
6  * @date 02. March 2016
7  ******************************************************************************/
8 /*
9  * Copyright (c) 2009-2016 ARM Limited. All rights reserved.
10  *
11  * SPDX-License-Identifier: Apache-2.0
12  *
13  * Licensed under the Apache License, Version 2.0 (the License); you may
14  * not use this file except in compliance with the License.
15  * You may obtain a copy of the License at
16  *
17  * www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
21  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  */
25 
26 
27  .syntax unified
28  .cpu cortex-m4
29  .arch armv7-m
30 
31  .section .stack
32  .align 3
33 #ifdef __STACK_SIZE
34  .equ Stack_Size, __STACK_SIZE
35 #else
36  .equ Stack_Size, 0x00002000
37 #endif
38  .globl __StackTop
39  .globl __StackLimit
40 __StackLimit:
41  .space Stack_Size
42  .size __StackLimit, . - __StackLimit
43 __StackTop:
44  .size __StackTop, . - __StackTop
45 
46  .section .heap
47  .align 3
48 #ifdef __HEAP_SIZE
49  .equ Heap_Size, __HEAP_SIZE
50 #else
51  .equ Heap_Size, 0x00002000
52 #endif
53  .globl __HeapBase
54  .globl __HeapLimit
55 __HeapBase:
56  .if Heap_Size
57  .space Heap_Size
58  .endif
59  .size __HeapBase, . - __HeapBase
60 __HeapLimit:
61  .size __HeapLimit, . - __HeapLimit
62 
63  .section .vectors
64  .align 2
65  .globl __Vectors
66  .globl __Vectors_Table
67 __Vectors:
68 __Vectors_Table:
69  .long __StackTop /* Top of Stack */
70  .long Reset_Handler /* Reset Handler */
71  .long NMI_Handler /* NMI Handler */
72  .long HardFault_Handler /* Hard Fault Handler */
73  .long MemManage_Handler /* MPU Fault Handler */
74  .long BusFault_Handler /* Bus Fault Handler */
75  .long UsageFault_Handler /* Usage Fault Handler */
76  .long 0 /* Reserved */
77  .long 0 /* Reserved */
78  .long 0 /* Reserved */
79  .long 0 /* Reserved */
80  .long SVC_Handler /* SVCall Handler */
81  .long DebugMon_Handler /* Debug Monitor Handler */
82  .long 0 /* Reserved */
83  .long PendSV_Handler /* PendSV Handler */
84  .long SysTick_Handler /* SysTick Handler */
85 
86  /* External interrupts */
87  .long SW_IRQHandler /* 0: software */
88  .long TIM0_IRQHandler /* 1: timer_app0 */
89  .long TIM1_IRQHandler /* 2: timer_app1 */
90  .long TIM2_IRQHandler /* 3: timer_app2 */
91  .long SYSTIME_IRQHandler /* 4: timer_app_systime_s */
92  .long WDG_IRQHandler /* 5: wdg_app */
93  .long DMAC_IRQHandler /* 6: dmac_app */
94  .long MCP_IRQHandler /* 7: mcp_app */
95  .long UART_IRQHandler /* 8: uart */
96  .long I2C_IRQHandler /* 9: i2c-app */
97  .long I2CXPIC_IRQHandler /* 10: i2c_xpic_app */
98  .long ECC_IRQHandler /* 11: ecc_app_1bit_error */
99  .long XPICDEBUG_IRQHandler /* 12: xpic_debug_app */
100  .long WDGXPIC_IRQHandler /* 13: wdg_xpic_app_arm */
101  .long NFIFO_ARM_APP_IRQHandler/* 14: nfifo_arm_app */
102  .long IOLINK_IRQHandler /* 15: io_link_irq_xpic_app */
103  .long SPI0_IRQHandler /* 16: spi0_app */
104  .long SPI1_IRQHandler /* 17: spi1_app */
105  .long SPI2_IRQHandler /* 18: spi2_app */
106  .long SPIXPIC_IRQHandler /* 19: spi_xpic_app */
107  .long UARTAPP_IRQHandler /* 20: uart_appp */
108  .long UARTXPIC_IRQHandler /* 21: uart_xpic_app */
109  .long ASIC_IRQHandler /* 22: bod */
110  .long CLKSUP_IRQHandler /* 23: clksup_app */
111  .long SQI_IRQHandler /* 24: sqi */
112  .long HIFPIO_IRQHandler /* 25: hif_pio_arm */
113  .long ETH_IRQHandler /* 26: eth */
114  .long HASH_IRQHandler /* 27: hash */
115  .long AES_IRQHandler /* 28: aes */
116  .long MTGY_IRQHandler /* 29: mtgy */
117  .long HIFRDY_IRQHandler /* 30: hif_rdy_to */
118  .long IDPM_IRQHandler /* 31: idpm_com_host */
119  .long HSC0_IRQHandler /* 32: hanshake channel 0 */
120  .long HSC1_IRQHandler /* 33: hanshake channel 1 */
121  .long HSC2_IRQHandler /* 34: hanshake channel 2 */
122  .long HSC3_IRQHandler /* 35: hanshake channel 3 */
123  .long HSC4_IRQHandler /* 36: hanshake channel 4 */
124  .long HSC5_IRQHandler /* 37: hanshake channel 5 */
125  .long HSC6_IRQHandler /* 38: hanshake channel 6 */
126  .long HSC7_IRQHandler /* 39: hanshake channel 7 */
127  .long HSC8TO15_IRQHandler /* 40: hanshake channel 8 to 15 */
128  .long ENDAT1_IRQHandler /* 41: endat_app0 */
129  .long ENDAT2_IRQHandler /* 42: endat_app1 */
130  .long BISS0_IRQHandler /* 43: biss_app0 */
131  .long BISS1_IRQHandler /* 44: biss_app1 */
132  .long MADC0_IRQHandler /* 45: madc_seq0 */
133  .long MADC1_IRQHandler /* 46: madc_seq1 */
134  .long MADC2_IRQHandler /* 47: madc_seq2 */
135  .long MADC3_IRQHandler /* 48: madc_seq3 */
136  .long MPWM_IRQHandler /* 49: mpwm */
137  .long MENC0_IRQHandler /* 50: menc_app_irq_enc0 */
138  .long MENC1_IRQHandler /* 51: menc_app_irq_enc1 */
139  .long MENCCAP_IRQHandler /* 52: menc_app_irq_cap_mp */
140  .long MENCERR_IRQHandler /* 53: menc_app_irq_err */
141  .long GPIO0_IRQHandler /* 54: gpio_app0 */
142  .long GPIO1_IRQHandler /* 55: gpio_app1 */
143  .long GPIO2_IRQHandler /* 56: gpio_app2 */
144  .long GPIO3_IRQHandler /* 57: gpio_app3 */
145  .long GPIO4_IRQHandler /* 58: gpio_app4 */
146  .long GPIO5_IRQHandler /* 59: gpio_app5 */
147  .long GPIO6_IRQHandler /* 60: gpio_app6 */
148  .long GPIO7_IRQHandler /* 61: gpio_app7 */
149  .long GPIOTIM0_IRQHandler /* 62: gpio_app_timer0 */
150  .long GPIOTIM1_IRQHandler /* 63: gpio_app_timer1 */
151  .long GPIOTIM2_IRQHandler /* 64: gpio_app_timer2 */
152  .long PIO0_IRQHandler /* 65: pio0_app */
153  .long PIO1_IRQHandler /* 66: pio1_app */
154  .long PIO2_IRQHandler /* 67: pio2_app */
155  .long PIO3_IRQHandler /* 68: pio3_app */
156  .long XCTRIGGER0_IRQHandler /* 69: trigger_out_edge0 */
157  .long XCTRIGGER1_IRQHandler /* 70: trigger_out_edge1 */
158  .long CAN0_IRQHandler /* 71: can_ctrl0_app */
159  .long CAN1_IRQHandler /* 72: can_ctrl1_app */
160  .long SQI0_IRQHandler /* 73: sqi0_app */
161  .long SQI1_IRQHandler /* 74: sqi1_app */
162  .long CTI0_IRQHandler /* 75: cti0_arm_app */
163  .long CTI1_IRQHandler /* 76: cti1_arm_app */
164  .long FPU_IRQHandler /* 77: fpu_arm_app */
165  .long 0 /* 78: reserved */
166  .long 0 /* 79: reserved */
167  .long 0 /* 80: reserved */
168  .long 0 /* 81: reserved */
169  .long 0 /* 82: reserved */
170  .long 0 /* 83: reserved */
171  .long 0 /* 84: reserved */
172  .long 0 /* 85: reserved */
173  .long 0 /* 86: reserved */
174  .long 0 /* 87: reserved */
175  .long 0 /* 88: reserved */
176  .long 0 /* 89: reserved */
177  .long 0 /* 90: reserved */
178  .long 0 /* 91: reserved */
179  .long 0 /* 92: reserved */
180  .long 0 /* 93: reserved */
181  .long 0 /* 94: reserved */
182  .long 0 /* 95: reserved */
183 
184  .size __Vectors, . - __Vectors
185 
186  .text
187  .thumb
188  .thumb_func
189  .align 2
190  .globl Reset_Handler
191  .type Reset_Handler, %function
192 Reset_Handler:
193 /* The following define is used to generate an application dummy. */
194 #ifdef __GENERATE_DUMMY
195  b .
196 #else
197 /* Firstly it copies data from read only memory to RAM. There are two schemes
198  * to copy. One can copy more than one sections. Another can only copy
199  * one section. The former scheme needs more instructions and read-only
200  * data to implement than the latter.
201  * Macro __STARTUP_COPY_MULTIPLE is used to choose between two schemes. */
202 #ifdef __STARTUP_COPY_MULTIPLE
203 /* Multiple sections scheme.
204  *
205  * Between symbol address __copy_table_start__ and __copy_table_end__,
206  * there are array of triplets, each of which specify:
207  * offset 0: LMA of start of a section to copy from
208  * offset 4: VMA of start of a section to copy to
209  * offset 8: size of the section to copy. Must be multiply of 4
210  *
211  * All addresses must be aligned to 4 bytes boundary.
212  */
213  ldr r4, =__copy_table_start__
214  ldr r5, =__copy_table_end__
215 
216 .L_loop0:
217  cmp r4, r5
218  bge .L_loop0_done
219  ldr r1, [r4]
220  ldr r2, [r4, #4]
221  ldr r3, [r4, #8]
222 
223 .L_loop0_0:
224  subs r3, #4
225  ittt ge
226  ldrge r0, [r1, r3]
227  strge r0, [r2, r3]
228  bge .L_loop0_0
229 
230  adds r4, #12
231  b .L_loop0
232 
233 .L_loop0_done:
234 #else
235 /* Single section scheme.
236  *
237  * The ranges of copy from/to are specified by following symbols
238  * __etext: LMA of start of the section to copy from. Usually end of text
239  * __data_start__: VMA of start of the section to copy to
240  * __data_end__: VMA of end of the section to copy to
241  *
242  * All addresses must be aligned to 4 bytes boundary.
243  */
244  ldr r1, =__etext
245  ldr r2, =__data_start__
246  ldr r3, =__data_end__
247 
248 .L_loop1:
249  cmp r2, r3
250  ittt lt
251  ldrlt r0, [r1], #4
252  strlt r0, [r2], #4
253  blt .L_loop1
254 #endif /*__STARTUP_COPY_MULTIPLE */
255 
256 /* This part of work usually is done in C library startup code. Otherwise,
257  * define this macro to enable it in this startup.
258  *
259  * There are two schemes too. One can clear multiple BSS sections. Another
260  * can only clear one section. The former is more size expensive than the
261  * latter.
262  *
263  * Define macro __STARTUP_CLEAR_BSS_MULTIPLE to choose the former.
264  * Otherwise efine macro __STARTUP_CLEAR_BSS to choose the later.
265  */
266 #ifdef __STARTUP_CLEAR_BSS_MULTIPLE
267 /* Multiple sections scheme.
268  *
269  * Between symbol address __copy_table_start__ and __copy_table_end__,
270  * there are array of tuples specifying:
271  * offset 0: Start of a BSS section
272  * offset 4: Size of this BSS section. Must be multiply of 4
273  */
274  ldr r3, =__zero_table_start__
275  ldr r4, =__zero_table_end__
276 
277 .L_loop2:
278  cmp r3, r4
279  bge .L_loop2_done
280  ldr r1, [r3]
281  ldr r2, [r3, #4]
282  movs r0, 0
283 
284 .L_loop2_0:
285  subs r2, #4
286  itt ge
287  strge r0, [r1, r2]
288  bge .L_loop2_0
289 
290  adds r3, #8
291  b .L_loop2
292 .L_loop2_done:
293 #elif defined (__STARTUP_CLEAR_BSS)
294 /* Single BSS section scheme.
295  *
296  * The BSS section is specified by following symbols
297  * __bss_start__: start of the BSS section.
298  * __bss_end__: end of the BSS section.
299  *
300  * Both addresses must be aligned to 4 bytes boundary.
301  */
302  ldr r1, =__bss_start__
303  ldr r2, =__bss_end__
304 
305  movs r0, 0
306 .L_loop3:
307  cmp r1, r2
308  itt lt
309  strlt r0, [r1], #4
310  blt .L_loop3
311 #endif /* __STARTUP_CLEAR_BSS_MULTIPLE || __STARTUP_CLEAR_BSS */
312 
313 #ifndef __NO_SYSTEM_INIT
314  bl SystemInit
315 #endif
316 
317 #ifndef __START
318 #define __START _start
319 #endif
320  bl __START
321 
322 #endif /* __GENERATE_DUMMY */
323  .pool
324  .size Reset_Handler, . - Reset_Handler
325 
326  .align 1
327  .thumb_func
328  .weak Default_Handler
329  .type Default_Handler, %function
330 Default_Handler:
331  b .
332  .size Default_Handler, . - Default_Handler
333 
334 /* Macro to define default handlers. Default handler
335  * will be weak symbol and just dead loops. They can be
336  * overwritten by other handlers */
337  .macro def_irq_handler handler_name
338 #ifdef __GENERATE_DUMMY
339 #else
340  .weak \handler_name
341 #endif /* __GENERATE_DUMMY */
342  .set \handler_name, Default_Handler
343  .endm
344 
345  def_irq_handler NMI_Handler
346  def_irq_handler HardFault_Handler
347  def_irq_handler MemManage_Handler
348  def_irq_handler BusFault_Handler
349  def_irq_handler UsageFault_Handler
350  def_irq_handler SVC_Handler
351  def_irq_handler DebugMon_Handler
352  def_irq_handler PendSV_Handler
353  def_irq_handler SysTick_Handler
354 
355 /* IRQ Handlers */
356 
357  def_irq_handler SW_IRQHandler
358  def_irq_handler TIM0_IRQHandler
359  def_irq_handler TIM1_IRQHandler
360  def_irq_handler TIM2_IRQHandler
361  def_irq_handler SYSTIME_IRQHandler
362  def_irq_handler WDG_IRQHandler
363  def_irq_handler DMAC_IRQHandler
364  def_irq_handler MCP_IRQHandler
365  def_irq_handler UART_IRQHandler
366  def_irq_handler I2C_IRQHandler
367  def_irq_handler I2CXPIC_IRQHandler
368  def_irq_handler ECC_IRQHandler
369  def_irq_handler XPICDEBUG_IRQHandler
370  def_irq_handler WDGXPIC_IRQHandler
371  def_irq_handler NFIFO_ARM_APP_IRQHandler
372  def_irq_handler IOLINK_IRQHandler
373  def_irq_handler SPI0_IRQHandler
374  def_irq_handler SPI1_IRQHandler
375  def_irq_handler SPI2_IRQHandler
376  def_irq_handler SPIXPIC_IRQHandler
377  def_irq_handler UARTAPP_IRQHandler
378  def_irq_handler UARTXPIC_IRQHandler
379  def_irq_handler ASIC_IRQHandler
380  def_irq_handler CLKSUP_IRQHandler
381  def_irq_handler SQI_IRQHandler
382  def_irq_handler HIFPIO_IRQHandler
383  def_irq_handler ETH_IRQHandler
384  def_irq_handler HASH_IRQHandler
385  def_irq_handler AES_IRQHandler
386  def_irq_handler MTGY_IRQHandler
387  def_irq_handler HIFRDY_IRQHandler
388  def_irq_handler IDPM_IRQHandler
389  def_irq_handler HSC0_IRQHandler
390  def_irq_handler HSC1_IRQHandler
391  def_irq_handler HSC2_IRQHandler
392  def_irq_handler HSC3_IRQHandler
393  def_irq_handler HSC4_IRQHandler
394  def_irq_handler HSC5_IRQHandler
395  def_irq_handler HSC6_IRQHandler
396  def_irq_handler HSC7_IRQHandler
397  def_irq_handler HSC8TO15_IRQHandler
398  def_irq_handler ENDAT1_IRQHandler
399  def_irq_handler ENDAT2_IRQHandler
400  def_irq_handler BISS0_IRQHandler
401  def_irq_handler BISS1_IRQHandler
402  def_irq_handler MADC0_IRQHandler
403  def_irq_handler MADC1_IRQHandler
404  def_irq_handler MADC2_IRQHandler
405  def_irq_handler MADC3_IRQHandler
406  def_irq_handler MPWM_IRQHandler
407  def_irq_handler MENC0_IRQHandler
408  def_irq_handler MENC1_IRQHandler
409  def_irq_handler MENCCAP_IRQHandler
410  def_irq_handler MENCERR_IRQHandler
411  def_irq_handler GPIO0_IRQHandler
412  def_irq_handler GPIO1_IRQHandler
413  def_irq_handler GPIO2_IRQHandler
414  def_irq_handler GPIO3_IRQHandler
415  def_irq_handler GPIO4_IRQHandler
416  def_irq_handler GPIO5_IRQHandler
417  def_irq_handler GPIO6_IRQHandler
418  def_irq_handler GPIO7_IRQHandler
419  def_irq_handler GPIOTIM0_IRQHandler
420  def_irq_handler GPIOTIM1_IRQHandler
421  def_irq_handler GPIOTIM2_IRQHandler
422  def_irq_handler PIO0_IRQHandler
423  def_irq_handler PIO1_IRQHandler
424  def_irq_handler PIO2_IRQHandler
425  def_irq_handler PIO3_IRQHandler
426  def_irq_handler XCTRIGGER0_IRQHandler
427  def_irq_handler XCTRIGGER1_IRQHandler
428  def_irq_handler CAN0_IRQHandler
429  def_irq_handler CAN1_IRQHandler
430  def_irq_handler SQI0_IRQHandler
431  def_irq_handler SQI1_IRQHandler
432  def_irq_handler CTI0_IRQHandler
433  def_irq_handler CTI1_IRQHandler
434  def_irq_handler FPU_IRQHandler
435 
436  .end