[Debugger]使用openocd+dap-link调试树莓派4B[Cortex-A72]

使用openocd+dap-link调试树莓派4B

2024-7-8
hongxi.zhu

1. 接线方式

这里的dap-link使用的是jtag的方式

dap-link树莓派4B
TDIPIN_37/GPIO26
TDOPIN_18/GPIO24
nRSTPIN_15/GPIO22
U_TXPIN_10/GPIO15
U_RXPIN_08/GPIO14
TMS/SWDIOPIN_13/GPIO27
TCK/SWCLKPIN_22/GPIO25
GNDGND

在这里插入图片描述

2. 修改OpenOCD的配置

由于使用的是jtag方式连接树莓派,但是OpenOCD的interface中的cmsis-dap.cfg是以swd方式连接,我们要参考它新建一个cmsis-dap-jtag.cfg

OpenOCD-20231002-0.12.0/share/openocd/scripts/interface/cmsis-dap-jtag.cfg

# SPDX-License-Identifier: GPL-2.0-or-later

#
# ARM CMSIS-DAP compliant adapter
#
# http://www.keil.com/support/man/docs/dapdebug/
#

adapter driver cmsis-dap

transport select jtag

# Optionally specify the serial number of CMSIS-DAP usb device.
# adapter serial 02200201E6661E601B98E3B9

运行OpenOCD

openocd -f interface/cmsis-dap-jtag.cfg -f target/bcm2711.cfg

运行GDB

aarch64-none-linux-gnu-gdb

运行效果如下:

C:\Users\hongxi.zhu>aarch64-none-linux-gnu-gdb
GNU gdb (Arm GNU Toolchain 13.3.Rel1 (Build arm-13.24)) 14.2.90.20240526-git
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=i686-w64-mingw32 --target=aarch64-none-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.linaro.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) target extended-remote :3333
Remote debugging using :3333
warning: No executable has been specified and target does not support
determining executable automatically.  Try using the "file" command.
0xffffffd84d36560c in ?? ()
(gdb) monitor targets
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0  bcm2711.ap         mem_ap     little bcm2711.cpu        running
 1* bcm2711.cpu0       aarch64    little bcm2711.cpu        halted
 2  bcm2711.cpu1       aarch64    little bcm2711.cpu        running
 3  bcm2711.cpu2       aarch64    little bcm2711.cpu        running
 4  bcm2711.cpu3       aarch64    little bcm2711.cpu        running
(gdb)

3. 调试例子

3.1 调试uboot

3.2 调试linux

3.2.1 调试驱动模块
3.2.2 调试内核

3.3 调试应用程序

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

坂田民工

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值