zephyr-dts
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

zephyr-dts test

license issues stars commits

A library for parsing DeviceTree from Zephyr.

Install

npm install zephyr-dts --save

Usage

This library loads DTS from Zephyr's build directory:

import { loadDT } from 'zephyr-dts';

const dt = await loadDT('/path/to/zephyr/build');

const flash = dt.choose('zephyr,flash');
if (flash) {
  for (const part of dt.under(`${flash.path}/partitions`)) {
    const reg = part.reg![0]!;
    console.log(`part ${part.label} - addr: ${reg.addr}, size: ${reg.size}`);
  }
}

APIs

function loadDT(buildDir: string): Promise<DeviceTreeParser>;

interface DeviceTreeParser {
  choose(name: string): Node | null;
  label(label: string): Node | null;
  node(path: NodePath): Node | null;
  under(parent: NodePath): Node[];
}

interface Node {
  path: string;
  compatible?: string[];
  label?: string;
  reg?: Register[];
  status?: 'okay' | 'disabled';
  interrupts?: number[];
  properties: Record<string, string>;
}

type NodePath = string;

interface Register {
  addr?: number;
  size?: number;
}

License

MIT License

Readme

Keywords

Package Sidebar

Install

npm i zephyr-dts

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

10.7 kB

Total Files

10

Last publish

Collaborators

  • xingrz