Skip to content

Commit

Permalink
[release] 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kadiwa4 committed Oct 3, 2023
1 parent 590302a commit 789eae4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 45 deletions.
10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ members = ["deforest_derive"]

[package]
name = "deforest"
version = "0.0.1"
version = "0.1.0"
edition = "2021"
rust-version = "1.70"
description = "efficient `#![no_std]` parser for devicetree blobs"
repository = "https://github.com/kadiwa4/deforest"
license = "MIT"
keywords = ["devicetree", "device-tree", "parser"]
categories = ["embedded", "no-std::no-alloc", "hardware-support", "parser-implementations"]
include = ["/README.md", "/src", "/examples", "/tests"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -29,9 +33,9 @@ required-features = ["alloc"]

[dependencies]
ascii = { version = "1.1.0", default-features = false }
deforest_derive = { path = "deforest_derive", optional = true }
deforest_derive = { path = "deforest_derive", version = "=0.1.0", optional = true }
fallible-iterator = { version = "0.3.0", default-features = false }
zerocopy = { version = "0.7.0", features = ["derive"] }
zerocopy = { version = "0.7.6", features = ["derive"] }

[features]
alloc = ["fallible-iterator/alloc"]
Expand Down
46 changes: 5 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,11 @@

Efficient `#![no_std]` parser for devicetree blobs compliant (hopefully) with version 0.4 of [the specification][spec].

This is in an early stage of development. Use [`fdt-rs`](https://lib.rs/crates/fdt-rs) instead.

The crate tries to be efficient by avoiding allocations (it can be used without `alloc`), but I have no realistic benchmarks and the interface isn't the most ergonomic.
The crate tries to be efficient by avoiding allocations (it can be used without `alloc`) and only iterating over nodes once, but I have no realistic benchmarks.
On the downside, the interface isn't the most ergonomic.

[spec]: https://www.devicetree.org/specifications

## Competitor crates
- [`device_tree`](https://github.com/mbr/device_tree-rs)
- [`devicetree`](https://github.com/duanyu-yu/DeviceTree)
- [`devicetree-tool`](https://github.com/michael2012z/devicetree-tool) (not very similar in what it's trying to achieve)
- [`dtb`](https://github.com/ababo/dtb)
- [`dtb_parser`](https://github.com/d3ara1n/dtb_parser)
- [`dtb-walker`](https://github.com/YdrMaster/dtb-walker)
- [`fdt`](https://github.com/repnop/fdt)
- [`fdt-rs`](https://github.com/rs-embedded/fdt-rs)
- [`serde-device-tree`](https://github.com/rustsbi/serde-device-tree)

Some things I didn't like about some of them (I never intentionally searched for UB in any of the crates):

device_tree:
- depends on `std`

devicetree:
- is nightly-only
- is somewhat slow
- has UB (`static mut` [here](https://github.com/duanyu-yu/DeviceTree/blob/main/src/tree/node.rs#L27))
- can't do simple things like getting a property's raw value (unless it's a string list)

devicetree-tool:
- depends on `std`
- no error handling, always panics
- prints a ton of debug output to stdout with no way to disable it, making it unbearably slow

dtb:
- very little abstraction
- has a small case of UB (pointer [here](https://github.com/ababo/dtb/blob/master/src/reader.rs#L314) might not point to a valid `Header`)

dtb_parser: doesn't work

dtb-walker:
- interface for "walking" is not great
- has UB (alignment isn't checked [here](https://github.com/YdrMaster/dtb-walker/blob/main/src/lib.rs#L103); unchecked operation [here](https://github.com/YdrMaster/dtb-walker/blob/main/src/str.rs#L47))
- little error handling
- doesn't support `#cells` values greater than what `usize` allows
## Alternatives
- [`fdt-rs`](https://github.com/rs-embedded/fdt-rs): can even build an index to interact with DTBs faster
- [`fdt`](https://github.com/repnop/fdt): comes with extra types for a couple of common nodes
5 changes: 4 additions & 1 deletion deforest_derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
[package]
name = "deforest_derive"
version = "0.0.1"
version = "0.1.0"
edition = "2021"
rust-version = "1.70"
description = "derive macros for the crate deforest"
readme = "../README.md"
repository = "https://github.com/kadiwa4/deforest"
license = "MIT"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down

0 comments on commit 789eae4

Please sign in to comment.