After entering the exception service routine, the hardware automatically updates the value of LR to the special EXC_RETURN.
When the program returns from the exception service routine and sends the EXC_RETURN value to the PC, the processor's exception interrupt return sequence is started.
Because the value of LR, EXC_RETURN, is automatically set by the hardware, do not change it unless there is a special requirement.
The upper 28 bits of RETURN are all 1, and only the value of bit[3:0] has a special meaning. The bit segment is as follows:
There are three legal EXC_RETURN values, as follows:
If the main program is running in thread mode and is interrupted while using MSP, LR=0xFFFFFFF9 in the service program (LR was automatically pushed onto the stack before the main program was interrupted).
If the main program is running in thread mode and is interrupted while using the PSP, LR=0xFFFFFFFD in the service program (LR was automatically pushed onto the stack before the main program was interrupted).
If the main program runs in Handler mode, LR=0xFFFFFFF1 in the service program (LR is automatically pushed into the stack before the main program is interrupted). This is the so-called "main program", which is more likely to be the interrupt service program that is preempted. In fact, when nested, the LR seen by the deeper ISR is always 0xFFFFFFF1.
[The value of LR is set to EXC_RETURN during an exception (thread mode uses the main stack)]
[The value of LR is set to EXC_RETURN during an exception (thread mode uses the process stack)]
【Notice】
The value of LR is automatically set by the CPU when entering an interrupt, so there is no mistake. Why is it possible that the value of LR becomes illegal when exiting an interrupt? There is only one reason: the interrupt routine modifies the value of LR and makes a wrong change.
From the format of EXC_RETURN, we can see that we cannot use the address between 0xFFFFFFF0 and 0xFFFFFFFF as any return address. In fact, there is no need to worry about making a mistake, because Cortex-M3 has marked this range as "instruction fetching unavailable area".
Previous article:TQ2440 Study Notes - 2. Network settings for pinging between Win7PC and virtual machine Ubuntu
Next article:TQ2440 Study Notes —— 1. Development tool installation and environment establishment under Windows platform
Recommended ReadingLatest update time:2024-11-16 21:40
- Popular Resources
- Popular amplifiers
- Embedded Security Processor Application and Practice
- uCOS-III Kernel Implementation and Application Development Practical Guide - Based on STM32 (Wildfire)
- Principles and Practices of Embedded Systems (Shen Jianhua, Wang Ci)
- FreeRTOS kernel implementation and application development practical guide: based on STM32
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [Evaluation and experience of Zhongke Yihaiwei EQ6HL45 development platform] +04.RTC board test and debug (zmj)
- Xianji official engineer's dry goods: How to use the HPM6000 series on-chip SRAM
- Gizwits IoT Platform + MSP430G2553 + Low-power Li-ion Battery Smart Manager
- Is it better to use logic level MOS or standard level MOS for DCDC circuit driving?
- A small question about COMSOL
- It's settled. Twitter is laying off more than 50% of its employees. The ratio of M to IC is 1:20. All top executives will be laid off.
- Please help me find the model of the Renesas microcontroller R8L35C in the attached picture. What is the real model? I can't find it on the Renesas website.
- [Hangxin ACM32F070 supporting capacitive touch development board - dual-machine UART communication linkage Hangxin evaluation final part - part 2]
- How many layers does the Raspberry Pi have? What should I pay attention to when drawing it myself?
- Microchip Live Broadcast at 10:30 AM Today | How to Implement AWS IoT Secure Authentication