STM32F10X_XX宏定义的选择

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

//=====================================================================
//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的设备参数一致,如图所示:
 

Rebuild started: Project: STM32_Proj *** Using Compiler 'V5.06 update 6 (build 750)', folder: 'D:\Keil_v5\ARM\ARMCC\Bin' Rebuild target 'STM32F103ZE' compiling stm32f10x_adc.c... ..\Libraries\FWlib\src\stm32f10x_adc.c(23): error: #5: cannot open source input file "stm32f10x_adc.h": No such file or directory #include "stm32f10x_adc.h" ..\Libraries\FWlib\src\stm32f10x_adc.c: 0 warnings, 1 error compiling stm32f10x_cec.c... ..\Libraries\FWlib\src\stm32f10x_cec.c(23): error: #5: cannot open source input file "stm32f10x_cec.h": No such file or directory #include "stm32f10x_cec.h" ..\Libraries\FWlib\src\stm32f10x_cec.c: 0 warnings, 1 error compiling stm32f10x_can.c... ..\Libraries\FWlib\src\stm32f10x_can.c(23): error: #5: cannot open source input file "stm32f10x_can.h": No such file or directory #include "stm32f10x_can.h" ..\Libraries\FWlib\src\stm32f10x_can.c: 0 warnings, 1 error compiling stm32f10x_crc.c... ..\Libraries\FWlib\src\stm32f10x_crc.c(23): error: #5: cannot open source input file "stm32f10x_crc.h": No such file or directory #include "stm32f10x_crc.h" ..\Libraries\FWlib\src\stm32f10x_crc.c: 0 warnings, 1 error compiling stm32f10x_exti.c... ..\Libraries\FWlib\src\stm32f10x_exti.c(23): error: #5: cannot open source input file "stm32f10x_exti.h": No such file or directory #include "stm32f10x_exti.h" ..\Libraries\FWlib\src\stm32f10x_exti.c: 0 warnings, 1 error compiling stm32f10x_flash.c... ..\Libraries\FWlib\src\stm32f10x_flash.c(23): error: #5: cannot open source input file "stm32f10x_flash.h": No such file or directory #include "stm32f10x_flash.h" ..\Libraries\FWlib\src\stm32f10x_flash.c: 0 warnings, 1 error compiling stm32f10x_dac.c... ..\Libraries\FWlib\src\stm32f10x_dac.c(23): error: #5: cannot open source input file "stm32f10x_dac.h": No such file or directory #include "stm32f10x_dac.h" ..\Libraries\FWlib\src\stm32f10x_dac.c: 0 warnings, 1 error compiling misc.c... ..\Libraries\FWlib\src\misc.c(24): error: #5: cannot open source input file "misc.h": No such file or directory #include "misc.h" ..\Libraries\FWlib\src\misc.c: 0 warnings, 1 error compiling stm32f10x_dma.c... ..\Libraries\FWlib\src\stm32f10x_dma.c(23): error: #5: cannot open source input file "stm32f10x_dma.h": No such file or directory #include "stm32f10x_dma.h" ..\Libraries\FWlib\src\stm32f10x_dma.c: 0 warnings, 1 error compiling stm32f10x_bkp.c... ..\Libraries\FWlib\src\stm32f10x_bkp.c(23): error: #5: cannot open source input file "stm32f10x_bkp.h": No such file or directory #include "stm32f10x_bkp.h" ..\Libraries\FWlib\src\stm32f10x_bkp.c: 0 warnings, 1 error compiling system_stm32f10x.c... compiling stm32f10x_i2c.c... ..\Libraries\FWlib\src\stm32f10x_i2c.c(23): error: #5: cannot open source input file "stm32f10x_i2c.h": No such file or directory #include "stm32f10x_i2c.h" ..\Libraries\FWlib\src\stm32f10x_i2c.c: 0 warnings, 1 error compiling stm32f10x_iwdg.c... ..\Libraries\FWlib\src\stm32f10x_iwdg.c(23): error: #5: cannot open source input file "stm32f10x_iwdg.h": No such file or directory #include "stm32f10x_iwdg.h" ..\Libraries\FWlib\src\stm32f10x_iwdg.c: 0 warnings, 1 error compiling stm32f10x_pwr.c... ..\Libraries\FWlib\src\stm32f10x_pwr.c(23): error: #5: cannot open source input file "stm32f10x_pwr.h": No such file or directory #include "stm32f10x_pwr.h" ..\Libraries\FWlib\src\stm32f10x_pwr.c: 0 warnings, 1 error compiling stm32f10x_fsmc.c... ..\Libraries\FWlib\src\stm32f10x_fsmc.c(23): error: #5: cannot open source input file "stm32f10x_fsmc.h": No such file or directory #include "stm32f10x_fsmc.h" ..\Libraries\FWlib\src\stm32f10x_fsmc.c: 0 warnings, 1 error compiling stm32f10x_gpio.c... ..\Libraries\FWlib\src\stm32f10x_gpio.c(23): error: #5: cannot open source input file "stm32f10x_gpio.h": No such file or directory #include "stm32f10x_gpio.h" ..\Libraries\FWlib\src\stm32f10x_gpio.c: 0 warnings, 1 error compiling stm32f10x_rcc.c... ..\Libraries\FWlib\src\stm32f10x_rcc.c(23): error: #5: cannot open source input file "stm32f10x_rcc.h": No such file or directory #include "stm32f10x_rcc.h" ..\Libraries\FWlib\src\stm32f10x_rcc.c: 0 warnings, 1 error compiling stm32f10x_dbgmcu.c... ..\Libraries\FWlib\src\stm32f10x_dbgmcu.c(23): error: #5: cannot open source input file "stm32f10x_dbgmcu.h": No such file or directory #include "stm32f10x_dbgmcu.h" ..\Libraries\FWlib\src\stm32f10x_dbgmcu.c: 0 warnings, 1 error assembling startup_stm32f10x_hd.s... compiling stm32f10x_rtc.c... ..\Libraries\FWlib\src\stm32f10x_rtc.c(23): error: #5: cannot open source input file "stm32f10x_rtc.h": No such file or directory #include "stm32f10x_rtc.h" ..\Libraries\FWlib\src\stm32f10x_rtc.c: 0 warnings, 1 error compiling stm32f10x_sdio.c... ..\Libraries\FWlib\src\stm32f10x_sdio.c(23): error: #5: cannot open source input file "stm32f10x_sdio.h": No such file or directory #include "stm32f10x_sdio.h" ..\Libraries\FWlib\src\stm32f10x_sdio.c: 0 warnings, 1 error compiling stm32f10x_spi.c... ..\Libraries\FWlib\src\stm32f10x_spi.c(23): error: #5: cannot open source input file "stm32f10x_spi.h": No such file or directory #include "stm32f10x_spi.h" ..\Libraries\FWlib\src\stm32f10x_spi.c: 0 warnings, 1 error compiling stm32f10x_tim.c... ..\Libraries\FWlib\src\stm32f10x_tim.c(23): error: #5: cannot open source input file "stm32f10x_tim.h": No such file or directory #include "stm32f10x_tim.h" ..\Libraries\FWlib\src\stm32f10x_tim.c: 0 warnings, 1 error compiling stm32f10x_usart.c... ..\Libraries\FWlib\src\stm32f10x_usart.c(23): error: #5: cannot open source input file "stm32f10x_usart.h": No such file or directory #include "stm32f10x_usart.h" ..\Libraries\FWlib\src\stm32f10x_usart.c: 0 warnings, 1 error compiling stm32f10x_wwdg.c... ..\Libraries\FWlib\src\stm32f10x_wwdg.c(23): error: #5: cannot open source input file "stm32f10x_wwdg.h": No such file or directory #include "stm32f10x_wwdg.h" ..\Libraries\FWlib\src\stm32f10x_wwdg.c: 0 warnings, 1 error compiling main.c... D:\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include\stm32f10x.h(486): error: #5: cannot open source input file "core_cm3.h": No such file or directory #include "core_cm3.h" ..\Source\Main\main.c: 0 warnings, 1 error compiling stm32f10x_it.c... D:\Keil_v5\ARM\Packs\Keil\STM32F1xx_DFP\2.4.1\Device\Include\stm32f10x.h(486): error: #5: cannot open source input file "core_cm3.h": No such file or directory #include "core_cm3.h" ..\Source\Main\stm32f10x_it.c: 0 warnings, 1 error compiling core_cm3.c... ".\Objects\STM32_Proj.axf" - 25 Error(s), 0 Warning(s). Target not created. Build Time Elapsed: 00:00:05
09-12
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值