diff --git a/cargo-ledger/Cargo.toml b/cargo-ledger/Cargo.toml index 9d159c37..26d8cb40 100644 --- a/cargo-ledger/Cargo.toml +++ b/cargo-ledger/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "cargo-ledger" -version = "1.3.0" +version = "1.4.0" authors = ["yhql"] -description = "Build and sideload Ledger Nano apps" +description = "Build and sideload Ledger devices apps" categories = ["development-tools::cargo-plugins"] repository = "https://github.com/LedgerHQ/cargo-ledger" readme = "README.md" diff --git a/cargo-ledger/src/main.rs b/cargo-ledger/src/main.rs index 28905959..a9a51aef 100644 --- a/cargo-ledger/src/main.rs +++ b/cargo-ledger/src/main.rs @@ -74,6 +74,8 @@ enum Device { Nanos, Nanox, Nanosplus, + Stax, + Flex, } impl Display for Device { @@ -88,6 +90,8 @@ impl AsRef for Device { Device::Nanos => "nanos", Device::Nanox => "nanox", Device::Nanosplus => "nanosplus", + Device::Stax => "stax", + Device::Flex => "flex", } } } @@ -199,6 +203,8 @@ fn build_app( Device::Nanos => std::env::var("NANOS_SDK"), Device::Nanosplus => std::env::var("NANOSP_SDK"), Device::Nanox => std::env::var("NANOX_SDK"), + Device::Stax => std::env::var("STAX_SDK"), + Device::Flex => std::env::var("FLEX_SDK"), }; let mut args: Vec = vec![]; @@ -294,7 +300,7 @@ fn build_app( // Modify flags to enable BLE if targeting Nano X let flags = match device { Device::Nanos | Device::Nanosplus => metadata_ledger.flags, - Device::Nanox => { + Device::Nanox | Device::Stax | Device::Flex => { let base = u32::from_str_radix(metadata_ledger.flags.as_str(), 16) .unwrap_or(0); format!("0x{:x}", base | 0x200) @@ -307,6 +313,8 @@ fn build_app( Device::Nanos => String::from("0x31100004"), Device::Nanox => String::from("0x33000004"), Device::Nanosplus => String::from("0x33100004"), + Device::Stax => String::from("0x33200004"), + Device::Flex => String::from("0x33300004"), }; // create manifest diff --git a/cargo-ledger/src/setup.rs b/cargo-ledger/src/setup.rs index 88929296..3abcc35b 100644 --- a/cargo-ledger/src/setup.rs +++ b/cargo-ledger/src/setup.rs @@ -13,13 +13,13 @@ pub fn install_targets() { let sysroot_cmd = std::str::from_utf8(&sysroot_cmd).unwrap().trim(); let target_files_url = Path::new( - "https://raw.githubusercontent.com/LedgerHQ/ledger-device-rust-sdk/a630c93398316cc56dcec6aceb0d424b626d150c/ledger_device_sdk/" + "https://raw.githubusercontent.com/LedgerHQ/ledger-device-rust-sdk/feat/stax_nbgl_2/ledger_device_sdk/" ); let sysroot = Path::new(sysroot_cmd).join("lib").join("rustlib"); // Retrieve each target file independently // TODO: handle target.json modified upstream - for target in &["nanos", "nanox", "nanosplus"] { + for target in &["nanos", "nanox", "nanosplus", "stax", "flex"] { let outfilepath = sysroot.join(target).join("target.json"); let targetpath = outfilepath.clone().into_os_string().into_string().unwrap();