ESP32 Projects
Start a build
Markdown

MicroPython Studio Serial REPL for ESP32

Connect to an ESP32 MicroPython REPL from VS Code and run a test script.

MicroPython-supported ESP32 boardMicroPythonBeginner
Parts and source

Before you start

The extension works with MicroPython-capable boards. Flash the firmware image for your exact chip before opening the port.

Getting started

  1. Connect the board over USB and choose its serial device from the extension.
  2. Run a short test script and confirm the output in the REPL.

Upstream README

MicroPython Studio — Live MicroPython Debugger for VS Code

Set breakpoints on a real Raspberry Pi Pico 2 W, step through MicroPython code, inspect locals and call stacks, and capture live runtime traces. MicroPython Studio also provides a REPL, device file manager, firmware tools, CircuitPython support and an optional local AI assistant.

Install from VS Code Marketplace · Watch the real-device debugger demo · Read the debugger guide

MicroPython CircuitPython License: MIT

Real debugging on real hardware — 2.7.0

MicroPython Studio native VS Code debugging on Pico 2 W, paused at a source breakpoint with locals, call stack, MCU Project, MCU Runtime and REPL output

Actual 2.7.0 development build: Pico 2 W, native Run and Debug with separate REPL and debugger CDC ports.

MicroPython Studio debugger details showing recorded RTA task and function timing, debug console, verified breakpoint and REPL output

Actual 2.7.0 development build: captured RTA statistics after tracing was switched off. Invalid trace events are reported, not counted as valid measurements.

Physical hardware qualification passed on a dedicated RP2350 test board with compatible scope/step firmware, using the 100-cycle configuration and separate REPL/debug CDC ports. The reported checks covered raw execution, streaming and Ctrl+C recovery, COM handoff, heap sampling, GC recovery, file transfer integrity, breakpoint execution, paused locals/globals, stepping, RTA events and debugger reattach. This is evidence for the tested build and board, not blanket approval of every firmware, target or final release commit.

Native VS Code debugging and memory diagnostics

  • MCU Project and MCU Runtime: project-scoped board and saved port details, passive connection state and timestamped heap snapshots from the existing analyzer. Refreshing these views does not probe the MCU. Third-party Python views can be hidden manually.

  • Native Run and Debug: use VS Code F5 / Run and Debug with MicroPython Studio's Debug Adapter Protocol (DAP) integration. Standard Breakpoints, Variables, Watch (read-only lookup), Call Stack, and stepping connect to the existing frozen-firmware debugger bridge, not a second serial transport. Source frames are displayed only when mapping is available. The existing RTA webview remains available while a native session runs.

  • Memory & Garbage Collection Analyzer: open MicroPython: Memory & Garbage Collection Analyzer or the Memory & GC status-bar item. Sample heap reads gc.mem_alloc() and gc.mem_free() without forcing garbage collection. Collect GC + compare explicitly runs gc.collect(), reports reclaimed bytes and measured collection duration when supported. Export snapshots to CSV, compare observed peaks and growth.

  • Safe measurements: the Memory Analyzer uses an already-connected, idle USB REPL and refuses to create a competing COM connection. Do not sample a busy application; evaluating code via REPL may interrupt user code. Sampling during a native debug session requires explicitly stopping the session first. Heap totals reflect the GC-managed heap, not every RAM allocation or physical memory bank. Rising samples alone do not establish a memory leak.

Start native debugging
  1. Check the board-specific debugger firmware matrix and ensure compatible firmware is already installed on the exact board.
  2. Connect the board's REPL/upload COM port normally. Select Start Debug, or use F5 and choose MicroPython Studio — Native Debugger.
  3. When prompted, select the separate debugger CDC/COM port. The native debugger only attaches to the frozen debugger; it never uploads Python helper files, overwrites boot.py, or flashes firmware.
  4. Set a source breakpoint in a .py function. When the firmware confirms its slot, the native Breakpoints pane marks it verified. Use VS Code stepping and inspect Variables/Call Stack. Unmapped source locations remain labelled as such instead of being guessed.
  5. To use the classic debugger/RTA panel by itself, run MicroPython: Open Legacy Debug & RTA Panel. Close any existing debug connection before switching modes.

