STM32 - Keil中启动文件的选择和固件库宏定义
● 启动文件的选择
1. Low-density devices (STM32F10nx4 = 16k, STM32F10nx6 = 32k)
- startup_stm32f10x_ld_vl.s: 小容量超值型。STM32F100xx系列,闪存16k~32k字节。
- startup_stm32f10x_ld.s: 小容量型。STM32F101xx, STM32F102xx, STM32F103xx系列,闪存16k~32k字节。
2. Medium-density devices (STM32F10nx8 = 64k, STM32F10nxB = 125k)
- startup_stm32f10x_md_vl.s: 中容量超值型。STM32F100xx系列,闪存64k~128k字节。
- startup_stm32f10x_md.s: 中容量型。STM32F101xx, STM32F102xx, STM32F103xx系列,闪存64k~128k字节。
3. High-density devices (STM32F10nxC = 256k, STM32F10nxD = 384k, STM32F10nxE = 512k)
- startup_stm32f10x_hd_vl.s: 大容量超值型。STM32F100xx系列,闪存256k~512k字节。
- startup_stm32f10x_hd.s: 大容量型。STM32F101xx, STM32F103xx系列,闪存256k~512k字节。
4. XL-density devices (STM32F10nxF = 768k, STM32F10nxG = 1024k)
- startup_stm32f10x_xl.s: 超大容量型。S TM32F101xx, STM32F103xx系列,闪存512k~1024k字节。
5. Connectivity line devices (STM32F105xx, STM32F107xx)
- startup_stm32f10x_cl.s: 互联型。TM32F105xx, STM32F107xx系列。
● 使用固件库的宏定义
在Keil中使用固件库时工程需要进行配置,在工程选项中的”C/C++”标签页有预处理的宏定义,在这里需要定义USE_STDPERIPH_DRIVER,并根据使用STM32的器件类型进行定义,同启动项名称类似。
/* #define STM32F10X_LD */ /*!< STM32F10X_LD: STM32 Low density devices */
/* #define STM32F10X_LD_VL */ /*!< STM32F10X_LD_VL: STM32 Low density Value Line devices */
/* #define STM32F10X_MD */ /*!< STM32F10X_MD: STM32 Medium density devices */
/* #define STM32F10X_MD_VL */ /*!< STM32F10X_MD_VL: STM32 Medium density Value Line devices */
/* #define STM32F10X_HD */ /*!< STM32F10X_HD: STM32 High density devices */
/* #define STM32F10X_HD_VL */ /*!< STM32F10X_HD_VL: STM32 High density value line devices */
/* #define STM32F10X_XL */ /*!< STM32F10X_XL: STM32 XL-density devices */
/* #define STM32F10X_CL */ /*!< STM32F10X_CL: STM32 Connectivity line devices */