Closed JF002 closed 2 years ago
You are welcome!
Actually the idea of blash is based on an OpenOCD script found here: https://github.com/bouffalolab/bl_mcu_sdk/blob/master/tools/bflb_flash_tool/utils/openocd/image-loader.cfg
Generally your script looks good - in my application some things are more complicated since the probe-rs lib doesn't know about mstatus ... But I guess the original script should help.
I'm on a mobile phone right now but I can look deeper tomorrow if needed.
Hope this helps to get it to work
Oh thanks for pointing me to the original script, I didn't know it existed! I've just tried it, with no success : the firmware is correctly stopped (I can see it on the serial output), the binary file seems to be correctly flashed (I checked with verify_image), but blfash ends with a timeout:
$ ./blflash-linux-amd64.1 flash /home/jf/git/bl602_cmake_mcusdk/cmake-build-debug/bl602_cmake_mcusdk.bin --port /dev/ttyUSB0
[INFO blflash::flasher] Start connection...
[TRACE blflash::flasher] 5ms send count 55
[TRACE blflash::flasher] handshake sent elapsed 113.957µs
[INFO blflash::flasher] Connection Succeed
Error: IO error: Operation timed out
caused by: Operation timed out
But now, I'm wondering... doesn't blflash also try to send the eflash_loader? Maybe your project uses a subset of blflash that only sends the firmware to the flash?
Yeah ... blflash will first try to download eflasher so you need a custom version that omits that step. That's one of the reasons I shamelessly copied the code
Otherwise it looks quite good
Hi!
I find this project really interesting, and I would like to reproduce the same functionality in an OpenOCD script, that would integrate more easily in my dev environment. I only need the part that downloads the eflasher bin into the RAM.
I hope you don't mind if I ask some help, even if it's not directly related to this project?
I tried to read the code (but I don't know Rust, unfortunately), and here's what I've tried so far:
/home/jf/git/blash/bin/eflasher.bin
is the fileeflash_loader_40m.bin
with the first 192 bytes stripped.OpenOCD runs this script without error, but it doesn't seem to work, and the MCU does not run the bootloader code (I checked the serial output).
Is my understanding of the code from Blash correct? Did I miss anything?
Thanks!