Building the project requires the following setup on the host machine, which preferebly runs a Debian-like linux distribution:
1. Install the following apt packages
libudev-dev
gdb-multiarch
picocom
openocd
curl
stlink-tools
binutils-multiarch
xxd
binutils-arm-none-eabi
srecord
2. Install Rust and Cargo
3. Install additional Rust tools
rustup component add llvm-tools-preview
rustup target add thumbv7em-none-eabihf
rustup install nightly
rustup +nightly target add thumbv7em-none-eabihf
cargo install cargo-binutils --vers 0.3.6
cargo install cargo-flash
cargo install cargo-make
cargo install microamp-tools --git https://github.com/rtfm-rs/microamp
4. Use the makefile from the project to build images
cargo make
After this step there are multiple outputs in the artifacts
directory.
- image-0.bin and image-1.bin: Binary image for each core
- image-0.elf and image-1.elf: ELF image for each core
- image-0.hex and image-1.hex: HEX image for each core
- merge.hex: A merged HEX image that contains code for both cores
1. Install the following dependencies
- VSCode, with extensions
- Docker
2. Open the project with VSCode
3. Reopen project in container
Press Ctrl+Shift+P and start typing Dev Container: Reopen in Container
and select that option.
4. Build using the command line
The container is built, use the shell in VSCode to build the project using the makefile.
cargo make
Use cargo flash
utility
cargo flash --chip STM32H747XIHx
Use cargo flash
utility
# Core 0
cargo flash --elf target/thumbv7em-none-eabihf/release/h747-dual-core-0 --chip STM32H747XIHx
# Core 1
cargo flash --elf target/thumbv7em-none-eabihf/release/h747-dual-core-1 --chip STM32H747XIHx
Use the STM32CubeProgrammer utility provided by STM. Tool can be downloaded from their website.
~~There is an error where project does not work after flashing, to fix it:~~This issue was fixed in this commit.
Soft reset or even power reset does not reset shared variables.
Follow this guide: https://s2e-systems.github.io/Debugging-embedded-Rust-programs-using-VS-Code/
Installing GDB:
sudo apt install -y gdb-multiarch openocd
sudo ln -s /usr/bin/gdb-multiarch /usr/bin/arm-none-eabi-gdb
Config file source: https://github.com/openocd-org/openocd/blob/master/tcl/board/st_nucleo_h747xi.cfg