fdt-rs
A Flattened Device Tree parser for embedded no-std environments
Usage
Add this to your Cargo.toml:
[]
= "0.2"
and this to your crate root:
extern crate fdt_rs;
Features
This crate can be used without the standard library (#![no_std]) by disabling
the default std feature. Use this in Cargo.toml:
[]
= "0.2"
= false
# features = ["ascii"] # <--- Uncomment if you wish to use the ascii crate for str's
The "ascii" feature will configure the Str type returned by string accessor
methods to be of type AsciiStr provided by the ascii crate.
Without this feature enabled, str references will be returned.
Example
The following example stashes a flattened device tree in memory, parses that
device tree into a fdt_rs::DevTree object, searches the device tree for the
first "ns16550a" compatible node, and if found prints that node's name.
extern crate fdt_rs;
use *;
// Place a device tree image into the rust binary and
// align it to a 32-byte boundary by using a wrapper struct.
;
pub const FDT: & = &_Wrapper.0;