Skip to content

Commit f534538

Browse files
authored
Merge pull request #32 from Zondax/support_nanos2
Support nanos plus device
2 parents 1856635 + 4548b4c commit f534538

149 files changed

Lines changed: 1836 additions & 1448 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: "Verify PRs to master"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
configure:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
uid_gid: ${{ steps.get-user.outputs.uid_gid }}
13+
steps:
14+
- id: get-user
15+
run: echo "::set-output name=uid_gid::$(id -u):$(id -g)"
16+
17+
get_version:
18+
needs: configure
19+
runs-on: ubuntu-latest
20+
container:
21+
image: zondax/builder-bolos:latest
22+
options: --user ${{ needs.configure.outputs.uid_gid }}
23+
env:
24+
BOLOS_ENV: /opt/bolos
25+
HOME: /home/zondax_circle
26+
outputs:
27+
version: ${{ steps.store-version.outputs.version }}
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v2
31+
with:
32+
submodules: true
33+
34+
- name: Invoke `version`
35+
shell: bash -l {0}
36+
env:
37+
BOLOS_SDK: ${{ github.workspace }}/deps/nanos-secure-sdk
38+
run: make version
39+
40+
- id: store-version
41+
run: echo ::set-output name=version::$(cat ./app/app.version)
42+
43+
check_app_version:
44+
needs: get_version
45+
runs-on: ubuntu-latest
46+
steps:
47+
- id: checkTag
48+
uses: mukunku/tag-exists-action@v1.0.0
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
with:
52+
tag: ${{ needs.get_version.outputs.version }}
53+
54+
- run: echo ${{ steps.checkTag.outputs.exists }}
55+
56+
- name: Tag exists
57+
if: ${{ steps.checkTag.outputs.exists == 'true' }}
58+
run: exit 1

