1. Concept
IAP: In-Application Programming, which is interpreted as "programming in the program" in Chinese. ICP (In-Circuit Programming) technology is to program the microcontroller through an online emulator, while ISP technology is a programming technology guided by the built-in bootloader program of the microcontroller.
2. Framework Design
Brief description: STM32's Flash 512Kb is divided into two parts, one 256Kb is used to store the minimum system, and the other 256Kb is used to store the APP code. The specific Flash size of the minimum system and APP can be adjusted according to the actual situation.
Difficulty analysis:
Storage address of the minimum system and APP
To find the storage address of the minimum system and APP, you need to understand the Flash storage space of STM32, as follows:
Minimum system and APP jump
After the system starts, it first enters the minimum system, which is determined by the hardware. After entering the minimum system, it determines whether the stack top pointer of the address burned by the APP system is correct to determine whether the APP is burned and start the APP. The official routine code is as follows:
/* Test if user code is programmed starting from address "ApplicationAddress" */
if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000)
{
/* Jump to user application */
JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);
Jump_To_Application = (pFunction) JumpAddress;
/* Initialize user application's Stack Pointer */
__set_MSP(*(__IO uint32_t*) ApplicationAddress);
Jump_To_Application();
}
The above is the first method. There is also a second method: after writing the APP program into Flash, write the relevant information in Flash. The minimum system program continuously detects and reads the information. If the information is read, write a flag to SRAM and restart the MCU. The rest also uses the above code, but the judgment condition is changed to the flag in SRAM.
Startup sequence
Regarding the startup sequence, there are more detailed instructions on the InternetNo IAP
Using IAP
Compilation of the minimum system and APP
The compilation of the minimum system can be done directly according to the normal project compilation, while the compilation of the APP requires special processing: the settings in keil are as follows:
The above is for the Flash address where the program is stored, and the interrupt vector table needs to be reset. You can use the functionvoid NVIC_SetVectorTable(u32 NVIC_VectTab, u32 Offset);
Call this function in the APP main function to set the offset. The offset should be equal to the offset of the program Flash.
Previous article:Porting STemWin to FreeRTOS on STM32F103RCT6
Next article:STM32L152 external interrupt configuration
Recommended ReadingLatest update time:2024-11-16 11:37
- Popular Resources
- Popular amplifiers
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
- PWM wide-frequency generator
- Ti CC2540 Bluetooth module study notes
- Silicon Labs BG22-EK4108A Bluetooth Development Review - Unboxing
- [2022 Digi-Key Innovation Design Competition] + Unboxing of Raspberry Pi 400, shocking news
- I copied the op amp circuit, but I don't understand the function of one component.
- Application of depletion-mode MOSFET in industrial sensors and smart transmitters
- Last two days! Free trial: Tailing Micro's new generation of low-power, high-performance multi-protocol wireless kit B91
- Award-winning live broadcast: Beneng International launches millimeter-wave radar module based on Infineon technology, perfectly solving the pain points of PIR market
- [RISC-V MCU CH32V103 Evaluation] 3. USB HID routine operation
- 01_Basic principles of static timing analysis and timing analysis model