Search › A-Z › M › Metro M4 Express
Metro M4 Express
The Adafruit Metro M4 (Express) is an Arduino-Uno-format development board built on a Microchip ATSAMD51J19A (a 120 MHz ARM Cortex-M4F, ARMv7E-M with a single-precision FPU, with 512 KB flash and 192 KB RAM) — emulated from scratch in the browser on this site's shared ARM core. It runs REAL compiled firmware: a flat flash image with the ARM vector table at 0x00000000 boots exactly as on silicon (SP and PC loaded from the table), then drives the real SAMD51 registers. The on-board surface a Metro M4 actually exposes is shown — the single WS2812 NeoPixel on PB22 (decoded from the real bit-banged 800 kHz line), the D13 built-in LED on PA16, and a SERCOM3 serial console (Serial1, TX PA22) that echoes what you type — with nothing invented: no breadboard, no fake audio (the Metro M4 has a DAC header but no on-board speaker, so it is honestly silent). Because the whole chip is ordinary JavaScript, it plugs into this site's shared debugger: the real Thumb-2 disassembler, live r0-r15 / xPSR / N-Z-C-V and the FPU s0-s31, side-effect-free FLASH / SRAM / peripheral / PORT memory at the real addresses, single-instruction step, execution breakpoints and write-watchpoints.
Adafruit Metro M4 (product 3382) ↗
Runs on: Web browser
Adafruit Metro M4 Express Online Emulator
Play Adafruit Metro M4 Express using JavaScript directly in your browser.
Controls
Configurations
| Configuration | Emulator | Machine | OS | Legal | |
|---|---|---|---|---|---|
| Blink D13 | Metro M4 Express | Metro M4 Express | open | Open ⛶ | |
| NeoPixel Rainbow | Metro M4 Express | Metro M4 Express | open | Open ⛶ | |
| TC0 Timer Blink | Metro M4 Express | Metro M4 Express | open | Open ⛶ | |
| Serial Terminal | Metro M4 Express | Metro M4 Express | open | Open ⛶ |
Chips
Notes
Embedding
This is a two-layer stack: a real ARM CPU core underneath, and a from-scratch SAMD51 SoC + Metro M4 board on top. It loads real Cortex-M4 flash images and runs them on the actual on-chip peripherals — the PORT GPIO, the SERCOM3 USART and the TC0 timer — at their real addresses. The bundled programs are genuine bare-metal firmware compiled with clang for thumbv7em, driving the real hardware paths, not a shim.
- The CPU.
cortex-m7.jsexecutes Thumb-2. The real chip is a Cortex-M4F (ARMv7E-M); this core is ARMv7-M, the same instruction-architecture family, so it runs the M4 image unchanged (these images are built soft-float, so no VFP init is needed). - Real reset. The image is a real flash image with the ARM vector table at
0x00000000: on reset the board loadsSPfrom word 0 andPCfrom word 1, exactly like the silicon. - The board, in JavaScript.
metro-board.jsmaps FLASH/SRAM/peripherals/PORT at their real SAMD51 addresses, decodes the WS2812 waveform the program bit-bangs on PB22 into a live RGB NeoPixel, advances the TC0 counter, feeds typed keys into the SERCOM3 RX FIFO, and copies every SERCOM3 DATA write into the serial console.
Debugger integration
metro-debug.js reads window.EMU_BOOT and hands the shared debugger a genuine ARM Cortex-M4F machine — the same core the firmware runs on, exposed instruction-accurately.
- Registers.
registers()reads r0-r12, SP, LR, PC, xPSR, the APSR flags N/Z/C/V and the FPv4 single-precision registers S0-S31 live each refresh; each has aset()that writes straight back into the core's register file. - Disassembly. FLASH is decoded with the shared
cortex-m7decoder (the Thumb-2 disassembler), so the code window shows real ARM mnemonics at the reset address0x00000000. - Single-step. Step calls
transport.stepInsn, which advances the core exactly one Thumb instruction; watch the WS2812 bit-bang toggle the PORT OUT register on PB22 as you step through the NeoPixel driver, or the reset handler zero.bssand fall intomain(). - Breakpoints & watchpoints. Execution breakpoints are a PC set the run-loop checks before each instruction; write watchpoints wrap the board's memory-write path and pause when a watched address is written (e.g. the PA
OUTSETat0x41008018or the SERCOM3DATAat0x41014028). Both are real. - Memory map. Six chips read the real address space side-effect-free: FLASH (program, disassembled at 0), SRAM (0x20000000), the low peripherals (0x40000000 — MCLK/GCLK/TC0), PORT (0x41008000 — watch PA/PB OUT/DIR/IN), SERCOM3 (0x41014000) and the DAC (0x43002400).
Architecture
The Adafruit Metro M4 (Express) is an Arduino-Uno-format development board built on a Microchip ATSAMD51J19A — a 120 MHz ARM Cortex-M4F with 512 KB flash and 192 KB RAM. This build models the SoC from scratch on the shared ARM core and wires the on-board surface a Metro M4 actually exposes.
- Cortex-M4F CPU — runs the real Thumb-2 image. FLASH is at
0x00000000(the vector table: word0 = initial SP, word1 = reset handler), SRAM at0x20000000, the low peripherals at0x40000000(MCLK/GCLK/TC0), the PORT GPIO at0x41008000, SERCOM3 at0x41014000and the DAC at0x43002400. On reset SP and PC are loaded from the vector table; the SAMD51 comes out of reset on DFLL48M, so no clock setup is needed. - NeoPixel (real WS2812 decode). The board carries one on-board WS2812 NeoPixel on PB22. A program clocks it by bit-banging the WS2812 800 kHz protocol — each bit is a HIGH pulse (long = 1, short = 0) then a LOW gap, and a long LOW latches the frame. The board watches the PORT OUT edges on PB22, measures each HIGH pulse in executed instructions to recover the bit, packs 24 bits (G,R,B) and lights the live RGB value. This is the genuine line protocol, decoded — not a framebuffer poke.
- D13 LED. The built-in LED is on
PA16, active-HIGH (lit when the pin is driven high). The board reads the PORT OUT/DIR of group A to light it. - SERCOM3 USART (serial console). The SAMD51's SERCOM3 at
0x41014000is the Metro M4's Serial1 (TX on PA22, RX on PA23). A program enables it and pollsINTFLAG.DREthen writesDATA; the board copies each transmitted byte into the on-screen serial console. Keys you type are pushed into the SERCOM3 RX FIFO and read back throughDATA— the terminal firmware echoes them. - TC0 timer. The TC0 timer/counter at
0x40003800runs in COUNT16 mode; the board advances its COUNT on the emulated instruction rate with the programmed prescaler, and aREADSYNCcommand latches COUNT for reading. The timer-blink program drives the LED straight from a bit of COUNT. - Content. Four original CC0 bare-metal programs compiled with clang for thumbv7em: NeoPixel Rainbow (default), Blink D13, TC0 Timer Blink and Serial Terminal. No proprietary firmware is used.
- Honest limits. The Metro M4 has a DAC header (A0/A1) but no on-board speaker, so this emulator is genuinely silent with no sound path (the DAC region is mapped for the debugger but drives nothing). USB, QSPI flash, the ADC, I2C/SPI, DMA and the interrupt-driven paths of the peripherals are not modelled — the bundled firmware polls. This is bare-metal firmware, not the CircuitPython/Arduino BSP runtime.