Wire a Driver into perovsat-app¶
Updated: 7/10/26
This guide covers the integration of a new device into the DBuild system.
Prerequisites¶
- An implemented driver repository (see Implement a driver)
- A working PEROVSAT workspace
Overview¶
Integration requires three areas of work:
- Register the driver west project in
west.yml - Create a snippet per supported backend mode
- Add the logical device to
dbuild.yml, linking to the correct snippets
The MPU6050 / IMU setup in perovsat-app is the reference.
Ensure it's in the West project¶
You likely already did this in the initial clone, but double check
In perovsat-app/west.yml:
- name: mpu6050-driver
remote: origin
revision: main
The name must match the driver repository name and zephyr/module.yml. Run west update or rerun setup.sh to clone it.
Create snippets¶
Create one directory per mode under snippets/. Naming convention: <chip>-<mode> (for example mpu6050-public-mock).
Each snippet needs:
snippet.yml— registers conf and overlay files.conf— enables the driver and any bus emulation options.overlay— instantiates the device and sets the application alias
Look at the other existing snippets for examples or see DBuild snippets for snippet.yml structure.
If you want, you can create a DeviceTree alias in the .overlay file(s)
Register in dbuild.yml¶
Add the device under devices with a kconfig_backend per mode, and add an entry to selections
Backend symbol names must match the driver's Kconfig choice block exactly.
Fetch the device in application code¶
const struct device *imu = DEVICE_DT_GET(mpu6050);
const struct device *imu = DEVICE_DT_GET(DT_ALIAS(imu)); // With alias
Verify¶
Preview the resolved build:
west dbuild -b qemu_cortex_m3 --dry-run
Confirm:
- Your snippet appears in the
-Slist - The expected
CONFIG_PEROVSAT_<CHIP>_BACKEND_<MODE>=ysymbol is set - No west-project or board-overlay validation errors
Related¶
- DBuild configuration —
dbuild.ymlschema and validation - Driver Model overview