Skip to content

Commit ad901b5

Browse files
authored
Merge pull request #239 from LedgerHQ/y333/avoid_unwanted_pin_lock_during_io_reset
Fix pin lock issue during io reset + Fix S+ and X SRAM size
2 parents 67b1ffe + 07fd458 commit ad901b5

File tree

7 files changed

+24
-10
lines changed

7 files changed

+24
-10
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ledger_device_sdk/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ledger_device_sdk"
3-
version = "1.20.3"
3+
version = "1.20.4"
44
authors = ["yhql", "yogh333", "agrojean-ledger", "kingofpayne"]
55
edition = "2021"
66
license.workspace = true
@@ -21,7 +21,7 @@ rand_core = { version = "0.6.3", default-features = false }
2121
zeroize = { version = "1.6.0", default-features = false }
2222
numtoa = "0.2.4"
2323
const-zero = "0.1.1"
24-
ledger_secure_sdk_sys = { path = "../ledger_secure_sdk_sys", version = "1.6.6" }
24+
ledger_secure_sdk_sys = { path = "../ledger_secure_sdk_sys", version = "1.6.7" }
2525

2626
[features]
2727
debug = []

ledger_device_sdk/nanosplus_layout.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ MEMORY
22
{
33
FLASH (rx) : ORIGIN = 0xc0de0000, LENGTH = 400K
44
DATA (r) : ORIGIN = 0xc0de0000, LENGTH = 400K
5-
SRAM (rwx) : ORIGIN = 0xda7a0000, LENGTH = 30K
5+
SRAM (rwx) : ORIGIN = 0xda7a0000, LENGTH = 44K
66
}
77

88
PAGE_SIZE = 512;

ledger_device_sdk/nanox_layout.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ MEMORY
22
{
33
FLASH (rx) : ORIGIN = 0xc0de0000, LENGTH = 400K
44
DATA (r) : ORIGIN = 0xc0de0000, LENGTH = 400K
5-
SRAM (rwx) : ORIGIN = 0xda7a0000, LENGTH = 30K
5+
SRAM (rwx) : ORIGIN = 0xda7a0000, LENGTH = 28K
66
}
77

88
PAGE_SIZE = 256;

ledger_device_sdk/src/nbgl.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ use core::ffi::{c_char, c_int};
88
use core::mem::transmute;
99
use ledger_secure_sdk_sys::*;
1010

11-
#[no_mangle]
12-
static mut G_ux_params: bolos_ux_params_t = unsafe { const_zero!(bolos_ux_params_t) };
13-
1411
pub mod nbgl_address_review;
1512
pub mod nbgl_choice;
1613
pub mod nbgl_generic_review;

ledger_secure_sdk_sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ledger_secure_sdk_sys"
3-
version = "1.6.6"
3+
version = "1.6.7"
44
authors = ["yhql", "agrojean-ledger", "yogh333"]
55
edition = "2021"
66
license.workspace = true

ledger_secure_sdk_sys/src/c/src.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ void c_reset_bss() {
266266
memset(bss, 0, bss_len);
267267
}
268268

269+
bolos_ux_params_t G_ux_params;
270+
269271
void c_boot_std() {
270272
// below is a 'manual' implementation of `io_seproxyhal_init`
271273
#ifdef HAVE_MCU_PROTECT
@@ -277,6 +279,21 @@ void c_boot_std() {
277279
io_seproxyhal_spi_send(c, 4);
278280
#endif
279281

282+
#ifndef TARGET_NANOS
283+
// Warn UX layer of io reset to avoid unwanted pin lock
284+
memset(&G_ux_params, 0, sizeof(G_ux_params));
285+
G_ux_params.ux_id = BOLOS_UX_IO_RESET;
286+
287+
// If the app has just been booted from the UX, multiple os_ux calls may be necessary
288+
// to ensure UX layer has take the BOLOS_UX_IO_RESET instruction into account.
289+
for (uint8_t i = 0; i < 2; i++) {
290+
os_ux(&G_ux_params);
291+
if (os_sched_last_status(TASK_BOLOS_UX) == BOLOS_UX_OK) {
292+
break;
293+
}
294+
}
295+
#endif
296+
280297
#ifdef HAVE_BLE
281298
unsigned int plane = G_io_app.plane_mode;
282299
#endif

0 commit comments

Comments
 (0)