.github/workflows/main.yml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,120 @@ jobs:
150150
run: |
151151
export PATH=~/.cargo/bin:$PATH
152152
cd tests_zemu && yarn testSR25519
153+
154+
build_package_0:
155+
needs: [ configure, build, build_ledger, test_zemu, test_zemu_sr25519 ]
156+
if: ${{ github.ref == 'refs/heads/master' }}
157+
runs-on: ubuntu-latest
158+
container:
159+
image: zondax/builder-bolos:latest
160+
options: --user ${{ needs.configure.outputs.uid_gid }}
161+
env:
162+
BOLOS_SDK: ${{ github.workspace }}/deps/nanos-secure-sdk
163+
BOLOS_ENV: /opt/bolos
164+
HOME: /home/zondax_circle
165+
steps:
166+
- name: Checkout
167+
uses: actions/checkout@v2
168+
with:
169+
submodules: true
170+
- name: Install deps
171+
run: pip install ledgerblue
172+
173+
- name: Build NanoS light
174+
shell: bash -l {0}
175+
run: |
176+
source $HOME/.cargo/env
177+
make SUBSTRATE_PARSER_FULL=0
178+
mv ./app/pkg/installer_s.sh ./app/pkg/installer_nanos_light.sh
179+
- name: Set tag
180+
id: nanos_light
181+
run: echo ::set-output name=tag_name::$(./app/pkg/installer_nanos_light.sh version)
182+
- name: Create or Update Release (1)
183+
id: create_release_0
184+
uses: softprops/action-gh-release@v1
185+
env:
186+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
187+
with:
188+
files: ./app/pkg/installer_nanos_light.sh
189+
tag_name: ${{ steps.nanos_light.outputs.tag_name }}
190+
draft: false
191+
prerelease: false
192+
193+
build_package_1:
194+
needs: [ configure, build, build_ledger, test_zemu, test_zemu_sr25519 ]
195+
if: ${{ github.ref == 'refs/heads/master' }}
196+
runs-on: ubuntu-latest
197+
container:
198+
image: zondax/builder-bolos:latest
199+
options: --user ${{ needs.configure.outputs.uid_gid }}
200+
env:
201+
BOLOS_SDK: ${{ github.workspace }}/deps/nanos-secure-sdk
202+
BOLOS_ENV: /opt/bolos
203+
HOME: /home/zondax_circle
204+
steps:
205+
- name: Checkout
206+
uses: actions/checkout@v2
207+
with:
208+
submodules: true
209+
- name: Install deps
210+
run: pip install ledgerblue
211+
212+
- name: Build NanoS XL
213+
shell: bash -l {0}
214+
run: |
215+
source $HOME/.cargo/env
216+
make SUBSTRATE_PARSER_FULL=1
217+
mv ./app/pkg/installer_s.sh ./app/pkg/installer_nanos_xl.sh
218+
- name: Set tag
219+
id: nanos_xl
220+
run: echo ::set-output name=tag_name::$(./app/pkg/installer_nanos_xl.sh version)
221+
- name: Update Release
222+
id: update_release_1
223+
uses: softprops/action-gh-release@v1
224+
env:
225+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
226+
with:
227+
files: ./app/pkg/installer_nanos_xl.sh
228+
tag_name: ${{ steps.nanos_xl.outputs.tag_name }}
229+
draft: false
230+
prerelease: false
231+
232+
build_package_2:
233+
needs: [ configure, build, build_ledger, test_zemu, test_zemu_sr25519 ]
234+
if: ${{ github.ref == 'refs/heads/master' }}
235+
runs-on: ubuntu-latest
236+
container:
237+
image: zondax/builder-bolos:latest
238+
options: --user ${{ needs.configure.outputs.uid_gid }}
239+
env:
240+
BOLOS_SDK: ${{ github.workspace }}/deps/nanosplus-secure-sdk
241+
BOLOS_ENV: /opt/bolos
242+
HOME: /home/zondax_circle
243+
steps:
244+
- name: Checkout
245+
uses: actions/checkout@v2
246+
with:
247+
submodules: true
248+
- name: Install deps
249+
run: pip install ledgerblue
250+
251+
- name: Build NanoSP XL
252+
shell: bash -l {0}
253+
run: |
254+
source $HOME/.cargo/env
255+
make SUBSTRATE_PARSER_FULL=1
256+
mv ./app/pkg/installer_s2.sh ./app/pkg/installer_nanosp_xl.sh
257+
- name: Set tag
258+
id: nanosp_xl
259+
run: echo ::set-output name=tag_name::$(./app/pkg/installer_nanosp_xl.sh version)
260+
- name: Update Release
261+
id: update_release_2
262+
uses: softprops/action-gh-release@v1
263+
env:
264+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
265+
with:
266+
files: ./app/pkg/installer_nanosp_xl.sh
267+
tag_name: ${{ steps.nanosp_xl.outputs.tag_name }}
268+
draft: false
269+
prerelease: false

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
[submodule "deps/nanox-secure-sdk"]
1111
path = deps/nanox-secure-sdk
1212
url = https://github.com/LedgerHQ/nanox-secure-sdk.git
13+
[submodule "deps/nanosplus-secure-sdk"]
14+
path = deps/nanosplus-secure-sdk
15+
url = https://github.com/LedgerHQ/nanosplus-secure-sdk

app/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ bin/app.sha256
4848
bin/app.apdu
4949

5050
\output/app.*
51-
pkg/installer_?.sh
51+
pkg/installer_*.sh

app/Makefile

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#*******************************************************************************
22
# Ledger App
3-
# (c) 2018-2021 Zondax GmbH
3+
# (c) 2018 - 2022 Zondax GmbH
44
# (c) 2017 Ledger
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -102,6 +102,7 @@ APP_LOAD_PARAMS += --tlvraw 9F:01
102102
DEFINES += HAVE_PENDING_REVIEW_SCREEN
103103

