Since becoming a teacher, the method of replacing the chip in the STM32 project has always been the most frequently asked question by beginners.

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.

86152e156798c551c1de6fc1a7fd507c.png

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.

302650491169789c0f8decf9b8c930e2.png

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:

2765bfbf227f62d5f1b9636480cd1d51.png

2ecf13586c8ec64c8edcf184665e12c0.png

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

b807c634fbaf23559e8dd546e7eedaf0.png

a6fdaf566f278a225e6f4ede0e16c75a.png

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.

Guess you like

Origin blog.csdn.net/danpianji777/article/details/123994216
Recommended