STM32F10X_XX宏定义的选择及含义

STM32F10X_XX宏定义的选择及含义

AMENG
2021-04-14 / 0 评论 / 0 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2021年09月24日,已超过945天没有更新,若内容或图片失效,请留言反馈。

IAR和Keil编译器中STM32F10X_XX宏定义的选择
!!!

其中USE_STDPERIPH_DRIVER和STM32F10X_HD什么意思?

(1)USE_STDPERIPH_DRIVER

to use or not the peripheral’s drivers in application code (i.e. code will be based on direct access to peripheral’s registers rather than drivers API) , this option is controlled by the #define USE_STDPERIPH_DRIVER

即这个定义控制了是否在应用中启用外设驱动。我们使用标准外设库本来就为了方便控制外设,所以要添加这个定义,以启用外设驱动。

(2)STM32F10X_HD

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

```c

#if !defined (STM32F10X_LD) & !defined (STM32F10X_MD) & !defined (STM32F10X_HD) & !defined (STM32F10X_CL)
/* #define STM32F10X_LD */ /*STM32F10X_LD: STM32 Low density devices */
/* #define STM32F10X_MD */ /*STM32F10X_MD: STM32 Medium density devices */
/* #define STM32F10X_HD */ /*STM32F10X_HD: STM32 High density devices */
#define STM32F10X_CL /*STM32F10X_CL: STM32 Connectivity line devices */
#endif

```
!!!

!!!
至于要使用哪个宏,则需要根据具体的芯片来进行选择。如果是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
忽略

!!!

0

评论 (0)

取消