[ Back to home ]
2025

Hardware-aware static analysis for embedded code.

A VS Code extension and custom Language Server Protocol that catches RAM overruns, pin conflicts, strapping-pin boot failures, and bus configuration errors in Arduino and ESP32 code as you type, not after the flash. Built solo in a few hours at Hack Western 12, where it won Best Developer Tool.

Install from the VS Code Marketplace or Open VSX · 1.2K installs.

1. Abstract

Embedded development still debugs like it is 1995: write code, hit upload, watch the ESP32 reboot because a strapping pin was held low at reset, or because the RAM estimate was off by 30%. Web developers get type checkers and instant diagnostics; firmware engineers get a serial monitor and a multimeter. Sentinel uses the Language Server Protocol machinery behind TypeScript and Rust tooling to model a microcontroller's hardware constraints and flag them in the editor, before the compile.

The build is a custom Node.js Language Server and a VS Code extension, both written end-to-end during Hack Western 12. The server holds an incremental AST of every .ino and .cpp file plus a per-board hardware state machine (pin map, bus assignments, timer usage, interrupt vectors). A rule engine fires on every keystroke; the extension renders its diagnostics inline beside an interactive board diagram.

The novelty is the surface, not the analyses. PC-Lint, Clang-Tidy, and Cppcheck all exist, but they sit downstream of the compiler and outside the editor. Moving that analysis into the LSP layer gives firmware the loop web developers have had for a decade: keystroke, diagnostic, fix, no flash needed.

2. Introduction

The compile, flash, reboot, debug cycle is the tax embedded developers pay every day. The cost is the gap between writing a line and learning it was wrong. A mistyped ESP32 strapping pin is invisible until the chip refuses to boot. A buffer that overflows SRAM by 5% surfaces as a heap-allocation crash an hour in. A wrong I2C clock against a slow sensor is a multi-hour scope session, not a compiler error.

2.1 Why the Language Server Protocol

LSP already standardises the editor-to-analyzer wire format and is built for incremental analysis. Both match what a hardware-aware analyzer needs.

2.2 What is actually new

The LSP framework, the VS Code extension surface, and the Arduino CLI integration all exist. The contribution is the hardware-aware server between them, reporting through the standard LSP diagnostic channel.

Section 3 is the engineering behind those three commitments.

3. System

3.1 Memory budget estimation

Two budgets are tracked per board, SRAM and Flash, computed statically from the AST and compared against per-board ceilings (32 KB Flash and 2 KB SRAM on ATmega328P; 4 MB Flash and roughly 320 KB usable SRAM on ESP32 with WiFi active).

3.2 Pin conflict detection

Every GPIO assignment is tracked across files and validated against the board model, with pin role (input, output, INPUT_PULLUP, peripheral-claimed) inferred from pinMode calls, bus initialisations, and analog APIs.

3.3 Bus configuration validation

3.4 Language Server architecture

4. Evaluation

Every number is measured on the calibration sketch suite Sentinel ships with, not an external benchmark.

The 3% figure holds on the calibration sketches and degrades outside that distribution. The 200+ device database is mostly assembled from public datasheets, not original research. Read the numbers as evidence for the editor-loop direction, not as a benchmark against PC-Lint or Clang-Tidy.

5. Conclusion and Implications

Embedded tooling is a productivity tax that limits who can build hardware. Moving diagnostics into the editor makes firmware feel like high-level software: fast iteration, instant safety rails, fewer trips to the oscilloscope. The safety payoff: strapping-pin and pin-conflict failures that now surface as field bugs, bricked devices, or boot loops in industrial and medical embedded systems can surface as squiggles in the editor instead. Best Developer Tool at Hack Western 12 showed the gap is felt by those who would benefit most from closing it; the 1.2K installs since are the quieter, more durable signal.

5.1 Limitations and future work

6. Acknowledgments

Built solo at Hack Western 12, where it won Best Developer Tool. It sits on the Arduino CLI (compile integration), the Language Server Protocol specification (wire format), and the vscode-languageclient reference implementation (extension scaffolding). The peripheral database draws on public datasheets across the Adafruit, Sparkfun, and general Arduino sensor ecosystems. Published on the VS Code Marketplace and the Open VSX Registry as RishiShah.sentinel-arduino.