🛠 Premier sketch sur le cœur M4 : le blink qui se flash par ADB

Arduino Portenta X8 · debutant · Schéma : IMG-portenta-x8-debutant-2-portenta-x8-premier-sketch-m4.svg — Arduino Portenta X8 avec le SoC STM32H747XI zoomé sur son cœur Cortex-M4 240 MHz, flèche de transfert USB-C vers la carte étiquée adb / upload Arduino, LED utilisateur clignotante, fenêtre Arduino IDE montrant le board Portenta X8 sélectionné

Objectives

Program the Arduino side of the X8: you are programming the Cortex-M4 of the STM32H747XI (up to 240 MHz) from the Arduino IDE, while the Cortex-M7 of the same SoC runs the "normally invisible" bridge firmware that exposes the MCU peripherals to Linux. The main difference from a classic board: the sketch is uploaded via ADB (upload.tool=adb, VID 0x2341 / PID 0x0061, application slot 0x08100000–0x08200000), not via standard serial. You will install the core, flash a blink, and understand the roles of the three embedded systems on the board.

Hardware

Full Code

// blink_m4.ino — coeur Cortex-M4 du STM32H747XI de la Portenta X8
// Carte : "Arduino Portenta X8" (arduino:mbed_portenta:portenta_x8)
// L'upload passe par ADB, pas par un port serie classique.

#include "SerialRPC.h"   // optionnel : monitor serie proxyfie vers Linux

int compteur = 0;

void setup {
  Serial.begin(115200);      // visible cote Linux via le service m4-proxy
  while (!Serial) {}
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.println("Portenta X8 - sketch M4 en vie");
}

void loop {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(500);
  digitalWrite(LED_BUILTIN, LOW);
  delay(500);
  Serial.print("tick ");
  Serial.println(compteur++);
}

Expected Verification

In the IDE, the upload displays progress via adb, then the sketch starts: the LED blinks at 1 Hz. The Serial of this sketch is not a classic USB serial port — it is proxied to Linux by the m4-proxy service (the RPC tutorial will teach you how to read it from a container). Keep an eye on the board: if the upload fails, adb devices must already respond before touching the code.

Common Errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials