Interrupts and exceptions

Publisher:Xingfu8888Latest update time:2024-07-31 Source: cnblogsKeywords:Interrupt Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Ways to detect event occurrence: polling and interruption

2 S3C2440 abnormal interrupt system block diagram

An interrupt is a type of exception.

Switching between different modes of ARM processor:

a. In the privileged level (non-user mode) operating mode, the operating mode can be switched by modifying the mode control bit of the program status register CPSR.

b. Switch the operation mode through the exception handling process.

Note that in user mode, the processor mode cannot be switched directly. It is necessary to generate exception handling and switch the processor operating mode during the exception handling process.

3 ARM Registers

Unbacked registers: shared between modes.

Backup register: exclusive to a certain mode.

Understanding the value of the program counter PC:

PC points to the instruction address at the read level, not the instruction address at the execution level. Depending on the depth of the pipeline, the offset of PC relative to the current instruction address is also different. The following takes the ARM architecture and 3-stage pipeline as an example:

The space occupied by ARM instructions is 4 bytes, so when executing the MOV instruction,

PC value = current execution level instruction address + 8

4 Exception Vector Table

Each time the CPU executes an instruction, it will detect whether an exception interrupt occurs. When an exception occurs during program execution, the program will jump to the corresponding exception vector address and perform exception handling operations. The exception vector address is related to the chip design, and this jump process is enforced by the CPU; however, exception handling is implemented by the user through code. A jump instruction can be placed at the address defined by the vector table to implement user-defined exception handling functions.

5 Abnormal interrupt response process

6 Abnormal interruption processing flow

7 Description of related registers of S3C2440 interrupt controller

8 printfException

9 und exception handling sample code

10 swi exception handling sample code

11 irq exception handling sample code


Keywords:Interrupt Reference address:Interrupts and exceptions

Previous article:System clock configuration
Next article:NAND Flash Driver

Latest Microcontroller Articles
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号