]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo_bsp/ps7_cortexa9_0/libsrc/standalone_v5_4/src/asm_vectors.S
Completely re-generate the Zynq 7000 demo using the 2016.1 SDK tools.
[freertos] / FreeRTOS / Demo / CORTEX_A9_Zynq_ZC702 / RTOSDemo_bsp / ps7_cortexa9_0 / libsrc / standalone_v5_4 / src / asm_vectors.S
1 /******************************************************************************
2 *
3 * Copyright (C) 2009 - 2015 Xilinx, Inc.  All rights reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * Use of the Software is limited solely to applications:
16 * (a) running on a Xilinx device, or
17 * (b) that interact with a Xilinx device through a bus or interconnect.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * XILINX  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 *
27 * Except as contained in this notice, the name of the Xilinx shall not be used
28 * in advertising or otherwise to promote the sale, use or other dealings in
29 * this Software without prior written authorization from Xilinx.
30 *
31 ******************************************************************************/
32 /*****************************************************************************/
33 /**
34 * @file asm_vectors.s
35 *
36 * This file contains the initial vector table for the Cortex A9 processor
37 *
38 * <pre>
39 * MODIFICATION HISTORY:
40 *
41 * Ver   Who     Date     Changes
42 * ----- ------- -------- ---------------------------------------------------
43 * 1.00a ecm/sdm 10/20/09 Initial version
44 * 3.05a sdm     02/02/12 Save lr when profiling is enabled
45 * 3.10a srt     04/18/13 Implemented ARM Erratas. Please refer to file
46 *                        'xil_errata.h' for errata description
47 * 4.00a pkp     22/01/14 Modified return addresses for interrupt
48 *                        handlers (DataAbortHandler and SVCHandler)
49 *                        to fix CR#767251
50 * 5.1   pkp     05/13/15 Saved the addresses of instruction causing data
51 *                        abort and prefetch abort into DataAbortAddr and
52 *                        PrefetchAbortAddr for further use to fix CR#854523
53 * 5.4   pkp     12/03/15 Added handler for undefined exception
54 * </pre>
55 *
56 * @note
57 *
58 * None.
59 *
60 ******************************************************************************/
61 #include "xil_errata.h"
62
63 #define __ARM_NEON__ 1
64
65 .org 0
66 .text
67
68 .globl _vector_table
69
70 .section .vectors
71 _vector_table:
72         B       _boot
73         B       Undefined
74         B       SVCHandler
75         B       PrefetchAbortHandler
76         B       DataAbortHandler
77         NOP     /* Placeholder for address exception vector*/
78         B       IRQHandler
79         B       FIQHandler
80
81
82 IRQHandler:                                     /* IRQ vector handler */
83
84         stmdb   sp!,{r0-r3,r12,lr}              /* state save from compiled code*/
85 #ifdef __ARM_NEON__
86         vpush {d0-d7}
87         vpush {d16-d31}
88         vmrs r1, FPSCR
89         push {r1}
90         vmrs r1, FPEXC
91         push {r1}
92 #endif
93
94 #ifdef PROFILING
95         ldr     r2, =prof_pc
96         subs    r3, lr, #0
97         str     r3, [r2]
98 #endif
99
100         bl      IRQInterrupt                    /* IRQ vector */
101
102 #ifdef __ARM_NEON__
103         pop     {r1}
104         vmsr    FPEXC, r1
105         pop     {r1}
106         vmsr    FPSCR, r1
107         vpop    {d16-d31}
108         vpop    {d0-d7}
109 #endif
110         ldmia   sp!,{r0-r3,r12,lr}              /* state restore from compiled code */
111
112
113         subs    pc, lr, #4                      /* adjust return */
114
115
116 FIQHandler:                                     /* FIQ vector handler */
117         stmdb   sp!,{r0-r3,r12,lr}              /* state save from compiled code */
118 #ifdef __ARM_NEON__
119         vpush {d0-d7}
120         vpush {d16-d31}
121         vmrs r1, FPSCR
122         push {r1}
123         vmrs r1, FPEXC
124         push {r1}
125 #endif
126
127 FIQLoop:
128         bl      FIQInterrupt                    /* FIQ vector */
129
130 #ifdef __ARM_NEON__
131         pop     {r1}
132         vmsr    FPEXC, r1
133         pop     {r1}
134         vmsr    FPSCR, r1
135         vpop    {d16-d31}
136         vpop    {d0-d7}
137 #endif
138         ldmia   sp!,{r0-r3,r12,lr}              /* state restore from compiled code */
139         subs    pc, lr, #4                      /* adjust return */
140
141
142 Undefined:                                      /* Undefined handler */
143         stmdb   sp!,{r0-r3,r12,lr}              /* state save from compiled code */
144         ldr     r0, =UndefinedExceptionAddr
145         sub     r1, lr, #4
146         str     r1, [r0]                        /* Store address of instruction causing undefined exception */
147
148         bl      UndefinedException              /* UndefinedException: call C function here */
149         ldmia   sp!,{r0-r3,r12,lr}              /* state restore from compiled code */
150         movs    pc, lr
151
152 SVCHandler:                                     /* SWI handler */
153         stmdb   sp!,{r0-r3,r12,lr}              /* state save from compiled code */
154
155         tst     r0, #0x20                       /* check the T bit */
156         ldrneh  r0, [lr,#-2]                    /* Thumb mode */
157         bicne   r0, r0, #0xff00                 /* Thumb mode */
158         ldreq   r0, [lr,#-4]                    /* ARM mode */
159         biceq   r0, r0, #0xff000000             /* ARM mode */
160
161         bl      SWInterrupt                     /* SWInterrupt: call C function here */
162
163         ldmia   sp!,{r0-r3,r12,lr}              /* state restore from compiled code */
164
165         movs    pc, lr          /*return to the next instruction after the SWI instruction */
166
167
168 DataAbortHandler:                               /* Data Abort handler */
169 #ifdef CONFIG_ARM_ERRATA_775420
170         dsb
171 #endif
172         stmdb   sp!,{r0-r3,r12,lr}              /* state save from compiled code */
173         ldr     r0, =DataAbortAddr
174         sub     r1, lr, #8
175         str     r1, [r0]                        /* Stores instruction causing data abort */
176
177         bl      DataAbortInterrupt              /*DataAbortInterrupt :call C function here */
178
179         ldmia   sp!,{r0-r3,r12,lr}              /* state restore from compiled code */
180
181         subs    pc, lr, #8                      /* points to the instruction that caused the Data Abort exception */
182
183 PrefetchAbortHandler:                           /* Prefetch Abort handler */
184 #ifdef CONFIG_ARM_ERRATA_775420
185         dsb
186 #endif
187         stmdb   sp!,{r0-r3,r12,lr}              /* state save from compiled code */
188         ldr     r0, =PrefetchAbortAddr
189         sub     r1, lr, #4
190         str     r1, [r0]                        /* Stores instruction causing prefetch abort */
191
192         bl      PrefetchAbortInterrupt          /* PrefetchAbortInterrupt: call C function here */
193
194         ldmia   sp!,{r0-r3,r12,lr}              /* state restore from compiled code */
195
196         subs    pc, lr, #4                      /* points to the instruction that caused the Prefetch Abort exception */
197
198 .end