An Alamgu ledger app is mostly written in Rust, and efforts have been taken to ensure it is developed in a fairly standard way (for embedded Rust programs).
These dependencies are needed:
- Rust toolchain with unstable features (including
rustc
and LLD the LLVM Linker). - C toolchain targeting freestanding ARM (including
newlib
as a rump libc) - "linker wrapper" script from our fork of the SDK.
Additionally for testing these are needed:
- Python3
- Speculos the official Ledger emulator
- Ragger, a library to run tests on Speculos emulator
The easiest way to get all these dependencies is with Nix:
nix-shell -A $DEVICE.rustShell
cd rust-app/
cargo build --release --target=$TARGET_JSON
where DEVICE
is one of
nanox
for Nano Xnanosplus
for Nano S+flex
, for Flexstax
, for Stax
Exact instructions are not provided.
See the ./docker
subdirectory or GitHub Actions
secondary CI.
Nix needs additional information not provided in the Cargo lock file for the most robust form of supply-chain integrity for git dependencies.
This information is contained in crate-hashes.json
at the root of this repo.
After modifying Cargo.lock
, please run
./update-crate-hashes.sh
in order to regenerate this file and keep it up to date.
Using Nix, from the root level of this repo, run the following script to run tests for all devices
./run-ragger-tests.sh
The easiest thing to do is just run a Nix build as described in the main read-me. Nix will always track the latest changes, freshly rebuilding components as needed.
That said, it is also possible to use Cargo build. This useful for the quickest "debug loop".
The cargo-ledger builds, outputs a hex
file and a manifest file for ledgerctl
, and loads it on a device in a single cargo-ledger ledger -l nanosplus
command in the rust-app folder within app directory.
(You do not need to install cargo-ledger
if you are using the nix-provided development shell, as it provides it.)
Before installing with either method, please ensure that your device is plugged, unlocked, and on the device home screen.
Note as described in the main read-me, it is currently not possible to side-load apps on the on Nano X, so one can only test in the emulator.