Source-level debugging of embedded firmware running in a circuit simulator, driven over the simulator's Remote Debug Monitor (TCP). It spawns a small debug-adapter (DAP server) and gives you normal VS Code debugging — breakpoints, stepping, call stack, variables, memory.
Current target: Microchip PIC firmware in the Proteus VSM simulator.
Supported device: PIC18F45K22 (the bundled debug-executive template is for
this part; other PICs need their own). Build your project with the MPLAB
extension pack, then debug it here — a distinct debug type (embedsim) keeps
it clear of MPLAB's own debugger (mplab-core-da).
Unofficial. Not affiliated with or endorsed by Labcenter Electronics (Proteus, VSM) or Microchip Technology (MPLAB, PIC). Those names are used only to describe compatibility. See
NOTICEfor the debug-executive caveat.
How it works
VS Code --DAP/stdio--> embedsim adapter --RDM/TCP 8000--> simulator
On launch the adapter parses DWARF from the MPLAB-built debug ELF (line table + globals), builds the device debug image, loads it into the simulator, sets breakpoints, runs, and maps halts back to source.
Prerequisites
- The circuit simulator running your design with its Remote Debug Monitor
enabled, listening on
127.0.0.1:8000. - Your project built for debug with MPLAB (XC8) → a debug
.elf. - A device debug-executive template (see
NOTICE). The bundled build expects one for PIC18F45K22; for other devices, supply your own viaembedsim.debugExecTemplate.
Use
- Build your firmware (debug) with MPLAB.
- Start the simulator with the Remote Debug Monitor on.
- Open the Tools sidebar → EmbedSim Debug → Start Debugging, or pick "EmbedSim: Debug" in Run and Debug (F5). The ELF is auto-located.
launch.json
{
"type": "embedsim",
"request": "launch",
"name": "EmbedSim: Debug",
"program": "${command:embedsim.findElf}", // or an explicit .elf path
"host": "127.0.0.1",
"port": 8000,
"stopOnEntry": true
}
Settings
embedsim.adapterPath— override the debug-adapter executable.embedsim.debugExecTemplate— override the device debug-executive template.
Features
Source-line breakpoints (DWARF), continue / step in / step over / step out (source-line granular), call stack with source mapping, CPU register (PC) + Globals view with live values, read/write data memory.