Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the global struct size #281

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/apdu_sign.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ typedef struct {
union {
/// @brief clear signing state info.
struct {
size_t total_length;
tz_parser_state parser_state;
size_t total_length;
uint8_t last_field_index;
bool received_msg;
} clear;
Expand Down
2 changes: 1 addition & 1 deletion app/src/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ typedef enum {
*/
typedef struct {
/* State */
main_step_t step; /// Current operational state of app.
tz_ui_stream_t stream; /// UX and display related information
bip32_path_with_curve_t path_with_curve; /// Derivation path
union {
Expand Down Expand Up @@ -119,6 +118,7 @@ typedef struct {
char error_code[ERROR_CODE_SIZE]; /// Error codes to be displayed in
/// blindsigning.
#endif
main_step_t step; /// Current operational state of app.
} globals_t;

/* Settings */
Expand Down
8 changes: 4 additions & 4 deletions app/src/parser/parser_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ typedef struct {
tz_parser_regs regs; /// parser register

/// common fields to communicate with caller
tz_parser_result errno; /// current parser result
struct {
char field_name[TZ_FIELD_NAME_SIZE]; /// name of the last field
/// parsed
Expand All @@ -100,14 +99,15 @@ typedef struct {
} field_info; /// information of the last field parsed
// common singleton buffers
int ofs; /// offset for the parser
/// input type specific state
tz_micheline_state micheline; /// micheline parser state
tz_operation_state operation; /// operation parser state
struct {
tz_num_parser_buffer num; /// number parser buffer
uint8_t capture[TZ_CAPTURE_BUFFER_SIZE]; /// capture buffer is used
/// to store string values
} buffers;
/// input type specific state
tz_micheline_state micheline; /// micheline parser state
tz_operation_state operation; /// operation parser state
tz_parser_result errno; /// current parser result
} tz_parser_state;

/**
Expand Down
12 changes: 6 additions & 6 deletions app/src/ui_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ typedef struct {
#ifdef HAVE_BAGL
tz_ui_icon_t icon; /// Icon to display on the screen.
tz_ui_layout_type_t
layout_type; /// Layout type for the screen. CAN BP, BNP, NP, PB or
/// HOME_X where X can be one of the BP, BNP, PB.
char *title; /// Title to display on the screen.
char *body[TZ_UI_STREAM_CONTENTS_LINES]; /// Body to display on the
/// screen (Below title).
short body_len; /// number of non-empty lines in the body.
layout_type; /// Layout type for the screen. CAN BP, BNP, NP, PB or
/// HOME_X where X can be one of the BP, BNP, PB.
uint8_t body_len; /// number of non-empty lines in the body.
char *title; /// Title to display on the screen.
char *body[TZ_UI_STREAM_CONTENTS_LINES]; /// Body to display on the
/// screen (Below title).
#else
nbgl_layoutTagValue_t
pairs[NB_MAX_DISPLAYED_PAIRS_IN_REVIEW]; /// Title-value pairs to be
Expand Down
2 changes: 1 addition & 1 deletion app/src/ui_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/

#ifdef TARGET_NANOS
#define BUFF_LEN 120 /// Ring buffer length of nanos
#define BUFF_LEN 114 /// Ring buffer length of nanos
#elif defined(HAVE_BAGL)
#define BUFF_LEN 256 /// Ring buffer length for nanos2/nanox
#else
Expand Down
Loading