stm32教你如何编译出LIB文件
的库文件:
本文引用地址:https://www.eepw.com.cn/article/201612/324463.htm
而不是像DX32的例程那样一堆C:
那么,本技巧篇例程就是教大家怎么生成那个.LIB 的文件的.
首先打开本程序,大家看到的整个工程就只有库文件:
因为这是把STM32的函数库编译成库的形式,所以你只需要包含函数库就行.
然后注意一点,stm32f10x_conf.h 文件中,所有的include都要开放
#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)
*/
这是因为当这堆C文件编译成*.LIB后,里面的内容将是恒定的,不能裁减的.(这是C语言的理
念,跟编译器什么的无关),所以我们必须开放所有H 文件,这样编译出来的LIB 文件才是全能
的.这个理解,就和普通的DX32例程中包含一大堆C文件的意义是一样的.只不过是我们先把
库函数那部分预先编译成LIB 文件.
评论