b ResetHandler
b HandlerUndef ;handler for Undefined mode
b HandlerSWI ;handler for SWI interrupt
b HandlerPabort ;handler for PAbort
b HandlerDabort ;handler for DAbort
b . ;reserved
b HandlerIRQ ;handler for IRQ interrupt
b HandlerFIQ ;handler for FIQ interrupt
The jump label is a series of macros
LTORG
HandlerFIQ HANDLER HandleFIQ
HandlerIRQ HANDLER HandleIRQ
HandlerUndef HANDLER HandleUndef
HandlerSWI HANDLER HandleSWI
HandlerDabort HANDLER HandleDabort
HandlerPabort HANDLER HandlePabort
This macro is implemented at the beginning of the file and does some pre-jump processing. As follows:
MACRO
$HandlerLabel HANDLER $HandleLabel
$HandlerLabel
sub sp,sp,#4 ;decrement sp(to store jump address)
stmfd sp!,{r0} ;PUSH the work register to stack(lr does't push because it return to original address)
ldr r0,=$ HandleLabel;load the address of HandleXXX to r0
ldr r0,[r0] ;load the contents(service routine start address) of HandleXXX
str r0,[sp,#4] ;store the contents(ISR) of HandleXXX to stack
ldmfd sp! ,{r0,pc} ;POP the work register and pc(jump to ISR)
MEND
Take HandleIRQ jump as an example to illustrate the secondary jump process of interrupt. The above macro code shows that IRQ jumps to the label HandleIRQ, which is defined as follows: (a series of interrupts and secondary interrupt entry addresses)
AREA RamData, DA
^ _ISR_STARTADDRESS; (This value is defined by yourself, it is the address of the interrupt vector table)
HandleReset # 4
HandleUndef # 4
HandleSWI # 4 HandlePabort #
4 HandleDabort
# 4
HandleReserved # 4
HandleIRQ # 4
HandleFIQ # 4
;Don't use the label 'IntVectorTable',
;The value of IntVectorTable is different with the address you think it may be.
;IntVectorTable (secondary IRQ interrupt vector table)
HandleEINT0 # 4
HandleEINT1 # 4
HandleEINT2 # 4
HandleEINT3 # 4
HandleEINT4_7 # 4
HandleEINT8_23 # 4
HandleRSV6 # 4
HandleBATFLT # 4
HandleTICK # 4
HandleWDT # 4 HandleTIMER0 # 4
HandleTIMER1
# 4 HandleTIMER2 #
4
HandleTIMER3 # 4
HandleTIMER4 # 4
HandleUART2 # 4
HandleLCD # 4
HandleDMA0 # 4
HandleDMA1 # 4
HandleDMA2 # 4
HandleDMA 3 # 4
HandleMMC # 4
HandleSPI0 # 4
HandleUART1 # 4
HandleRSV24 # 4
HandleUSBD # 4
HandleUSBH # 4
HandleIIC # 4
HandleUART0 # 4
HandleSPI1 # 4
HandleRTC # 4
HandleADC # 4
And HandleIRQ is assigned by the following code, and it can be seen that it jumps to IsrIRQ:
dr r0,=HandleIRQ ;This routine is needed
ldr r1,=IsrIRQ ;if there isn't 'subs pc,lr,#4' at 0x18, 0x1c place interrupt jump
str r1,[r0]
IsrIRQ ;The real IRQ interrupt entry
sub sp,sp,#4 ;reserved for PC to set aside a location to save the interrupt entry address
stmfd sp!,{r8-r9}
ldr r9,=INTOFFSET
ldr r9,[r9] ;Read the interrupt offset code
ldr r8,=HandleEINT0 ;The first address of the secondary jump table
add r8,r8,r9,lsl #2 ;R8=R8+R9X4 to get the corresponding interrupt entry address
ldr r8,[r8]
str r8,[sp,#8] ;The interrupt entry address is sent to SP (the 4-byte space reserved by the first code)
ldmfd sp!,{r8-r9,pc}
So far, the interrupt has been successfully entered into the interrupt vector table, and it has become very simple to write a service program in C language. For example, the ISR of the EINT0 interrupt
void Eint0(void)
{ }
pISR_EINT0=(U32)Eint0; //Use the interrupt entry to point to the function pointer.
Previous article:ARM926EJ-S/ARM920T coprocessor CP14, CP15 detailed explanation
Next article:STM32 interrupt priority and switch total interrupt
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- What do you think about RISC-V?
- DIY Energy Saving Socket Strip
- Can you recommend some 16-bit or 32-bit dual in-line microcontrollers with a price range of 2-6 yuan?
- Very pleasantly surprised, let me show you the winning nail clipper set.
- SensorTile.box accelerometer IIS3DHHCTR test project
- AD When viewing in 3D, the color cannot be changed in any way, it is just one color.
- Jiuxing shares - causes and hazards of motor bearing heating
- After the medical equipment is completed, how can we protect the security of our programs?
- How to select external clock and external memory for TI DSP?
- Can UST_OTG1 be used with a USB flash drive?