james.munns@ferrous-systems.com
Meeting Embedded
2019-11-13
c
python
rust
with a little c
c++
)make embedded systems talk to other systems
c data types are not a good message format
int
enum
int
!int
isn’t portable-fshort-enums
sizeof(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
)cbindgen
Converts 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 --release
cbindgen
bindgen
turn 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