diff --git a/ledger_secure_sdk_sys/build.rs b/ledger_secure_sdk_sys/build.rs index f96b222c..c8b406fa 100644 --- a/ledger_secure_sdk_sys/build.rs +++ b/ledger_secure_sdk_sys/build.rs @@ -2,6 +2,7 @@ extern crate cc; use std::path::{Path, PathBuf}; use std::process::Command; use std::{env, fs::File, io::BufRead, io::BufReader, io::Read}; +use glob::glob; #[cfg(feature = "ccid")] const DEFINES_CCID: [(&str, Option<&str>); 2] = @@ -496,6 +497,7 @@ impl SDKBuilder { Device::NanoS => ("nanos", "sdk_nanos.h"), Device::NanoX => ("nanox", "sdk_nanox.h"), Device::NanoSPlus => ("nanos2", "sdk_nanosp.h"), + Device::Stax => ("stax", "sdk_stax.h") }; bindings = bindings.clang_arg(format!("-I{bsdk}/target/{include_path}/include/")); bindings = bindings.header(header); @@ -518,6 +520,11 @@ impl SDKBuilder { ) } Device::Stax => { + bindings = bindings.clang_args([ + format!("-I{bsdk}/lib_nbgl/include/").as_str(), + format!("-I{bsdk}/lib_ux_stax/").as_str(), + "-I./src/c/", + ]); bindings = bindings .header( self.bolos_sdk @@ -650,6 +657,11 @@ fn configure_lib_bagl(command: &mut cc::Build, bolos_sdk: &Path) { } fn finalize_stax_configuration(command: &mut cc::Build, bolos_sdk: &Path) { + let defines = header2define("sdk_stax.h"); + for (define, value) in defines { + command.define(define.as_str(), value.as_deref()); + } + command .target("thumbv8m.main-none-eabi") .define("ST33K1M5", None) diff --git a/ledger_secure_sdk_sys/sdk_nanox.h b/ledger_secure_sdk_sys/sdk_nanox.h index 0baf6c69..aa4c956a 100644 --- a/ledger_secure_sdk_sys/sdk_nanox.h +++ b/ledger_secure_sdk_sys/sdk_nanox.h @@ -19,9 +19,4 @@ #define HAVE_SE_SCREEN #define HAVE_BLE -#define HAVE_BLE_APDU - -#if defined(TARGET_STAX) -#define HAVE_NBGL -#define NBGL_USE_CASE -#endif +#define HAVE_BLE_APDU \ No newline at end of file diff --git a/ledger_secure_sdk_sys/sdk_stax.h b/ledger_secure_sdk_sys/sdk_stax.h new file mode 100644 index 00000000..639f7c2f --- /dev/null +++ b/ledger_secure_sdk_sys/sdk_stax.h @@ -0,0 +1,15 @@ +#define HAVE_NBGL +#define NBGL_USE_CASE +#define HAVE_PIEZO_SOUND +#define NBGL_PAGE +#define HAVE_LOCAL_APDU_BUFFER +#define IO_HID_EP_LENGTH 64 +#define USB_SEGMENT_SIZE 64 +#define OS_IO_SEPROXYHAL +#define HAVE_IO_USB +#define HAVE_L4_USBLIB +#define HAVE_USB_APDU +#define __IO volatile +#define IO_USB_MAX_ENDPOINTS 6 +#define IO_SEPROXYHAL_BUFFER_SIZE_B 128 +#define main _start \ No newline at end of file