STM32
| F103MINI
开发板开发与学习之点灯时间:2023-03-11
1.F103MINI开发板资料
2.Embedfire-stm32f103-mini gitee代码仓库
3.【野火®】零死角玩转STM32—F103-MINI.pdf
4.野火STM32F103_MINI开发板资料下载
KEIL5
链接:https://pan.baidu.com/s/15ZeM1wbuZc9uohPn12HIQA
提取码:kspq
[lanfeiye@fly-vm Keil MDK-ARM 5.14]$ tree
.
├── Crack
│ ├── Keygen 1.exe
│ └── Keygen 2.exe
└── mdk514.exe
点击“
mdk514.exe
”进行安装;除了下面图中步骤需要注意,其他的直接点击下一步直到安装完成;
keil5最新版安装与破解:http://t.zoukankan.com/yelang-lkg-p-9679511.html;以管理员模式打开KEIL5软件;
Keil主题设置:https://blog.csdn.net/Ltter1/article/details/116161920
STM32
芯片包keil的官网下载:http://www.keil.com/dd2/pack/
Keil.STM32F1xx_DFP.2.4.0.pack
: https://keilpack.azureedge.net/pack/Keil.STM32F1xx_DFP.2.4.0.pack链接:https://pan.baidu.com/s/1Rm2ANAnGRLSIgrG5hiKN7A 提取码:mj7j
资料(需要开发板的电路原理图及芯片数据手册):
1.
F103-MINI
原理图.pdf目录: D:\05_study\STM32\F103 Mini\A盘(资料盘)\6-STM32官方资料\1-STM32官方手册LastWriteTime Length Name------------- ------ ---- 2010/11/14 10:04 14306739 1-STM32F10x-中文参考手册.pdf 2015/5/16 17:30 13016697 1-STM32F10x-英文参考手册.pdf 2016/7/21 16:01 2901411 2-STM32F103xCDE_数据手册-中文.pdf 2015/8/17 16:02 1731731 2-STM32F103xCDE_数据手册-英文.pdf 2015/8/3 10:21 6923614 CM3权威指南CnR2.pdf 2016/8/5 10:09 1400739 STM32F10xxx Cortex-M3编程手册-英文版.pdf 2011/6/7 14:26 475567 STM32F10xxx闪存编程参考手册.pdf 2016/3/21 14:44 2624839 STM32系统存储器启动模式.pdf 2016/3/16 11:03 2517456 STM8和STM32产品选型手册.pdf
└─01-REG_LED
├─Listing
└─Output
CPU
File : D:\03_tools\DesTools\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.4.0\Keil.STM32F1xx_DFP.pdsc
Sequence : CheckID
Context : Item #1: Item #0: ::Line 2
Expression : " Message(2, "Not a genuine ST Device! Abort connection.");"
----------------------------^
E203 : Undefined identifier - function 'Message'
Keil升级ARM支持包后Loading PDSC Debug Description failed for XXX问题
在目录:
D:\03_tools\DesTools\Keil_v5\ARM\Pack\Keil
下搜索“startup_stm32f10x_hd.s
”;复制该文件到STM32\stm32-f103rct6-mini-prj\code\01-REG_LED
目录下;新建文件:stm32f10x.h 和 main.c,并添加到工程中。
Build target 'Target 1'
compiling main.c...
linking...
.\Output\LED-REG.axf: Warning: L6373W: libattrs.map file not found in System Library directory C:\Program Files (x86)\ARM\ADSv1_2\LIB\armlib\. Library selection may be impaired.
.\Output\LED-REG.axf: Warning: L6310W: Unable to find ARM libraries.
.\Output\LED-REG.axf: Error: L6411E: No compatible library exists with a definition of startup symbol __main.
Not enough information to list image symbols.
Not enough information to list the image map.
Finished: 2 information, 2 warning and 1 error messages.
".\Output\LED-REG.axf" - 1 Error(s), 2 Warning(s).
Target not created.
Build Time Elapsed: 00:00:00
Error: L6411E: No compatible library exists with a definition of startup symbol __main.
解决办法
Build target 'Target 1'
linking...
.\Output\LED-REG.axf: Error: L6218E: Undefined symbol SystemInit (referred from startup_stm32f10x_hd.o).
Not enough information to list image symbols.
Finished: 1 information, 0 warning and 1 error messages.
".\Output\LED-REG.axf" - 1 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed: 00:00:00
在mian.c文件中定义:
void SystemInit(void) { }
LED
把
GPIO
口的引脚设置为推挽输出并且默认下拉,输出低电平,点亮LED
。
stm32f10x.h
#ifndef __STM32F10X_H__
#define __STM32F10X_H__/* 片上外设基地址 */
#define PERIPH_BASE ((unsigned int)0x40000000)/* APB2 总线基地址 */
#define APB2PERIPH_BASE (PERIPH_BASE + 0x10000)
/* AHB总线基地址 */
#define AHBPERIPH_BASE (PERIPH_BASE + 0x20000)/* GPIOC外设基地址 */
#define GPIOC_BASE (APB2PERIPH_BASE + 0x1000)/* GPIOC寄存器地址,强制转换成指针 */
#define GPIOC_CRL *(unsigned int*)(GPIOC_BASE+0x00)
#define GPIOC_CRH *(unsigned int*)(GPIOC_BASE+0x04)
#define GPIOC_IDR *(unsigned int*)(GPIOC_BASE+0x08)
#define GPIOC_ODR *(unsigned int*)(GPIOC_BASE+0x0C)
#define GPIOC_BSRR *(unsigned int*)(GPIOC_BASE+0x10)
#define GPIOC_BRR *(unsigned int*)(GPIOC_BASE+0x14)
#define GPIOC_LCKR *(unsigned int*)(GPIOC_BASE+0x18)/*RCC外设基地址*/
#define RCC_BASE (AHBPERIPH_BASE + 0x1000)
/*RCC的AHB1时钟使能寄存器地址,强制转换成指针*/
#define RCC_APB2ENR *(unsigned int*)(RCC_BASE+0x18)#endif /* __STM32F10X_H__ */
main.c
#include "stm32f10x.h"void SystemInit(void)
{
}void soft_delay(unsigned int count)
{for(;count != 0; count --);
}int main(void)
{/* 配置RCC寄存器,使能GPIO口的时钟 */RCC_APB2ENR |= (1<<4);/* 配置CRL寄存器,配置为推挽输出 */GPIOC_CRL |= ( 1<<(4*2) );GPIOC_CRL |= ( 1<<(4*3) );/* 配套ODR寄存器 */GPIOC_ODR &= ~( 1<<2 );GPIOC_ODR &= ~( 1<<3 );while(1){GPIOC_ODR &= ~( 1<<2 );GPIOC_ODR &= ~( 1<<3 );soft_delay(0xfffff);GPIOC_ODR |= ( 1<<2 );GPIOC_ODR |= ( 1<<3 );soft_delay(0xfffff);}return 0;
}