1

我正在尝试使用此系统启动内核调试: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

问题从这里开始:

开放式:

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中,我想这是不正确的:

在此处输入图像描述

更新 1

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

Eclipse Reset 和 Halt 命令不能完美运行。最好取消选中它们并写入命令窗口。还可以添加加载地址:

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...] 命令有什么区别
  • 为什么我需要加载 /compressed/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 调试会话:

    • 监控暂停
    • 加载没有偏移量的uboot-a

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

    • uboot 停止“theKernel”调用

我知道内核位于地址 0x20008000。

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

    • 监控暂停
    • 在地址 0x20008000 上加载内核

      load arch/arm/boot/compressed/vmlinux 0x20008000
      Loading section .text, size 0x8bdc7c lma 0x20008000
      
    • 启动调试会话

现在一切正常,内核启动,但我仍然无法在源代码级别进行调试。

“符号不可用” 在此处输入图像描述 DEBUG 和 DEBUG_INFO 为内核打开。

vmlinux 截图

在我看来,这个文件中有大约 50 个函数符号。

在此处输入图像描述

4

0 回答 0