Skip to content

Commit 81f27b6

Browse files
committed
Remove Nano S support
1 parent 4376c0c commit 81f27b6

File tree

20 files changed

+68
-762
lines changed

20 files changed

+68
-762
lines changed

cargo-ledger/src/main.rs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ struct CliArgs {
5252

5353
#[derive(ValueEnum, Clone, Copy, Debug, PartialEq)]
5454
enum Device {
55-
Nanos,
5655
Nanox,
5756
Nanosplus,
5857
Stax,
@@ -68,7 +67,6 @@ impl Display for Device {
6867
impl AsRef<str> for Device {
6968
fn as_ref(&self) -> &str {
7069
match self {
71-
Device::Nanos => "nanos",
7270
Device::Nanox => "nanox",
7371
Device::Nanosplus => "nanosplus",
7472
Device::Stax => "stax",
@@ -159,7 +157,6 @@ fn build_app(
159157
let exe_path = match use_prebuilt {
160158
None => {
161159
let c_sdk_path = match device {
162-
Device::Nanos => std::env::var("NANOS_SDK"),
163160
Device::Nanosplus => std::env::var("NANOSP_SDK"),
164161
Device::Nanox => std::env::var("NANOX_SDK"),
165162
Device::Stax => std::env::var("STAX_SDK"),
@@ -264,7 +261,7 @@ fn build_app(
264261
None => match metadata_ledger.flags {
265262
Some(flags) => match device {
266263
// Modify flags to enable BLE if targeting Nano X
267-
Device::Nanos | Device::Nanosplus => flags,
264+
Device::Nanosplus => flags,
268265
Device::Nanox | Device::Stax | Device::Flex => {
269266
let base =
270267
u32::from_str_radix(flags.trim_start_matches("0x"), 16)
@@ -279,7 +276,6 @@ fn build_app(
279276
// Target ID according to target, in case it
280277
// is not present in the retrieved ELF infos.
281278
let backup_targetid: String = match device {
282-
Device::Nanos => String::from("0x31100004"),
283279
Device::Nanox => String::from("0x33000004"),
284280
Device::Nanosplus => String::from("0x33100004"),
285281
Device::Stax => String::from("0x33200004"),
@@ -301,13 +297,8 @@ fn build_app(
301297
"binary": hex_file,
302298
"dataSize": infos.size
303299
});
304-
// Ignore apiLevel for Nano S as it is unsupported for now
305-
match device {
306-
Device::Nanos => (),
307-
_ => {
308-
json["apiLevel"] = infos.api_level.into();
309-
}
310-
}
300+
301+
json["apiLevel"] = infos.api_level.into();
311302
serde_json::to_writer_pretty(file, &json).unwrap();
312303

313304
// Copy icon to the same directory as the app.json
@@ -359,41 +350,41 @@ mod tests {
359350
#[test]
360351
fn valid_metadata() {
361352
let (_, metadata_ledger, metadata_nanos) =
362-
retrieve_metadata(Device::Nanos, Some("./tests/valid/Cargo.toml"));
353+
retrieve_metadata(Device::Flex, Some("./tests/valid/Cargo.toml"));
363354

364355
assert_eq!(metadata_ledger.name, Some("TestApp".to_string()));
365356
assert_eq!(metadata_ledger.curve, ["secp256k1"]);
366357
assert_eq!(metadata_ledger.flags, "0x38");
367358
assert_eq!(metadata_ledger.path, ["'44/123"]);
368359

369-
assert_eq!(metadata_nanos.icon, "./assets/nanos.gif")
360+
//assert_eq!(metadata_nanos.icon, "./assets/nanos.gif")
370361
}
371362

372363
#[test]
373364
fn valid_metadata_variant() {
374365
let (_, metadata_ledger, metadata_nanos) = retrieve_metadata(
375-
Device::Nanos,
366+
Device::Flex,
376367
Some("./tests/valid_variant/Cargo.toml"),
377368
);
378369

379370
assert_eq!(metadata_ledger.name, Some("TestApp".to_string()));
380371
assert_eq!(metadata_ledger.curve, ["secp256k1"]);
381372
assert_eq!(metadata_ledger.flags, "0x38");
382373
assert_eq!(metadata_ledger.path, ["'44/123"]);
383-
assert_eq!(metadata_nanos.icon, "./assets/nanos.gif")
374+
//assert_eq!(metadata_nanos.icon, "./assets/nanos.gif")
384375
}
385376

386377
#[test]
387378
fn valid_outdated_metadata() {
388379
let (_, metadata_ledger, metadata_nanos) = retrieve_metadata(
389-
Device::Nanos,
380+
Device::Flex,
390381
Some("./tests/valid_outdated/Cargo.toml"),
391382
);
392383

393384
assert_eq!(metadata_ledger.name, Some("TestApp".to_string()));
394385
assert_eq!(metadata_ledger.curve, ["secp256k1"]);
395386
assert_eq!(metadata_ledger.flags, "0");
396387
assert_eq!(metadata_ledger.path, ["'44/123"]);
397-
assert_eq!(metadata_nanos.icon, "nanos.gif")
388+
//assert_eq!(metadata_nanos.icon, "nanos.gif")
398389
}
399390
}

ledger_device_sdk/.cargo/config.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[target.nanos]
2-
runner = "speculos -m nanos --display=headless"
3-
41
[target.nanox]
52
runner = "speculos -m nanox --display=headless"
63

ledger_device_sdk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ default = [ "heap" ]
3333

3434
[lints.rust.unexpected_cfgs]
3535
level = "warn"
36-
check-cfg = ['cfg(target_os, values("stax", "flex", "nanos", "nanox", "nanosplus"))']
36+
check-cfg = ['cfg(target_os, values("stax", "flex", "nanox", "nanosplus"))']

ledger_device_sdk/src/io.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,6 @@ impl Comm {
430430
}
431431

432432
if unsafe { G_io_app.apdu_state } != APDU_IDLE && unsafe { G_io_app.apdu_length } > 0 {
433-
#[cfg(not(any(target_os = "nanos")))]
434433
unsafe {
435434
if os_perso_is_pin_set() == BOLOS_TRUE.try_into().unwrap()
436435
&& os_global_pin_is_validated() != BOLOS_TRUE.try_into().unwrap()

ledger_device_sdk/src/lib.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,11 @@ impl<T> NVMData<T> {
123123
NVMData { data }
124124
}
125125

126-
#[cfg(target_os = "nanos")]
127-
pub fn get_mut(&mut self) -> &mut T {
128-
ledger_secure_sdk_sys::pic_rs_mut(&mut self.data)
129-
}
130-
131126
/// This will return a mutable access by casting the pointer
132127
/// to the correct offset in `.nvm_data` manually.
133128
/// This is necessary when using the `rwpi` relocation model,
134129
/// because a static mutable will be assumed to be located in
135130
/// RAM, and be accessed through the static base (r9)
136-
#[cfg(not(target_os = "nanos"))]
137131
fn get_addr(&self) -> *mut T {
138132
use core::arch::asm;
139133
unsafe {
@@ -148,15 +142,13 @@ impl<T> NVMData<T> {
148142
}
149143
}
150144

151-
#[cfg(not(target_os = "nanos"))]
152145
pub fn get_mut(&mut self) -> &mut T {
153146
unsafe {
154147
let pic_addr = self.get_addr();
155148
&mut *pic_addr.cast()
156149
}
157150
}
158151

159-
#[cfg(not(target_os = "nanos"))]
160152
pub fn get_ref(&self) -> &T {
161153
unsafe {
162154
let pic_addr = self.get_addr();

ledger_device_sdk/src/nvm.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,6 @@ macro_rules! atomic_storage {
184184
};
185185
}
186186

187-
#[cfg(target_os = "nanos")]
188-
atomic_storage!(64);
189187
#[cfg(target_os = "nanox")]
190188
atomic_storage!(256);
191189
#[cfg(any(target_os = "nanosplus", target_os = "stax", target_os = "flex"))]

ledger_device_sdk/src/ui.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@
22

33
pub mod bagls;
44

5-
#[cfg(not(target_os = "nanos"))]
65
pub mod string_se;
76

8-
#[cfg(target_os = "nanos")]
9-
pub mod string_mcu;
10-
117
pub mod bitmaps;
128
pub mod fonts;
139
pub mod layout;
@@ -19,8 +15,4 @@ pub const PADDING: usize = 2;
1915
pub const Y_PADDING: usize = 3;
2016
pub const SCREEN_WIDTH: usize = 128;
2117

22-
#[cfg(target_os = "nanos")]
23-
pub const SCREEN_HEIGHT: usize = 32;
24-
25-
#[cfg(not(target_os = "nanos"))]
2618
pub const SCREEN_HEIGHT: usize = 64;

ledger_device_sdk/src/ui/bagls.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
#[cfg(target_os = "nanos")]
2-
pub mod mcu;
3-
#[cfg(target_os = "nanos")]
4-
pub use self::mcu::*;
5-
6-
#[cfg(not(target_os = "nanos"))]
71
pub mod se;
8-
#[cfg(not(target_os = "nanos"))]
92
pub use self::se::*;
103

114
use bitmaps::Glyph;

0 commit comments

Comments
 (0)