james.munns@ferrous-systems.com
Meeting Embedded
2019-11-13
cpythonrust with a little cc++)make embedded systems talk to other systems
c data types are not a good message format
intenumint!int isn’t portable-fshort-enumssizeof(int)struct__attribute__((packed))some devices (arm) don’t allow unaligned access at all
take the best concepts from the last 30 years
evolutionary rather than revolutionary
(“the data”)
(“the format”)
Serialize (frontend)Serializer (backend)Deserialize (frontend)Deserializer (backend)u8/i32/f64/bool)cbindgenConverts Rust FFI code to C headers
we always serialize and deserialize the data on the wire
local representation doesn’t matter
rust can make staticlibs (.a)
or dynamic libraries (.so or similar)
or both!
[package]
name = "serializer"
[dependencies.serde]
version = "1.0"
default-features = false
features = ["derive"]
[dependencies.ssmarshal]
version = "1.0"
default-features = false
[package]
name = "serializer"
[lib]
crate-type = ["staticlib", "dylib"]
[dependencies.serde]
version = "1.0"
default-features = false
features = ["derive"]
[dependencies.ssmarshal]
version = "1.0"
default-features = false
cargo build --releasecbindgenbindgenturn C header files into Rust data/function declarations
A Love Story
James Munns
@bitshiftmask
james.munns@ferrous-systems.com
https://github.com/ferrous-systems/embedded-rust-and-serde