Tutorial: First Flash on M5Stack Core2

In this tutorial you will flash PylotOS onto an M5Stack Core2 over USB-C and verify the C HAL, PSRAM, and Dual-OTA partitions live in the MicroPython REPL.


Step 1: Identify Your Core2 Hardware Revision

M5Stack Core2 exists in two hardware revisions that use different Power Management ICs (PMICs):

Visual CheckRevisionPMIC at I2C 0x34Notes
Green power LEDCore2 v1.0AXP192Original release
Blue power LEDCore2 v1.1AXP2101 + INA3221 (0x40)Includes dedicated RTC backup cell

PylotOS uses a single unified m5stack_core2 firmware designed to auto-detect both revisions at runtime.


Step 2: Obtain the Full Flash Image (*-full.bin)

  1. Download the pylotos-m5stack_core2-firmware artifact from the latest green CI run under Actions (or from a GitHub Release once published).
  2. Extract pylotos-m5stack_core2-<version>-full.bin.

Important: Always use *-full.bin for initial USB flashing. Never flash *-ota.bin to address 0x1000 — *-ota.bin contains only the application partition image for wireless OTA updates.


Step 3: Flash Over USB-C with esptool

Install esptool and mpremote (in your Python environment):

pip install esptool mpremote

Erase the previous flash layout (recommended when switching from UIFlow/Arduino to PylotOS's 16 MiB Dual-OTA partition table) and flash PylotOS at offset 0x1000:

# Replace COM3 with your serial port (e.g., /dev/ttyUSB0 or /dev/cu.usbserial-* on Linux/macOS)
esptool --chip esp32 --port COM3 erase_flash
esptool --chip esp32 --port COM3 --baud 921600 write_flash 0x1000 pylotos-m5stack_core2-0.1.0-ci-full.bin

Step 4: Verify in the MicroPython REPL

Connect to the serial console using mpremote:

mpremote connect COM3 repl

Press Enter to see the >>> prompt, then run:

import json
import pylot
import hal
import sys_ota

# Inspect board identity, live PSRAM, and Dual-OTA partition state
print(json.dumps(pylot.describe()))

# Check hardware capability flags
print("Has display:", hal.has_cap("display"))
print("Has PSRAM:  ", hal.has_cap("psram"))

# Inspect active and next OTA slots
print("OTA status: ", sys_ota.status())

Expected Output Highlights