KEIL5 使用STM32 官方例程

1. 安装keil5,破解

网上很多安装包/教程,跳过

2.下载官方固件库

https://www.st.com/content/st_com/en.html 

在这里找微处理器,STM32 standard peripheral Library。找起来有点麻烦,下面给出最后找到的地址

https://www.st.com/en/embedded-software/stm32-standard-peripheral-libraries.html

下载对应的库。这里我下载了F1。

得到ZIP,解压得到

Project中有例程

examples里有各种外设(ADC,DAC,USART等)的例程,Template里则是工程模板

 

3.

工程模板里,EWARM里是IAR软件的工程文件,MDK-ARM里的是Keil uVision的工程文件,双击打开

4. 端口例程 ADC为例

在刚刚的example文件夹打开

ProjectSTM32F10x_StdPeriph_ExamplesADC3ADCs_DMA

里面有readme文件

@par How to use it ? 

In order to make the program work, you must do the following :
 - Copy all source files from this example folder to the template folder under
   ProjectSTM32F10x_StdPeriph_Template
 - Open your preferred toolchain 
 - Rebuild all files and load your image into target memory
 - Run the example 

对比之下明白了使用例程的方法就是替换template文件夹下的source file为例程的sourcefile (刚好一一对应),然后打开MDKARM文件夹下的工程。

建议保存一个Template的副本,以防后续的变故。

保存副本后,替换,打开工程试一试

可见工程已经换为刚刚替换的例程

原文地址:https://www.cnblogs.com/lqerio/p/12514261.html