You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用JLink JTAG加载二进制至DRAM失败,寻求调试解决方法

环境信息

  • 系统:Ubuntu-20.04.5
  • JLink驱动版本:6.72
  • 目标芯片:全志Cortex-A7(基于sun8i,双ARMv7核心)
  • JTAG可正常识别目标,识别日志如下:
Connecting to target via JTAG
ConfigTargetSettings() start
Setting up: AW Cortex-A7
ConfigTargetSettings() end
TotalIRLen = 4, IRPrint = 0x01
JTAG chain detection found 1 devices:
 #0 Id: 0x5BA00477, IRLen: 04, CoreSight JTAG-DP
AP map detection skipped. Manually configured AP map found.
AP[0]: AHB-AP (IDR: Not set)
AP[1]: APB-AP (IDR: Not set)
Using preconfigured AP[1] as APB-AP
AP[1]: APB-AP found
ROMTbl[0][0]: CompAddr: 80050000 CID: B105900D, PID:04-004BB906 CTI
ROMTbl[0][1]: CompAddr: 81000000 CID: B105100D, PID:08-00A9CC32 ROM Table
ROMTbl[1][0]: CompAddr: 81010000 CID: 00000000, PID:00-00000000 ???
ROMTbl[1][1]: CompAddr: 81020000 CID: 00000000, PID:00-00000000 ???
ROMTbl[1][2]: CompAddr: 81400000 CID: B105100D, PID:04-000BB4A7 ROM Table
ROMTbl[2][0]: CompAddr: 81410000 CID: B105900D, PID:04-005BBC07 Cortex-A7
Found Cortex-A7 r0p5
6 code breakpoints, 4 data breakpoints
Debug architecture ARMv7.1
Data endian: little
Main ID register: 0x410FC075
I-Cache L1: 32 KB, 512 Sets, 32 Bytes/Line, 2-Way
D-Cache L1: 32 KB, 128 Sets, 64 Bytes/Line, 4-Way
Unified-Cache L2: 256 KB, 512 Sets, 64 Bytes/Line, 8-Way
System control register:
  Instruction endian: little
  Level-1 instruction cache enabled
  Level-1 data cache enabled
  MMU enabled
  Branch prediction enabled
Memory zones:
  [0]: Default (Default access mode)
  [1]: AHB-AP (AP0) (DMA like acc. in AP0 addr. space)
  [2]: APB-AP (AP1) (DMA like acc. in AP1 addr. space)
Cortex-A7 identified.

核心问题

尝试通过JLink JTAG将二进制文件下载至目标板DRAM(起始地址0x40000000)时,执行loadbin a.bin 0x40000000报错-1,提示“failed to read memory”,必须执行r命令重置JTAG端口才能重新读取内存。

JLinkGDBServer与gdb可正常调试通过Windows工具烧录至RAM的代码(读写内存操作正常),但执行gdb命令load a.elf或JLinkExe中loadbin命令均无法成功写入DRAM。

测试操作与报错详情

1. GDB加载add.elf测试

  • 操作流程:启动JLinkGDBServer,使用gdb-multiarch连接,执行monitor reset后可读取0x40000000地址内存,执行load add.elf后无法访问该地址。
  • GDB操作日志:
(gdb) monitor reset
Resetting target
(gdb) x/8x 0x40000000
0x40000000:     0xea00001e      0x736f7472      0x00000000      0xa143480d
0x40000010:     0x0008b630      0x0008b630      0x0008b630      0x2e302e30

(gdb) load add.elf
`/home/t/develop/ctest/add.elf' has changed; re-reading symbols.
(no debugging symbols found)
Loading section .note.gnu.build-id, size 0x24 lma 0x100b4
Loading section .text, size 0x64 lma 0x40000000
Start address 0x40000000, load size 136
Transfer rate: 5 KB/sec, 68 bytes/write.

(gdb) x/8x 0x40000000
0x40000000 <main>:      Cannot access memory at address 0x40000000
  • JLinkGDBServer同步报错:
Downloading 36 bytes @ address 0x000100B4
Downloading 100 bytes @ address 0x40000000
Writing register (PC = 0x40000000)
Reading all registers
WARNING: Failed to read memory @ address 0x40000000

2. JLinkExe加载zero.bin测试

  • 操作流程:执行r命令重置目标后可读取0x40000000内存,执行loadbin zero.bin 0x40000000时报错。
  • 操作日志:
J-Link>r
Reset delay: 0 ms
Reset type NORMAL: Toggle reset pin and halt CPU core.
J-Link>mem32 0x40000000 16
40000000 = EA00001E 736F7472 00000000 A143480D
40000010 = 0008B630 0008B630 0008B630 2E302E30
40000020 = 00000030 2E302E30 00000030 40000000
40000030 = 00000000 00000000 00000000 00000000
40000040 = 00000000 00000000 00000000 00000000
40000050 = 00000040 00000000
J-Link>loadbin zero.bin 0x40000000
Downloading file [zero.bin]...
Unspecified error -1
J-Link>

3. sunxi-fel工具尝试

  • 初始可识别设备,执行写入命令后超时,后续无法识别设备,需重启板卡恢复。
  • 操作日志:
(base):~/tools/sunxi-tools-master$ sudo ./sunxi-fel -v --list
USB device 001:035   Allwinner R528    93406400:0c004814:0146880a:044713cd

(base):~/tools/sunxi-tools-master$ sudo ./sunxi-fel -p write 0x40000000 ~/u-boot.bin
usb_bulk_send() ERROR -7: Operation timed out

(base):~/tools/sunxi-tools-master$ sudo ./sunxi-fel -v --list
usb_bulk_send() ERROR -7: Operation timed out

需求

寻求通过JLink JTAG将二进制镜像加载至DRAM进行调试的可行方案。

内容的提问来源于stack exchange,提问作者wangt13

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.02 20:30:44