STM32F1 startup method

1. Three start-up methods of stm32f103: The
so-called start-up generally refers to the value of BOOT pin will be latched on the 4th rising edge of SYSCLK when we restart the chip after we download the program. The user can select the startup mode after reset by setting the state of the BOOT1 and BOOT0 pins.
Start mode
Main Flash memory
is the built-in Flash of STM32. Generally, when we download the program in JTAG or SWD mode, we download it into this, and start the program directly from here after restarting.
System memory is
started from the system memory, and the program function of this mode is set by the manufacturer. Generally speaking, this startup method is used less. System memory is a specific area inside the chip. When STM32 is shipped from the factory, ST has preset a BootLoader in this area, which is what we often call ISP program. This is a ROM and cannot be modified after leaving the factory. Generally speaking, when we choose this startup mode, it is to download the program from the serial port, because in the BootLoader provided by the manufacturer, the firmware of the serial port downloading program is provided, and the program can be downloaded to the Flash of the system through this BootLoader. But this download method requires the following steps:
Step1:
Set BOOT0 to 1, BOOT1 to 0, and then press the reset button to start BootLoader from the system memory.
Step2:
Finally, with the help of BootLoader, download the program to Flash via the serial port
Step3: After the
program is downloaded, it is necessary to set BOOT0 to GND and manually reset it, so that STM32 can be started from Flash. It is quite troublesome to download the program by using the serial port. It is necessary to jump around. Very little attention to user experience. Punctual Atom's serial port download circuit:
Download circuit
STM32 startup process:
The STM32's internal flash memory (flash) address starts at 0x08000000. Generally, the program file is written from the address. In addition, STM32 is a Cortex-M3 core-based microcontroller, which responds through an interrupt vector table. After the program starts, first take out the reset interrupt vector from the "interrupt vector table", execute the reset interrupt program to complete the startup, and the start address of this "interrupt vector table" is 0x8000004, when the interrupt comes, the internal hardware mechanism of STM32 will automatically change The PC pointer is positioned at the interrupt vector table, and the corresponding interrupt vector is taken out according to the interrupt source to execute the interrupt service routine.
In Figure 53.1.1, STM32 first fetches the address of the reset interrupt vector from the address 0x08000004 after reset, and jumps to the reset interrupt service routine, as shown in the title (1), after the reset interrupt is executed, it will jump To our main function. In Figure 53.1.1, after STM32 is reset, it first fetches the address of the reset interrupt vector from address 0x08000004 and jumps to the reset interrupt service routine.
Then, enter the corresponding interrupt service program according to the interrupt source, as shown in icon number 4. After the interrupt service is executed, the program returns to the main function again, as shown in icon number 5.
2

Guess you like

Origin blog.csdn.net/weixin_42595206/article/details/103603153