Linux preempt-rt

Check our new training course

Real-Time Linux with PREEMPT_RT

Check our new training course
with Creative Commons CC-BY-SA
lecture and lab materials

Bootlin logo

Elixir Cross Referencer

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
;/**************************************************************************//**
; * @file     startup_psoc6a2m_cm0plus.s
; * @brief    CMSIS Core Device Startup File for
; *           ARMCM0plus Device Series
; * @version  V5.00
; * @date     08. March 2016
; ******************************************************************************/
;/*
; * Copyright (c) 2018 Cypress Semiconductor
; * Copyright (c) 2009-2016 ARM Limited. All rights reserved.
; *
; * SPDX-License-Identifier: Apache-2.0
; *
; * Licensed under the Apache License, Version 2.0 (the License); you may
; * not use this file except in compliance with the License.
; * You may obtain a copy of the License at
; *
; * www.apache.org/licenses/LICENSE-2.0
; *
; * Unless required by applicable law or agreed to in writing, software
; * distributed under the License is distributed on an AS IS BASIS, WITHOUT
; * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; * See the License for the specific language governing permissions and
; * limitations under the License.
; */

;
; The modules in this file are included in the libraries, and may be replaced
; by any user-defined modules that define the PUBLIC symbol _program_start or
; a user defined start symbol.
; To override the cstartup defined in the library, simply add your modified
; version to the workbench project.
;
; The vector table is normally located at address 0.
; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
; The name "__vector_table" has special meaning for C-SPY:
; it is where the SP start value is found, and the NVIC vector
; table register (VTOR) is initialized to this address if != 0.
;
; Cortex-M version
;

        MODULE  ?cstartup

        ;; Forward declaration of sections.
        SECTION CSTACK:DATA:NOROOT(3)
        SECTION .intvec_ram:DATA:NOROOT(2)
        SECTION .intvec:CODE:NOROOT(2)

        EXTERN  __iar_program_start
        EXTERN  SystemInit
        EXTERN __iar_data_init3
        PUBLIC  __vector_table
        PUBLIC  __vector_table_0x1c
        PUBLIC  __Vectors
        PUBLIC  __Vectors_End
        PUBLIC  __Vectors_Size
        PUBLIC  __ramVectors

        DATA

__vector_table
        DCD     sfe(CSTACK)
        DCD     Reset_Handler

        DCD     0x0000000D      ; NMI_Handler is defined in ROM code
        DCD     HardFault_Handler
        DCD     0
        DCD     0
        DCD     0
__vector_table_0x1c
        DCD     0
        DCD     0
        DCD     0
        DCD     0
        DCD     SVC_Handler
        DCD     0
        DCD     0
        DCD     PendSV_Handler
        DCD     SysTick_Handler

        ; External interrupts                         Power Mode  Description
        DCD     NvicMux0_IRQHandler                   ; CM0 + NVIC Mux input 0 
        DCD     NvicMux1_IRQHandler                   ; CM0 + NVIC Mux input 1 
        DCD     NvicMux2_IRQHandler                   ; CM0 + NVIC Mux input 2 
        DCD     NvicMux3_IRQHandler                   ; CM0 + NVIC Mux input 3 
        DCD     NvicMux4_IRQHandler                   ; CM0 + NVIC Mux input 4 
        DCD     NvicMux5_IRQHandler                   ; CM0 + NVIC Mux input 5 
        DCD     NvicMux6_IRQHandler                   ; CM0 + NVIC Mux input 6 
        DCD     NvicMux7_IRQHandler                   ; CM0 + NVIC Mux input 7 
        DCD     NvicMux8_IRQHandler                   ; CM0 + NVIC Mux input 8 
        DCD     NvicMux9_IRQHandler                   ; CM0 + NVIC Mux input 9 
        DCD     NvicMux10_IRQHandler                  ; CM0 + NVIC Mux input 10 
        DCD     NvicMux11_IRQHandler                  ; CM0 + NVIC Mux input 11 
        DCD     NvicMux12_IRQHandler                  ; CM0 + NVIC Mux input 12 
        DCD     NvicMux13_IRQHandler                  ; CM0 + NVIC Mux input 13 
        DCD     NvicMux14_IRQHandler                  ; CM0 + NVIC Mux input 14 
        DCD     NvicMux15_IRQHandler                  ; CM0 + NVIC Mux input 15 
        DCD     NvicMux16_IRQHandler                  ; CM0 + NVIC Mux input 16 
        DCD     NvicMux17_IRQHandler                  ; CM0 + NVIC Mux input 17 
        DCD     NvicMux18_IRQHandler                  ; CM0 + NVIC Mux input 18 
        DCD     NvicMux19_IRQHandler                  ; CM0 + NVIC Mux input 19 
        DCD     NvicMux20_IRQHandler                  ; CM0 + NVIC Mux input 20 
        DCD     NvicMux21_IRQHandler                  ; CM0 + NVIC Mux input 21 
        DCD     NvicMux22_IRQHandler                  ; CM0 + NVIC Mux input 22 
        DCD     NvicMux23_IRQHandler                  ; CM0 + NVIC Mux input 23 
        DCD     NvicMux24_IRQHandler                  ; CM0 + NVIC Mux input 24 
        DCD     NvicMux25_IRQHandler                  ; CM0 + NVIC Mux input 25 
        DCD     NvicMux26_IRQHandler                  ; CM0 + NVIC Mux input 26 
        DCD     NvicMux27_IRQHandler                  ; CM0 + NVIC Mux input 27 
        DCD     NvicMux28_IRQHandler                  ; CM0 + NVIC Mux input 28 
        DCD     NvicMux29_IRQHandler                  ; CM0 + NVIC Mux input 29 
        DCD     NvicMux30_IRQHandler                  ; CM0 + NVIC Mux input 30 
        DCD     NvicMux31_IRQHandler                  ; CM0 + NVIC Mux input 31 

