STM32F10X_XX宏定义的选择

本文介绍了STM32F10X系列微控制器在使用STM32F10X_stdperiph库时如何正确选择宏定义。通过对比不同型号STM32F10X芯片的FLASH容量,明确了STM32F10X_LD、STM32F10X_MD、STM32F10X_HD和STM32F10X_CL宏的具体适用范围。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

//=====================================================================
//TITLE:
//    STM32F10X_XX宏定义的选择
//AUTHOR:
//    norains
//DATE:
//    Tuesday  12-October-2010
//Environment:
//    KEIL MDK 4.0
//    RedCow Board
//=====================================================================

 

     如果你使用stm32f10x_stdperiph_lib,会发现在stm32f10x.h文件会有一段关于宏选择的代码,如:

 

    至于要使用哪个宏,则需要根据具体的芯片来进行选择。那么,这些宏又对应着哪些具体的芯片呢?其实我们可以在《Reference manual》的第九章中找到答案,如文档截图:


 

    这段话的意思很明显,如果是STM32F105xx和STM32F107xx,是Connectivity Line Devices,则宏定义选择的是STM32F10X_CL;如果是别的型号,则根据FLASH的容量来进行选择。可能文字写的有点不太清楚,还是以表格来说明:

MCU 型号

FLASH大小

STM32F10X_LD

STM32F101xx

STM32F102xx

STM32F103xx

16 ~ 32 Kbytes

STM32F10X_MD

STM32F101xx

STM32F102xx

STM32F103xx

64 ~ 128 Kbytes

STM32F10X_HD

STM32F101xx

STM32F103xx

256 ~ 512 Kbytes

STM32F10X_CL

STM32F105xx

STM32F107xx

忽略

    这些参数,和MDK的设备参数一致,如图所示:
 

Build started: Project: deepone *** Using Compiler 'V5.06 update 6 (build 750)', folder: 'D:\Program Files\MDK\Core\ARM\ARMCC\Bin' Build target 'Target 1' compiling main.c... D:\Program Files\MDK\Pack\Keil\STM32F1xx_DFP\2.3.0\Device\Include\stm32f10x.h(8302): error: #5: cannot open source input file "stm32f10x_conf.h": No such file or directory #include "stm32f10x_conf.h" main.c: 0 warnings, 1 error compiling misc.c... D:\Program Files\MDK\Pack\Keil\STM32F1xx_DFP\2.3.0\Device\Include\stm32f10x.h(8302): error: #5: cannot open source input file "stm32f10x_conf.h": No such file or directory #include "stm32f10x_conf.h" D:\Program Files\MDK\Pack\Keil\STM32F1xx_DFP\2.3.0\Device\StdPeriph_Driver\src\misc.c: 0 warnings, 1 error compiling stm32f10x_gpio.c... D:\Program Files\MDK\Pack\Keil\STM32F1xx_DFP\2.3.0\Device\Include\stm32f10x.h(8302): error: #5: cannot open source input file "stm32f10x_conf.h": No such file or directory #include "stm32f10x_conf.h" D:\Program Files\MDK\Pack\Keil\STM32F1xx_DFP\2.3.0\Device\StdPeriph_Driver\src\stm32f10x_gpio.c: 0 warnings, 1 error compiling GPIO_STM32F10x.c... D:\Program Files\MDK\Pack\Keil\STM32F1xx_DFP\2.3.0\Device\Include\stm32f10x.h(8302): error: #5: cannot open source input file "stm32f10x_conf.h": No such file or directory #include "stm32f10x_conf.h" D:\Program Files\MDK\Pack\Keil\STM32F1xx_DFP\2.3.0\RTE_Driver\GPIO_STM32F10x.c: 0 warnings, 1 error compiling stm32f10x_rcc.c... D:\Program Files\MDK\Pack\Keil\STM32F1xx_DFP\2.3.0\Device\Include\stm32f10x.h(8302): error: #5: cannot open source input file "stm32f10x_conf.h": No such file or directory #include "stm32f10x_conf.h" D:\Program Files\MDK\Pack\Keil\STM32F1xx_DFP\2.3.0\Device\StdPeriph_Driver\src\stm32f10x_rcc.c: 0 warnings, 1 error ".\Objects\deepone.axf" - 5 Error(s), 0 Warning(s). Target not created. Build Time Elapsed: 00:00:01
最新发布
03-21
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值