ARM vectored and non-vectored interrupts

Publisher:创意旅程Latest update time:2016-04-20 Source: eefocusKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
The vector interrupt response process of 44B0 is that after the interrupt occurs, the chip will automatically jump to 0x00000018 to execute instructions

ENTRY
 b ResetHandler ; 0x00
 b HandlerUndef ; 0x04
 b HandlerSWI ; 0x08
 b HandlerPabort ; 0x0c
 b HandlerDabort ; 0x10
 b . ; 0x14
 b HandlerIRQ ; 0x18
 b HandlerFIQ ; 0x1c

 ldr pc,=HandlerEINT0 ; 0x20
 ldr pc,=HandlerEINT1
 ldr pc,=HandlerEINT2
 ldr pc,=HandlerEINT3
 ldr pc,=HandlerEINT4567
 ldr pc,=HandlerTICK ; 0x34
 b .
 b .
 ldr pc,=HandlerZDMA0 ; 0x40
 ldr pc,=HandlerZDMA1
 ldr pc,=HandlerBDMA0
 ldr pc,=HandlerBDMA1
 ldr pc,=HandlerWDT
 ldr pc,=HandlerUERR01; 0x54
 b .
 b .
 ldr pc,=HandlerTIMER0 ; 0x60
 ldr pc,=HandlerTIMER1
 ldr pc,=HandlerTIMER2 ldr
 pc,=HandlerTIMER3
 ldr pc,=HandlerTIMER4 ldr pc , = HandlerTIMER5
 ; 0x74
 b
 . ,=HandlerUTXD1; 0x94 b . b . ldr pc,=HandlerRTC ; 0xa0 b . b . b . b . b . b . ldr pc,=HandlerADC ; 0xb4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 According to DATASEET of 44b0, the instruction placed at 0x18 is b HandlerIRQ; when the program jumps to this address to execute, the code fetched by the chip at this address has been replaced by the branch instructions in the subsequent program. For example, if the chip EINT3 interrupts, the chip will jump to 0x18 to execute, and fetch instructions at 0x18 first. At this time, the instruction fetched is no longer b HandlerIRQ. b HandlerIRQ has been automatically replaced by ldr pc,=HandlerEINT3 by the chip, and then the chip executes this instruction again.

The code for non-vector interrupts is as follows:

ENTRY
 b ResetHandler ; for debug
 b HandlerUndef ; handlerUndef
 b HandlerSWI ; SWI interrupt handler
 b HandlerPabort ; handlerPAbort
 b HandlerDabort ; handlerDAbort
 b . ; handlerReserved
 b IsrIRQ
 b HandlerFIQ
 . . . . . .

IsrIRQ
 sub sp,sp,#4 ; reserved for PC
 stmfd sp!,{r8-r9}
 ldr r9,=I_ISPR
 ldr r9,[r9]
 mov r8,#0x0
movs r9,r9,lsr #1
 bcs %F1
 add r8,r8,#4
 b %B0
