一次失败的调试(试着把ads, axd, u-boot结合起来)
时间:2006-11-26 来源:游行到此
这是一次失败的调试. 郁闷也要记录一下.
周末在家里, 想使用asd自带的调试工具axd来调试u-boot. 这样想要移植u-boot就容易很多了, 拿出了我的板子, 开始了调试.
有两种方法可以实现. 一是将u-boot代码全部移植到asd下, 编译, 调试; 一是使用linux下的交叉编译工具编译, 然后将编译产生的elf格式的文件, 拿到axd下进行调试. 这两种实现方式都在网上搜索到了零星的片段.
关于第一种方法, 把u-boot的代码全部移植到asd下, 是个很复杂的过程. 当时在网上看到的资料, 作者花了很长时间并且改写了代码. 我按照以下步骤
· 根据asd中新建工程中选择”Makefile Importer Winzard”.
· Makefile Location选择了u-boot下的config.mk, 导入了工程.
· 点击设置(不会cublog贴图 ),
Target Settings/Linker: ARM Linker
Target Settings/Post-linker: ARM fromELF
ARM Assembler/Architecture of Processor: ARM920T
ARM C Compiler/Architecture of Processor: ARM920T
ARM C++ Compiler/Architecture of Processor: ARM920T
Thumb C Compiler/Architecture of Processor: ARM920T
Thumb C++ Compiler/Architecture of Processor: ARM920T
· 将u-boot文件夹下的文件全部拖到ads下.
· 点击编译, 出了2254个错误. 第一条大概的意思就是不能识别#include里的<>. 所以重新点击设置
Access Path/Always Search User Paths 选中
· 再次编译, 出了这种信息.
Error : C2285E: expected ‘;’ or ‘,’ – inserted ‘;’ before ‘int’ bitops.h line 11
- 再次编译, 出了这种信息. 第一种方案到此为止.
关于第二种方式, 按照传统的方法进行编译, 将生成的u-boot(ELF格式)放到axd下进行调试.出现类似” DBT Warning 00056: Debug table format error at offset 0xd4 in area .debug_info”的信息. 试了以下方式进行扭转.
- 在网上搜索的资料, 说是交叉编译工具3.3.2版本不可以, 应该使用2.95.3, 于是更换了编译工具, 但是2.95.3编译出现了类似”cannot exec cpp0”的错误.
- 再次搜索, 说是2.95.3不能放在自定义的目录下, 应该放在/usr/local下, 于是调整了目录, 但是未果.
- 在邮件列表上看到说是编译工具链可能有问题, 于是下载了eldk的编译工具链, 编译之. 未果.
- 在arm的网站上看到以下信息:
“To load images built with RVCT 3.0 into armsd and AXD, you must compile your application using the --dwarf2 command-line option. “
试着加入的这个编译选项到arm_config.mk, 但是交叉工具链不认识此选项. - 查看了gcc的man手册, 找到了几个类似的选项, 未果.
-feliminate-dwarf2-dups
Compress DWARF2 debugging information by eliminating duplicated
information about each symbol. This option only makes sense when
generating DWARF2 debugging information with -gdwarf-2.
-mno-dwarf2-asm -mfixed-range=register-range
-mdwarf2-asm
Don’t (or do) generate assembler code for the DWARF2 line number
debugging info. This may be useful when not using the GNU assem-
bler.
总结一下, 个人觉得想将u-boot代码移植到ads下, 必将是个很复杂的过程. 采用这种方式不会提高效率, 反而找来了麻烦, 降低了效率. 不过如果是为了深入的学习, 这到是一个好的方式. 第二种方式应该是比较合理的, 但是没有找到实现的好方法. 就当设置一个断点在这了, 下次接着调试.