flasher-core-arduino.sh
The X8 unique move: the Linux itself uploads the Arduino firmware to the real-time core via mboot. Backup, flash, run in three commands — OTA deployment for both worlds of the board becomes a plain script.
Hardware
An Arduino Portenta X8 (ST STM32MP1 module: quad Cortex-A7 Linux + dual Cortex-M4 real-time core, 8 GB eMMC, 2 GB LPDDR4, on-board Wi-Fi/BT, optional LTE). None; the compiled sketch (.bin) exported from the Arduino IDE.
Wiring
Nothing to wire: flashing goes from the Linux application to the internal MCU core.
How it works
mboot manages the core firmware partitions: --backup archives the current one, --flash writes the .bin, --run switches execution. Flash failure = rollback possible.
Running it
Linux side: SSH access (routed USB-C or network) on the Portenta Linux image, bash/Python scripts. Real-time side: Arduino IDE with the « Arduino Mbed OS Portenta X8 Boards » core, application M7 core, flashing via mboot from Linux.
Variants
Wire the flash into a CI pipeline (GitHub Actions builds the .bin, pushes it via scp and calls mboot).
flasher-core-arduino.sh
#!/bin/bash
# mboot : le Linux de la X8 flashe les coeurs Arduino (M7/M4).
# Preparer le .bin avec l'Arduino IDE (Portenta X8-M7 core),
# le copier sur la carte (scp), puis :
set -e
BIN="${1:?Usage: $0 firmware.bin [--reset]}"
if [ ! -f "$BIN" ]; then
echo "fichier introuvable : $BIN"
echo "Exporter le croquis (Sketch > Export Binary) puis scp :"
echo " scp firmware.bin root@<carte>:/tmp/"
exit 1
fi
# Sauvegarde du firmware courant.
mboot --backup > /tmp/backup-$(date +%F).tar 2>/dev/null || true
# Flash du coeur applicatif temps reel.
mboot --flash "$BIN"
# Redemarrer l'application flashee.
mboot --run
echo "Firmware Arduino applique."
# Pour revenir a l'etat d'usine :
# mboot --restore /tmp/backup-*.tar
# Logs du deploiement :
# journalctl -f (selon l'image)