Skip to content

Commit

Permalink
refactor(core): use std snprintf in emulator
Browse files Browse the repository at this point in the history
[no changelog]
  • Loading branch information
cepetr committed Oct 2, 2024
1 parent 730b6f2 commit 6376ea9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
1 change: 0 additions & 1 deletion core/SConscript.bootloader_emu
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ SOURCE_MOD += [
'embed/lib/gfx_bitblt_rgb565.c',
'embed/lib/gfx_bitblt_rgba8888.c',
'embed/lib/image.c',
'embed/lib/mini_printf.c',
'embed/lib/rsod.c',
'embed/lib/terminal.c',
'embed/lib/unit_variant.c',
Expand Down
1 change: 0 additions & 1 deletion core/SConscript.unix
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ SOURCE_MOD += [
'embed/lib/gfx_bitblt_rgba8888.c',
'embed/lib/gfx_bitblt_mono8.c',
'embed/lib/image.c',
'embed/lib/mini_printf.c',
'embed/lib/rsod.c',
'embed/lib/terminal.c',
'embed/lib/translations.c',
Expand Down
4 changes: 0 additions & 4 deletions core/embed/bootloader/bootui.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@
#include "display_draw.h"
#include "display_utils.h"
#include "fonts/fonts.h"
#ifdef TREZOR_EMULATOR
#include "emulator.h"
#else
#include "mini_printf.h"
#endif
#include "rust_ui.h"
#include "version.h"

Expand Down
1 change: 0 additions & 1 deletion core/embed/bootloader/emulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define __EMULATOR_H__

#define CLOCK_180_MHZ 0
#define mini_snprintf snprintf

#undef FIRMWARE_START

Expand Down
11 changes: 11 additions & 0 deletions core/embed/lib/mini_printf.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,20 @@ extern "C" {

#include <stdarg.h>

#ifdef TREZOR_EMULATOR

#include <stdio.h>

#define mini_vsnprintf vsnprintf
#define mini_snprintf snprintf

#else

int mini_vsnprintf(char* buffer, unsigned int buffer_len, const char *fmt, va_list va) __attribute__ ((__format__ (__printf__, 3, 0)));
int mini_snprintf(char* buffer, unsigned int buffer_len, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4)));

#endif

#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit 6376ea9

Please sign in to comment.