標(biāo)題: STM32啟動(dòng)文件選擇說(shuō)明 [打印本頁(yè)]

作者: 51hei社區(qū)    時(shí)間: 2016-1-11 04:47
標(biāo)題: STM32啟動(dòng)文件選擇說(shuō)明
先說(shuō)這個(gè)問(wèn)題,大家都知道,我們?cè)谶x擇使用哪些外圍的的時(shí)候,是去更改從官方模版中拷貝過(guò)來(lái)的stm32f10x_conf.h文件的27-48行,把我們要用的外圍的頭文件包含進(jìn)來(lái),不用的外圍的頭文件注釋掉,但是你是否發(fā)現(xiàn)我們根本沒(méi)有在用戶主程序文件中包含stm32f10x_conf.h這個(gè)文件。那我們的修改這個(gè)文件怎么進(jìn)入主程序文件的呢?答案只有一個(gè),它包含在stm32f10x.h這個(gè)文件中,因?yàn)樵谟脩糁魑募形覀兊谝痪渚褪褂昧?include "stm32f10x.h",所以應(yīng)該是stm32f10x.h這個(gè)文件包含了stm32f10x_conf.h,間接的包含進(jìn)了用戶主程序文件中。(其實(shí)大家去看看固件庫(kù)的文件結(jié)構(gòu)圖就明白了確實(shí)是這樣,我們推測(cè)是對(duì)的,參見(jiàn)下圖1)

        

         圖1. STM32F10xxx標(biāo)準(zhǔn)外設(shè)庫(kù)體系結(jié)構(gòu)

2. 有了上面的認(rèn)識(shí)我們打開(kāi)stm32f10x_conf.h中搜索“stm32f10x_conf.h”,我們?cè)?291-8293行看見(jiàn)這么幾句代碼:
    #ifdef USE_STDPERIPH_DRIVER
      #include "stm32f10x_conf.h"
    #endif
  大家看到問(wèn)題所在了吧?這個(gè)條件編譯就是說(shuō):如果定義了USE_STDPERIPH_DRIVER標(biāo)記,那么就包含stm32f10x_conf.h,沒(méi)有定義就不包含。那不用說(shuō)了,我們想使用固件庫(kù),所以就應(yīng)該預(yù)定義USE_STDPERIPH_DRIVER這個(gè)標(biāo)記,KEIL提供了編譯前預(yù)定義標(biāo)記的辦法,就是上面提到的在項(xiàng)目設(shè)置“option for targe”=>“C/C++”標(biāo)簽=>“define”處加USE_STDPERIPH_DRIVER。如下圖2所示:

        
        圖2. Keil開(kāi)發(fā)環(huán)境(C/C++預(yù)設(shè)置窗口)


        3. 大家肯定看見(jiàn)上面標(biāo)記預(yù)設(shè)置區(qū)我還加入了另一個(gè)標(biāo)記STM32F10X_HD,是因?yàn)榇蠹視?huì)發(fā)現(xiàn)49-58行:需要我們指定期間的型號(hào)
 #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)

/* #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 */

#endif
 

:請(qǐng)問(wèn)一下, STM32的STM32F10X_MD_VL和STM32F10X_MD有什么區(qū)別呀?
- startup_stm32f10x_ld_vl.s: for STM32 Low density Value line devices
- startup_stm32f10x_ld.s: for STM32 Low density devices
- startup_stm32f10x_md_vl.s: for STM32 Medium density Value line devices
- startup_stm32f10x_md.s: for STM32 Medium density devices
- startup_stm32f10x_hd.s: for STM32 High density devices
- startup_stm32f10x_xl.s: for STM32 XL density devices
- startup_stm32f10x_cl.s: for STM32 Connectivity line devices
cl:互聯(lián)型產(chǎn)品,stm32f105/107系列
vl:超值型產(chǎn)品,stm32f100系列
xl:超高密度產(chǎn)品,stm32f101/103系列
ld:低密度產(chǎn)品,F(xiàn)LASH小于64K
md:中等密度產(chǎn)品,F(xiàn)LASH=64 or 128
hd:高密度產(chǎn)品,F(xiàn)LASH大于128


        轉(zhuǎn)載內(nèi)容,具體根據(jù)自己的情況設(shè)置。

startup_stm32f10x_cl.s 互聯(lián)型的器件,STM32F105xx,STM32F107xx
startup_stm32f10x_hd.s 大容量的STM32F101xx,STM32F102xx,STM32F103xx
startup_stm32f10x_hd_vl.s 大容量的STM32F100xx
startup_stm32f10x_ld.s 小容量的STM32F101xx,STM32F102xx,STM32F103xx
startup_stm32f10x_ld_vl.s 小容量的STM32F100xx
startup_stm32f10x_md.s 中容量的STM32F101xx,STM32F102xx,STM32F103xx
startup_stm32f10x_md_vl.s 中容量的STM32F100xx
startup_stm32f10x_xl.s FLASH在512K到1024K字節(jié)的STM32F101xx,STM32F102xx,STM32F103xx


cl:互聯(lián)型產(chǎn)品,stm32f105/107系列
vl:超值型產(chǎn)品,stm32f100系列
xl:超高密度產(chǎn)品,stm32f101/103系列
ld:低密度產(chǎn)品,F(xiàn)LASH小于64K
md:中等密度產(chǎn)品,F(xiàn)LASH=64 or 128
hd:高密度產(chǎn)品,F(xiàn)LASH大于128






歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1