104104
ifeq ($(TARGET_NAME),TARGET_NANOS)
105+
APP_LOAD_PARAMS += --appFlags 0x000
105106
APP_STACK_SIZE:=3216
106107
ICONNAME:=$(CURDIR)/nanos_icon.gif
107108
OUTPUT_ELF ?= $(CURDIR)/output/app_s.elf
@@ -116,6 +117,14 @@ OUTPUT_ELF ?= $(CURDIR)/output/app_x.elf
116117
OUTPUT_INSTALLER:= $(CURDIR)/pkg/installer_x.sh
117118
endif
118119

120+
ifeq ($(TARGET_NAME),TARGET_NANOS2)
121+
APP_LOAD_PARAMS += --appFlags 0x200
122+
SCRIPT_LD:=$(CURDIR)/script_s2.ld
123+
ICONNAME:=$(CURDIR)/nanox_icon.gif
124+
OUTPUT_ELF ?= $(CURDIR)/output/app_s2.elf
125+
OUTPUT_INSTALLER:= $(CURDIR)/pkg/installer_s2.sh
126+
endif
127+
119128
$(info TARGET_NAME = [$(TARGET_NAME)])
120129
$(info ICONNAME = [$(ICONNAME)])
121130

@@ -143,7 +152,10 @@ DEFINES += HAVE_BOLOS_APP_STACK_CANARY
143152

144153
DEFINES += HAVE_WEBUSB WEBUSB_URL_SIZE_B=0 WEBUSB_URL=""
145154

146-
ifeq ($(TARGET_NAME),TARGET_NANOX)
155+
ifeq ($(TARGET_NAME),TARGET_NANOS)
156+
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128
157+
else
158+
# Assume Nano X/S+
147159
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300
148160

149161
DEFINES += HAVE_GLO096
@@ -154,18 +166,16 @@ DEFINES += HAVE_BAGL_FONT_OPEN_SANS_EXTRABOLD_11PX
154166
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_LIGHT_16PX
155167

156168
DEFINES += HAVE_UX_FLOW
169+
endif
157170

171+
ifeq ($(TARGET_NAME),TARGET_NANOX)
172+
# X specific
158173
DEFINES += HAVE_BLE
159174
DEFINES += HAVE_BLE_APDU BLE_COMMAND_TIMEOUT_MS=2000
160175

161176
SDK_SOURCE_PATH += lib_blewbxx lib_blewbxx_impl
162-
else
163-
# Assume Nano S
164-
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128
165177
endif
166178

167-
# X specific
168-
169179
#Feature temporarily disabled
170180
DEFINES += LEDGER_SPECIFIC
171181

@@ -232,11 +242,11 @@ clean: rust_clean
232242
# load, delete and listvariants are provided to comply with Ledger requirements
233243
.PHONY: load
234244
load:
235-
python -m ledgerblue.loadApp $(APP_LOAD_PARAMS)
245+
python3 -m ledgerblue.loadApp $(APP_LOAD_PARAMS)
236246

237247
.PHONY: delete
238248
delete:
239-
python -m ledgerblue.deleteApp $(COMMON_DELETE_PARAMS)
249+
python3 -m ledgerblue.deleteApp $(COMMON_DELETE_PARAMS)
240250

241251
# Import generic rules from the SDK
242252
include $(BOLOS_SDK)/Makefile.rules
@@ -248,6 +258,10 @@ dep/%.d: %.c Makefile
248258
listvariants:
249259
ifeq ($(TARGET_NAME),TARGET_NANOS)
250260
@echo VARIANTS COIN CFG CFG_XL
251-
else ifeq ($(TARGET_NAME),TARGET_NANOX)
261+
else
252262
@echo VARIANTS COIN CFG
253263
endif
264+
265+
.PHONY: version
266+
version:
267+
@echo "v$(APPVERSION)" > app.version

app/Makefile.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ APPVERSION_M=1
33
# This is the `spec_version` field of `Runtime`
44
APPVERSION_N=245
55
# This is the `patch_version`
6-
APPVERSION_P=2
6+
APPVERSION_P=3

0 commit comments

Comments
 (0)