具体现象为:函数main只有一个空函数a,此函数来自文件a.c。即使这样代码也不能正常运行。解决方法:最后勾选编译选项One Elf per section解决。
我唯一能怀疑的就是:我包含了太多库文件。
我一直相信这辈子我不可能遇到编译错误,但事实就是这么残酷。
MDK版本是5.2x
对比map文件
不勾选One Elf per section:,只在Global Symbols里面有,其它地方都没有。
勾选One Elf per section:出现在Memory Map of the image中
One ELF Section per Function option tells the compiler to put all functions into their own individual ELF sections. This allows the linker to remove unused functions. An ELF code section typically contains the code for a number of functions. The linker is normally only able to remove unused ELF sections, not unused functions.