Skip to content

Commit 9442db7

Browse files
authored
Merge pull request #5 from Zondax/support_nanos2
Support nanos plus device
2 parents 0fb4d25 + 83a5661 commit 9442db7

114 files changed

Lines changed: 1708 additions & 980 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.

.github/workflows/main.yml

Lines changed: 78 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ jobs:
150150
export PATH=~/.cargo/bin:$PATH
151151
cd tests_zemu && yarn testSR25519
152152
153-
build_package:
153+
build_package_0:
154154
needs: [ configure, build, build_ledger, test_zemu, test_zemu_sr25519 ]
155155
if: ${{ github.ref == 'refs/heads/main' }}
156156
runs-on: ubuntu-latest
@@ -168,41 +168,101 @@ jobs:
168168
submodules: true
169169
- name: Install deps
170170
run: pip install ledgerblue
171-
- name: Build
171+
172+
- name: Build NanoS light
172173
shell: bash -l {0}
173174
run: |
174175
source $HOME/.cargo/env
175176
make SUBSTRATE_PARSER_FULL=0
176-
- name: Set tag name var (1)
177-
id: vars_1
178-
run: echo ::set-output name=tag_name::$(./app/pkg/installer_s.sh version)
177+
mv ./app/pkg/installer_s.sh ./app/pkg/installer_nanos_light.sh
178+
- name: Set tag
179+
id: nanos_light
180+
run: echo ::set-output name=tag_name::$(./app/pkg/installer_nanos_light.sh version)
179181
- name: Create or Update Release (1)
180-
id: create_release_1
182+
id: create_release_0
183+
uses: softprops/action-gh-release@v1
184+
env:
185+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
186+
with:
187+
files: ./app/pkg/installer_nanos_light.sh
188+
tag_name: ${{ steps.nanos_light.outputs.tag_name }}
189+
draft: false
190+
prerelease: false
191+
192+
build_package_1:
193+
needs: [ configure, build, build_ledger, test_zemu, test_zemu_sr25519 ]
194+
if: ${{ github.ref == 'refs/heads/main' }}
195+
runs-on: ubuntu-latest
196+
container:
197+
image: zondax/builder-bolos:latest
198+
options: --user ${{ needs.configure.outputs.uid_gid }}
199+
env:
200+
BOLOS_SDK: ${{ github.workspace }}/deps/nanos-secure-sdk
201+
BOLOS_ENV: /opt/bolos
202+
HOME: /home/zondax_circle
203+
steps:
204+
- name: Checkout
205+
uses: actions/checkout@v2
206+
with:
207+
submodules: true
208+
- name: Install deps
209+
run: pip install ledgerblue
210+
211+
- name: Build NanoS XL
212+
shell: bash -l {0}
213+
run: |
214+
source $HOME/.cargo/env
215+
make SUBSTRATE_PARSER_FULL=1
216+
mv ./app/pkg/installer_s.sh ./app/pkg/installer_nanos_xl.sh
217+
- name: Set tag
218+
id: nanos_xl
219+
run: echo ::set-output name=tag_name::$(./app/pkg/installer_nanos_xl.sh version)
220+
- name: Update Release
221+
id: update_release_1
181222
uses: softprops/action-gh-release@v1
182223
env:
183224
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
184225
with:
185-
files: ./app/pkg/installer_s.sh
186-
tag_name: ${{ steps.vars_1.outputs.tag_name }}
226+
files: ./app/pkg/installer_nanos_xl.sh
227+
tag_name: ${{ steps.nanos_xl.outputs.tag_name }}
187228
draft: false
188229
prerelease: false
189-
- name: Clear and rebuild XL version
230+
231+
build_package_2:
232+
needs: [ configure, build, build_ledger, test_zemu, test_zemu_sr25519 ]
233+
if: ${{ github.ref == 'refs/heads/main' }}
234+
runs-on: ubuntu-latest
235+
container:
236+
image: zondax/builder-bolos:latest
237+
options: --user ${{ needs.configure.outputs.uid_gid }}
238+
env:
239+
BOLOS_SDK: ${{ github.workspace }}/deps/nanosplus-secure-sdk
240+
BOLOS_ENV: /opt/bolos
241+
HOME: /home/zondax_circle
242+
steps:
243+
- name: Checkout
244+
uses: actions/checkout@v2
245+
with:
246+
submodules: true
247+
- name: Install deps
248+
run: pip install ledgerblue
249+
250+
- name: Build NanoSP XL
190251
shell: bash -l {0}
191252
run: |
192253
source $HOME/.cargo/env
193254
make SUBSTRATE_PARSER_FULL=1
194-
cp rust/app/pkg/installer_s.sh rust/app/pkg/installer_baking_s.sh
195-
cp app/pkg/installer_s.sh app/pkg/installer_XL_s.sh
196-
- name: Set tag name var (2)
197-
id: vars_2
198-
run: echo ::set-output name=tag_name::$(./app/pkg/installer_XL_s.sh version)
199-
- name: Create or Update Release (2)
200-
id: create_release_2
255+
mv ./app/pkg/installer_s2.sh ./app/pkg/installer_nanosp_xl.sh
256+
- name: Set tag
257+
id: nanosp_xl
258+
run: echo ::set-output name=tag_name::$(./app/pkg/installer_nanosp_xl.sh version)
259+
- name: Update Release
260+
id: update_release_2
201261
uses: softprops/action-gh-release@v1
202262
env:
203263
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
204264
with:
205-
files: ./app/pkg/installer_XL_s.sh
206-
tag_name: ${{ steps.vars_2.outputs.tag_name }}
265+
files: ./app/pkg/installer_nanosp_xl.sh
266+
tag_name: ${{ steps.nanosp_xl.outputs.tag_name }}
207267
draft: false
208268
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: 22 additions & 13 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");
@@ -95,22 +95,32 @@ endef
9595
$(error "$(error_message)")
9696
endif
9797

