为了方便想用jetson nano来给stm32下载程序。网上的ubuntu使用SEGGER官网驱动的方式在jetson的平台好像并不适用,因此使用了openocd来作为程序下载工具。
sudo apt-get install openocd
发现可以直接使用该指令进行安装,不用网上说的繁琐步骤。
openocd -f /interface/jlink.cfg -f /target/stm32f1x.cfg
使用该条指令之后报错如下
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: stm32f1x.cpu: IR capture error; saw 0x0f not 0x01
Warn : Bypassing JTAG setup events due to errors
Error: Invalid ACK (7) in DAP response
Error: JTAG-DP STICKY ERROR
Error: Could not initialize the debug port
看了一下,这是因为默认是JTAG,因为我使用的为JlinkOB,是SWD的,因此需要额外如下步骤
cd /usr/share/openocd/scripts/interface
sudo cp jlink.cfg jlink_swd.cfg
sudo vi jlink_swd.cfg
在里面添加一行
# http://www.segger.com/jlink.html
#
interface jlink
transport select swd
# The serial number can be used to select a specific device in case more than
保存退出。
openocd -f /interface/jlink——swd.cfg -f /target/stm32f1x.cfg
看到
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
这样一行,证明可以开始调试了。
参考:https://blog.csdn.net/zjx923759789/article/details/84335178