Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ jobs:
uses: actions/checkout@v2
with:
submodules: true
- name: Update Rust toolchain
run: |
rustup update stable
rustup default stable
rustup component add rustfmt clippy
- name: Install Miri
run: |
rustup toolchain install nightly --component miri
Expand Down
4 changes: 3 additions & 1 deletion bolos-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use std::{env, path::PathBuf};
fn sdk_includes(target: &str) -> impl IntoIterator<Item = PathBuf> {
[
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"),
Expand Down Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion zemu/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::env;
use std::{env, fs, path};

#[derive(Debug, Clone, Copy)]
enum Device {
Expand All @@ -24,6 +24,11 @@ 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"),
Expand Down
8 changes: 7 additions & 1 deletion zemu/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ impl Into<bindings::zxerr_t> 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>(
Expand Down
Loading