DapLink 命令行工具
命令列表
命令 | 功能说明 |
---|---|
? | help message |
init | init swd port |
scan | scan swd device |
speed | set swd speed |
asm | disasm instructions: disasm addr len |
mem | read memory: mem addr len |
write1 | write byte to memory: mem addr value |
write2 | write short to memory: mem addr value |
write4 | write word to memory: mem addr value |
i | board information |
r | reset mcu |
h | halt mcu |
s | step mcu |
c | run mcu |
f | fault diagnosis |
rh | reset and halt mcu |
sp | show stack contents |
reg | read/write register: reg idx [value] |
regs | read all registers |
pc | read/write PC: pc [value] |
dhcsr | read/write DBG_HCSR: dhcsr [value] |
demcr | read/write DBG_EMCR: demcr [value] |
aircr | read/write AIRCR: aircr [value] |
dp | read/write DP: dp addr [value] |
ap | read/write AP: ap addr [value] |
scp | copy file to mcu memory: scp file addr |
exec | remote exec: stack_base sp entry_addr LR [arg1,arg2,arg3,arg4] |
flash | flash mcu: flash ['file' |
init
初始化SWD PORT
scan
扫描链接到SWD端口的设备
swd>: scan
DP_DPIDR 0x2ba01477
DP_VERSION:0x1 REVISION:0x0 PARTNO:0xba DESIGNER:0x23b MIN:0x0
CPUID 0x412fc231 (M3: r2 p1) DP version:1
Desinger:ARM (0x043b) partno:186
TARGET:CH32F208W MEM:0x20000000 - 0x10000 FLASH:0x8000000 - 0x20000 erasesize:0x80
TARGET:STMicroelectronics Name: CH32F208W
MEM:0x20000000 - 0x20005000 FLASH:0x8000000 - 0x8020000
speed
设置 SWD 的时钟频率单位khz
asm 返汇编指令
asm 指令地址 地址长度(单位 BYTE)
swd>: asm 0x08000606 16
Read memory 0x08000606 Len:32 :Ok
d004 beq 0000078
68fb ldr r3, [r7, #12]
f403 0000 and r0, r3, #8388608
3380 adds r3, #128
2b00 cmp r3, #0
d0f2 beq 0000060
4b08 ldr r3, [pc, #32]
681b ldr r3, [r3, #0]
4a07 ldr r2, [pc, #28]
write1
写一个字节(BYTE)到目标地址
swd>: write1 0x20000000 0x12
write2
写二个字节(Short)到目标地址
swd>: write1 0x20000000 0x1234
write4
写四个字节(Word)到目标地址
swd>: write1 0x20000000 0x12345678
a
切换 SWD通道,同(act_port)
i
查看目标板信息
r
Reset 目标板
rh
Reset 目标板并且halt住 CPU
h
Halt 目标板
s
单步执行代码
c
continue(退出单步执行)
f
查看 target fault
sp
显示调用堆栈
reg
读、写寄存器
swd>: reg 0
REG[0] = 0xfa (250)
swd>: reg 0 0x123456
Write REG[0] = 0x123456 (1193046)
regs
显示所有寄存值
swd>: regs
PC = 08000606
R0 = 00123456, R1 = 00002ee0, R2 = e000e010, R3 = 00000001
R4 = e339e339, R5 = e339e339, R6 = e339e339, R7 = 2000fed8
R8 = 09934090, R9 = 2000ff00, R10= 9242908c, R11= 200001a8
R12= 00000014
SP(R13)= 2000fed8, MSP= 2000fed8, PSP= 00138070, R14(LR) = 08000277 SPSEL:1
XPSR = 21000000 , SPECIAL = 00138070
pc
查看、读写PC寄存器
swd>: pc
PC = 0x8000606
swd>: pc 0x8000608
PC = 0x8000608
dhcsr
查看DBG_HCSR寄存器
swd>: dhcsr
DBG_HCSR = 00030003
C_DEBUGEN = 1, C_HALT = 1, C_STEP = 0, C_MASKINTS = 0,
S_REGRDY = 1, S_HALT = 1, S_SLEEP = 0,
S_LOCKUP = 0, S_RESET_ST = 0, S_RETIRE_ST = 0
demcr
查看DBG_EMCR寄存器
swd>: demcr
DBG_EMCR = 00000001
VC_CORERESET = 1, VC_MMERR = 0, VC_NOCPERR = 0, VC_CHKERR = 0,
VC_STATERR = 0, VC_BUSERR = 0, VC_INTERR = 0, VC_HARDERR = 0,
MON_EN = 0, MON_PEND = 0, MON_STEP = 0, MON_REQ = 0, TRCENA = 0
swd>:
aircr
查看AIRCR寄存器
swd>: aircr
DBG_AIRCR = 0x00000001
SYSRESETREQ = 0, PRIGROUP = 0, VECTRESET = 1, VECTCLRACTIVE = 0,
swd>:
dp
读定 DP 寄存器
ap
读定 AP 寄存器
scp
将文件copy到目标板内存中(不支持 FLASH)
exec
远程执行代码 exec 栈基址 当前SP指针 目标地址 返回地址 参数0 参数1 参数2 参数3
exec 0x2000ff00 0x2000feb8 0x080001ec 08000277 0
flash
烧录Soc flash