前面几个小节已经详细介绍了标准外设库的组成结构以及部分主要文件的功能描述,那么如果在开发中使用标准外设库需要哪些描述呢?下面就进行简要的介绍,这儿介绍的使用方法是与开发环境无关的,在不同的开发环境中可能在操作方式上略有不同,但是总体的流程都是一样的,下一小节将介绍在MDK ARM开发环境下使用标准外设库的详细过程。
首先新建一个项目并设置工具链对应的启动文件,可以使用标准外设库中提供的模板,也可以自己根据自己的需求新建。标准外设库中已经提供了不同工具链对应的文件,位于STM32F10x_StdPeriph_Lib_V3.4.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup目录下。
其次按照使用产品的具体型号选择具体的启动文件,加入工程。文件主要按照使用产品的容量进行区分,根据产品容量进行选择即可。每个文件的具体含义可以在"stm32f10x.h"文件中找到对应的说明,摘录如下:
1 #if !defined (STM32F10X_LD) && !defined (STM32F10X_LD_VL) && !defined (STM32F10X_MD) && !defined (STM32F10X_MD_VL) && !defined (STM32F10X_HD) && !defined (STM32F10X_HD_VL) && !defined (STM32F10X_XL) && !defined (STM32F10X_CL)
2
3 /* #define STM32F10X_LD */ /*!< STM32F10X_LD: STM32 Low density devices */
4
5 /* #define STM32F10X_LD_VL */ /*!< STM32F10X_LD_VL: STM32 Low density Value Line devices */
6
7 /* #define STM32F10X_MD */ /*!< STM32F10X_MD: STM32 Medium density devices */
8
9 /* #define STM32F10X_MD_VL */ /*!< STM32F10X_MD_VL: STM32 Medium density Value Line devices */ /* #define STM32F10X_HD */ /*!< STM32F10X_HD: STM32 High density devices */
10
11 /* #define STM32F10X_HD_VL */ /*!< STM32F10X_HD_VL: STM32 High density value line devices */
12
13 /* #define STM32F10X_XL */ /*!< STM32F10X_XL: STM32 XL-density devices */
14
15 /* #define STM32F10X_CL */ /*!< STM32F10X_CL: STM32 Connectivity line devices */
16
17 #endif
18
19 /* Tip: To avoid modifying this file each time you need to switch between these
20
21 devices, you can define the device in your toolchain compiler preprocessor.
22
23 - Low-density devices are STM32F101xx, STM32F102xx and STM32F103xx microcontrollers
24
25 where the Flash memory density ranges between 16 and 32 Kbytes.
26
27 - Low-density value line devices are STM32F100xx microcontrollers where the Flash
28
29 memory density ranges between 16 and 32 Kbytes.
30
31 - Medium-density devices are STM32F101xx, STM32F102xx and STM32F103xx microcontrollers
32
33 where the Flash memory density ranges between 64 and 128 Kbytes.
34
35 - Medium-density value line devices are STM32F100xx microcontrollers where the
36
37 Flash memory density ranges between 64 and 128 Kbytes.
38
39 - High-density devices are STM32F101xx and STM32F103xx microcontrollers where
40
41 the Flash memory density ranges between 256 and 512 Kbytes.
42
43 - High-density value line devices are STM32F100xx microcontrollers where the
44
45 Flash memory density ranges between 256 and 512 Kbytes.
46
47 - XL-density devices are STM32F101xx and STM32F103xx microcontrollers where
48
49 the Flash memory density ranges between 512 and 1024 Kbytes.
50
51 - Connectivity line devices are STM32F105xx and STM32F107xx microcontrollers.
52
53 */
评论
查看更多