Skip to content

To add support for NVRAM save and load operations for Rust #562

@iartemov-ledger

Description

@iartemov-ledger

As it is don for C-apps in #552.
The linking is done rather differently for Rust:

  1. LLD: https://github.com/LedgerHQ/ledger-device-rust-sdk/blob/master/ledger_secure_sdk_sys/link.ld#L77
  2. relocation: https://github.com/LedgerHQ/ledger-device-rust-sdk/blob/master/ledger_secure_sdk_sys/link_wrap.sh
  3. then at app startup these calls: https://github.com/LedgerHQ/ledger-device-rust-sdk/blob/13ede06b1c28063689aa487a08ff6a00a344fd18/ledger_secure_sdk_sys/src/c/src.c#L313 (namely link_pass_nvram() and link_pass_ram())

We may want to look for:

  • _nvm_data_start - for the beginning of NVRAM zone
  • _nvram_prev_run or _envram_data - for its end
    in a separate .nvm_data section (another segment).

There are sys_nvm_write() calls at the app-boilerplate-rust start-up at address c0df2e00 (=.rodata, _erelocs, _nvram_data - relocations are being made ?)

.nvm_data section is linked to flash2 segment, different form flash with .text. So we may pass by chance here https://github.com/LedgerHQ/speculos/blob/master/src/launcher.c#L247 aading an additional page to .text section. What if the writable NVRAM is bigger ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions