From 3a0420497edbc4a468693afc06c0b4278d24490a Mon Sep 17 00:00:00 2001 From: Miguel Ruiz de Sotto Date: Mon, 2 Jun 2025 17:41:08 +0200 Subject: [PATCH 1/2] fix(build): udpate with new IO revamp --- bolos-sys/build.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bolos-sys/build.rs b/bolos-sys/build.rs index 2399c2f..c5cd3d7 100644 --- a/bolos-sys/build.rs +++ b/bolos-sys/build.rs @@ -3,6 +3,8 @@ use std::{env, path::PathBuf}; fn sdk_includes(target: &str) -> impl IntoIterator { [ PathBuf::from("include"), + PathBuf::from("io/include"), + PathBuf::from("io_legacy/include"), PathBuf::from("target").join(target).join("include"), PathBuf::from("lib_ux").join("include"), PathBuf::from("lib_cxng").join("include"), @@ -151,7 +153,7 @@ fn main() { .map(|path| format!("-I{}", path.display())), ) .clang_arg(format!("-I{}", sdk_path.display())) - .clang_arg(format!("-I{}/include", sdk_path.display())) + .clang_arg("-D OS_IO_SEPH_BUFFER_SIZE=272") .generate() .expect("able to generate bindings"); bindings From 1e94530a1081fba2de5ae3779b6dc5a211d40baa Mon Sep 17 00:00:00 2001 From: Miguel Ruiz de Sotto Date: Mon, 2 Jun 2025 17:41:41 +0200 Subject: [PATCH 2/2] fix(zemu): IO revamp uses now G_io_tx_buffer --- zemu/build.rs | 8 +++++++- zemu/src/ui.rs | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/zemu/build.rs b/zemu/build.rs index d3c4e17..c3d91fd 100644 --- a/zemu/build.rs +++ b/zemu/build.rs @@ -1,4 +1,4 @@ -use std::env; +use std::{env, fs, path}; #[derive(Debug, Clone, Copy)] enum Device { @@ -24,6 +24,12 @@ fn main() { if let Some(v) = env::var_os("BOLOS_SDK") { if !v.is_empty() { + if let Ok(contents) = fs::read_to_string(path::Path::new(&v).join("Makefile.defines")) { + if contents.contains("REVAMPED_IO") { + println!("cargo:rustc-cfg=revamped_io"); + } + } + match detect_device().expect("invalid or unable to retrieve TARGET_NAME") { Device::NanoS => println!("cargo:rustc-cfg=nanos"), Device::NanoX => println!("cargo:rustc-cfg=nanox"), diff --git a/zemu/src/ui.rs b/zemu/src/ui.rs index d66f81e..fe35743 100644 --- a/zemu/src/ui.rs +++ b/zemu/src/ui.rs @@ -42,7 +42,13 @@ impl Into for ViewError { } pub(crate) fn apdu_buffer_mut() -> &'static mut [u8] { - PIC::new(unsafe { &mut bolos_sys::raw::G_io_apdu_buffer }).into_inner() + PIC::new(unsafe { + cfg_if::cfg_if! { + if #[cfg(revamped_io)] { &mut bolos_sys::raw::G_io_tx_buffer } + else { &mut bolos_sys::raw::G_io_apdu_buffer } + } + }) + .into_inner() } pub(crate) fn store_into<'buf, T: Sized>(