How to run to the main function after GD32 MCU starts
How to run to the main function entry after GD32 MCU is started? Do you also have such doubts? What did the MCU do before executing the main function? Here are the answers for you.
After the MCMCU is powered on, it will first start from the main Flash/SRAM/ISP based on the status of BOOT0 and BOOT1. If BOOT0 is low level, the MCU will start from the main Flash, that is, the data in the main Flash will be mapped to At the 0x0000 0000 address, the ARM processor will obtain the top of the stack pointer from the 0x0000 0000 address, and then obtain the reset interrupt entry address (boot code base address) from 0x0000 0004. As shown in the figure below, we can open a bin file at random and the first 4 words The first section is the MSP stack pointer, the next four bytes are the reset interrupt entry address, and the following is the interrupt vector table.
After the MCU finds the stack pointer and the reset interrupt entry address, it will load and execute the reset interrupt. The reset interrupt function is defined in the .s startup file. The specific definition is as follows. After entering the reset interrupt function, the SystemInit system initialization function is first executed. This function is mainly a system clock configuration function, and then jumps to the main function for execution. That is to say, the system clock has been configured before executing the main function. After executing the reset interrupt function, the MCU will enter the main function for execution.
;/* reset Handler */ Reset_Handler PROC EXPORT Reset_Handler (WEAK) IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP
#run #main #function #GD32 #MCU #starts
- Input-output relationship and circuit application diagram of voltage follower
- How to keep driving heavy loads when the voltage drops?
- Novel theory-based evaluation gives a clearer picture of fusion in the sun
- What are the disadvantages of IC temperature sensors?
- Control transformer overcurrent protection, grounding and applications
- What is the difference between chip packaging and SMD?
- Design and application of dry multi-channel priority amplifier
- Can igbt directly replace thyristor? What will be the impact of IGBT directly replacing thyristor?
- Easily understand the avalanche effect of power MOSFETs
- Google’s AI isn’t too ‘woke.’ It’s too rushed