diff --git a/app-sdk/src/lib.rs b/app-sdk/src/lib.rs index d7e23b3..77ffa30 100644 --- a/app-sdk/src/lib.rs +++ b/app-sdk/src/lib.rs @@ -1,4 +1,3 @@ -#![feature(asm_const)] #![cfg_attr(target_arch = "riscv32", no_main, no_std)] extern crate alloc; diff --git a/vm/Cargo.toml b/vm/Cargo.toml index 21769eb..c57b0a2 100644 --- a/vm/Cargo.toml +++ b/vm/Cargo.toml @@ -6,15 +6,15 @@ edition = "2021" [dependencies] common = { path = "../common", features=["device_sdk"] } -ledger_device_sdk = { version="1.17.4" } include_gif = "1.2.0" serde = {version="1.0.192", default-features = false, features = ["derive"]} serde-json-core = { git = "https://github.com/rust-embedded-community/serde-json-core"} hex = { version = "0.4.3", default-features = false, features = ["serde", "alloc"] } numtoa = "0.2.4" postcard = { version = "1.0.8", features = ["alloc"] } -ledger_secure_sdk_sys = "1.5.3" +ledger_secure_sdk_sys = "1.6.1" zeroize = "1.8.1" +ledger_device_sdk = "1.19.1" [profile.release] opt-level = 3 @@ -42,4 +42,7 @@ icon = "vanadium_32x32.gif" [package.metadata.ledger.flex] icon = "vanadium_40x40.gif" +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("stax", "flex", "nanos", "nanox", "nanosplus"))'] } + [workspace] diff --git a/vm/src/main.rs b/vm/src/main.rs index a56b9a0..bd61974 100644 --- a/vm/src/main.rs +++ b/vm/src/main.rs @@ -17,14 +17,13 @@ #![no_std] #![no_main] -#![feature(panic_info_message)] mod app_ui; mod handlers; mod settings; -use alloc::{vec, vec::Vec}; +use alloc::{string::ToString, vec, vec::Vec}; use app_ui::menu::ui_menu_main; use handlers::{ get_version::handler_get_version, register_vapp::handler_register_vapp, @@ -71,12 +70,16 @@ fn handle_panic(info: &core::panic::PanicInfo) -> ! { "Panic occurred in file '{}' at line {}: {:?}", location.file(), location.line(), - info.message().unwrap_or(&format_args!("no message")) + info.message() + .as_str() + .unwrap_or(&format_args!("no message").to_string()) ) } else { alloc::format!( "Panic occurred: {}", - info.message().unwrap_or(&format_args!("no message")) + info.message() + .as_str() + .unwrap_or(&format_args!("no message").to_string()) ) }; println!("{}", message); diff --git a/vm/src/settings.rs b/vm/src/settings.rs index 9efa11e..6da141d 100644 --- a/vm/src/settings.rs +++ b/vm/src/settings.rs @@ -19,17 +19,20 @@ impl Default for Settings { impl Settings { #[inline(never)] #[allow(unused)] + #[allow(static_mut_refs)] // This is safe because we are in single-threaded mode pub fn get_mut(&mut self) -> &mut AtomicStorage<[u8; SETTINGS_SIZE]> { return unsafe { DATA.get_mut() }; } #[inline(never)] #[allow(unused)] + #[allow(static_mut_refs)] // This is safe because we are in single-threaded mode pub fn get_ref(&mut self) -> &AtomicStorage<[u8; SETTINGS_SIZE]> { return unsafe { DATA.get_ref() }; } #[allow(unused)] + #[allow(static_mut_refs)] // This is safe because we are in single-threaded mode pub fn get_element(&self, index: usize) -> u8 { let storage = unsafe { DATA.get_ref() }; let settings = storage.get_ref(); @@ -37,7 +40,7 @@ impl Settings { } #[allow(unused)] - // Not used in this boilerplate, but can be used to set a value in the settings + #[allow(static_mut_refs)] // This is safe because we are in single-threaded mode pub fn set_element(&self, index: usize, value: u8) { let storage = unsafe { DATA.get_mut() }; let mut updated_data = *storage.get_ref();