Keil MDK编译优化(不编译未使用的函数)


设置选项为: Options-C/C++中勾选上 One ELF Section per Function复选框
它的意义多是,每个函数独自设立建设一个 elf,link时能够仅把须要的函数编译进代码内里。

官方说法:
One ELF Section per Function:
Generate one ELF section for each function in source file. Output sections are named with the same name as the function that generates the section. Allows to optimize code or to locate each function on individual memory addresses.

这里有个文章:http://wenku.baidu.com/view/6bd94e60561252d380eb6e3e.html


有人提出不同意见:
这个选项是说,每个函数只存在一个,而不是复制多个,可以理解为 时间换空间。
意思是运行速度会慢一点。

也有人在选择了此项优化后,串口通信出了问题,去掉优化后就好了,有待考证.


我的使用:

选择此优化,但不选择Optimization优化(Level 0),暂时没有发现问题,串口xmodem烧录Flash也没有问题。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM