From 8937edaa4fee5b7376fea579de813ce7f3a1c0e1 Mon Sep 17 00:00:00 2001 From: chrysn Date: Thu, 23 Oct 2025 16:42:23 +0200 Subject: [PATCH] Make the DECT-2020 NR+ libmodem.a available as well --- build.rs | 31 ++++++++++++++++++++++++++++++- wrapper.h | 1 + 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 385af64..7251195 100644 --- a/build.rs +++ b/build.rs @@ -110,7 +110,23 @@ fn main() { Path::new(&nrfxlib_path).join("nrf_modem/lib/cellular/nrf9120/hard-float/libmodem.a") }; + #[cfg(feature = "nrf9160")] + let libmodemdect_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(feature = "nrf9120")] + let libmodemdect_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"); + let libmodemdect_changed_path = + PathBuf::from(env::var("OUT_DIR").unwrap()).join("libmodem_dect.a"); // The modem library now has compressed headers, but Rust cannot deal with that. // If the appropriate features is active, we're gonna strip it or decompress it. @@ -141,7 +157,7 @@ fn main() { .tool(&llvm_tools::exe("llvm-objcopy")) .expect(tool_error); - let child = std::process::Command::new(path) + let child = std::process::Command::new(&path) .arg("--strip-debug") .arg(&libmodem_original_path) .arg(&libmodem_changed_path) @@ -152,6 +168,18 @@ fn main() { if !child_result.status.success() { panic!("Something went wrong with `llvm-objcopy`."); } + + let child = std::process::Command::new(&path) + .arg("--strip-debug") + .arg(&libmodemdect_original_path) + .arg(&libmodemdect_changed_path) + .spawn() + .expect(tool_error); + + let child_result = child.wait_with_output().unwrap(); + if !child_result.status.success() { + panic!("Something went wrong with `llvm-objcopy`."); + } } // Make sure we link against the libraries @@ -173,6 +201,7 @@ fn main() { .display() ); println!("cargo:rustc-link-lib=static=modem"); + println!("cargo:rustc-link-lib=static=modem_dect"); println!("cargo:rustc-link-lib=static=oberon_3.0.16"); println!("cargo:rustc-link-lib=static=nrf_cc310_platform_0.9.19"); } diff --git a/wrapper.h b/wrapper.h index fccb710..2cf7fa3 100644 --- a/wrapper.h +++ b/wrapper.h @@ -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