Analysis of s3c2410 assembly startup code and interrupt jump

Publisher:cwk2003Latest update time:2016-12-02 Source: eefocusKeywords:s3c2410 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The initial code is familiar to everyone, the most basic interrupt jump

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, DATA, READWRITE

        ^ _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.


Keywords:s3c2410 Reference address:Analysis of s3c2410 assembly startup code and interrupt jump

Previous article:UART test program based on s3c2410 development board
Next article:s3c2410 Timer

Recommended ReadingLatest update time:2024-11-17 00:46

Network-based car anti-theft system based on S3C2410
introduction The popularity of cars has brought convenience to people's lives, but it has also posed a big problem to people - car anti-theft. This design is to solve the shortcomings and deficiencies of previous car anti-theft products and develop a car anti-theft alarm system that integrates three functiona
[Microcontroller]
Summary of clock frequency based on S3C2410
Among them, pll includes two types: MPLL is mainly used to provide clocks for various devices. We will focus on the application of UPLL in USB clock frequency application, which is 48M. The setting of MPLL mainly relies on the use of various phase-locked loops and frequency dividers to change the original input frequ
[Microcontroller]
S3C2410 Universal Asynchronous Receiver and Transmitter UART Serial Communication
1. UART Principle Description Universal Asynchronous Receiver/Transmitter, abbreviated as UART, is used to transmit serial data. When sending data, the CPU writes parallel data to the UART, and the UART sends it serially on a wire according to a certain format. When receiving data, the CPU detects the signal on
[Microcontroller]
S3C2410 Universal Asynchronous Receiver and Transmitter UART Serial Communication
Linux kernel transplantation s3c2410, preparation, continue
When vmlinux is linked, the files used are all files defined in vmlinux-all, and the linking script is defined in arch/arm/kernel/vmlinux.lds. Link these files. To summarize the above: Real Linux source code is managed through Makefile. The top-level Makefile defines the contents of those folders to be compiled into t
[Microcontroller]
Implementation of D/A Conversion Based on S3C2410 and Embedded Linux
1 Introduction In embedded application systems, especially in intelligent instruments, meters, electromechanical equipment and device control, it is necessary to use A/D conversion to convert analog electrical quantity signals into digital signals for processing, and then convert the processing results into ana
[Microcontroller]
Implementation of D/A Conversion Based on S3C2410 and Embedded Linux
Design of an Embedded Network Camera Based on ARM S3C2410X and Linux
introduction The video surveillance system based on coaxial cable has a complex structure, poor stability, low reliability and high price, so remote Web video surveillance systems such as embedded network cameras have emerged. This embedded network camera uses a high-performance ARM9 chip as a microprocessor, a built-
[Microcontroller]
Design of an Embedded Network Camera Based on ARM S3C2410X and Linux
Wireless Data Acquisition System Designed by S3C2410
The functions of handheld terminals are becoming more and more powerful, and the data processing capabilities are becoming stronger and stronger. People's requirements for their wireless communication functions are also getting higher and higher. For this reason, various wireless devices have entered people's lives.
[Analog Electronics]
Wireless Data Acquisition System Designed by S3C2410
Analysis of nandflash boot process of s3c2410
Note: This article is a partial excerpt and has been modified based on the original  textlink I have been trying to figure out the boot process of s3c2410 these days. The confusion was finally solved last night. Let's analyze its first boot process in detail. 1. When the board is powered on, it will automatically det
[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

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号