__Vectors_End

__Vectors       EQU   __vector_table
__Vectors_Size  EQU   __Vectors_End - __Vectors

        SECTION .intvec_ram:DATA:REORDER:NOROOT(2)
__ramVectors
        DS32     __Vectors_Size


        THUMB

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Default handlers
;;
        PUBWEAK Default_Handler
        SECTION .text:CODE:REORDER:NOROOT(2)
Default_Handler
        B Default_Handler


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Saves and disables the interrupts
;;
        PUBLIC Cy_SaveIRQ
        SECTION .text:CODE:REORDER:NOROOT(2)
Cy_SaveIRQ
        MRS r0, PRIMASK
        CPSID I
        BX LR


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Restores the interrupts
;;
        PUBLIC Cy_RestoreIRQ
        SECTION .text:CODE:REORDER:NOROOT(2)
Cy_RestoreIRQ
        MSR PRIMASK, r0
        BX LR


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Weak function for startup customization
;;
        PUBWEAK Cy_OnResetUser
        SECTION .text:CODE:REORDER:NOROOT(2)
Cy_OnResetUser
        BX LR

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Define strong version to return zero for
;; __iar_program_start to skip data sections
;; initialization.
;;
        PUBLIC __low_level_init
        SECTION .text:CODE:REORDER:NOROOT(2)
__low_level_init
        MOVS R0, #0
        BX LR

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Default interrupt handlers.
;;
        THUMB
        PUBWEAK Reset_Handler
        SECTION .text:CODE:REORDER:NOROOT(2)
Reset_Handler

        ; Define strong function for startup customization
        LDR     R0, =Cy_OnResetUser
        BLX     R0

        ; Disable global interrupts
        CPSID I

        ; Copy vectors from ROM to RAM
        LDR r1, =__vector_table
        LDR r0, =__ramVectors
        LDR r2, =__Vectors_Size
intvec_copy
        LDR r3, [r1]
        STR r3, [r0]
        ADDS r0, r0, #4
        ADDS r1, r1, #4
        SUBS r2, r2, #1
        CMP r2, #0
        BNE intvec_copy

        ; Update Vector Table Offset Register
        LDR r0, =__ramVectors
        LDR r1, =0xE000ED08
        STR r0, [r1]
        dsb

        ; Initialize data sections
        LDR     R0, =__iar_data_init3
        BLX     R0

        LDR     R0, =SystemInit
        BLX     R0

        LDR     R0, =__iar_program_start
        BLX     R0

; Should never get here
Cy_Main_Exited
        B Cy_Main_Exited


        PUBWEAK NMI_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
NMI_Handler
        B NMI_Handler


        PUBWEAK Cy_SysLib_FaultHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
Cy_SysLib_FaultHandler
        B Cy_SysLib_FaultHandler

        PUBWEAK HardFault_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
