Skip to content

Commit

Permalink
Add SDK header file for Stax
Browse files Browse the repository at this point in the history
  • Loading branch information
agrojean-ledger committed Jan 18, 2024
1 parent 5791bd1 commit 8e82d57
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
7 changes: 7 additions & 0 deletions ledger_secure_sdk_sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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] =
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -650,6 +652,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)
Expand Down
7 changes: 1 addition & 6 deletions ledger_secure_sdk_sys/sdk_nanox.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 13 additions & 0 deletions ledger_secure_sdk_sys/sdk_stax.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#define HAVE_NBGL
#define NBGL_USE_CASE
#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

0 comments on commit 8e82d57

Please sign in to comment.