Since becoming a teacher, the method of replacing the chip in the STM32 project has always been the most frequently asked question by beginners.
Take the microcontroller STM32F103RC replaced by STM32F103C8 as an example.
The first step is to change the chip model
Open the submenu Device of the project Options for Target.. to find STM32F103C8, select it and press OK, as shown in the following figure.
The second step is to change the global macro definition
1. Click the magic wand and find Define under the C/C++ submenu:
·2. Change STM32F10X_HD to STM32F103_MD, click OK, as shown in the figure below.
Reason for change
STM32F103RC is a large-capacity device, HD said, STM32F103C8 is a large-capacity device, MD said. Similarly, if it is a small-capacity device, it is LD. According to the name, the capacity type of the microcontroller can be determined. According to the naming rules of the reference manual of STM32, the capacity of the single-chip microcomputer is obtained, and the capacity type of the single-chip microcomputer can be known by comparing the data sheet. As shown below:
The third step is to change the startup file
1. Remove the startup_stm32f103x_hd.s file from the project
2. Add startup_stm32f103x_md.s to the project, because the startup files are different due to different capacities
Note: If startup_stm32f10x_md.s is not found, you can search it in the keil5 installation directory.
At the beginning of this year, I recorded a relatively systematic introductory single-chip microcomputer tutorial. The students who want it can just ask me to take it. It is free, and you can send me a private message~ There are also in the introduction.