在SDK程序中,使用了math.h中声明的sqrt、log10等函数。由于math.h不包括sqrt等函数的定义,因此在程序编译过程中出现了如下的错误,
解决方法如下,在gcc linker中添加-lm选项即可
在Xilinx SDK软件中,当工程中的代码层次较多时,如下图,手动添加工程的include路径比较繁琐,
可以通过编辑xml文件的方式,将include路径导入到SDK中,
<cdtprojectproperties>
<section name="org.eclipse.cdt.internal.ui.wizards.settingswizards.IncludePaths">
<language name="s">
language>
<language name="c,S">
<includepath>../test/src/FreeRTOS_Relative/FreeRTOS_Kernel/includeincludepath>
<includepath>../test/src/FreeRTOS_Relative/FreeRTOS_Kernel/portableincludepath>
<includepath>../test/src/FreeRTOS_Relative/FreeRTOS_Kernel/includepath>
<includepath>../test/src/FreeRTOS_Relative/FreeRTOS_Plus_TCP/includeincludepath>
<includepath>../test/src/FreeRTOS_Relative/FreeRTOS_Plus_TCP/portable/Compiler/GCCincludepath>
<includepath>../test/src/FreeRTOS_Relative/FreeRTOS_Plus_TCP/portable/NetworkInterface/includeincludepath>
<includepath>../test/src/FreeRTOS_Relative/FreeRTOS_Plus_TCP/portable/NetworkInterface/Zynqincludepath>
<includepath>../test/src/USERincludepath>
language>
<language name="Object File">
language>
<language name="ld">
language>
section>
cdtprojectproperties>
使用导入的方式批量设置include路径时,有时会出现下述错误,
对比了一下出错前后的工程设置,发现在导入之后,C/C++ Build Setting中的设置发生了变化,下述篮框中的设置消失了,再手动添加也无济于事,
58295 - 14.7 SDK - An error occurs when attempting to add a user library to the build
上述链接中提到,当在C/C++ General中设置路径时,可能会导致makefile文件corrupting,
由于SDK中makefile一般是工程自动管理的,因此最好还是手动逐一添加include路径吧(/ □ )
有时,在SDK中添加了include路径后,编译时依然会报找不到路径的错误;此时,一种可能的原因是include path没有全部添加。要注意,如果A文件夹下有A01、A02、A03几个文件夹,即使A文件夹下没有h文件,依然需要将A文件夹添加到路径中,而不能仅仅添加A01、A02、A03这几个子文件夹。
SDK允许不同的文件设置不同的编译选项,可以分别设置文件是否优化、是否保留debug信息等
XILINX官方给出的方法是
In XPS:
照做之后会提示下述错误
之后如下图修改链接选项
提示如下错误
于是我自己在相应路径下先建了一个同名空文件,生成map文件成功
参考69084 - SDK: Stepping into a BSP function causes the Debug pointer to jump to disassembly
参考以下方法
总结起来,就是,编译阶段设置 -fdata-sections -ffunction-sections标志,链接阶段设置
-Wl,–gc-sections标志,实测如下,
在SDK中编译处理时,保留中间文件,就能在中间文件中查看宏展开后的处理情况,gcc的-save-temps标志能够达到这个效果。
为了文件夹路径改变后不用重新导入,需要对platform进行更新