Documentation
// arm cortex-m0+

RP2040 Emulation (Raspberry Pi Pico)

The Raspberry Pi Pico and Pico W are emulated entirely in the browser using rp2040js, an open-source ARM Cortex-M0+ emulator. No QEMU or backend process is required, the binary runs at full speed inside a Web Worker.

Supported Boards

BoardFQBNBuilt-in LED
Raspberry Pi Picorp2040:rp2040:rpipicoGPIO 25
Raspberry Pi Pico Wrp2040:rp2040:rpipicowGPIO 25 (via CYW43)

Binary Format

The backend compiles the sketch with arduino-cli targeting rp2040:rp2040:rpipico and returns a raw ARM binary (.bin) encoded in base64. Unlike AVR, there is no Intel HEX, the binary is loaded directly into the RP2040 flash at offset 0.

The backend also prepends #define Serial Serial1 to the sketch so that Arduino Serial calls are redirected to UART0 (the virtual serial port streamed to the Serial Monitor).

Peripherals

PeripheralSupportNotes
GPIO (30 pins)FullDigital read/write, pull-up/down
UART0 / UART1FullSerial Monitor via UART0
ADC (ch 0-3)FullGPIO 26-29; ch 4 = temperature sensor
I2C0 / I2C1PartialDS1307 RTC, TempSensor, EEPROM virtual devices
SPI0 / SPI1LoopbackTX looped back to RX
PWMFrequency onlyNo waveform output to components
Timer / AlarmFullUsed by delay() and millis()

WFI Optimisation

When the CPU executes a WFI (Wait For Interrupt) instruction, the emulator fast-forwards the system clock to the next scheduled alarm instead of spinning through idle cycles. This dramatically reduces CPU usage during delay() calls.

Simulation Loop

The simulation runs inside requestAnimationFrame at ~60 FPS. Each frame executes approximately 2,200,000 CPU cycles (133 MHz / 60 fps). GPIO listeners fire whenever a pin state changes and update the visual components on the canvas.

Known Limitations

  • Pico W wireless chip (CYW43439) is not emulated, WiFi/Bluetooth will not work
  • SPI loopback only, no real SPI device emulation
  • PWM produces correct frequency but no visual waveform on components
  • DMA not emulated
  • Second CPU core (core 1) not emulated, multicore_launch_core1() has no effect

Full Documentation

See the complete technical reference: RP2040_EMULATION.md