Module · Register Map & C Header
Turn register tables into C headers
DatasheetVend reads register tables from a datasheet and returns a C header, CMSIS-SVD, a CSV table and JSON. Code checks the extracted facts, and clang compiles every delivered header against a check of each extracted value.
- Get address, bit position, access and reset macros without typing them by hand.
- clang compiles the header for C99, C11 (Arm) and C++17, with a generated check of every extracted value.
- The SVD carries a debugger-readiness label. The CSV and the source-backed JSON come from the same register model.
// Abridged, written by hand to show the format, with ADXL345 facts.// The clang checks run on a separate generated test file, not inside this header./** * @file registers.h * @brief Register definitions extracted from ADXL345 datasheet. * @note Auto-generated from explicit datasheet register facts only. */#ifndef ADXL345_REGISTERS_H#define ADXL345_REGISTERS_H#include <stdint.h>/* DEVID (Device ID at 0x00, reset 0xE5) */#define DEVID_ADDR 0x00#define DEVID_RESET 0xE5/* POWER_CTL (Power-saving features control at 0x2D) */#define POWER_CTL_ADDR 0x2D#define POWER_CTL_RESET 0x00/* MEASURE: Measurement mode (bit 3) */#define POWER_CTL_MEASURE_Pos 3U#define POWER_CTL_MEASURE_Msk 0x8U#endif /* ADXL345_REGISTERS_H */What it does
What you can do with it
Firmware bring-up
Skip typing #define macros, bit shifts and masks from register tables by hand. Each register carries its address, access, reset value and fields as the document states them.
Driver development
Start from one header with register addresses, reset values and CMSIS-style _Pos and _Msk field macros, plus a low-level driver that takes your bus callbacks.
Debugger and SVD
Export CMSIS-SVD labelled debugger_ready, description_only or not_ready, with reasons. debugger_ready means Arm's svdconv validator accepted the file and the readiness bar is met. Otherwise the file is a register description.
What the output includes
Header, SVD, driver and JSON from one register model
The module reads register tables into addresses, bit ranges, access types and reset values, then builds the files below from one accepted register model. Each register keeps its source page.
- C header (registers.h) with CMSIS-style _Pos and _Msk macros
- clang compile pass for C99, C11 (Arm) and C++17, plus a generated check of every extracted value
- CMSIS-SVD (device.svd) labelled debugger_ready, description_only or not_ready, with reasons
- Low-level C driver (driver.h, driver.c) with bus_read and bus_write callbacks
- Mock-bus check: clang builds the driver and runs it against an in-memory register file
- Proof checks on the register model. Two fields that claim the same bit block delivery
- Source-backed register_map.json for scripts and AI agents
- CSV table of register offsets and access modes
- Reset values as printed, and I/O-space address aliases where the datasheet gives one
- The source page of each register in the original PDF
Who can use it
Embedded software engineers · Firmware architects · Device driver developers · Silicon validation teams · IoT and hardware startups · AI coding agents and tool builders
Why DatasheetVend
A driver starts with turning a dense register table into a header. The work is repetitive, and a shifted bit or a wrong address is easy to miss.
Table readers in code do the first pass. A model reads only the sections they cannot, or the whole document when the code path declines. Code then checks bit ranges, overlaps and addresses.
clang compiles the header with a check of every extracted value, plus a control run with one deliberately corrupted macro that must fail.
Trust and limits
Code generation you can audit
Where the module is strong
- Every delivered header is compiled with clang under strict flags, and each extracted value is checked with a preprocessor assertion. If clang is not available the result is marked not run, never passed.
- Register facts are bound to source evidence in the document. A number in a register caption does not become an address.
- A read-modify-write setter is generated only for read-write registers whose fields are all plain read-write. Write-1-to-clear, write-only, clear-on-read, read-only and access-not-stated registers get no setter, and a C comment says why.
- Each SVD carries a label that says whether it can be loaded into a debugger. Registers of an I2C or SPI part are always a description, because a debugger cannot read an off-chip register live.
- driver.h and driver.c take two bus callbacks and an intf_ptr, so the same driver is meant to run on STM32 HAL, ESP-IDF, Zephyr, Linux /dev/i2c or bare metal.
What it does not claim
- clang checks the header against the extracted values. It does not check those values against the silicon. Review the output before firmware use.
- It does not write application code such as sensor fusion, filters or RTOS tasks. The driver is low-level register access.
- When the datasheet prints no registers, as with many microcontrollers, the module uses the vendor's published register file for some parts, or a Reference Manual you attach. Otherwise it says that no registers were found.
- A register address given only as a row index stays an index until the document states a bus mapping.
- Unresolved or contradictory facts stay in the evidence record for review. The module does not guess.
Next step
Get a register header you can review
Run a datasheet and review the header, SVD and JSON, with the source page of each register.
Run it on a datasheet you have.
Free passes cover pinout, footprint, thermal, timing and pin cautions. The register map runs on module credits instead.
Explore extraction capabilities