Detailed workflow: Native DAP and Memory Analyzer guide.


See what makes the debugger different

On compatible debugger-enabled firmware, MicroPython Studio provides source breakpoints, step/continue controls, local/global variable inspection, call stacks and live RTA function tracing, without requiring a separate JTAG probe for those software-debugging features. The demo shows the debugger operating on a real Pico 2 W.

Hardware-support status matters. The existing Pico 2 W debugger workflow has been exercised on real hardware. The new Pico-family frozen-firmware builds and ESP32-S3 debugger improvements are under separate hardware qualification; an ESP32-C3 debugger has not been released. Do not interpret a successful CI build as evidence that your board is supported. Read the board-specific firmware and test status before flashing anything.

Experimental debugger firmware — for debugging and testing your own code ONLY. NOT FOR PRODUCTION USE. This warning applies to unvalidated firmware in the TestBuilds download directory, not to an approved, board-specific stable release. A successful CI build does not mean the image is hardware-approved. Verify the exact board model, back up your files and follow the matching firmware instructions before flashing. Download Debug Firmware opens the file or download page; Studio does not automatically flash the board or overwrite boot.py.

Why Use It?

Need MicroPython Studio Helps With
Start quickly Project wizard, environment setup, board config, templates
Work with real boards Serial REPL, file explorer, upload/download, package install
Debug harder problems Breakpoints, stepping, locals, call stack, debug firmware flow
Test without hardware QEMU-based simulator for fast prototype runs
Use wireless workflows MicroPython WebREPL and CircuitPython Web Workflow support
Keep code private Optional local AI assistant powered by Ollama

Main Features

  • Device File Explorer Browse, upload, download, rename, delete, and create files on your board.

  • One-Click Run and Shell Run the active Python file or open an interactive REPL from VS Code.

  • Live Debugger Set breakpoints, step through code, inspect locals, and view call stack data.

  • CircuitPython Support Detect CIRCUITPY drives, install libraries, sync files, and use Web Workflow.

  • MicroPython WebREPL Configure Wi-Fi access and connect to supported boards over the network.

  • Firmware Tools Download and flash firmware for supported targets, including debug firmware.

  • QEMU Simulator (temporarily disabled in security-hardening preview) Requires verified, SHA-256-pinned QEMU and firmware artifacts before running on the host.

  • Private AI Assistant Use local Ollama models for code help and device-error investigation.


Quick Start

  1. Install the extension in VS Code.
  2. Run MicroPython: Setup Development Environment.
  3. Connect your board by USB.
  4. Run MicroPython: Refresh Device Files.
  5. Create or open a project.
  6. Press Run to execute your active Python file.

That is the normal daily loop: connect, edit, run, inspect files, repeat.


Common Commands

Command What It Does
MicroPython: Setup Development Environment Creates the Python environment and installs required tools
MicroPython: Create New Project Starts a guided project setup
MicroPython: Open Existing Project Opens a project with existing device configuration
MicroPython: Refresh Device Files Connects to the board and refreshes the device file tree
MicroPython: Run Script on Device Runs the active Python file
MicroPython: Open Device Shell Opens an interactive REPL
MicroPython: Upload File to Device Copies one file to the board
MicroPython: Upload Project to Device Copies the project to the board
MicroPython: Start Debug Starts the live debugger setup/connect flow
MicroPython: Flash Firmware Opens firmware flashing tools

Debugging

The debugger is designed for embedded Python workflows where JTAG is not always practical.

It supports:

  • breakpoints

  • stepping

  • locals inspection

  • call stack view

  • runtime trace events

  • live function/runtime tracing (observed elapsed-time share, not CPU utilisation)

  • debugger-enabled firmware for supported board-specific configurations; existing published Pico firmware may need the legacy setup steps

  • test-only frozen debugger images are not published as stable releases until hardware validation

For best results, start with a simple script first, confirm upload/run works, then enable the debugger.

Debugger USB connections

