Skip to content

Commit

Permalink
Merge pull request #97 from Zondax/nanos_plus
Browse files Browse the repository at this point in the history
Nanos plus
  • Loading branch information
ftheirs authored Mar 18, 2022
2 parents 8c1d6a3 + 38b497e commit 2677082
Show file tree
Hide file tree
Showing 105 changed files with 1,786 additions and 1,438 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/check_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "Verify PRs to master"

on:
pull_request:
branches:
- master

jobs:
configure:
runs-on: ubuntu-latest
outputs:
uid_gid: ${{ steps.get-user.outputs.uid_gid }}
steps:
- id: get-user
run: echo "::set-output name=uid_gid::$(id -u):$(id -g)"

get_version:
needs: configure
runs-on: ubuntu-latest
container:
image: zondax/builder-bolos:latest
options: --user ${{ needs.configure.outputs.uid_gid }}
env:
BOLOS_ENV: /opt/bolos
HOME: /home/zondax_circle
outputs:
version: ${{ steps.store-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true

- name: Invoke `version`
shell: bash -l {0}
env:
BOLOS_SDK: ${{ github.workspace }}/deps/nanos-secure-sdk
run: make version

- id: store-version
run: echo ::set-output name=version::$(cat ./app/app.version)

check_app_version:
needs: get_version
runs-on: ubuntu-latest
steps:
- id: checkTag
uses: mukunku/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ needs.get_version.outputs.version }}

- run: echo ${{ steps.checkTag.outputs.exists }}

- name: Tag exists
if: ${{ steps.checkTag.outputs.exists == 'true' }}
run: exit 1
114 changes: 92 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ jobs:
run: |
cd ./app/rust
cargo test
build_ledger:
build_nano_S:
needs: configure
runs-on: ubuntu-latest
container:
Expand All @@ -69,11 +70,54 @@ jobs:
uses: actions/checkout@v2
with:
submodules: true
- name: Build Standard app
- name: Build nanos app
shell: bash -l {0}
run: |
source $HOME/.cargo/env
make
build_nano_SP:
needs: configure
runs-on: ubuntu-latest
container:
image: zondax/builder-bolos:latest
options: --user ${{ needs.configure.outputs.uid_gid }}
env:
BOLOS_SDK: ${{ github.workspace }}/deps/nanosplus-secure-sdk
BOLOS_ENV: /opt/bolos
HOME: /home/zondax_circle
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Build nanosplus app
shell: bash -l {0}
run: |
source $HOME/.cargo/env
make
build_nano_X:
needs: configure
runs-on: ubuntu-latest
container:
image: zondax/builder-bolos:latest
options: --user ${{ needs.configure.outputs.uid_gid }}
env:
BOLOS_SDK: ${{ github.workspace }}/deps/nanox-secure-sdk
BOLOS_ENV: /opt/bolos
HOME: /home/zondax_circle
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Build nanox app
shell: bash -l {0}
run: |
source $HOME/.cargo/env
make
test_zemu:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -110,8 +154,9 @@ jobs:
run: |
export PATH=~/.cargo/bin:$PATH
make zemu_test
build_package:
needs: [ configure, build, build_ledger, test_zemu ]
build_package_nanos:
needs: [ configure, build, build_nano_S, build_nano_X, build_nano_SP, test_zemu ]
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
container:
Expand All @@ -128,41 +173,66 @@ jobs:
submodules: true
- name: Install deps
run: pip install ledgerblue
- name: Build

- name: Build NanoS
shell: bash -l {0}
run: |
source $HOME/.cargo/env
make
- name: Set tag name var (1)
id: vars_1
run: echo ::set-output name=tag_name::$(./app/pkg/installer_s.sh version)
- name: Create or Update Release (1)
id: create_release_1
mv ./app/pkg/installer_s.sh ./app/pkg/installer_nanos.sh
- name: Set tag
id: nanos
run: |
pip install ledgerblue
echo ::set-output name=tag_name::$(./app/pkg/installer_nanos.sh version)
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
files: ./app/pkg/installer_s.sh
tag_name: ${{ steps.vars_1.outputs.tag_name }}
files: ./app/pkg/installer_nanos.sh
tag_name: ${{ steps.nanos.outputs.tag_name }}
draft: false
prerelease: false
- name: Clear and rebuild XL version

build_package_nanos_plus:
needs: [ configure, build, build_nano_S, build_nano_X, build_nano_SP, test_zemu ]
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
container:
image: zondax/builder-bolos:latest
options: --user ${{ needs.configure.outputs.uid_gid }}
env:
BOLOS_SDK: ${{ github.workspace }}/deps/nanosplus-secure-sdk
BOLOS_ENV: /opt/bolos
HOME: /home/zondax_circle
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Install deps
run: pip install ledgerblue

