#devices #tree #fdt #dtb #data-structures

no-std dtb_parser

no std but alloc depended device tree blob parsing lib

7 releases

0.2.3 Aug 20, 2023
0.2.2 Aug 19, 2023
0.1.2 Oct 5, 2022
0.1.1 Sep 14, 2022
0.1.0 Aug 21, 2022

#282 in Embedded development

Download history 6/week @ 2024-02-16 5/week @ 2024-02-23 3/week @ 2024-03-01 5/week @ 2024-03-08 10/week @ 2024-03-15 40/week @ 2024-03-29 9/week @ 2024-04-05

60 downloads per month

MIT license

38KB
878 lines

dtb_parser

Usage

pub const BLOB: &[u8] = include_bytes!("device.dtb");

fn main() {
    let tree = DeviceTree::from_bytes(BLOB).unwrap();
    println!("{}", tree);

    assert!(!matches!(tree.find_node("/soc/pci@30000000"), None));
}

TODO

  • Tree&Node parsing
  • Property with inherited value (#address-cells etc)
  • Display trait for the whole tree (output has subtle differences with dts mainly in values presentation which affected by #<specifier>-cells)
  • PHandle binding
  • Nexus node and specifier mapping
  • The situation when #address-cells value set to 3

lib.rs:

dtb_parser

Parses a device tree blob to a human-friendly data structure.

The no [std] but [alloc] library is required.

No runtime deps

Features