Exception vector table for s3c2440:
The IRQ interrupt address is 0x18. Therefore, based on the previous exception handling method, we write the startup file:
Why do you need to reduce lr by 4? You can refer to this article: http://blog.csdn.net/zzsfqiuyigui/article/details/23334177
This is to ensure that when the CPU is executing an instruction and is interrupted by an interrupt, when the interrupt returns, the interrupted instruction must continue to be executed. If 4 is not subtracted, the CPU will be interrupted after processing the interrupt. If the next instruction following the interrupted instruction starts executing (because lr_irq saves the address of the next instruction executed), the execution of the interrupted instruction will be lost. Therefore, it is important to save the return address after the interrupt is processed. .
void handle_irq_c(void)
{
/* Identify interrupt source*/
int bit = INTOFFSET;
/* Call the corresponding processing function */
irq_array[bit](bit);
/* Clear interrupt: start clearing from source */
SRCPND = (1< Button schematic diagram: Corresponding offset: 0,2,5 irq_array[bit](bit); Let’s not talk about this function pointer array first, let’s talk about the subsequent clearing operation first. Since we have different requests from the same source, the corresponding bit of the SRCPND register needs to be cleared. The clearing operation is just to write a value to this register (because the chip manual says so), here we use the method of writing 1. If I don't use this function pointer array, it will be very troublesome when I write another interrupt service function. I need to add a lot of code to the handle_irq_c function in the startup file. But after we adopt the C language skills, we can easily There are many introductions. It can also be seen that C language skills are very important for our code encapsulation.This is also consistent with the clearing sequence of our program. To clear the interrupt pending bit, we still write 1.
Now let’s talk about this array of function pointers:
[object Object]
Previous article:One of the seven modes of S3C2440 - undefined mode (remove bl print1 bug to solve)
Next article:s3c2440 code relocation and introduction of segments - apply what you have learned and practice comprehensive Makefile
- 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
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- Module Power Structure Design Guide
- 【Help】ADC acquisition
- MSP430G2755 Main Bootloader UART Porting Guide
- CH224D Review: USB PD Portable Soldering Iron is Here
- Bluetooth, 4-Digit True RMS Digital Multimeter
- Zibee transparent transmission program development
- June 14th prize live broadcast | TI takes you to experience the interconnected and efficient smart home solutions
- Download the 150,000+ word "RF and Microwave Technology Practical Handbook" for free here! (Internal Gift)
- World clock controlled by NXP LPC845
- EEWORLD University Hall----Live Replay: TI's low-power wireless technology for building automation sensor applications