- name: Build NanoS
shell: bash -l {0}
run: |
source $HOME/.cargo/env
make
cp rust/app/pkg/installer_s.sh rust/app/pkg/installer_baking_s.sh
cp app/pkg/installer_s.sh app/pkg/installer_XL_s.sh
- name: Set tag name var (2)
id: vars_2
run: echo ::set-output name=tag_name::$(./app/pkg/installer_XL_s.sh version)
- name: Create or Update Release (2)
id: create_release_2
mv ./app/pkg/installer_s2.sh ./app/pkg/installer_nanos_plus.sh
- name: Set tag
id: nanosp
run: |
pip install ledgerblue
echo ::set-output name=tag_name::$(./app/pkg/installer_nanos_plus.sh version)
- name: Update Release
id: update_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
files: ./app/pkg/installer_XL_s.sh
tag_name: ${{ steps.vars_2.outputs.tag_name }}
files: ./app/pkg/installer_nanos_plus.sh
tag_name: ${{ steps.nanosp.outputs.tag_name }}
draft: false
prerelease: false
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "deps/nanox-secure-sdk"]
path = deps/nanox-secure-sdk
url = https://github.com/LedgerHQ/nanox-secure-sdk.git
[submodule "deps/nanosplus-secure-sdk"]
path = deps/nanosplus-secure-sdk
url = https://github.com/LedgerHQ/nanosplus-secure-sdk.git
37 changes: 29 additions & 8 deletions app/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#*******************************************************************************
#******************************************************************************
# Ledger App
# (c) 2018-2021 Zondax GmbH
# (c) 2017 Ledger
Expand Down Expand Up @@ -54,8 +54,8 @@ COIN=STX
endif

APPVERSION_M=0
APPVERSION_N=19
APPVERSION_P=1
APPVERSION_N=20
APPVERSION_P=0

$(info COIN = [$(COIN)])

Expand Down Expand Up @@ -86,6 +86,7 @@ APP_STACK_SIZE:=3100
ICONNAME:=$(CURDIR)/nanos_icon.gif
OUTPUT_ELF:= $(CURDIR)/output/app_s.elf
OUTPUT_INSTALLER := $(CURDIR)/pkg/installer_s.sh
RUST_TARGET := thumbv6m-none-eabi
endif

ifeq ($(TARGET_NAME),TARGET_NANOX)
Expand All @@ -94,6 +95,18 @@ SCRIPT_LD:=$(CURDIR)/script_x.ld
ICONNAME:=$(CURDIR)/nanox_icon.gif
OUTPUT_ELF:= $(CURDIR)/output/app_x.elf
OUTPUT_INSTALLER:= $(CURDIR)/pkg/installer_x.sh
RUST_TARGET := thumbv6m-none-eabi
endif

ifeq ($(TARGET_NAME),TARGET_NANOS2)
APP_LOAD_PARAMS += --appFlags 0x200
SCRIPT_LD:=$(CURDIR)/script_s2.ld
ICONNAME:=$(CURDIR)/nanox_icon.gif
OUTPUT_ELF ?= $(CURDIR)/output/app_s2.elf
OUTPUT_INSTALLER:= $(CURDIR)/pkg/installer_s2.sh
RUST_TARGET := thumbv6m-none-eabi
# do not use this target as there are known problems with it
# RUST_TARGET := thumbv8m.main-none-eabi
endif

$(info TARGET_NAME = [$(TARGET_NAME)])
Expand Down Expand Up @@ -123,7 +136,10 @@ DEFINES += HAVE_BOLOS_APP_STACK_CANARY

DEFINES += HAVE_WEBUSB WEBUSB_URL_SIZE_B=0 WEBUSB_URL=""

ifeq ($(TARGET_NAME),TARGET_NANOX)
ifeq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128
else
# Assume Nano X/S+
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300

DEFINES += HAVE_GLO096
Expand All @@ -134,14 +150,13 @@ DEFINES += HAVE_BAGL_FONT_OPEN_SANS_EXTRABOLD_11PX
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_LIGHT_16PX

DEFINES += HAVE_UX_FLOW
endif

ifeq ($(TARGET_NAME),TARGET_NANOX)
DEFINES += HAVE_BLE
DEFINES += HAVE_BLE_APDU BLE_COMMAND_TIMEOUT_MS=2000

SDK_SOURCE_PATH += lib_blewbxx lib_blewbxx_impl
else
# Assume Nano S
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128
endif

# X specific
Expand Down Expand Up @@ -199,7 +214,7 @@ SDK_SOURCE_PATH += lib_ux

.PHONY: rust
rust:
cd rust && CARGO_HOME="$(CURDIR)/rust/.cargo" cargo build --target thumbv6m-none-eabi --release
cd rust && CARGO_HOME="$(CURDIR)/rust/.cargo" cargo build --target $(RUST_TARGET) --release

# Before linking, we need to be sure rust lib is there
bin/app.elf: rust
Expand Down Expand Up @@ -228,3 +243,9 @@ dep/%.d: %.c Makefile
.PHONY: listvariants
listvariants:
@echo VARIANTS COIN STX

.PHONY: version
version:
@echo "v$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)" > app.version


2 changes: 1 addition & 1 deletion app/rust/.cargo/config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build]

[target.thumbv6m-none-eabi]
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
rustflags = [
"--emit", "asm",
"-C", "relocation-model=ropi",
Expand Down
Loading

0 comments on commit 2677082

Please sign in to comment.