File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ use std::{env, path::PathBuf};
33fn sdk_includes ( target : & str ) -> impl IntoIterator < Item = PathBuf > {
44 [
55 PathBuf :: from ( "include" ) ,
6+ PathBuf :: from ( "io/include" ) ,
7+ PathBuf :: from ( "io_legacy/include" ) ,
68 PathBuf :: from ( "target" ) . join ( target) . join ( "include" ) ,
79 PathBuf :: from ( "lib_ux" ) . join ( "include" ) ,
810 PathBuf :: from ( "lib_cxng" ) . join ( "include" ) ,
@@ -151,7 +153,7 @@ fn main() {
151153 . map ( |path| format ! ( "-I{}" , path. display( ) ) ) ,
152154 )
153155 . clang_arg ( format ! ( "-I{}" , sdk_path. display( ) ) )
154- . clang_arg ( format ! ( "-I{}/include" , sdk_path . display ( ) ) )
156+ . clang_arg ( "-D OS_IO_SEPH_BUFFER_SIZE=272" )
155157 . generate ( )
156158 . expect ( "able to generate bindings" ) ;
157159 bindings
Original file line number Diff line number Diff line change 1- use std:: env;
1+ use std:: { env, fs , path } ;
22
33#[ derive( Debug , Clone , Copy ) ]
44enum Device {
@@ -24,6 +24,11 @@ fn main() {
2424
2525 if let Some ( v) = env:: var_os ( "BOLOS_SDK" ) {
2626 if !v. is_empty ( ) {
27+ if let Ok ( contents) = fs:: read_to_string ( path:: Path :: new ( & v) . join ( "Makefile.defines" ) ) {
28+ if contents. contains ( "REVAMPED_IO" ) {
29+ println ! ( "cargo:rustc-cfg=revamped_io" ) ;
30+ }
31+ }
2732 match detect_device ( ) . expect ( "invalid or unable to retrieve TARGET_NAME" ) {
2833 Device :: NanoS => println ! ( "cargo:rustc-cfg=nanos" ) ,
2934 Device :: NanoX => println ! ( "cargo:rustc-cfg=nanox" ) ,
Original file line number Diff line number Diff line change @@ -42,7 +42,13 @@ impl Into<bindings::zxerr_t> for ViewError {
4242}
4343
4444pub ( crate ) fn apdu_buffer_mut ( ) -> & ' static mut [ u8 ] {
45- PIC :: new ( unsafe { & mut bolos_sys:: raw:: G_io_apdu_buffer } ) . into_inner ( )
45+ PIC :: new ( unsafe {
46+ cfg_if:: cfg_if! {
47+ if #[ cfg( revamped_io) ] { & mut bolos_sys:: raw:: G_io_tx_buffer }
48+ else { & mut bolos_sys:: raw:: G_io_apdu_buffer }
49+ }
50+ } )
51+ . into_inner ( )
4652}
4753
4854pub ( crate ) fn store_into < ' buf , T : Sized > (
You can’t perform that action at this time.
0 commit comments