Hello everyone,
I would like to program in Rust on the Daisy Seed but I am running into issues while flashing the code.
Here are the steps to reproduce:
- Setup Rust development environment
# install rustc and cargo
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# install probe-run (with defmt)
cargo install \
--git https://github.com/knurling-rs/probe-run \
--branch main \
--features defmt
# install cargo-generate (with defmt)
cargo install cargo-generate
# generate project template for embedded dev
cargo generate \
--git https://github.com/knurling-rs/app-template \
--branch main \
--name daisy-seed
cd daisy-seed
- Now there are a few thing to customize in the template for the STM32H750IBK6 chip
# .cargo/config.toml
# TODO(2) replace `$CHIP` with your chip's name (see `probe-run --list-chips` output)
runner = "probe-run --chip STM32H750IBKx --defmt"
# TODO(3) Adjust the compilation target.
target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)
# Cargo.toml
# TODO(4) enter your HAL here (cf https://crates.io/crates/stm32h7xx-hal)
stm32h7xx-hal = {version = "0.7.1", features = ["stm32h743v","rt"]}
# src/lib.rs
// TODO(5) adjust HAL import
use stm32h7xx_hal as _; // memory layout
# Add `memory.x` linker script for `cortex-m-rt`
curl https://raw.githubusercontent.com/stm32-rs/stm32h7xx-hal/master/memory.x > memory.x
# Uncomment the FLASH length corresponding to STM32H750xB
FLASH : ORIGIN = 0x08000000, LENGTH = 128K
- Finally, build and flash the test program with:
cargo run --bin hello
.
This gives me the following error:
...
Running `probe-run --chip STM32H750IBKx --defmt target/thumbv7em-none-eabihf/debug/hello`
flashing program ..
[2020-09-05T11:20:15Z INFO probe_run] opened probe
[2020-09-05T11:20:15Z INFO probe_run] started session
[2020-09-05T11:20:15Z INFO probe_rs::flashing::download] Found 4 loadable sections:
[2020-09-05T11:20:15Z INFO probe_rs::flashing::download] .vector_table at 08000000 (664 byte0)
[2020-09-05T11:20:15Z INFO probe_rs::flashing::download] .text at 08000298 (1792 byte0)
[2020-09-05T11:20:15Z INFO probe_rs::flashing::download] .rodata at 080009A0 (372 byte0)
[2020-09-05T11:20:15Z INFO probe_rs::flashing::download] .data at 20000000 (48 byte0)
[2020-09-05T11:20:15Z WARN probe_rs::architecture::arm::core::m4] Reason for halt has changed, old reason was Halted(Unknown), new reason is Request
[2020-09-05T11:20:15Z WARN probe_rs::architecture::arm::core::m4] Reason for halt has changed, old reason was Halted(Request), new reason is Exception
[2020-09-05T11:20:15Z ERROR probe_rs::flashing::flasher] Failed to verify flash algorithm. Data mismatch at address 0x30000200
[2020-09-05T11:20:15Z ERROR probe_rs::flashing::flasher] Original instruction: 0xe00abe00
[2020-09-05T11:20:15Z ERROR probe_rs::flashing::flasher] Readback instruction: 0x000000
[2020-09-05T11:20:15Z ERROR probe_rs::flashing::flasher] Original: [e00abe00, 62d780d, ..., 52002114, 0]
[2020-09-05T11:20:15Z ERROR probe_rs::flashing::flasher] Readback: [0, 0, 0, ..., 0, 0]
Error: Error while flashing
Caused by:
The RAM contents did not match the expected contents after loading the flash algorithm.
Now I don’t know what to do to fix this issue.
I have looked at Electrosmith’s Arduino linker script but playing with the memory definitions did not give other outcome and I don’t understand much of the SECTIONS part…
I would appreciate if someone could help me debug this so that I can get to the fun part
Thank you in advance
NB:
- I use the STLINK-V3MINI as probe
- knurlings
app-template
:https://github.com/knurling-rs/app-template
- knurlings
app-template
setup withdefmt
: https://ferrous-systems.com/blog/defmt/