I was having a few issues with my GIGA R1 WiFi board, well, actually, one of them has totally died on me (it no longer enters into DFU mode) so I've raised a support ticket with Arduino themselves.
There isn't much information online covering Rust bare-metal and the GIGA R1 WiFi board in particular but I found this blog post called "Visual Studio Code for C/C++ with ARM Cortex-M: Part 4 - Debug" which helped confirm some of my VSCode configuration.
I also came across this Cortex M Quickstart repo on Github which helped as a clean starting point. Of course, I needed to make updates for the target device (STM32H747XI) in
memory.x
and the cargo config for the build target architecture which is thumbv7em-none-eabihf
(Cortex-M7F).I'm compiling this like usual with
cargo build --release
although my flashing routine takes a few more steps using dfu-util
.Flashing the GIGA R1 WiFi board
First place the board into DFU mode, then we can check if it appears as a valid USB device (on Mac).
$ dfu-util -l
dfu-util 0.11
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Found DFU: [0483:df11] ver=0200, devnum=1, cfg=1, intf=0, path="0-1", alt=1, name="@Option Bytes /0x5200201C/01*128 e", serial="xxx"
Found DFU: [0483:df11] ver=0200, devnum=1, cfg=1, intf=0, path="0-1", alt=0, name="@Internal Flash /0x08000000/16*128Kg", serial="xxx"
We then need to convert our ELF file to a binary
bin
file. This is best achieved with some help from Homebrew and the ARM gcc toolchain with /opt/homebrew/bin/arm-none-eabi-objcopy -v -O binary quickstart quickstart.bin
. We are assuming your release build is called quickstart.Finally with can flash our bin file (ignore the bin size as this is from another project); this demo should be way way smaller. Make note that we are flashing the chip into address
0x8000_0000
. This removed the default Mbed OS bootloader. Follow these steps should you wish to revert.$ dfu-util -a 0 -d 0483:df11 -s 0x08000000 -D *.bin
dfu-util 0.11
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
dfu-util: Warning: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release
Opening DFU capable USB device...
Device ID 0483:df11
Device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Interface #0 ...
Determining device status...
DFU state(2) = dfuIDLE, status(0) = No error condition is present
DFU mode device DFU version 011a
Device returned transfer size 1024
DfuSe interface name: "Internal Flash "
Downloading element to address = 0x08000000, size = 137384
Erase [=========================] 100% 137384 bytes
Erase done.
Download [=========================] 100% 137384 bytes
Download done.