1 #include "FreeRTOSConfig.h"
2 ;******************** (C) COPYRIGHT 2003 STMicroelectronics ********************
3 ;* File Name : 71x_vect.s
4 ;* Author : MCD Application Team
5 ;* Date First Issued : 16/05/2003
6 ;* Description : This file used to initialize the exception and IRQ
7 ;* vectors, and to enter/return to/from exceptions handlers.
8 ;*******************************************************************************
15 ;*******************************************************************************
16 ; THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH
17 ; CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
18 ; AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
19 ; OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
20 ; OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION
21 ; CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
22 ;*******************************************************************************/
25 SECTION .intvec:CODE(2)
28 EIC_base_addr EQU 0xFFFFF800; EIC base address.
29 CICR_off_addr EQU 0x04 ; Current Interrupt Channel Register.
30 IVR_off_addr EQU 0x18 ; Interrupt Vector Register.
31 IPR_off_addr EQU 0x40 ; Interrupt Pending Register.
34 ;*******************************************************************************
35 ; Import the __iar_program_start address from 71x_init.s
36 ;*******************************************************************************
38 IMPORT __iar_program_start
40 ;*******************************************************************************
41 ; Import exception handlers
42 ;*******************************************************************************
44 IMPORT Undefined_Handler
45 IMPORT Prefetch_Handler
49 ;*******************************************************************************
50 ; Import IRQ handlers from 71x_it.c
51 ;*******************************************************************************
53 IMPORT Default_Handler
54 IMPORT vPortYieldProcessor
55 IMPORT vSerialISREntry
56 IMPORT vPortPreemptiveTickISR
57 IMPORT vPortNonPreemptiveTick
59 ;*******************************************************************************
60 ; Export Peripherals IRQ handlers table address
61 ;*******************************************************************************
65 ;*******************************************************************************
67 ;*******************************************************************************
68 IVR_ADDR DEFINE 0xFFFFF818
71 LDR PC, Undefined_Addr
79 ;*******************************************************************************
80 ; Exception handlers address table
81 ;*******************************************************************************
83 Reset_Addr DCD __iar_program_start
84 Undefined_Addr DCD UndefinedHandler
85 SWI_Addr DCD vPortYieldProcessor
86 Prefetch_Addr DCD PrefetchAbortHandler
87 Abort_Addr DCD DataAbortHandler
88 DCD 0 ; Reserved vector
89 IRQ_Addr DCD 0 ; Direct vectors are used. See the STR75x demo for an alternative implementation
90 FIQ_Addr DCD FIQHandler
92 ;*******************************************************************************
93 ; Peripherals IRQ handlers address table
94 ;*******************************************************************************
96 T0TIMI_Addr DCD Default_Handler
97 FLASH_Addr DCD Default_Handler
98 RCCU_Addr DCD Default_Handler
99 RTC_Addr DCD Default_Handler
100 #if configUSE_PREEMPTION == 0
101 WDG_Addr DCD vPortNonPreemptiveTick ; Tick ISR if the cooperative scheduler is used.
103 WDG_Addr DCD vPortPreemptiveTickISR ; Tick ISR if the preemptive scheduler is used.
105 XTI_Addr DCD Default_Handler
106 USBHP_Addr DCD Default_Handler
107 I2C0ITERR_Addr DCD Default_Handler
108 I2C1ITERR_ADDR DCD Default_Handler
109 UART0_Addr DCD vSerialISREntry
110 UART1_Addr DCD Default_Handler
111 UART2_ADDR DCD Default_Handler
112 UART3_ADDR DCD Default_Handler
113 BSPI0_ADDR DCD Default_Handler
114 BSPI1_Addr DCD Default_Handler
115 I2C0_Addr DCD Default_Handler
116 I2C1_Addr DCD Default_Handler
117 CAN_Addr DCD Default_Handler
118 ADC12_Addr DCD Default_Handler
119 T1TIMI_Addr DCD Default_Handler
120 T2TIMI_Addr DCD Default_Handler
121 T3TIMI_Addr DCD Default_Handler
125 HDLC_Addr DCD Default_Handler
126 USBLP_Addr DCD Default_Handler
129 T0TOI_Addr DCD Default_Handler
130 T0OC1_Addr DCD Default_Handler
131 T0OC2_Addr DCD Default_Handler
134 ;*******************************************************************************
136 ;*******************************************************************************
138 ;*******************************************************************************
139 ;* Macro Name : SaveContext
140 ;* Description : This macro used to save the context before entering
141 ; an exception handler.
142 ;* Input : The range of registers to store.
144 ;*******************************************************************************
146 SaveContext MACRO reg1,reg2
148 STMFD sp!,{reg1-reg2,lr} ; Save The workspace plus the current return
149 ; address lr_ mode into the stack.
150 MRS r1,spsr ; Save the spsr_mode into r1.
151 STMFD sp!,{r1} ; Save spsr.
154 ;*******************************************************************************
155 ;* Macro Name : RestoreContext
156 ;* Description : This macro used to restore the context to return from
157 ; an exception handler and continue the program execution.
158 ;* Input : The range of registers to restore.
160 ;*******************************************************************************
162 RestoreContext MACRO reg1,reg2
164 LDMFD sp!,{r1} ; Restore the saved spsr_mode into r1.
165 MSR spsr_cxsf,r1 ; Restore spsr_mode.
166 LDMFD sp!,{reg1-reg2,pc}^; Return to the instruction following...
167 ; ...the exception interrupt.
170 ;*******************************************************************************
171 ;* Function Name : UndefinedHandler
172 ;* Description : This function called when undefined instruction
173 ; exception is entered.
176 ;*******************************************************************************
178 SaveContext r0,r12 ; Save the workspace plus the current
179 ; return address lr_ und and spsr_und.
180 ldr r0,=Undefined_Handler
181 ldr lr,=Undefined_Handler_end
182 bx r0 ; Branch to Undefined_Handler
183 Undefined_Handler_end:
184 RestoreContext r0,r12 ; Return to the instruction following...
185 ; ...the undefined instruction.
188 ;*******************************************************************************
189 ;* Function Name : PrefetchAbortHandler
190 ;* Description : This function called when Prefetch Abort
191 ; exception is entered.
194 ;*******************************************************************************
197 SUB lr,lr,#4 ; Update the link register.
198 SaveContext r0,r12 ; Save the workspace plus the current
199 ; return address lr_abt and spsr_abt.
200 ldr r0,=Prefetch_Handler
201 ldr lr,=Prefetch_Handler_end
203 bx r0 ; Branch to Prefetch_Handler.
204 Prefetch_Handler_end:
205 RestoreContext r0,r12 ; Return to the instruction following that...
206 ; ...has generated the prefetch abort exception.
208 ;*******************************************************************************
209 ;* Function Name : DataAbortHandler
210 ;* Description : This function is called when Data Abort
211 ; exception is entered.
214 ;*******************************************************************************
217 SUB lr,lr,#8 ; Update the link register.
218 SaveContext r0,r12 ; Save the workspace plus the current
219 ; return address lr_ abt and spsr_abt.
220 ldr r0,=Abort_Handler
221 ldr lr,=Abort_Handler_end
223 bx r0 ; Branch to Abort_Handler.
225 RestoreContext r0,r12 ; Return to the instruction following that...
226 ; ...has generated the data abort exception.
228 ;*******************************************************************************
229 ;* Function Name : FIQHandler
230 ;* Description : This function is called when FIQ
231 ; exception is entered.
234 ;*******************************************************************************
237 SUB lr,lr,#4 ; Update the link register.
238 SaveContext r0,r7 ; Save the workspace plus the current
239 ; return address lr_ fiq and spsr_fiq.
241 ldr lr,=FIQ_Handler_end
243 bx r0 ; Branch to FIQ_Handler.
245 RestoreContext r0,r7 ; Restore the context and return to the...
246 ; ...program execution.
253 ;******************* (C) COPYRIGHT 2003 STMicroelectronics *****END OF FILE****