1. Arash Vahidi (private)
  2. tinyDTB


tinyDTB /

Filename Size Date modified Message
13 B
7.7 KB
786 B
1.7 KB


tinyDTB is a minimal library for reading flattened device trees (DTS) in binary form (DTB). It is very small in size and parses the binary "in-place", hence it also has a minimal memory footprint.

In case you have never seen a device tree, here is one before compilation:

/* stolen from Thomas Petazzoni's ELCE-12 presentation */
/memreserve/ 0x0c000000 0x04000000;
/include/ "bcm2835.dtsi"
/ {
    compatible = "raspberrypi,model-b", "brcm,bcm2835";
    model = "Raspberry Pi Model B";
    memory {
        reg = <0 0x10000000>;
    soc {
        uart@20201000 {
            status = "okay";

Which is transformed to a flat binary format using the device tree compiler dtc. The tinyDTB library contains the API needed to access that binary at runtime.

When should I use this?

If you are writing software for resource constrained devices, or for some other reason want to keep resource usage to a minimum (e.g. if you are writing a bootloader) you might find this library useful.

The small size of the library (around 1K bytes on most architectures) allows you to add device tree functionality to your code without making it bloat,


The makefile accepts two optional parameters: CROSS_COMPILE and UFLAGS (which is added to our CFLAGS)

# native build
# build for ARMv7
make CROSS_COMPILE=arm-none-eabi-
# build for ARMv8 with additional flags
make CROSS_COMPILE=aarch64-linux-gnu- UFLAGS="-mcpu=cortex-a53"


The examples/ folder contains sample code that demonstrates how to use the library.