Hardware: An stm32 Development Board, St-link/v2
I. hardware related:
1. Pin Connection:
Pin7 <-> swio
Pin9 <-> swclk
Pin20/pin18 <-> Gnd
Pin19 <-> + 3.3 V (if you do not use St-link to power the board, do not connect)
2. Set in Keil:
1) In debug, select St-link Debugger
2) Select the St-link debugger and select Settings.
3) select Flash download and add programming algroithm. (I am using a chip of stm32f10x)
2. Software related:
Click here:
Then you can see:
Here is an example of gpio. I have added: cmsis-core (required), device-> gpio (gpio initialization), device-> startup (initial code) device-> stdpherphdrivers-> gpio control, device-> stdpherphdrivers-> RCC (clock control ).
If an error is reported during compilation, the Library is missing.
If a compilation error occurs, the file such as stm32f10x_conf.h is missing, and then set it here:
Add use_stdperiph_driver in define, add the directory where your project is located in includepaths, and copy stm32f10x_conf.h to the directory where the project is located. (Stm32f10x_conf.h can be found in the directory of keilv5. Do not direct the file directly, because each project may be modified as needed ).
If your project still fails to be compiled, you can search for it by yourself.