文章目录

最近的项目从Keil转到IAR,程序功能基本实现后,准备像在keil那样精减掉没调用的函数,以减小烧写文件的大小。翻了翻Help,只找到两个相关的选项:Multi-file Compilation和Discard Unused Publics,而且后者必须跟前者一同使用。这下就可犯难了,因为我的项目是C/C++混合的,不可能做Multi-file Compilation。
深入研究最终发现,根本没有必要设置什么,IAR会自动去掉没调用的函数。Help里Compiler reference/Linking your application/Linking considerations明确说明:
By default, ILINK removes any sections, section fragments, and global symbols that are not needed by the application.
查看map文件核对,果然如此。这下省事了。

文章目录