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也没有问题。

 

posted @ 2021-12-28 15:47  lcdinfo  阅读(1855)  评论(0编辑  收藏  举报