使用Jtag进行Linux调试 - [ARM9] [AT91SAM9G25] - Amontec,openocd,gdb,eclipse

时间:2012-10-26 10:30:41

标签: debugging linux-kernel u-boot jtag openocd

我正在尝试使用此系统启动内核调试: Amontec JTAGkey2,openocd,gdb,eclipse。

最后,我想调试在其中运行的内核和应用程序。 我几乎没有问题,似乎我需要经常解决它们。 现在我有CPU暂停/恢复,读/写RAM 缺少什么:进入,跳过,C / C ++级调试。

我做了以下事情: - 连接JTAG,上电板,通过Uboot启动带有调试消息的uImage - 启动openocd:

# openocd -f /usr/share/openocd/scripts/interface/jtagkey2.cfg -f /usr/share/openocd/scripts/board/at91sam9g20-ek.cfg

输出:

jtag_nsrst_delay: 200
jtag_ntrst_delay: 200
RCLK - adaptive
     TapName            | Enabled |   IdCode      Expected    IrLen IrCap  IrMask Instr     
---|--------------------|---------|------------|------------|------|------|------|---------
 0 | at91sam9g20.cpu    |    Y    | 0x00000000 | 0x0792603f | 0x04 | 0x01 | 0x0f | 0x0f
Info : max TCK change to: 30000 kHz
Info : RCLK (adaptive clock speed)
Info : JTAG tap: at91sam9g20.cpu tap/device found: 0x0792603f (mfg: 0x01f, part: 0x7926, ver: 0x0)
Info : Embedded ICE version 6

问题从这里开始:

OpenOCD的:

Warn : acknowledgment received, but no packet pending
undefined debug reason 6 - target needs reset
Warn : target not halted

蚀:

symbol-file /opt/Tixi_Repos/KiwiG6v2/buildroot-2011.05/package_tixi/linux-2.6.39/arch/arm/boot/compressed/vmlinux
target remote localhost:3333
start () at arch/arm/boot/compressed/head.S:108
108 kphex r5, 8 /* end of kernel */

似乎JTAG正在尝试将代码加载到0x0中,我认为这是错误的:

enter image description here

更新1

在分析了ARM的一些在线教程后:

Eclipse重置和暂停命令不起作用。最好取消选中它们并写入命令窗口。也可以添加加载地址:

monitor halt
load arch/arm/boot/compressed/vmlinux 0x22000000

我不使用

monitor reset

我让Uboot启动并初始化RAM和其他外围设备。然后我通过进入shell来停止Uboot。然后我让eclipse将linux写入RAM,并启动它。它需要很长时间,但效果会更好。内核在RPC初始化时启动和停止,而不返回控制台。

  • 是否可以在Uboot控制台中将内核加载到RAM中,然后启动JTAG会话?
  • [load ...]和[monitor load ...]命令之间有什么区别
  • 为什么我需要加载/压缩/ vmlinux而不是uImage?
  • 在eclipse窗口中我有两个加载字段:加载图像我加载符号。我禁用了两个选项但只写了load arch / arm / boot / compressed / vmlinux 0x22000000。这可能是下一个问题的原因吗?

更新2 : 好。谢谢你的提示。

我取得了一些进展。你能给我一些建议,也许我还在做错事。

现在我的内核在JTAG控制下运行,但我仍然无法在源代码级别上进行调试。

我这样做:

  1. 打开电路板,进入uboot shell。
  2. 启动openOCD会话
  3. 在内核调用上设置bootm.c中的Uboot断点:

    cleanup_before_linux ();
    theKernel (0, machid, bd->bi_boot_params);
    
  4. 启动eclipse调试会话:

    • monitor halt
    • 加载uboot-a无偏移

      load u-boot-2010.06/u-boot 
      Loading section .text, size 0x349ec lma 0x26f00000
      
    • 启动uboot并让它运行

    • uboot停止“theKernel”调用
  5. 我知道内核位于地址0x20008000。

    1. 重新启动openOCD会话
    2. 使用内核配置再次启动ecipse调试器:

      • monitor halt
      • 在地址0x20008000上加载内核

        load arch/arm/boot/compressed/vmlinux 0x20008000
        Loading section .text, size 0x8bdc7c lma 0x20008000
        
      • 启动debugg session
    3. 现在一切正常,内核启动,但我仍然无法在源代码级别进行调试。

      “符号不可用” enter image description here DEBUG和DEBUG_INFO用于内核。

      vmlinux截图

      对于我来说,这个文件中有大约50个功能符号似乎是个巨大的变化。

      enter image description here

0 个答案:

没有答案