An experimental project for using Golioth (currently just) on the nRF9160.
This project is currently in a holding pattern until the Embedded Rust ecosystem has caught up to the necessary networking support.
Before this project can be revived, two things are necessary:
-
Rust Embedded needs better networking support. This means that the
AsyncRead
andAsyncWrite
traits should be either accessible on#![no_std]
in a widely-used crate or that they should be stabilized incore
.1.1. This also means that the
nrfxlib
crate should be accessible withAsyncRead
andAsyncWrite
. -
There should be a Rust DTLS implementation that supports
#![no_std]
and PSK authentication usable throughAsyncRead
andAsyncWrite
. This could be written in Rust (e.g.drogue-iot
) or bound (e.g.mbedtls
).
When these critera are met, the Golioth
struct in this crate should be modified to be generic on an AsyncRead + AsyncWrite
type, which should be passed into the Golioth::new
function. The issue here is that we can't confirm that the tunnel is being sent over DTLS: maybe there's a different design
that's better?
You will need to flash spm onto the nRF9160 you use.
This will jump to 0x50000
on boot, which is where the rust binary will be located.
Insert your device's Golioth PSK ID and PSK into the consts in the src/config.rs
file.
$ cargo install flip-link
Install the git version of probe-run
$ cargo install --git https://github.com/knurling-rs/probe-run --branch main
$ rustup target add thumbv8m.main-none-eabi --toolchain nightly
$ cargo +nightly run
or
$ cargo +nightly run --release
Nightly is required in order to setup an alloc error handler.
If you are using rust-analyzer with VS Code for IDE-like features you can add following configuration to your .vscode/settings.json
to make it work transparently across workspaces. Find the details of this option in the RA docs.
{
"rust-analyzer.linkedProjects": [
"Cargo.toml",
"firmware/Cargo.toml",
]
}
Licensed under either of
-
Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
-
MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.