Hi all,
Firstly thanks for this great work! I've finally found something much more organized than CMSIS-Pack's flashing algorithm! I'm trying to implement a flash algorithm for STM32WLJC. Here's the implementation: https://github.com/huming2207/stm32wle5-flash-algo/blob/master/src/main.rs
Then I tried running RUST_BACKTRACE=1 cargo run
, here's what I've got:
Test: Erasing sectorwise and writing two pages ...
Message: Init
Message: Erase sector addr:0x8000000
Message: Erase sector addr:0x8000800
thread 'main' panicked at 'Not all sectors were erased', /home/hu/.cargo/registry/src/github.com-1ecc6299db9ec823/target-gen-0.16.0/src/commands/test.rs:99:5
stack backtrace:
0: rust_begin_unwind
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/std/src/panicking.rs:575:5
1: core::panicking::panic_fmt
at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/core/src/panicking.rs:65:14
2: target_gen::commands::test::cmd_test
3: target_gen::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
However, if I use pyocd cmd
and run rw 0x08000000 128
, here's what I've got:
pyocd> rw 0x08000000 4096
08000000: ffffffff ffffffff ffffffff ffffffff |................|
08000010: ffffffff ffffffff ffffffff ffffffff |................|
08000020: ffffffff ffffffff ffffffff ffffffff |................|
08000030: ffffffff ffffffff ffffffff ffffffff |................|
08000040: ffffffff ffffffff ffffffff ffffffff |................|
08000050: ffffffff ffffffff ffffffff ffffffff |................|
08000060: ffffffff ffffffff ffffffff ffffffff |................|
08000070: ffffffff ffffffff ffffffff ffffffff |................|
...
08000e40: ffffffff ffffffff ffffffff ffffffff |................|
08000e50: ffffffff ffffffff ffffffff ffffffff |................|
08000e60: ffffffff ffffffff ffffffff ffffffff |................|
08000e70: ffffffff ffffffff ffffffff ffffffff |................|
08000e80: ffffffff ffffffff ffffffff ffffffff |................|
08000e90: ffffffff ffffffff ffffffff ffffffff |................|
08000ea0: ffffffff ffffffff ffffffff ffffffff |................|
08000eb0: ffffffff ffffffff ffffffff ffffffff |................|
08000ec0: ffffffff ffffffff ffffffff ffffffff |................|
08000ed0: ffffffff ffffffff ffffffff ffffffff |................|
08000ee0: ffffffff ffffffff ffffffff ffffffff |................|
08000ef0: ffffffff ffffffff ffffffff ffffffff |................|
08000f00: ffffffff ffffffff ffffffff ffffffff |................|
08000f10: ffffffff ffffffff ffffffff ffffffff |................|
08000f20: ffffffff ffffffff ffffffff ffffffff |................|
08000f30: ffffffff ffffffff ffffffff ffffffff |................|
08000f40: ffffffff ffffffff ffffffff ffffffff |................|
08000f50: ffffffff ffffffff ffffffff ffffffff |................|
08000f60: ffffffff ffffffff ffffffff ffffffff |................|
08000f70: ffffffff ffffffff ffffffff ffffffff |................|
08000f80: ffffffff ffffffff ffffffff ffffffff |................|
08000f90: ffffffff ffffffff ffffffff ffffffff |................|
08000fa0: ffffffff ffffffff ffffffff ffffffff |................|
08000fb0: ffffffff ffffffff ffffffff ffffffff |................|
08000fc0: ffffffff ffffffff ffffffff ffffffff |................|
08000fd0: ffffffff ffffffff ffffffff ffffffff |................|
08000fe0: ffffffff ffffffff ffffffff ffffffff |................|
08000ff0: ffffffff ffffffff ffffffff ffffffff |................|
As you see, the flash has been emptied.
I've also checked the target-gen
's code and here's something that made me a bit confused: https://github.com/probe-rs/probe-rs/blob/dc5eb11ba23a5abfd1dd734385b93c7edd60f490/target-gen/src/commands/test.rs#L98
I'm not sure why it's hardcoded to 0x0? I think it probably should be to whichever the microcontroller's flash base address is. For my STM32WLE5JC, it should be 0x08000000. May I ask, am I right? Have I misinterpreted something?
Regards,
Jackson