打印

stm32不用的外设头文件到底是注释掉还是都包含进去的?

[复制链接]
4143|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
weixinal|  楼主 | 2012-11-6 12:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
st库stm32f10x_conf.h里为什么提示用户可以注释掉不用的外设头文件,不注释掉有什么不好吗? 不要说是节省编译时间和节省程序空间的,注释掉得头文件相应的外设c文件也同样会被编译。

/* Includes ------------------------------------------------------------------*/
/* Uncomment/Comment the line below to enable/disable peripheral header file inclusion */
// #include "stm32f10x_adc.h"
// #include "stm32f10x_bkp.h"
// #include "stm32f10x_can.h"
// #include "stm32f10x_cec.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) */
沙发
byeyear| | 2012-11-7 15:44 | 只看该作者
1. 对程序空间确实没啥影响
2. 对编译时间影响相当大。
   编译器处理头文件是需要不少时间的,尤其是嵌套包含的头文件。
   注释掉不用的头文件,编译速度可以很多。lz试试就知道了。

使用特权

评论回复
板凳
weixinal|  楼主 | 2012-11-7 20:32 | 只看该作者
好吧,我试了一次,快了几秒,难道就只有这个作用

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:电工小店 http://shop63460958.taobao.com mailbox:wx-ta@163.com

4

主题

51

帖子

4

粉丝