I am trying to compile an SDK with the an embedded arm gcc compiler in cygwin. It is a makefile based SDK. My target is a cortex m3 device. My problem is, the SDK has a custom libc implementation for the target, and when I compile with the arm compiler (arm-none-eabi-gcc) it looks to pick up the gnu arm libc, not the SDK libc. This is resulting in a compilation error. I am positive the makefiles are correct (I copy and pasted the entire SDK from a computer where this was working). I no longer have access to that computer to try and verify / compare settings. I don't know how to prevent the arm gcc compiler from looking for its own implementation of the libc and instead point it to the correct implementation. Any help is greatly appreciated.
答案 0 :(得分:0)
可能有两种解决方案:
使用-nostdlib
链接器选项并显式链接所需的库和C运行时启动代码,因此链接器命令行可能包含以下内容:
-nostdlib -L / usr / myarmtools / gcc / lib -lc crt0.o
请注意-nostdlib
禁止libc libstdc ++和crt0.o的默认链接,因此您必须为库提供搜索路径(-L),或者通过它们的完整路径和文件名显式链接它们并链接目标的C运行时对象代码。
我使用选项2作为首选项,因为它可以在任何环境中使用。但是,如果您希望使用通用makefile来构建多个目标,则选项1可能很有用。