Skip to content

Commit bc6e226

Browse files
author
Stephane Portron
committed
IO revamping
1 parent f917dec commit bc6e226

File tree

183 files changed

+13919
-38482
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+13919
-38482
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ repos:
2222
rev: v2.2.5
2323
hooks:
2424
- id: codespell
25+
args: [--ignore-words-list=aci]
2526

2627
- repo: https://github.com/pre-commit/mirrors-clang-format
2728
rev: v16.0.6

Makefile.defines

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ DEFINES += SCREEN_SIZE_NANO
189189
DEFINES += HAVE_BAGL
190190
endif # TARGET_NANOS
191191

192+
DEFINES += OS_IO_SEPH_BUFFER_SIZE=272
193+
192194
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_NANOS2))
193195
# Screen is directly connected to the SE
194196
DEFINES += HAVE_SE_SCREEN

Makefile.rules

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ else
2727
NBGL_INCLUDE_PATH := lib_nbgl
2828
endif
2929

30+
DEFINES += REVAMPED_IO
31+
32+
ifneq ($(IS_STANDARD_APP),1)
33+
ifneq ($(DISABLE_OS_IO_STACK_USE), 1)
34+
DEFINES += USE_OS_IO_STACK
35+
endif
36+
endif
37+
3038
define uniq =
3139
$(eval seen :=)
3240
$(foreach _,$1,$(if $(filter $_,${seen}),,$(eval seen += $_)))
@@ -38,6 +46,8 @@ define check_duplicate =
3846
$(if $(LIST), $(info [WARNING] Found duplicate files in SDK and APP: ${LIST}))
3947
endef
4048

49+
SDK_SOURCE_PATH += io io_legacy protocol lib_u2f_legacy
50+
4151
# adding the correct target header to sources
4252
SDK_SOURCE_PATH += target/$(TARGET)/include
4353

Makefile.standard_app

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_NANOX TARGET_STAX TARGET_FLE
2525
HAVE_APPLICATION_FLAG_BOLOS_SETTINGS = 1
2626
DEFINES += HAVE_BLE BLE_COMMAND_TIMEOUT_MS=2000 HAVE_BLE_APDU
2727
DEFINES += BLE_SEGMENT_SIZE=32
28-
SDK_SOURCE_PATH += lib_blewbxx lib_blewbxx_impl
28+
SDK_SOURCE_PATH += lib_blewbxx
2929
endif
3030
endif
3131

@@ -36,6 +36,7 @@ ifeq ($(ENABLE_NFC), 1)
3636
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME), TARGET_STAX TARGET_FLEX))
3737
HAVE_APPLICATION_FLAG_BOLOS_SETTINGS = 1
3838
DEFINES += HAVE_NFC
39+
SDK_SOURCE_PATH += lib_nfc
3940
endif
4041
endif
4142

@@ -82,17 +83,6 @@ else
8283
DEFINES += PRINTF\(...\)=
8384
endif
8485

85-
#####################################################################
86-
# IO SEPROXY BUFFER SIZE #
87-
#####################################################################
88-
ifneq ($(DISABLE_DEFAULT_IO_SEPROXY_BUFFER_SIZE), 1)
89-
ifeq ($(TARGET_NAME), TARGET_NANOS)
90-
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128
91-
else
92-
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300
93-
endif
94-
endif
95-
9686
#####################################################################
9787
# NBGL #
9888
#####################################################################
@@ -121,19 +111,30 @@ ifeq ($(ENABLE_NBGL_KEYPAD), 1)
121111
DEFINES += NBGL_KEYPAD
122112
endif
123113

114+
#####################################################################
115+
# OS IO STACK USE #
116+
#####################################################################
117+
ifneq ($(DISABLE_OS_IO_STACK_USE), 1)
118+
DEFINES += USE_OS_IO_STACK
119+
endif
120+
124121
#####################################################################
125122
# STANDARD DEFINES #
126123
#####################################################################
127124
DEFINES += $(DEFINES_LIB)
128125
DEFINES += MAJOR_VERSION=$(APPVERSION_M) MINOR_VERSION=$(APPVERSION_N) PATCH_VERSION=$(APPVERSION_P)
129126
DEFINES += IO_HID_EP_LENGTH=64
130127

128+
129+
SDK_SOURCE_PATH += io
130+
SDK_SOURCE_PATH += protocol
131+
131132
ifeq ($(DISABLE_STANDARD_APP_DEFINES), 1)
132133
DISABLE_STANDARD_SNPRINTF = 1
133134
DISABLE_STANDARD_USB = 1
134135
DISABLE_STANDARD_WEBUSB = 1
136+
DISABLE_STANDARD_U2F = 1
135137
DISABLE_STANDARD_BAGL_UX_FLOW = 1
136-
DISABLE_STANDARD_SEPROXYHAL = 1
137138
endif
138139

139140
ifneq ($(DISABLE_STANDARD_SNPRINTF), 1)
@@ -143,7 +144,8 @@ endif
143144
ifneq ($(DISABLE_STANDARD_USB), 1)
144145
DEFINES += HAVE_IO_USB HAVE_L4_USBLIB IO_USB_MAX_ENDPOINTS=4 HAVE_USB_APDU
145146
DEFINES += USB_SEGMENT_SIZE=64
146-
SDK_SOURCE_PATH += lib_stusb lib_stusb_impl
147+
SDK_SOURCE_PATH += lib_stusb
148+
SDK_SOURCE_PATH += lib_stusb_impl
147149
endif
148150