HardFault_Handler
        IMPORT Cy_SysLib_FaultHandler
        movs r0, #4
        mov r1, LR
        tst r0, r1
        beq L_MSP
        mrs r0, PSP
        b L_API_call
L_MSP
        mrs r0, MSP
L_API_call
        ; Storing LR content for Creator call stack trace
        push {LR}
        bl Cy_SysLib_FaultHandler


        PUBWEAK SVC_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
SVC_Handler
        B SVC_Handler

        PUBWEAK PendSV_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
PendSV_Handler
        B PendSV_Handler

        PUBWEAK SysTick_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
SysTick_Handler
        B SysTick_Handler


        ; External interrupts
        PUBWEAK NvicMux0_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux0_IRQHandler
        B       NvicMux0_IRQHandler

        PUBWEAK NvicMux1_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux1_IRQHandler
        B       NvicMux1_IRQHandler

        PUBWEAK NvicMux2_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux2_IRQHandler
        B       NvicMux2_IRQHandler

        PUBWEAK NvicMux3_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux3_IRQHandler
        B       NvicMux3_IRQHandler

        PUBWEAK NvicMux4_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux4_IRQHandler
        B       NvicMux4_IRQHandler

        PUBWEAK NvicMux5_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux5_IRQHandler
        B       NvicMux5_IRQHandler

        PUBWEAK NvicMux6_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux6_IRQHandler
        B       NvicMux6_IRQHandler

        PUBWEAK NvicMux7_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux7_IRQHandler
        B       NvicMux7_IRQHandler

        PUBWEAK NvicMux8_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux8_IRQHandler
        B       NvicMux8_IRQHandler

        PUBWEAK NvicMux9_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux9_IRQHandler
        B       NvicMux9_IRQHandler

        PUBWEAK NvicMux10_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux10_IRQHandler
        B       NvicMux10_IRQHandler

        PUBWEAK NvicMux11_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux11_IRQHandler
        B       NvicMux11_IRQHandler

        PUBWEAK NvicMux12_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux12_IRQHandler
        B       NvicMux12_IRQHandler

        PUBWEAK NvicMux13_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux13_IRQHandler
        B       NvicMux13_IRQHandler

        PUBWEAK NvicMux14_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux14_IRQHandler
        B       NvicMux14_IRQHandler

        PUBWEAK NvicMux15_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux15_IRQHandler
        B       NvicMux15_IRQHandler

        PUBWEAK NvicMux16_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux16_IRQHandler
        B       NvicMux16_IRQHandler

        PUBWEAK NvicMux17_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux17_IRQHandler
        B       NvicMux17_IRQHandler

        PUBWEAK NvicMux18_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux18_IRQHandler
        B       NvicMux18_IRQHandler

        PUBWEAK NvicMux19_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux19_IRQHandler
        B       NvicMux19_IRQHandler

        PUBWEAK NvicMux20_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux20_IRQHandler
        B       NvicMux20_IRQHandler

        PUBWEAK NvicMux21_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux21_IRQHandler
        B       NvicMux21_IRQHandler

        PUBWEAK NvicMux22_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux22_IRQHandler
        B       NvicMux22_IRQHandler

        PUBWEAK NvicMux23_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux23_IRQHandler
        B       NvicMux23_IRQHandler

        PUBWEAK NvicMux24_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux24_IRQHandler
        B       NvicMux24_IRQHandler

        PUBWEAK NvicMux25_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux25_IRQHandler
        B       NvicMux25_IRQHandler

        PUBWEAK NvicMux26_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux26_IRQHandler
        B       NvicMux26_IRQHandler

        PUBWEAK NvicMux27_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux27_IRQHandler
        B       NvicMux27_IRQHandler

        PUBWEAK NvicMux28_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux28_IRQHandler
        B       NvicMux28_IRQHandler

        PUBWEAK NvicMux29_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux29_IRQHandler
        B       NvicMux29_IRQHandler

        PUBWEAK NvicMux30_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux30_IRQHandler
        B       NvicMux30_IRQHandler

        PUBWEAK NvicMux31_IRQHandler
        SECTION .text:CODE:REORDER:NOROOT(1)
NvicMux31_IRQHandler
        B       NvicMux31_IRQHandler


        END


; [] END OF FILE