新聞中心

EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > stm32教你如何編譯出LIB文件

stm32教你如何編譯出LIB文件

作者: 時(shí)間:2016-12-01 來(lái)源:網(wǎng)絡(luò) 收藏
這個(gè)是生成LIB的技巧.也許大家在網(wǎng)上看到某些程序會(huì)發(fā)現(xiàn),他們用這個(gè)方式來(lái)包含STM32

的庫(kù)文件:

本文引用地址:http://butianyuan.cn/article/201612/324463.htm


而不是像DX32的例程那樣一堆C:


那么,本技巧篇例程就是教大家怎么生成那個(gè).LIB 的文件的.
首先打開(kāi)本程序,大家看到的整個(gè)工程就只有庫(kù)文件:


因?yàn)檫@是把STM32的函數(shù)庫(kù)編譯成庫(kù)的形式,所以你只需要包含函數(shù)庫(kù)就行.
然后注意一點(diǎn),stm32f10x_conf.h 文件中,所有的include都要開(kāi)放
#include "stm32f10x_adc.h"
#include "stm32f10x_bkp.h"
#include "stm32f10x_can.h"
#include "stm32f10x_crc.h"
#include "stm32f10x_dac.h"
#include "stm32f10x_dbgmcu.h"
#include "stm32f10x_dma.h"
#include "stm32f10x_exti.h"
#include "stm32f10x_flash.h"
#include "stm32f10x_fsmc.h"
#include "stm32f10x_gpio.h"
#include "stm32f10x_i2c.h"
#include "stm32f10x_iwdg.h"
#include "stm32f10x_pwr.h"
#include "stm32f10x_rcc.h"
#include "stm32f10x_rtc.h"
#include "stm32f10x_sdio.h"
#include "stm32f10x_spi.h"
#include "stm32f10x_tim.h"
#include "stm32f10x_usart.h"
#include "stm32f10x_wwdg.h"
#include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions)
*/
這是因?yàn)楫?dāng)這堆C文件編譯成*.LIB后,里面的內(nèi)容將是恒定的,不能裁減的.(這是C語(yǔ)言的理
念,跟編譯器什么的無(wú)關(guān)),所以我們必須開(kāi)放所有H 文件,這樣編譯出來(lái)的LIB 文件才是全能
的.這個(gè)理解,就和普通的DX32例程中包含一大堆C文件的意義是一樣的.只不過(guò)是我們先把
庫(kù)函數(shù)那部分預(yù)先編譯成LIB 文件.


上一頁(yè) 1 2 下一頁(yè)

關(guān)鍵詞: stm32LIB文

評(píng)論


技術(shù)專(zhuān)區(qū)

關(guān)閉