149151
ifneq ($(DISABLE_STANDARD_WEBUSB), 1)
@@ -153,8 +155,21 @@ ifneq ($(DISABLE_STANDARD_WEBUSB), 1)
153155
DEFINES += HAVE_WEBUSB WEBUSB_URL_SIZE_B=$(WEBUSB_URL_SIZE_B) WEBUSB_URL=$(WEBUSB_URL)
154156
endif
155157

158+
ifneq ($(TARGET_NAME),$(filter $(TARGET_NAME), TARGET_NANOS2))
159+
ifneq ($(DISABLE_STANDARD_U2F), 1)
160+
DEFINES += HAVE_IO_U2F
161+
SDK_SOURCE_PATH += lib_u2f
162+
endif
163+
endif
164+
165+
ifeq ($(ENABLE_USB_CCID), 1)
166+
DEFINES += HAVE_CCID_USB
167+
SDK_SOURCE_PATH += lib_ccid
168+
SDK_SOURCE_PATH += lib_stusb_impl
169+
endif
170+
156171
ifneq ($(DISABLE_STANDARD_BAGL_UX_FLOW), 1)
157-
ifneq ($(USE_NBGL), 1)
172+
ifndef USE_NBGL
158173
DEFINES += HAVE_UX_FLOW
159174
endif
160175
endif
@@ -259,14 +274,15 @@ include $(BOLOS_SDK)/Makefile.defines
259274
include $(BOLOS_SDK)/Makefile.glyphs
260275

261276
load: all
262-
python3 -m ledgerblue.loadApp $(APP_LOAD_PARAMS)
277+
python3 -m ledgerblue.loadApp $(APP_LOAD_PARAMS) --rootPrivateKey f028458b39af92fea938486ecc49562d0e7731b53d9b25e2701183e4f2adc991
263278

264279
load-offline: all
265280
python3 -m ledgerblue.loadApp $(APP_LOAD_PARAMS) --offline
266281

267282
delete:
268283
python3 -m ledgerblue.deleteApp $(COMMON_DELETE_PARAMS)
269284

285+
IS_STANDARD_APP = 1
270286
include $(BOLOS_SDK)/Makefile.rules
271287

272288
# Prepare `listvariants` mandatory target.

include/ledger_protocol.h

Lines changed: 0 additions & 64 deletions
This file was deleted.

include/os.h

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -128,63 +128,4 @@ int snprintf(char *str, size_t str_size, const char *format, ...);
128128
int compute_address_location(int address);
129129
#endif
130130

131-
// syscall test
132-
// SYSCALL void dummy_1(unsigned int* p PLENGTH(2+len+15+ len + 16 + sizeof(io_send_t) + 1 ),
133-
// unsigned int len);
134-
135-
/* ----------------------------------------------------------------------- */
136-
/* - I/O I2C - */
137-
/* ----------------------------------------------------------------------- */
138-
139-
#ifdef HAVE_IO_I2C
140-
141-
#define IO_I2C_SPEED_STD 0
142-
#define IO_I2C_SPEED_FAST 1
143-
#define IO_I2C_SPEED_FASTPLUS 2
144-
#define IO_I2C_SPEED_HS 3
145-
#define IO_I2C_MASTER 0x80
146-
/**
147-
* Configure the I2C peripheral.
148-
* @param speed_and_master enables to set the bus speed. And to select if the peripheral will act as
149-
* master (issuing Start and Stop condition upon need) or slave mode.
150-
* @param address In master mode, this parameter sets the target I2C device's address. In slave
151-
* mode, the address is the desired I2C bus address for the interface. The address is always a 7bit
152-
* address (excluding the transfer direction bit).
153-
*/
154-
SYSCALL void io_i2c_setmode(unsigned int speed_and_master, unsigned int address);
155-
156-
/**
157-
* Setup the I2C peripheral for:
158-
* - In slave mode, receiving a WRITE transaction of maxlength bytes at most. Upon WRITE transaction
159-
* end, an SEPROXYHAL_TAG_I2C_EVENT is issued with the received data. It has to be received through
160-
* ::io_seph_recv.
161-
* - In master mode, this call is nop.
162-
*/
163-
SYSCALL void io_i2c_prepare(unsigned int maxlength);
164-
165-
#define IO_I2C_FLAGS_READ 0
166-
#define IO_I2C_FLAGS_WRITE 1
167-
#define IO_I2C_FLAGS_START 2
168-
#define IO_I2C_FLAGS_STOP 4
169-
/**
170-
* Request to execute a transfer:
171-
* - In slave mode, this call is non-blocking. It only enables to reply to a READ transaction of at
172-
* most length bytes. After the Stop condition is issued from the master, a SEPROXYHAL_TAG_I2C_EVENT
173-
* event containing the effectively transferred length is issued and can be retrieved through
174-
* ::io_seph_recv. To restart or continue the transfer requires another call to ::io_i2c_xfer.
175-
* - In master mode, this call is blocking and triggers the transaction as requested through the
176-
* flags parameter. The READ or WRITE transaction will place or transmit data from the given buffer
177-
* and length. Depending on the passed start/stop flags, corresponding bus condition are executed.
178-
*/
179-
SYSCALL void io_i2c_xfer(void *buffer PLENGTH(length), unsigned int length, unsigned int flags);
180-
181-
#ifndef BOLOS_RELEASE
182-
#ifdef BOLOS_DEBUG
183-
SYSCALL void io_i2c_dumpstate(void);
184-
SYSCALL void io_debug(char *chars, unsigned int len);
185-
#endif // BOLOS_DEBUG
186-
#endif // BOLOS_RELEASE
187-
188-
#endif // HAVE_IO_I2C
189-
190131
#endif // OS_H

include/os_io.h

Lines changed: 0 additions & 112 deletions
This file was deleted.

0 commit comments

Comments
 (0)