Device Drivers


This utility tool extracts data from PDF documents (such as data sheets, reference manuals, errata) and generates header files and hardware abstraction layers (HALs) for digital devices, with a focus on digital sensors.

Intermediate Representation

Metalware IR is a structured data file automatically generated from device documentation. It contains a detailed register map for compiler use in generating device-specific HAL, and device metadata for invariant identification. The IR-generation process identifies registers and their metadata, including layout (contiguous or FIFO-backed) and much more. Using this information, Metalware can automatically implement the API of the target RTOS or SDK.


The generation of an accurate IR enables the compilation of functional drivers for various platforms (e.g., Zephyr, Arduino, bare-metal), ensuring device accessibility and operability. Additionally, this process allows for the creation of comprehensive documentation and references linked directly to the driver's functionality and traceable back to the datasheet.

Generation Process

Our approach utilizes vision transformers, table detection algorithms, static heuristics, and domain-specific custom large language models (LLMs) to convert PDF content into IR, with accuracy verified through:

  • Unit Tests: Validate transformation accuracy across different device classes and vendors.
  • HITL (Hardware-In-The-Loop) Tests: Manual verification of all driver features on real hardware. We are exploring automation to increase coverage by building roboticized test racks (e.g. generate an acceleration through a programmable actuator, generate a pulse for an ADC through a signal generator etc.).

IR generation correctness depends on the variability in PDF formats and quality. Our tool cannot compensate for missing or incorrect information in the datasheet. Our future efforts include generating IR directly from RTL for increased reliability.

Supported Invariants

Currently, our tool only supports channel invariants, which represent measurable quantities specific to a device class (e.g., acceleration for accelerometers). We are rapidly expanding peripheral support.

Channel Invariant Examples:

  • Accelerometers


Supported data types include uint8, uint32, uint64, and reg for defining registers and their values.

Built-in functions

The tool provides macros for register operations, assuming 8-bit registers. Macros begin with $.

  • $read_register(reg r, uint32 len) -> uint8.
  • $read_register_multibyte(reg r, uint32 len, array<uint8> out) -> void

Future Peripheral Support

  • 1-Wire Bus
  • Analog-to-Digital Converter (ADC)
  • Auxiliary Display (auxdisplay)
  • Audio
  • Battery Backed RAM (BBRAM)
  • BC1.2 Devices (Experimental)
  • Clock Control
  • Controller Area Network (CAN)
  • Chargers
  • Coredump Device
  • Counter
  • Digital-to-Analog Converter (DAC)
  • Direct Memory Access (DMA)
  • Display Interface
  • Electrically Erasable Programmable Read-Only Memory (EEPROM)
  • Enhanced Serial Peripheral Interface (eSPI) Bus
  • Entropy
  • Error Detection And Correction (EDAC)
  • Flash
  • Fuel Gauge
  • GNSS (Global Navigation Satellite System)
  • General-Purpose Input/Output (GPIO)
  • Hardware Information
  • I2C EEPROM Target
  • Improved Inter-Integrated Circuit (I3C) Bus
  • Inter-Integrated Circuit (I2C) Bus
  • Inter-Processor Mailbox (IPM)
  • Keyboard Scan
  • Light-Emitting Diode (LED)
  • Management Data Input/Output (MDIO)
  • MIPI Display Bus Interface (DBI)
  • MIPI Display Serial Interface (DSI)
  • Multi-Channel Inter-Processor Mailbox (MBOX)
  • Peripheral Component Interconnect express Bus (PCIe)
  • Platform Environment Control Interface (PECI)
  • PS/2
  • Pulse Width Modulation (PWM)
  • Real-Time Clock (RTC)
  • Regulators
  • Reset Controller
  • Retained Memory
  • Secure Digital High Capacity (SDHC)
  • Sensors
  • Serial Peripheral Interface (SPI) Bus
  • System Management Bus (SMBus)
  • Universal Asynchronous Receiver-Transmitter (UART)
  • USB Type-C Port Controller (TCPC)
  • Time-aware General-Purpose Input/Output (TGPIO)
  • Video
  • Watchdog