98-
APP_LOAD_PARAMS = --appFlags 0x200 --delete $(COMMON_LOAD_PARAMS) --path $(APPPATH)
98+
APP_LOAD_PARAMS = --curve ed25519 --delete $(COMMON_LOAD_PARAMS) --path $(APPPATH)
9999

100100
ifeq ($(TARGET_NAME),TARGET_NANOS)
101+
APP_LOAD_PARAMS += --appFlags 0x000
101102
APP_STACK_SIZE:=3216
102103
ICONNAME:=$(CURDIR)/nanos_icon.gif
103104
OUTPUT_ELF ?= $(CURDIR)/output/app_s.elf
104105
OUTPUT_INSTALLER := $(CURDIR)/pkg/installer_s.sh
105106
endif
106107

107108
ifeq ($(TARGET_NAME),TARGET_NANOX)
109+
APP_LOAD_PARAMS += --appFlags 0x200
108110
SCRIPT_LD:=$(CURDIR)/script_x.ld
109111
ICONNAME:=$(CURDIR)/nanox_icon.gif
110112
OUTPUT_ELF ?= $(CURDIR)/output/app_x.elf
111113
OUTPUT_INSTALLER:= $(CURDIR)/pkg/installer_x.sh
112114
endif
113115

116+
ifeq ($(TARGET_NAME),TARGET_NANOS2)
117+
APP_LOAD_PARAMS += --appFlags 0x200
118+
SCRIPT_LD:=$(CURDIR)/script_s2.ld
119+
ICONNAME:=$(CURDIR)/nanox_icon.gif
120+
OUTPUT_ELF ?= $(CURDIR)/output/app_s2.elf
121+
OUTPUT_INSTALLER:= $(CURDIR)/pkg/installer_s2.sh
122+
endif
123+
114124
$(info TARGET_NAME = [$(TARGET_NAME)])
115125
$(info ICONNAME = [$(ICONNAME)])
116126

@@ -137,7 +147,10 @@ DEFINES += HAVE_BOLOS_APP_STACK_CANARY
137147

138148
DEFINES += HAVE_WEBUSB WEBUSB_URL_SIZE_B=0 WEBUSB_URL=""
139149

140-
ifeq ($(TARGET_NAME),TARGET_NANOX)
150+
ifeq ($(TARGET_NAME),TARGET_NANOS)
151+
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128
152+
else
153+
# Assume Nano X/S+
141154
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300
142155

143156
DEFINES += HAVE_GLO096
@@ -148,20 +161,16 @@ DEFINES += HAVE_BAGL_FONT_OPEN_SANS_EXTRABOLD_11PX
148161
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_LIGHT_16PX
149162

150163
DEFINES += HAVE_UX_FLOW
164+
endif
151165

166+
ifeq ($(TARGET_NAME),TARGET_NANOX)
167+
# X specific
152168
DEFINES += HAVE_BLE
153169
DEFINES += HAVE_BLE_APDU BLE_COMMAND_TIMEOUT_MS=2000
154170

155171
SDK_SOURCE_PATH += lib_blewbxx lib_blewbxx_impl
156-
else
157-
# Assume Nano S
158-
DEFINES += HAVE_BAGL BAGL_WIDTH=128 BAGL_HEIGHT=32
159-
DEFINES += BAGL_WIDTH_MARGIN=10
160-
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128
161172
endif
162173

163-
# X specific
164-
165174
# App specific
166175

167176
#Feature temporarily disabled
@@ -230,11 +239,11 @@ clean: rust_clean
230239
# load, delete and listvariants are provided to comply with Ledger requirements
231240
.PHONY: load
232241
load:
233-
python -m ledgerblue.loadApp $(APP_LOAD_PARAMS)
242+
python3 -m ledgerblue.loadApp $(APP_LOAD_PARAMS)
234243

235244
.PHONY: delete
236245
delete:
237-
python -m ledgerblue.deleteApp $(COMMON_DELETE_PARAMS)
246+
python3 -m ledgerblue.deleteApp $(COMMON_DELETE_PARAMS)
238247

239248
# Import generic rules from the SDK
240249
include $(BOLOS_SDK)/Makefile.rules
@@ -246,7 +255,7 @@ dep/%.d: %.c Makefile
246255
listvariants:
247256
ifeq ($(TARGET_NAME),TARGET_NANOS)
248257
@echo VARIANTS COIN XX XX_XL
249-
else ifeq ($(TARGET_NAME),TARGET_NANOX)
258+
else
250259
@echo VARIANTS COIN XX
251260
endif
252261

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=201
55
# This is the patch version of this release
6-
APPVERSION_P=0
6+
APPVERSION_P=1

0 commit comments

Comments
 (0)