Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ arm-none-eabi-objcopy = []
llvm-objcopy = ["dep:llvm-tools"]
log = []

## Links the DECT modem library
##
## This exposes the same set of headers, but internally uses a different
## libmodem.a library, which is used with considerable differences. Note that
## using this also requires using an alternative radio core firmware, which is
## not shipped in crates.
dect = []

nrf9160 = []
nrf9151 = ["nrf9120"]
nrf9161 = ["nrf9120"]
Expand Down
20 changes: 18 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ fn main() {
.clang_arg("-mcpu=cortex-m33")
// Use softfp
.clang_arg("-mfloat-abi=soft")
// Enum types are short, eg. nrf_modem_dect_phy_err is 16bit
.clang_arg("-fshort-enums")
// We're no_std
.use_core()
// Include only the useful stuff
Expand Down Expand Up @@ -96,20 +98,34 @@ fn main() {
let bindings_out_path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("bindings.rs");
std::fs::write(bindings_out_path, rust_source).expect("Couldn't write updated bindgen output");

#[cfg(feature = "nrf9160")]
#[cfg(all(feature = "nrf9160", not(feature = "dect")))]
let libmodem_original_path = if cfg!(feature = "log") {
Path::new(&nrfxlib_path).join("nrf_modem/lib/cellular/nrf9160/hard-float/libmodem_log.a")
} else {
Path::new(&nrfxlib_path).join("nrf_modem/lib/cellular/nrf9160/hard-float/libmodem.a")
};

#[cfg(feature = "nrf9120")]
#[cfg(all(feature = "nrf9120", not(feature = "dect")))]
let libmodem_original_path = if cfg!(feature = "log") {
Path::new(&nrfxlib_path).join("nrf_modem/lib/cellular/nrf9120/hard-float/libmodem_log.a")
} else {
Path::new(&nrfxlib_path).join("nrf_modem/lib/cellular/nrf9120/hard-float/libmodem.a")
};

#[cfg(all(feature = "nrf9160", feature = "dect"))]
let libmodem_original_path = if cfg!(feature = "log") {
Path::new(&nrfxlib_path).join("nrf_modem/lib/dect_phy/nrf9160/hard-float/libmodem_log.a")
} else {
Path::new(&nrfxlib_path).join("nrf_modem/lib/dect_phy/nrf9160/hard-float/libmodem.a")
};

#[cfg(all(feature = "nrf9120", feature = "dect"))]
let libmodem_original_path = if cfg!(feature = "log") {
Path::new(&nrfxlib_path).join("nrf_modem/lib/dect_phy/nrf9120/hard-float/libmodem_log.a")
} else {
Path::new(&nrfxlib_path).join("nrf_modem/lib/dect_phy/nrf9120/hard-float/libmodem.a")
};

let libmodem_changed_path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("libmodem.a");

// The modem library now has compressed headers, but Rust cannot deal with that.
Expand Down
1 change: 1 addition & 0 deletions wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "nrf_modem/include/nrf_modem_bootloader.h"
#include "nrf_modem/include/nrf_modem_trace.h"
#include "nrf_modem/include/nrf_gai_errors.h"
#include "nrf_modem/include/nrf_modem_dect_phy.h"

/*
* Crypto Cell 310 (CC310) platform headers
Expand Down
Loading