Skip to content
Closed
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
31 changes: 30 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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");
}
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