portenta-h7 provides examples for the Arduino Portenta-H7 board written in Rust. The entry point address for the application is located at 0x08040000 to which the Arduino bootloader jumps. The software can be flashed on the target either with USB (DFU), or with a debug probe (JLink, ST-Link). Flashing with Arduino IDE is not supported.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup target add thumbv7em-none-eabihf
cargo install cargo-embed cargo-binutils
Installing on MacOSX is slightly different. The easiest way to install rust
on OSX is using HomeBrew.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Installing rustup
is preferred over installing rust
:
brew install rustup
The brew formula will install rustup-init
. Execute rust-init
and select 1
to install rust
. Next add the following:
rustup target add thumbv7em-none-eabihf
rustup component add llvm-tools-preview
cargo install cargo-embed cargo-binutils
Install the tool for flashing the target:
brew install dfu-util
The installation is complete!
To build an example, run the following command:
cargo <example_name> [--release]
For instance, to build rtic_blinky
:
cargo rtic_blinky
- If not already, install dfu-utils on your system.
- Connect USB to Portenta.
- Set the Portenta in bootloader mode by pressing the reset button twice.
- Generate the target binary by running the following command:
For example, to generate the target binary for
cargo <example_name>-bin
rtic_blinky
, run the following command:cargo rtic_blinky-bin
- Flash the binary to the target by running the following command:
For example, to flash
dfu-util -a 0 -d 2341:035b --dfuse-address=0x08040000:leave -D <binary_path>
rtic_blinky
, run the following command:dfu-util -a 0 -d 2341:035b --dfuse-address=0x08040000:leave -D target/thumbv7em-none-eabihf/release/examples/rtic_blinky.bin
- Connect the probe to the JTAG port of the breakout board.
- Run the following command:
For example, to flash
cargo <example_name>-probe [--release]
rtic_blinky
, run the following command:cargo rtic_blinky-probe