An experimental project for using Golioth on the nRF9160 cellular SiP. This repo is built on the Embassy async framework and nrf-modem. This repo currently requires Rust 1.75 or higher.
Most nRF9160 devices come loaded with the MCUBoot bootloader. Using this repo will overwrite MCUBoot. MCUBoot will need to be replaced before going back to the Nordic SDK. The easiest way to restore it is to flash a binary that includes the MCUBoot in it. MCUBoot is not needed for this repo.
You will need to flash a Secure Partition Manager (SPM) onto the nRF9160. For quickstart, an SPM is included in this repo. Embassy can run in secure
mode on the nRF9160; however, the modem library must operate in non-secure (NS) mode which means we need the SPM to transition into NS mode. 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 in the src/config.rs file.
Nordic's nrfxlib is written in C, we need Clang and the ARM GCC toolchain for generating bindings
Unix
$ sudo apt install llvm-dev libclang-dev clang
$ sudo apt install gcc-arm-none-eabi
Windows
Download and install GCC toolchain and LLVM-Clang, then make sure they are in the Path
environment variable. You can test this by running these commands.
$ arm-none-eabi-gcc --version
$ clang --version
This flips the stack for overflow protection
$ cargo install flip-link
Install probe-run which is used for the project runner in .cargo/config.toml
$ cargo install probe-run
$ rustup component add llvm-tools-preview
Nightly is required in order to set up an alloc error handler and for Embassy. This is handled in rust-toolchain.toml
$ rustup target add thumbv8m.main-none-eabi
Build profiles, such as release
, can be configured in Cargo.toml
$ cargo run --bin sensor_stream
or
$ cargo run --release --bin sensor_stream
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.