Skip to content

Latest commit

 

History

History
71 lines (50 loc) · 1.49 KB

app-dev.md

File metadata and controls

71 lines (50 loc) · 1.49 KB

How-To

Build a RISC-V app

Build the docker image to have a ready-to-use RISC-V toolchain:

docker build -t riscv .

Retrieve jsmn and nanopb git submodule:

git submodule update --init

Build the RISC-V app using the docker.sh script:

$ ./docker.sh riscv
[root:/app] # cmake -Bbuild -H.
[root:/app] # make -C build/

Build the RISC-V VM and install it on the Nano device

Like any other Nano apps. Sources are in the vm/ directory.

cd vm/
make
make load

Run the app

Using speculos:

$ speculos.py --model nanox --sdk 2.0.2 vm/bin/app.elf &
$ ./host/stream.py --speculos --app ./app/build/app-swap/app-swap

Or using a real device:

$ ./host/stream.py --app ./app/build/app-swap/app-swap

Requests can then be entered in hexadecimal on stdin. Clients are also available, for instance for app-swap:

$ ./app/app-swap/swap.py --speculos --app ./app/build/app-swap/app-swap

Once the app is signed, the .zip can be passed as an argument:

$ ./app/app-swap/swap.py --speculos --app /tmp/app.zip

Sign the app

While everything is done transparently when passing an ELF file to stream.py, the following commands can be used to sign an app manually. The app is first signed by a (fake) Ledger HSM, then by the device:

$ python host/hsm.py --elf-path app/build/app-ethereum/app-ethereum --app-path /tmp/app.zip
$ python host/app.py --speculos --app-path /tmp/app.zip