前面幾個(gè)小節(jié)已經(jīng)詳細(xì)介紹了標(biāo)準(zhǔn)外設(shè)庫的組成結(jié)構(gòu)以及部分主要文件的功能描述,那么如果在開發(fā)中使用標(biāo)準(zhǔn)外設(shè)庫需要哪些描述呢?下面就進(jìn)行簡要的介紹,這兒介紹的使用方法是與開發(fā)環(huán)境無關(guān)的,在不同的開發(fā)環(huán)境中可能在操作方式上略有不同,但是總體的流程都是一樣的,下一小節(jié)將介紹在MDK ARM開發(fā)環(huán)境下使用標(biāo)準(zhǔn)外設(shè)庫的詳細(xì)過程。
首先新建一個(gè)項(xiàng)目并設(shè)置工具鏈對(duì)應(yīng)的啟動(dòng)文件,可以使用標(biāo)準(zhǔn)外設(shè)庫中提供的模板,也可以自己根據(jù)自己的需求新建。標(biāo)準(zhǔn)外設(shè)庫中已經(jīng)提供了不同工具鏈對(duì)應(yīng)的文件,位于STM32F10x_StdPeriph_Lib_V3.4.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup目錄下。
其次按照使用產(chǎn)品的具體型號(hào)選擇具體的啟動(dòng)文件,加入工程。文件主要按照使用產(chǎn)品的容量進(jìn)行區(qū)分,根據(jù)產(chǎn)品容量進(jìn)行選擇即可。每個(gè)文件的具體含義可以在"stm32f10x.h"文件中找到對(duì)應(yīng)的說明,摘錄如下:
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 */
評(píng)論