前面幾個小節已經詳細介紹了標準外設庫的組成結構以及部分主要文件的功能描述,那么如果在開發中使用標準外設庫需要哪些描述呢?下面就進行簡要的介紹,這兒介紹的使用方法是與開發環境無關的,在不同的開發環境中可能在操作方式上略有不同,但是總體的流程都是一樣的,下一小節將介紹在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 */
評論
查看更多