CMSIS-DAP
我这里使用的是DAP下载器进行烧录的,这种调试器使用的是 标准CMSIS-DAP协议↗ ,而不是ST公司的ST-Link协议,所以说不能够使用STM32CubeProgrammer。
OpenOCD
我这边使用的是 OpenOCD↗ 进行程序的烧录,这是一项针对于嵌入式设备的调试提供帮助的开源项目,有兴趣的可以查看 OpenOCD User’s Guide↗ 进行学习。
sudo pacman -S openocd
安装完成之后,确保你的CMSIS-DAP调试器按照要求链接正常,可以运行以下命令进行链接测试:
myArch% openocd -f interface/cmsis-dap.cfg -f target/stm32h7x.cfg
Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: JTAG supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: Test domain timer supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 0 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 0
Info : CMSIS-DAP: Interface ready
Info : clock speed 1800 kHz
Info : SWD DPIDR 0x6ba02477
Info : [stm32h7x.cpu0] Cortex-M7 r1p1 processor detected
Info : [stm32h7x.cpu0] target has 8 breakpoints, 4 watchpoints
Info : gdb port disabled
Info : starting gdb server for stm32h7x.cpu0 on 3333
Info : Listening on port 3333 for gdb connections
出现以上信息,说明OpenOCD连接CMSIS-DAP成功。
使用 OpenOCD 烧录程序到 STM32H743
由于我们
前文
中已经烧录完成了固件,如build/stm32h743.hex
。进入到我们的固件根目录下运行以下指令:
openocd -f interface/cmsis-dap.cfg -f target/stm32h7x.cfg \
-c "program build/STM32H743.hex verify reset exit"
verify
验证烧录成功与否reset
烧录完成自动重启MCUexit
烧录完成后自动退出OpenOCD
如果烧录成功,终端输出如下:
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
shutdown command invoked