The debugger uses a separate connection from the REPL. For compatible debugger-enabled test firmware, the connection layout is:

Board Project REPL and file upload Debugger + RTA USB cables
Pico / Pico W / Pico 2 / Pico 2 W (frozen UF2 candidate) CDC0 COM CDC1 COM One
ESP32-S3 test candidate Physical Serial/JTAG COM Physical native-USB debugger COM Two

Firmware must match the exact board. See board support and firmware status for stable versus experimental builds and connection guidance.


Simulator

Security qualification status: Automatic QEMU simulator startup is temporarily disabled. The previous simulator downloaded executable binaries and firmware from mutable URLs without verified hashes. It now refuses to run until resource/simulator-manifest.json contains qualified release artifacts and approved SHA-256 checksums. Semihosting is disabled.

After independently verified artifacts are published and approved, the intended workflow will be:

  • Start or stop it from the status bar.
  • Run code through the same VS Code workflow.
  • Use local lib/ folders for dependencies.
  • The simulated filesystem is read-only, so direct uploads are blocked with a clear warning.

Security and trusted-device guidance

  • MicroPython WebREPL (ws://) and CircuitPython Web Workflow (HTTP) are not encrypted by their standard on-device protocols. Use them only on trusted, isolated networks or with a properly authenticated secure tunnel. Do not reuse your Wi-Fi password for the device REPL.
  • Device passwords are stored using VS Code SecretStorage and are removed from legacy plaintext device.cfg entries on migration. Existing copies in git history, shared ZIP files or backups are not automatically erased: rotate any previously exposed password.
  • New projects create a .gitignore excluding device.cfg and CircuitPython settings.toml. Existing projects must apply equivalent rules manually; ignoring a file does not remove it from past git commits.
  • Native debugging runs code on your connected MCU; only attach boards and firmware you trust. Device-derived data and filenames are treated as untrusted by the extension.
  • Simulator execution is intentionally blocked until signed or checksum-pinned dependencies are verified. Do not bypass this integrity check.

Local AI Assistant

MicroPython Studio can use Ollama for private local AI help.

  1. Install Ollama.
  2. Open the MicroPython Studio AI view.
  3. Let the extension prepare the local model.
  4. Ask questions about your active file, device errors, or MicroPython APIs.

Your source code stays on your machine.


Supported Workflows

Platform USB Serial File Explorer Packages Wireless Debugging
MicroPython Yes Yes mip WebREPL Supported targets
CircuitPython Yes CIRCUITPY drive / Web Workflow circup Web Workflow Limited
Digi XBee Yes Project/library support Bundled helpers Device dependent Device dependent
Simulator (temporarily disabled) Planned TCP REPL Planned read-only target Local lib/ Local only Requires verified QEMU/firmware manifest

Project Status

MicroPython Studio is actively developed and already used by many embedded Python developers. The current focus is reliability: port locking, debugger setup, ESP32-S3 workflows, automated CI checks, and better regression testing.

If something breaks, please open an issue with:

  • board name
  • firmware type and version
  • operating system
  • selected port
  • output from the MicroPython IDE or MPy Debugger Setup panel


Acknowledgements

MicroPython Studio builds on excellent open source projects:

Project License Used For
MicroPython MIT Runtime, REPL, tools
mpremote MIT Device communication
CircuitPython MIT CircuitPython support
circup MIT CircuitPython library management
MicroPython WebREPL MIT Wireless REPL workflow
websocket-client Apache 2.0 WebREPL transport
term.js MIT Terminal UI
FileSaver.js MIT Browser-side file save support
xbee-micropython MIT XBee stubs and helpers
esptool GPL-2.0 ESP firmware flashing
pyserial BSD Serial communication
QEMU GPL-2.0 Simulator backend
Ollama MIT Local AI runtime
Gemma Gemma Terms Local AI model option

All bundled third-party files retain their original license headers.


Support

Questions, bugs, and ideas are welcome.


License

MicroPython Studio is licensed under the MIT License.

XBee MicroPython type hints and libraries are sourced from Digi International's xbee-micropython, also under the MIT License.