ldr r9,=HandleADC
 add r9,r9,r8
 ldr r9,[r9]
 str r9,[sp,#8]
 ldmfd sp!,{r8-r9,pc}
 . . . . . .

HandleADC # 4
HandleRTC # 4
HandleUTXD1 # 4
HandleUTXD0 # 4
. . . . . .

HandleEINT3 # 4
HandleEINT2 # 4
HandleEINT1 # 4
HandleEINT0 # 4; 0xc1(c7)fff84

 When an interrupt occurs, the chip automatically jumps to 0x18 for execution. The instruction at 0x18 is b IsrIRQ. The function of the IsrIRQ program is to check each bit of I_ISPR to determine what kind of interrupt has occurred, and then jump to the corresponding interrupt service program for execution according to the type of interrupt. The address definitions of various interrupt service programs are as follows:

HandleADC # 4
HandleRTC # 4
HandleUTXD1 # 4
HandleUTXD0 # 4
. . . . . .

HandleEINT3 #4

 It is worth mentioning that in the 44binit code, the vector interrupt jumps to HandlerEINT0 and the non-vector interrupt jumps to HandleEINT0. The program uses a macro to equate these two labels. Regardless of whether a vector interrupt or a non-vector interrupt is used, whether it jumps to HandleEINT0 or HandlerEINT0, the effect is the same, that is, it jumps to the address of the interrupt service program for execution.

 By the way, let me talk about the interrupt method of Philips' LPC series ARM chips. When the LPC chip receives an interrupt signal, when the interrupt is initialized, the program puts the entry address of the interrupt service program into the interrupt vector address register. Each interrupt source has an interrupt vector address register corresponding to it. There is also a register called VICVectAddr (0xffff0030). When an interrupt occurs, the hardware automatically determines which interrupt to execute, and then puts the address in the interrupt vector address register corresponding to the interrupt source into the register VICVectAddr. The code in the program interrupt vector table is executed by jumping to the address in VICVectAddr. Once an interrupt occurs, it automatically jumps to the address in VICVectAddr to execute, because at this time VICVectAddr has been replaced with the interrupt service program address of the interrupt source.

The above
 HandleADC # 4
allocates 4 bytes of storage space in the data area, which is equivalent to
 HandleADC FEILD 4.
The four bytes of storage space store the address of the interrupt service program. In the main program written in C language, how to put the entry address of the interrupt service program into this storage space? Careful readers can find that the starting address of this data area is _ISR_STARTADDRESS. In the MAIN function, just let
 (*(unsigned *)(_ISR_STARTADDRESS+0x74)) =(int)MyIsr;
MyIsr is the name of the interrupt service program, but _ISR_STARTADDRESS is an undefined value. This value is only assigned when the connector is connected. It is an undefined value in the compilation stage, so an error will be reported during compilation. #define _ISR_STARTADDRESS to an address value in SDRAM. In this case, it is 0xc7fff00.

 The initialization of interrupts includes initializing INTMSK and INTCON. If it is EINT0~7, PCONG and EXTINT need to be initialized, and
 (*(unsigned *)(_ISR_STARTADDRESS+0x74
(or other offset))) needs to be assigned a value. At the end of the interrupt service routine, I_ISPC needs to be written to clear INTPND.
If it is EINT0~7, the EXTINTPND register needs to be written before writing I_ISPC.


Keywords:ARM Reference address:ARM vectored and non-vectored interrupts

Previous article:The expansion design of S3C2410 processor
Next article:STM32 NVIC

Recommended ReadingLatest update time:2024-11-16 14:32

Method of relocating ARM interrupt vector table to off-chip RAM
Since the PC pointer automatically jumps to address 0x00 to execute after an interrupt or exception occurs in the ARM CPU (while saving some CPSR registers, switching the operating mode, etc.), the interrupt vector table must be stored at address 0x00. If we want to relocate the interrupt vector table to off-chip RAM,
[Microcontroller]
ARM9_S3C2440 learning (V) norflash startup, nandflash startup, SDRAM summary
The first instruction read when S3C2440 starts is at 0x00, which is divided into starting on nand flash and nor flash.   NAND flash: suitable for large-capacity data storage, similar to hard disk; nor flash: suitable for storing small-capacity programs or data, similar to a small hard disk; sdram: Mainly used for prog
[Microcontroller]
Crack the ARM interrupt register for you
S3C2440 interrupt register: 1. Interrupts are divided into two categories: internal interrupts and external interrupts. 2. External interrupts. 24 external interrupts occupy GPF0-GPF7 (EINT0-EINT7), GPG0-GPG15 (EINT8-EINT23). If you use these pins as interrupt inputs, you must configure the pins as interrupts and
[Microcontroller]
ARM Linux interrupt vector table migration design process
Preface   I will use some space here to describe how to initialize the interrupt vector table in Linux under the arm architecture. Because this method is very universal, I call it code migration. You said that everyone knows how to move code, isn't it just copying? It is true, but there are also skills in copying.
[Microcontroller]
ARM Linux interrupt vector table migration design process
Encryption Methods for LPC2100 Series ARM7 Microcontrollers
1. Encryption principle description     The LPC2100 series ARM7 microcontroller is the world's first ARM chip that can be encrypted. The method of encrypting it is to set the specified data at the specified address through the user program. PHILIPS stipulates that for the LPC2100 chip (except LPC2106/2105/2104), when
[Microcontroller]
Temperature sensor driver based on ARM-LINUX (DS18B20)
The DS18B20 digital temperature sensor is easy to wire and can be used in a variety of occasions after packaging, such as pipeline type, threaded type, magnet adsorption type, stainless steel package type, and various models, including LTM8877, LTM8874, etc. Its appearance is mainly changed according to different appl
[Microcontroller]
Temperature sensor driver based on ARM-LINUX (DS18B20)
ARM S3C2410 watchdog setting principle and source code
S3C2410 watchdog has only two functions 1. As a regular clock, it can generate interrupts 2. Used as a watchdog timer, when the clock decreases to 0 (timeout), it will generate a clock signal of 128 clocks (PLCK).   Watchdog settings: 1. The external clock source of the watchdog is provided by PLCK. PLCK generat
[Microcontroller]
Learn ARM development (1)
Before doing anything, you must have a goal in mind. Things without a goal cannot be done well or accomplished. My goal is to learn ARM development, of course, in-depth learning. The goals are as follows: 1. Learn the ARM development environment. 2. Learn ARM instructions. 3. Learn ARM assembly.
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components
Guess you like

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号