I apologize for not catching this sooner, but I did not include my process for reading binaries from the chips. here's a little short post on that.
The commands are all very similar and I'm using the same two config files as before, openocd-1.cfg and openocd-2.cfg. The commands for reading your binaries off of multiple chips are as follows. The blurb at the top is the relevant bit from the openocd manual.
# Command: flash read_bank num filename [offset [length]]
# Read length bytes from the flash bank num starting at offset and write
# the contents to the binary filename. If offset is omitted, start at
# the beginning of the flash bank. If length is omitted, read the
# remaining bytes from the flash bank. The num parameter is a
# value shown by flash banks.
openocd -d0 -f openocd-1.cfg -c 'reset halt' -c 'flash read_bank 0 a5-1.bin 0x08000000' -c 'reset' -c 'exit'
openocd -d0 -f openocd-2.cfg -c 'reset halt' -c 'flash read_bank 0 a5-2.bin 0x08000000' -c 'reset' -c 'exit'
If I run my little script with those commands in it...
./read-binaries Open On-Chip Debugger 0.11.0+dev-00546-g5795f4d3e (2021-12-22-14:13) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html debug_level: 0 target halted due to debug-request, current mode: Thread xPSR: 0xf1000000 pc: 0x00003660 msp: 0x20000330 wrote 16384 bytes to file a5-1.bin from flash bank 0 at offset 0x00000000 in 0.155701s (102.761 KiB/s) Open On-Chip Debugger 0.11.0+dev-00546-g5795f4d3e (2021-12-22-14:13) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html debug_level: 0 target halted due to debug-request, current mode: Thread xPSR: 0xf1000000 pc: 0x00003660 msp: 0x20000330 wrote 16384 bytes to file a5-2.bin from flash bank 0 at offset 0x00000000 in 0.154476s (103.576 KiB/s)
You can see that it starts correctly and reads until the end, giving the correct 16384 byte size files. And here are the files:
-rw-rw-r-- 1 clapp clapp 16384 Jan 13 18:42 a5-1.bin
-rw-rw-r-- 1 clapp clapp 16384 Jan 13 18:42 a5-2.bin
Then a quick little reprogram and verify that they run and we now have vetted binary files.
Cheers!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.