Build the Application | Developers

2. Build the Application

Estimated reading time: 3 minutes

Before you start

Note
    This page serves as:
  • A tutorial using the app‑boilerplate
  • General instructions on how to do a build. In this case, follow all the instructions below replace your‑app for app‑boilerplate.

1. Get the Boilerplate Application

Ensure that you are outside of the ledger‑app‑builder folder, because it is not recommended that the app‑boilerplate is nested inside the ledger‑app‑builder.

The Boilerplate Application was specifically designed for developers to play around with and read the code. You can clone it in your working folder to start a new project. Applications that support multiple Ledger devices are typically all in a single repository, so you can use the same repository to build an app for different devices.

git clone https://github.com/LedgerHQ/app-boilerplate.git
cd app-boilerplate

2. Build the Application

Using the Clang Static Analyzer

It is Nano independent it is a good idea to do it before

  • The Docker image includes the Clang Static Analyzer, which can be invoked using the following command verbatim
    Note: docker can be replaced with podman or buildah without sudo
sudo docker run --rm -ti -v "$(realpath .):/app" ledger-app-builder:latest

While the image is running, type make scan-build:

root@656be163fe84:/app# make scan-build

Nano S

1 - At the root of app‑boilerplate launch the following command verbatim
Note: docker can be replaced with podman or buildah without sudo

sudo docker run --rm -ti -v "$(realpath .):/app" ledger-app-builder:latest

2 - While the image is running, type make:

root@656be163fe84:/app# make

Nano X and Nano S Plus

For Nano X and S Plus, specify the BOLOS_SDK environment variable before building your app, at the root of app‑boilerplate:

  • Launch the following command verbatim
    Note: docker can be replaced with podman or buildah without sudo
sudo docker run --rm -ti -v "$(realpath .):/app" ledger-app-builder:latest

For Nano X, while the image is running, type BOLOS_SDK=$NANOX_SDK make:

root@656be163fe84:/app# BOLOS_SDK=$NANOX_SDK make

For Nano S Plus, while the image is running, type BOLOS_SDK=$NANOSP_SDK make:

root@656be163fe84:/app# BOLOS_SDK=$NANOSP_SDK make
Note
If you are building for different versions of Nano (S, X, S Plus) at the same time, you need change the BOLOS_SDK variable between two builds, and first use make clean to avoid errors.

3. Exit the image

The build generates several files in your application folder and especially the app.elf (in the bin folder) that can be loaded to a Nano S or S Plus or into the Nano X or S Emulator (Speculos).

You can exit the image, with the exit command.


Did you find this page helpful?


How would you improve this page for developers?



1. Build the Container
Linux users
Getting Started
Theme Features
Customization

Embedded Apps