On STM32F103 and other microcontrollers with cortex-m3/m4 cores, the interrupt vector table can be redefined by setting the value of the register SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET;. However, in the STM32F0xx series microcontrollers with cortex-m0 as the core, the register for setting the interrupt vector table cannot be found. The following method can be used to redefine the interrupt vector table.
Basic idea:
1. Put the interrupt vector table into the starting address of RAM (just keep the actual address of RAM 0x100 unused in the application).
2. Copy the interrupt vector table of the application from Flash to SRAM in bootload.
3. Copy the STM32F0 interrupt vector table located in SRAM
The specific implementation code is as follows:
static void JumpToApp(void)
{
ApplicationAddress = APP_FLASHADDR;
if (((*(uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000)
{
m_JumpAddress = *(uint32_t*) (ApplicationAddress + 4);
JumpToApplication = (FunVoidType) m_JumpAddress;
__set_MSP(*(uint32_t*) ApplicationAddress);
JumpToApplication();
}
}
int main(void)
{
memcpy((void*)0x20000000, (void*)APP_FLASHADDR, 0x100);
SYSCFG->CFGR1 |= 0x03;
JumpToApp();
while (1);
}
Previous article:Create a new project with STM32, KEIL, MDK
Next article:Reasons and solutions for STM32RTC not working after power failure after installing battery
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
- Testing of heating power of NOx sensor
- IoT access terminal
- How to Measure Cable Impedance and Loss Using a Vector Network Analyzer
- Make Magazine: Getting started with Python on hardware
- Does the LCD module need to be grounded when used?
- 【BLE 5.3 wireless MCU CH582】11. Mobile app controls the LED on and off
- [Silicon Labs Development Kit Evaluation] + Simplicity Studio V5 environment is successfully built (Win10 environment)
- Registration for the 2021 STM32 National Tour Seminar is now open!
- Flexible use of software to simulate PA parameter changes
- After reading this article, do you have the urge to make some modifications? Let's take a look at the design of an outdoor camera with a temperature switch.