#embedded-hal #i2c #diagnostics #scanner

no-std dvcdbg

Lightweight diagnostics toolkit for embedded (no_std, I2C scan, quick tests)

6 releases

Uses new Rust 2024

0.3.0 Sep 3, 2025
0.2.1 Aug 20, 2025
0.1.2 Aug 14, 2025

#2270 in Embedded development

Download history

346 downloads per month

MIT/Apache

71KB
1.5K SLoC

dvcdbg

🛠️ Lightweight debugging crate for embedded Rust (no_std friendly)

dvcdbg is a lightweight, no_std-friendly debugging library for embedded Rust. It is designed to simplify the initial setup and bring-up of new hardware by providing a convenient set of diagnostic tools.


✨ Key Features

  • ✅ Works in no_std environments
  • ✅ Lightweight and fast, formatless logging support
  • ✅ Includes useful embedded utilities:
    • I2C bus scanner (scan_i2c)
    • Hex dump (write_hex!)
    • Execution cycle measurement (measure_cycles!)
  • ✅ Quick diagnostic workflow with quick_diag!

📦 Quickstart

cargo add dvcdbg --no-default-features --features "ehal_0_2"

Detailed settings


Provided Macros

  • Logging & Formatting

    • write_hex!(dst, &buf)
      Write a byte slice in hexadecimal (12 AB FF ).
    • write_bin!(dst, &buf)
      Write a byte slice in binary (10101010 11110000 ).
    • assert_log!(cond, logger, "msg")
      Log an assertion failure without panicking.
  • Diagnostics

    • scan_i2c(i2c, serial) Scan I2C bus and log found devices.
    • quick_diag!(serial, i2c, timer [, { expr }])
      Run a quick diagnostic workflow: serial check, I2C scan, optional cycle measurement.
  • Timing & Control

    • measure_cycles!(expr, timer)
      Measure execution cycles (or timestamps) for an expression.
    • loop_with_delay!(delay, ms, { body })
      Run a loop with a fixed delay between iterations.
  • Adapters

  • Explore


📚 Documentation


🚀 Binary Size Optimisation

Since dvcdbg is designed for a no_std environment, it is important to minimise the final binary size.

Enabling LTO (link-time optimisation) and strip during release builds will remove unused code from dvcdbg and other dependent crates, significantly reducing the binary size.

Add the following settings to your application's Cargo.toml.

# Cargo.toml (application)
[profile.release]
opt-level = "z"
lto = true
codegen-units = 1
panic = "abort"
strip = true

🛠️ Supported Environments

  • Rust no_std
  • AVR (Arduino Uno)
  • ESP-IDF / other HALs supported via serial abstraction

🤝 Contributing

Bug reports, feature suggestions, and pull requests are welcome! See CONTRIBUTING.md for guidelines.


📄 License

MIT OR Apache-2.0

Dependencies

~795KB
~15K SLoC