From 8f7d8204d0530c0ca531a751c2b267cb3fc46461 Mon Sep 17 00:00:00 2001 From: Nicolas Roggeman Date: Mon, 9 Sep 2024 08:25:51 +0200 Subject: [PATCH] Put fonts in Shared library to access them without syscall --- include/shared_trampoline.h | 6 +++--- lib_nbgl/include/nbgl_fonts.h | 1 - lib_nbgl/src/nbgl_fonts.c | 11 +---------- src/syscalls.c | 7 ------- 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/include/shared_trampoline.h b/include/shared_trampoline.h index 0065178eb..7f3446fe5 100644 --- a/include/shared_trampoline.h +++ b/include/shared_trampoline.h @@ -7,9 +7,9 @@ #elif defined(TARGET_NANOX) #define SHARED_TRAMPOLINE_ADDR 0x00210001 #elif defined(TARGET_NANOS2) -#define SHARED_TRAMPOLINE_ADDR 0x00810001 +#define SHARED_TRAMPOLINE_ADDR 0x00808001 #elif defined(TARGET_STAX) -#define SHARED_TRAMPOLINE_ADDR 0x00818001 +#define SHARED_TRAMPOLINE_ADDR 0x00810001 #elif defined(TARGET_FLEX) -#define SHARED_TRAMPOLINE_ADDR 0x00818001 +#define SHARED_TRAMPOLINE_ADDR 0x00810001 #endif diff --git a/lib_nbgl/include/nbgl_fonts.h b/lib_nbgl/include/nbgl_fonts.h index 91bded048..a05c1eaa0 100644 --- a/lib_nbgl/include/nbgl_fonts.h +++ b/lib_nbgl/include/nbgl_fonts.h @@ -166,7 +166,6 @@ typedef struct nbgl_unicode_ctx_s { /********************** * GLOBAL PROTOTYPES **********************/ -const nbgl_font_t *nbgl_font_getFont(unsigned int fontId); const nbgl_font_t *nbgl_getFont(nbgl_font_id_e fontId); uint16_t nbgl_getSingleLineTextWidth(nbgl_font_id_e fontId, const char *text); uint16_t nbgl_getSingleLineTextWidthInLen(nbgl_font_id_e fontId, const char *text, uint16_t maxLen); diff --git a/lib_nbgl/src/nbgl_fonts.c b/lib_nbgl/src/nbgl_fonts.c index 006b0ef8b..43739c050 100644 --- a/lib_nbgl/src/nbgl_fonts.c +++ b/lib_nbgl/src/nbgl_fonts.c @@ -44,7 +44,6 @@ static nbgl_unicode_ctx_t unicodeCtx = {0}; static const LANGUAGE_PACK *language_pack; #endif // HAVE_LANGUAGE_PACK -#if defined(BOLOS_OS_UPGRADER_APP) #ifdef SCREEN_SIZE_WALLET #ifdef TARGET_STAX #include "nbgl_font_inter_regular_24.inc" @@ -74,8 +73,6 @@ const nbgl_font_t *const C_nbgl_fonts[] = { }; const unsigned int C_nbgl_fonts_count = sizeof(C_nbgl_fonts) / sizeof(C_nbgl_fonts[0]); -#endif - #if (defined(HAVE_BOLOS) && !defined(BOLOS_OS_UPGRADER_APP)) #if !defined(HAVE_LANGUAGE_PACK) const nbgl_font_unicode_t *const C_nbgl_fonts_unicode[] = { @@ -116,7 +113,6 @@ bool hard_caesura = false; * @param fontId font ID * @return the found font or NULL */ -#if defined(BOLOS_OS_UPGRADER_APP) const nbgl_font_t *nbgl_getFont(nbgl_font_id_e fontId) { unsigned int i = C_nbgl_fonts_count; @@ -132,12 +128,7 @@ const nbgl_font_t *nbgl_getFont(nbgl_font_id_e fontId) // id not found return NULL; } -#else -const nbgl_font_t *nbgl_getFont(nbgl_font_id_e fontId) -{ - return nbgl_font_getFont(fontId); -} -#endif // BOLOS_OS_UPGRADER_APP + /** * @brief Get the coming unicode value on the given UTF-8 string. If the value is a simple ASCII * character, is_unicode is set to false. diff --git a/src/syscalls.c b/src/syscalls.c index f5dcc2f2d..570e56f26 100644 --- a/src/syscalls.c +++ b/src/syscalls.c @@ -181,13 +181,6 @@ void nbgl_sideRefreshArea(nbgl_area_t *area, nbgl_post_refresh_t post_refresh) return; } -const nbgl_font_t *nbgl_font_getFont(unsigned int fontId) -{ - unsigned int parameters[1]; - parameters[0] = (unsigned int) fontId; - return (const nbgl_font_t *) SVC_Call(SYSCALL_nbgl_get_font_ID, parameters); -} - void nbgl_screen_reinit(void) { unsigned int parameters[1];