我正在尝试使用openocd(STLINK-V2)对具有软设备(蓝牙堆栈)和应用程序固件(latest.hex)的nrf设备进行编程。
这是我正在使用的命令:
openocd -f interface/stlink.cfg -f target/nrf52.cfg -c init -c "reset init" -c halt -c "nrf5 mass_erase" -c "program btstack.hex verify" -c "program latest.hex verify" -c reset -c exit
它完成了,但是我不确定这是正确的方法吗?
我已经使用esptool.py来刷新esp设备,并且您需要指定要将每个十六进制文件闪存到的地址,但这对于openocd来说不是必需的吗? -它知道自动做什么吗?
固件可以运行,但是蓝牙似乎没有激活,我想知道第二个十六进制文件是否覆盖了第一个十六进制文件?
这是通过nrfjprog(我没有)使用Segger程序员的命令
nrfjprog --eraseall -f nrf52
nrfjprog --program drivers/bluetooth/s132_nrf52_6.0.0/s132_nrf52_6.0.0_softdevice.hex -f nrf52
nrfjprog --program build-pca10040-s132/firmware.hex --sectorerase -f nrf52
nrfjprog --reset -f nrf52
其中还有一个附加的“ --sectorerase”,这到底在做什么,我还需要在openocd命令中添加类似内容吗?
还有一个错误:“设置WORKAREASIZE 0”,但是如果我按照建议进行设置,则它报告空间不足,编程需要几分钟。
** Programming Started **
auto erase enabled
Info : Padding image section 0 at 0x00000a18 with 1512 bytes
Warn : using fast async flash loader. This is currently supported
Warn : only with ST-Link and CMSIS-DAP. If you have issues, add
Warn : "set WORKAREASIZE 0" before sourcing nrf51.cfg/nrf52.cfg to disable it
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000001e msp: 0xfffffffc
wrote 155648 bytes from file btstack.hex in 7.037133s (21.600 KiB/s)
** Programming Finished **
** Verify Started **
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000002e msp: 0xfffffffc
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000002e msp: 0xfffffffc
verified 151008 bytes in 0.529927s (278.281 KiB/s)
** Verified OK **
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00000998 msp: 0x20000400
** Programming Started **
auto erase enabled
Warn : using fast async flash loader. This is currently supported
Warn : only with ST-Link and CMSIS-DAP. If you have issues, add
Warn : "set WORKAREASIZE 0" before sourcing nrf51.cfg/nrf52.cfg to disable it
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000001e msp: 0x20000400
wrote 155648 bytes from file latest.hex in 7.042735s (21.583 KiB/s)
** Programming Finished **
** Verify Started **
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000002e msp: 0x20000400
verified 154652 bytes in 0.462758s (326.364 KiB/s)
** Verified OK **