mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-08-02 20:08:31 +00:00
fix(emulator): fix rsod drawing in emulator
[no changelog]
This commit is contained in:
parent
0ebc82728b
commit
af4d792212
@ -219,15 +219,9 @@ else:
|
|||||||
|
|
||||||
CPPDEFINES_MOD += [
|
CPPDEFINES_MOD += [
|
||||||
'TRANSLATIONS',
|
'TRANSLATIONS',
|
||||||
|
'RSOD_IN_COREAPP',
|
||||||
]
|
]
|
||||||
|
|
||||||
if TREZOR_MODEL not in ('1', ):
|
|
||||||
CPPDEFINES_MOD += [
|
|
||||||
'FANCY_FATAL_ERROR',
|
|
||||||
]
|
|
||||||
|
|
||||||
CPPDEFINES_MOD += ['USE_SVC_SHUTDOWN']
|
|
||||||
|
|
||||||
if FEATURE_FLAGS["RDI"]:
|
if FEATURE_FLAGS["RDI"]:
|
||||||
CPPDEFINES_MOD += ['RDI']
|
CPPDEFINES_MOD += ['RDI']
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ static void coreapp_init(applet_t *applet) {
|
|||||||
|
|
||||||
// Shows RSOD (Red Screen of Death)
|
// Shows RSOD (Red Screen of Death)
|
||||||
static void show_rsod(const systask_postmortem_t *pminfo) {
|
static void show_rsod(const systask_postmortem_t *pminfo) {
|
||||||
#ifdef FANCY_FATAL_ERROR
|
#ifdef RSOD_IN_COREAPP
|
||||||
applet_t coreapp;
|
applet_t coreapp;
|
||||||
coreapp_init(&coreapp);
|
coreapp_init(&coreapp);
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ void rsod_terminal(const systask_postmortem_t* pminfo) {
|
|||||||
|
|
||||||
#endif // KERNEL_MODE
|
#endif // KERNEL_MODE
|
||||||
|
|
||||||
#if (defined(FIRMWARE) || defined(BOOTLOADER)) && defined(FANCY_FATAL_ERROR)
|
#ifdef FANCY_FATAL_ERROR
|
||||||
|
|
||||||
#include "rust_ui.h"
|
#include "rust_ui.h"
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ void rsod_gui(const systask_postmortem_t* pminfo) {
|
|||||||
display_rsod_rust(title, message, footer);
|
display_rsod_rust(title, message, footer);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // FANCY_FATAL_ERROR
|
||||||
|
|
||||||
#ifdef KERNEL_MODE
|
#ifdef KERNEL_MODE
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ static void init_and_show_rsod(const systask_postmortem_t* pminfo) {
|
|||||||
// Initialize necessary drivers
|
// Initialize necessary drivers
|
||||||
display_init(DISPLAY_RESET_CONTENT);
|
display_init(DISPLAY_RESET_CONTENT);
|
||||||
|
|
||||||
#if (defined(FIRMWARE) || defined(BOOTLOADER)) && defined(FANCY_FATAL_ERROR)
|
#ifdef FANCY_FATAL_ERROR
|
||||||
// Show the RSOD using Rust GUI
|
// Show the RSOD using Rust GUI
|
||||||
rsod_gui(pminfo);
|
rsod_gui(pminfo);
|
||||||
#else
|
#else
|
||||||
|
@ -17,15 +17,17 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "terminal.h"
|
#include TREZOR_BOARD
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "display.h"
|
|
||||||
#include TREZOR_BOARD
|
|
||||||
|
|
||||||
|
#include "display.h"
|
||||||
#include "fonts/fonts.h"
|
#include "fonts/fonts.h"
|
||||||
#include "gfx_draw.h"
|
#include "gfx_draw.h"
|
||||||
|
#include "mini_printf.h"
|
||||||
|
#include "terminal.h"
|
||||||
|
|
||||||
#define TERMINAL_COLS (DISPLAY_RESX / 6)
|
#define TERMINAL_COLS (DISPLAY_RESX / 6)
|
||||||
#define TERMINAL_ROWS (DISPLAY_RESY / 8)
|
#define TERMINAL_ROWS (DISPLAY_RESY / 8)
|
||||||
@ -169,29 +171,16 @@ void term_print(const char *text, int textlen) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TREZOR_EMULATOR
|
|
||||||
#define mini_vsnprintf vsnprintf
|
|
||||||
#include <stdio.h>
|
|
||||||
#else
|
|
||||||
#include "mini_printf.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// variadic term_print
|
// variadic term_print
|
||||||
void term_printf(const char *fmt, ...) {
|
void term_printf(const char *fmt, ...) {
|
||||||
if (!strchr(fmt, '%')) {
|
if (!strchr(fmt, '%')) {
|
||||||
term_print(fmt, strlen(fmt));
|
term_print(fmt, strlen(fmt));
|
||||||
#ifdef TREZOR_EMULATOR
|
|
||||||
printf("%s", fmt);
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, fmt);
|
va_start(va, fmt);
|
||||||
char buf[256] = {0};
|
char buf[256] = {0};
|
||||||
int len = mini_vsnprintf(buf, sizeof(buf), fmt, va);
|
int len = mini_vsnprintf(buf, sizeof(buf), fmt, va);
|
||||||
term_print(buf, len);
|
term_print(buf, len);
|
||||||
#ifdef TREZOR_EMULATOR
|
|
||||||
vprintf(fmt, va);
|
|
||||||
#endif
|
|
||||||
va_end(va);
|
va_end(va);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,7 @@ void display_copy_mono1p(const gfx_bitblt_t *bb) {
|
|||||||
gfx_bitblt_t bb_new = *bb;
|
gfx_bitblt_t bb_new = *bb;
|
||||||
bb_new.dst_row =
|
bb_new.dst_row =
|
||||||
(uint8_t *)drv->buffer->pixels + (drv->buffer->pitch * bb_new.dst_y);
|
(uint8_t *)drv->buffer->pixels + (drv->buffer->pitch * bb_new.dst_y);
|
||||||
bb_new.dst_stride = DISPLAY_RESX;
|
bb_new.dst_stride = drv->buffer->pitch;
|
||||||
|
|
||||||
gfx_rgb565_copy_mono1p(&bb_new);
|
gfx_rgb565_copy_mono1p(&bb_new);
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "extmod/misc.h"
|
#include "extmod/misc.h"
|
||||||
#include "extmod/vfs_posix.h"
|
#include "extmod/vfs_posix.h"
|
||||||
@ -44,6 +45,11 @@
|
|||||||
#include "flash_otp.h"
|
#include "flash_otp.h"
|
||||||
#include "genhdr/mpversion.h"
|
#include "genhdr/mpversion.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
#include "rsod.h"
|
||||||
|
#include "system.h"
|
||||||
|
#include "systimer.h"
|
||||||
|
#include "touch.h"
|
||||||
|
|
||||||
#include "py/builtin.h"
|
#include "py/builtin.h"
|
||||||
#include "py/compile.h"
|
#include "py/compile.h"
|
||||||
#include "py/gc.h"
|
#include "py/gc.h"
|
||||||
@ -53,10 +59,6 @@
|
|||||||
#include "py/repl.h"
|
#include "py/repl.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
#include "py/stackctrl.h"
|
#include "py/stackctrl.h"
|
||||||
#include "systimer.h"
|
|
||||||
#include "touch.h"
|
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
|
|
||||||
// Command line options, with their defaults
|
// Command line options, with their defaults
|
||||||
STATIC bool compile_only = false;
|
STATIC bool compile_only = false;
|
||||||
@ -487,8 +489,7 @@ MP_NOINLINE int main_(int argc, char **argv) {
|
|||||||
|
|
||||||
pre_process_options(argc, argv);
|
pre_process_options(argc, argv);
|
||||||
|
|
||||||
systick_init();
|
system_init(&rsod_panic_handler);
|
||||||
systimer_init();
|
|
||||||
|
|
||||||
display_init(DISPLAY_RESET_CONTENT);
|
display_init(DISPLAY_RESET_CONTENT);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user