I'm excited about everything Rust and especially embedded stuff.
bjoernq / blash Goto Github PK
View Code? Open in Web Editor NEWA tool to flash BL602 via JTAG + serial without pressing buttons / setting jumpers
A tool to flash BL602 via JTAG + serial without pressing buttons / setting jumpers
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:
halt
reset
mwb 0x22010000 0x73
mwb 0x22010001 0x13
mwb 0x22010002 0x0
mwb 0x22010003 0x30
reg t1 0x80000000
reg pc 0x22010000
step
load_image /home/jf/git/blash/bin/eflasher.bin 0x22010000 bin
reset
reg pc 0x22010000
resume
/home/jf/git/blash/bin/eflasher.bin
is the file eflash_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!
Hi!
I'm currently experimenting on the Pine64 BL602 board from Pine64. I tried Blash using my Sipeed JTAG adapter and it works perfectly, thanks a lot for creating this tool!
Now, I was wondering what would it take to add support for the Pine64 JTAG adapter? It should be pretty similar to the Sipeed one, but have a different PID/VID :
Any idea if that would be possible? I would be happy to help but I don't know Rust, and I don't know where to start :/
Here the output of blash when I tried using the Pine64 adapter:
$ /home/jf/.cargo/bin/blash --port /dev/ttyUSB0 --monitor-baud 2000000 -- /home/jf/git/bl60cmake_mcusdk/cmake-build-debug/bl602_cmake_mcusdk.bin
[TRACE blash] Downloading eflasher
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Probe(ProbeSpecific(Custom { kind: Other, error: "libusb error code -1" }))', src/main.rs:129:47
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
$ RUST_BACKTRACE=1 /home/jf/.cargo/bin/blash --port /dev/ttyUSB0 --monitor-baud 2000000 -- /home/jf/git/bl602_cmake_mcusdk/cmake-build-debug/bl602_cmake_mcusdk.bin
[TRACE blash] Downloading eflasher
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Probe(ProbeSpecific(Custom { kind: Other, error: "libusb error code -1" }))', src/main.rs:129:47
stack backtrace:
0: rust_begin_unwind
at /build/rust/src/rustc-1.54.0-src/library/std/src/panicking.rs:515:5
1: core::panicking::panic_fmt
at /build/rust/src/rustc-1.54.0-src/library/core/src/panicking.rs:92:14
2: core::result::unwrap_failed
at /build/rust/src/rustc-1.54.0-src/library/core/src/result.rs:1355:5
3: blash::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
$ RUST_BACKTRACE=full /home/jf/.cargo/bin/blash --port /dev/ttyUSB0 --monitor-baud 2000000 -- /home/jf/git/bl602_cmake_mcusdk/cmake-build-debug/bl602_cmake_mcusdk.bin
[TRACE blash] Downloading eflasher
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Probe(ProbeSpecific(Custom { kind: Other, error: "libusb error code -1" }))', src/main.rs:129:47
stack backtrace:
0: 0x55ad7bf5e2d0 - std::backtrace_rs::backtrace::libunwind::trace::h930cf0be2ce43851
at /build/rust/src/rustc-1.54.0-src/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
1: 0x55ad7bf5e2d0 - std::backtrace_rs::backtrace::trace_unsynchronized::he8c90b95546147bf
at /build/rust/src/rustc-1.54.0-src/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x55ad7bf5e2d0 - std::sys_common::backtrace::_print_fmt::h2d518076e7529961
at /build/rust/src/rustc-1.54.0-src/library/std/src/sys_common/backtrace.rs:67:5
3: 0x55ad7bf5e2d0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc03afe5108b924f5
at /build/rust/src/rustc-1.54.0-src/library/std/src/sys_common/backtrace.rs:46:22
4: 0x55ad7bf7fefc - core::fmt::write::h03501fd186e1f342
at /build/rust/src/rustc-1.54.0-src/library/core/src/fmt/mod.rs:1110:17
5: 0x55ad7bf5bce5 - std::io::Write::write_fmt::he6bd3203a99cf841
at /build/rust/src/rustc-1.54.0-src/library/std/src/io/mod.rs:1588:15
6: 0x55ad7bf6032b - std::sys_common::backtrace::_print::h6d8d274cdb4b9345
at /build/rust/src/rustc-1.54.0-src/library/std/src/sys_common/backtrace.rs:49:5
7: 0x55ad7bf6032b - std::sys_common::backtrace::print::hdbba7107ed5db727
at /build/rust/src/rustc-1.54.0-src/library/std/src/sys_common/backtrace.rs:36:9
8: 0x55ad7bf6032b - std::panicking::default_hook::{{closure}}::h69616457d96cfc5a
at /build/rust/src/rustc-1.54.0-src/library/std/src/panicking.rs:208:50
9: 0x55ad7bf5fe01 - std::panicking::default_hook::h10bbc125f6ee1853
at /build/rust/src/rustc-1.54.0-src/library/std/src/panicking.rs:225:9
10: 0x55ad7bf60a04 - std::panicking::rust_panic_with_hook::h6eb033573a515ade
at /build/rust/src/rustc-1.54.0-src/library/std/src/panicking.rs:622:17
11: 0x55ad7bf604d7 - std::panicking::begin_panic_handler::{{closure}}::hffa4a3da6bf48f5f
at /build/rust/src/rustc-1.54.0-src/library/std/src/panicking.rs:519:13
12: 0x55ad7bf5e7cc - std::sys_common::backtrace::__rust_end_short_backtrace::h8245d4af937e663d
at /build/rust/src/rustc-1.54.0-src/library/std/src/sys_common/backtrace.rs:141:18
13: 0x55ad7bf60439 - rust_begin_unwind
at /build/rust/src/rustc-1.54.0-src/library/std/src/panicking.rs:515:5
14: 0x55ad7bd653f1 - core::panicking::panic_fmt::h497201afa0408fa6
at /build/rust/src/rustc-1.54.0-src/library/core/src/panicking.rs:92:14
15: 0x55ad7bd654e3 - core::result::unwrap_failed::h7d766b1c7851f7a7
at /build/rust/src/rustc-1.54.0-src/library/core/src/result.rs:1355:5
16: 0x55ad7bd9f4d0 - blash::main::h49a3cdd7b6c1e98f
17: 0x55ad7bd91433 - std::sys_common::backtrace::__rust_begin_short_backtrace::hcf2eda9647c8b481
18: 0x55ad7bda3e49 - std::rt::lang_start::{{closure}}::hb2a2d3efeeaaef23
19: 0x55ad7bf60f09 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h23da4485ce9c2fa2
at /build/rust/src/rustc-1.54.0-src/library/core/src/ops/function.rs:259:13
20: 0x55ad7bf60f09 - std::panicking::try::do_call::h26656c7c8049ab32
at /build/rust/src/rustc-1.54.0-src/library/std/src/panicking.rs:401:40
21: 0x55ad7bf60f09 - std::panicking::try::hafa31606aae6b61d
at /build/rust/src/rustc-1.54.0-src/library/std/src/panicking.rs:365:19
22: 0x55ad7bf60f09 - std::panic::catch_unwind::h12fc93c48e24c0bf
at /build/rust/src/rustc-1.54.0-src/library/std/src/panic.rs:434:14
23: 0x55ad7bf60f09 - std::rt::lang_start_internal::hb67ef9ab47b75f78
at /build/rust/src/rustc-1.54.0-src/library/std/src/rt.rs:34:21
24: 0x55ad7bd9f982 - main
25: 0x7f60d927cb25 - __libc_start_main
26: 0x55ad7bd65bce - _start
27: 0x0 - <unknown>
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.