From 446c3b77b467a21d6ccffe8d9b31413fe3c3766b Mon Sep 17 00:00:00 2001 From: cepetr Date: Wed, 17 Jan 2024 15:29:49 +0100 Subject: [PATCH] refactor(core/embed): move&rename display terminal functions [no changelog] --- core/SConscript.boardloader | 2 + core/SConscript.bootloader | 1 + core/SConscript.bootloader_ci | 1 + core/SConscript.bootloader_emu | 1 + core/SConscript.firmware | 1 + core/SConscript.prodtest | 1 + core/SConscript.reflash | 1 + core/SConscript.unix | 1 + core/embed/boardloader/main.c | 29 +++--- core/embed/lib/display.c | 106 --------------------- core/embed/lib/display.h | 7 -- core/embed/lib/terminal.c | 131 ++++++++++++++++++++++++++ core/embed/lib/terminal.h | 32 +++++++ core/embed/reflash/main.c | 14 +-- core/embed/trezorhal/stm32f4/common.c | 35 +++---- core/embed/trezorhal/unix/common.c | 26 ++--- 16 files changed, 225 insertions(+), 164 deletions(-) create mode 100644 core/embed/lib/terminal.c create mode 100644 core/embed/lib/terminal.h diff --git a/core/SConscript.boardloader b/core/SConscript.boardloader index 3622d842ac..2c98eac7d5 100644 --- a/core/SConscript.boardloader +++ b/core/SConscript.boardloader @@ -63,7 +63,9 @@ SOURCE_MOD += [ 'embed/lib/fonts/font_bitmap.c', 'embed/lib/image.c', 'embed/lib/mini_printf.c', + 'embed/lib/terminal.c', 'vendor/trezor-storage/flash_common.c', + ] SOURCE_BOARDLOADER = [ diff --git a/core/SConscript.bootloader b/core/SConscript.bootloader index f408f12808..0de592dacc 100644 --- a/core/SConscript.bootloader +++ b/core/SConscript.bootloader @@ -87,6 +87,7 @@ SOURCE_MOD += [ 'embed/lib/fonts/fonts.c', 'embed/lib/fonts/font_bitmap.c', 'embed/lib/image.c', + 'embed/lib/terminal.c', 'embed/extmod/modtrezorcrypto/rand.c', 'vendor/micropython/lib/uzlib/adler32.c', 'vendor/micropython/lib/uzlib/crc32.c', diff --git a/core/SConscript.bootloader_ci b/core/SConscript.bootloader_ci index 4fe32da421..35fb02e672 100644 --- a/core/SConscript.bootloader_ci +++ b/core/SConscript.bootloader_ci @@ -75,6 +75,7 @@ CPPPATH_MOD += [ ] SOURCE_MOD += [ 'embed/lib/display.c', + 'embed/lib/terminal.c', 'embed/lib/colors.c', 'embed/lib/fonts/fonts.c', 'embed/lib/fonts/font_bitmap.c', diff --git a/core/SConscript.bootloader_emu b/core/SConscript.bootloader_emu index 37fcd39f8c..875f1b4a33 100644 --- a/core/SConscript.bootloader_emu +++ b/core/SConscript.bootloader_emu @@ -84,6 +84,7 @@ SOURCE_MOD += [ 'embed/lib/fonts/fonts.c', 'embed/lib/fonts/font_bitmap.c', 'embed/lib/image.c', + 'embed/lib/terminal.c', 'embed/lib/touch.c', 'embed/extmod/modtrezorcrypto/rand.c', 'vendor/micropython/lib/uzlib/adler32.c', diff --git a/core/SConscript.firmware b/core/SConscript.firmware index 168d47865d..2858e2b199 100644 --- a/core/SConscript.firmware +++ b/core/SConscript.firmware @@ -194,6 +194,7 @@ SOURCE_MOD += [ 'embed/lib/fonts/fonts.c', 'embed/lib/fonts/font_bitmap.c', 'embed/lib/image.c', + 'embed/lib/terminal.c', 'embed/extmod/modtrezorui/modtrezorui.c', 'vendor/micropython/lib/uzlib/adler32.c', 'vendor/micropython/lib/uzlib/crc32.c', diff --git a/core/SConscript.prodtest b/core/SConscript.prodtest index 7e66eb938d..3e0b988fc3 100644 --- a/core/SConscript.prodtest +++ b/core/SConscript.prodtest @@ -85,6 +85,7 @@ SOURCE_MOD += [ 'embed/lib/fonts/font_bitmap.c', 'embed/lib/image.c', 'embed/lib/mini_printf.c', + 'embed/lib/terminal.c', 'embed/lib/qr-code-generator/qrcodegen.c', 'vendor/micropython/lib/uzlib/adler32.c', 'vendor/micropython/lib/uzlib/crc32.c', diff --git a/core/SConscript.reflash b/core/SConscript.reflash index 7e84ceb6f4..65e5fd9fdd 100644 --- a/core/SConscript.reflash +++ b/core/SConscript.reflash @@ -60,6 +60,7 @@ SOURCE_MOD += [ 'embed/lib/fonts/font_bitmap.c', 'embed/lib/image.c', 'embed/lib/mini_printf.c', + 'embed/lib/terminal.c', 'vendor/micropython/lib/uzlib/adler32.c', 'vendor/micropython/lib/uzlib/crc32.c', 'vendor/micropython/lib/uzlib/tinflate.c', diff --git a/core/SConscript.unix b/core/SConscript.unix index a1dda73a97..b49186f635 100644 --- a/core/SConscript.unix +++ b/core/SConscript.unix @@ -194,6 +194,7 @@ SOURCE_MOD += [ 'embed/lib/fonts/fonts.c', 'embed/lib/fonts/font_bitmap.c', 'embed/lib/image.c', + 'embed/lib/terminal.c', 'embed/extmod/modtrezorui/modtrezorui.c', 'vendor/micropython/lib/uzlib/adler32.c', 'vendor/micropython/lib/uzlib/crc32.c', diff --git a/core/embed/boardloader/main.c b/core/embed/boardloader/main.c index c4599544c5..0e58b08582 100644 --- a/core/embed/boardloader/main.c +++ b/core/embed/boardloader/main.c @@ -28,6 +28,7 @@ #include "image.h" #include "model.h" #include "rng.h" +#include "terminal.h" #ifdef USE_SD_CARD #include "sdcard.h" #endif @@ -116,43 +117,43 @@ static uint32_t check_sdcard(void) { return 0; } -static void progress_callback(int pos, int len) { display_printf("."); } +static void progress_callback(int pos, int len) { term_printf("."); } static secbool copy_sdcard(void) { display_backlight(255); - display_printf("Trezor Boardloader\n"); - display_printf("==================\n\n"); + term_printf("Trezor Boardloader\n"); + term_printf("==================\n\n"); - display_printf("bootloader found on the SD card\n\n"); - display_printf("applying bootloader in 10 seconds\n\n"); - display_printf("unplug now if you want to abort\n\n"); + term_printf("bootloader found on the SD card\n\n"); + term_printf("applying bootloader in 10 seconds\n\n"); + term_printf("unplug now if you want to abort\n\n"); uint32_t codelen; for (int i = 10; i >= 0; i--) { - display_printf("%d ", i); + term_printf("%d ", i); hal_delay(1000); codelen = check_sdcard(); if (0 == codelen) { - display_printf("\n\nno SD card, aborting\n"); + term_printf("\n\nno SD card, aborting\n"); return secfalse; } } - display_printf("\n\nerasing flash:\n\n"); + term_printf("\n\nerasing flash:\n\n"); // erase all flash (except boardloader) if (sectrue != flash_area_erase(&ALL_WIPE_AREA, progress_callback)) { - display_printf(" failed\n"); + term_printf(" failed\n"); return secfalse; } - display_printf(" done\n\n"); + term_printf(" done\n\n"); ensure(flash_unlock_write(), NULL); // copy bootloader from SD card to Flash - display_printf("copying new bootloader from SD card\n\n"); + term_printf("copying new bootloader from SD card\n\n"); ensure(sdcard_power_on(), NULL); @@ -171,8 +172,8 @@ static secbool copy_sdcard(void) { sdcard_power_off(); ensure(flash_lock_write(), NULL); - display_printf("\ndone\n\n"); - display_printf("Unplug the device and remove the SD card\n"); + term_printf("\ndone\n\n"); + term_printf("Unplug the device and remove the SD card\n"); return sectrue; } diff --git a/core/embed/lib/display.c b/core/embed/lib/display.c index 64facab52c..572ced367a 100644 --- a/core/embed/lib/display.c +++ b/core/embed/lib/display.c @@ -190,112 +190,6 @@ bool display_toif_info(const uint8_t *data, uint32_t len, uint16_t *out_w, return true; } -#ifndef TREZOR_PRINT_DISABLE - -#define DISPLAY_PRINT_COLS (DISPLAY_RESX / 6) -#define DISPLAY_PRINT_ROWS (DISPLAY_RESY / 8) -static char display_print_buf[DISPLAY_PRINT_ROWS][DISPLAY_PRINT_COLS]; -static uint16_t display_print_fgcolor = COLOR_WHITE, - display_print_bgcolor = COLOR_BLACK; - -// set colors for display_print function -void display_print_color(uint16_t fgcolor, uint16_t bgcolor) { - display_print_fgcolor = fgcolor; - display_print_bgcolor = bgcolor; -} - -// display text using bitmap font -void display_print(const char *text, int textlen) { - static uint8_t row = 0, col = 0; - - // determine text length if not provided - if (textlen < 0) { - textlen = strlen(text); - } - - // print characters to internal buffer (display_print_buf) - for (int i = 0; i < textlen; i++) { - switch (text[i]) { - case '\r': - break; - case '\n': - row++; - col = 0; - break; - default: - display_print_buf[row][col] = text[i]; - col++; - break; - } - - if (col >= DISPLAY_PRINT_COLS) { - col = 0; - row++; - } - - if (row >= DISPLAY_PRINT_ROWS) { - for (int j = 0; j < DISPLAY_PRINT_ROWS - 1; j++) { - memcpy(display_print_buf[j], display_print_buf[j + 1], - DISPLAY_PRINT_COLS); - } - memzero(display_print_buf[DISPLAY_PRINT_ROWS - 1], DISPLAY_PRINT_COLS); - row = DISPLAY_PRINT_ROWS - 1; - } - } - - // render buffer to display - display_set_window(0, 0, DISPLAY_RESX - 1, DISPLAY_RESY - 1); - for (int i = 0; i < DISPLAY_RESX * DISPLAY_RESY; i++) { - int x = (i % DISPLAY_RESX); - int y = (i / DISPLAY_RESX); - const int j = y % 8; - y /= 8; - const int k = x % 6; - x /= 6; - char c = 0; - if (x < DISPLAY_PRINT_COLS && y < DISPLAY_PRINT_ROWS) { - c = display_print_buf[y][x] & 0x7F; - // char invert = display_print_buf[y][x] & 0x80; - } else { - c = ' '; - } - if (c < ' ') { - c = ' '; - } - const uint8_t *g = Font_Bitmap + (5 * (c - ' ')); - if (k < 5 && (g[k] & (1 << j))) { - PIXELDATA(display_print_fgcolor); - } else { - PIXELDATA(display_print_bgcolor); - } - } - display_pixeldata_dirty(); - display_refresh(); -} - -#ifdef TREZOR_EMULATOR -#define mini_vsnprintf vsnprintf -#include -#else -#include "mini_printf.h" -#endif - -// variadic display_print -void display_printf(const char *fmt, ...) { - if (!strchr(fmt, '%')) { - display_print(fmt, strlen(fmt)); - } else { - va_list va; - va_start(va, fmt); - char buf[256] = {0}; - int len = mini_vsnprintf(buf, sizeof(buf), fmt, va); - display_print(buf, len); - va_end(va); - } -} - -#endif // TREZOR_PRINT_DISABLE - #ifdef FRAMEBUFFER static void display_text_render(int x, int y, const char *text, int textlen, int font, uint16_t fgcolor, uint16_t bgcolor) { diff --git a/core/embed/lib/display.h b/core/embed/lib/display.h index 23a201cc49..d61f9f2fe7 100644 --- a/core/embed/lib/display.h +++ b/core/embed/lib/display.h @@ -45,13 +45,6 @@ void display_bar(int x, int y, int w, int h, uint16_t c); bool display_toif_info(const uint8_t *buf, uint32_t len, uint16_t *out_w, uint16_t *out_h, toif_format_t *out_format); -#ifndef TREZOR_PRINT_DISABLE -void display_print_color(uint16_t fgcolor, uint16_t bgcolor); -void display_print(const char *text, int textlen); -void display_printf(const char *fmt, ...) - __attribute__((__format__(__printf__, 1, 2))); -#endif - void display_text(int x, int y, const char *text, int textlen, int font, uint16_t fgcolor, uint16_t bgcolor); void display_text_center(int x, int y, const char *text, int textlen, int font, diff --git a/core/embed/lib/terminal.c b/core/embed/lib/terminal.c new file mode 100644 index 0000000000..9411cbdff9 --- /dev/null +++ b/core/embed/lib/terminal.c @@ -0,0 +1,131 @@ +/* + * This file is part of the Trezor project, https://trezor.io/ + * + * Copyright (c) SatoshiLabs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "terminal.h" +#include +#include +#include +#include "display.h" +#include TREZOR_BOARD + +#ifndef TREZOR_PRINT_DISABLE + +#define TERMINAL_COLS (DISPLAY_RESX / 6) +#define TERMINAL_ROWS (DISPLAY_RESY / 8) + +static char terminal_fb[TERMINAL_ROWS][TERMINAL_COLS]; +static uint16_t terminal_fgcolor = COLOR_WHITE; +static uint16_t terminal_bgcolor = COLOR_BLACK; + +// set colors for display_print function +void term_set_color(uint16_t fgcolor, uint16_t bgcolor) { + terminal_fgcolor = fgcolor; + terminal_bgcolor = bgcolor; +} + +// display text using bitmap font +void term_print(const char *text, int textlen) { + static uint8_t row = 0, col = 0; + + // determine text length if not provided + if (textlen < 0) { + textlen = strlen(text); + } + + // print characters to internal buffer (terminal_fb) + for (int i = 0; i < textlen; i++) { + switch (text[i]) { + case '\r': + break; + case '\n': + row++; + col = 0; + break; + default: + terminal_fb[row][col] = text[i]; + col++; + break; + } + + if (col >= TERMINAL_COLS) { + col = 0; + row++; + } + + if (row >= TERMINAL_ROWS) { + for (int j = 0; j < TERMINAL_ROWS - 1; j++) { + memcpy(terminal_fb[j], terminal_fb[j + 1], TERMINAL_COLS); + } + memset(terminal_fb[TERMINAL_ROWS - 1], 0, TERMINAL_COLS); + row = TERMINAL_ROWS - 1; + } + } + + // render buffer to display + display_set_window(0, 0, DISPLAY_RESX - 1, DISPLAY_RESY - 1); + for (int i = 0; i < DISPLAY_RESX * DISPLAY_RESY; i++) { + int x = (i % DISPLAY_RESX); + int y = (i / DISPLAY_RESX); + const int j = y % 8; + y /= 8; + const int k = x % 6; + x /= 6; + char c = 0; + if (x < TERMINAL_COLS && y < TERMINAL_ROWS) { + c = terminal_fb[y][x] & 0x7F; + // char invert = terminal_fb[y][x] & 0x80; + } else { + c = ' '; + } + if (c < ' ') { + c = ' '; + } + const uint8_t *g = Font_Bitmap + (5 * (c - ' ')); + if (k < 5 && (g[k] & (1 << j))) { + PIXELDATA(terminal_fgcolor); + } else { + PIXELDATA(terminal_bgcolor); + } + } + display_pixeldata_dirty(); + display_refresh(); +} + +#ifdef TREZOR_EMULATOR +#define mini_vsnprintf vsnprintf +#include +#else +#include "mini_printf.h" +#endif + +// variadic term_print +void term_printf(const char *fmt, ...) { + if (!strchr(fmt, '%')) { + term_print(fmt, strlen(fmt)); + } else { + va_list va; + va_start(va, fmt); + char buf[256] = {0}; + int len = mini_vsnprintf(buf, sizeof(buf), fmt, va); + term_print(buf, len); + va_end(va); + } +} + +#endif // TREZOR_PRINT_DISABLE diff --git a/core/embed/lib/terminal.h b/core/embed/lib/terminal.h new file mode 100644 index 0000000000..7cc036dffb --- /dev/null +++ b/core/embed/lib/terminal.h @@ -0,0 +1,32 @@ +/* + * This file is part of the Trezor project, https://trezor.io/ + * + * Copyright (c) SatoshiLabs + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef LIB_TERMINAL_H +#define LIB_TERMINAL_H + +#include "colors.h" + +#ifndef TREZOR_PRINT_DISABLE +void term_set_color(uint16_t fgcolor, uint16_t bgcolor); +void term_print(const char *text, int textlen); +void term_printf(const char *fmt, ...) + __attribute__((__format__(__printf__, 1, 2))); +#endif + +#endif // LIB_TERMINAL_H diff --git a/core/embed/reflash/main.c b/core/embed/reflash/main.c index ac26ec64eb..5f7a3de2d8 100644 --- a/core/embed/reflash/main.c +++ b/core/embed/reflash/main.c @@ -34,7 +34,7 @@ #include "secbool.h" #include "touch.h" -static void progress_callback(int pos, int len) { display_printf("."); } +static void progress_callback(int pos, int len) { term_printf("."); } static void flash_from_sdcard(const flash_area_t* area, uint32_t source, uint32_t length) { @@ -46,7 +46,7 @@ static void flash_from_sdcard(const flash_area_t* area, uint32_t source, "length not a multiple of block size"); for (uint32_t i = 0; i < length / SDCARD_BLOCK_SIZE; i++) { - display_printf("read %d\n", (unsigned int)(i + source / SDCARD_BLOCK_SIZE)); + term_printf("read %d\n", (unsigned int)(i + source / SDCARD_BLOCK_SIZE)); ensure(sdcard_read_blocks(buf, i + source / SDCARD_BLOCK_SIZE, 1), "sdcard_read_blocks"); @@ -70,15 +70,15 @@ int main(void) { ensure(sdcard_is_present(), "sdcard_is_present"); - display_printf("updating boardloader + bootloader\n"); + term_printf("updating boardloader + bootloader\n"); - display_printf("erasing sectors"); + term_printf("erasing sectors"); ensure(flash_area_erase(&BOARDLOADER_AREA, progress_callback), "flash_erase_sectors"); ensure(flash_area_erase(&BOOTLOADER_AREA, progress_callback), "flash_erase_sectors"); - display_printf("\n"); - display_printf("erased\n"); + term_printf("\n"); + term_printf("erased\n"); ensure(flash_unlock_write(), NULL); @@ -92,7 +92,7 @@ int main(void) { flash_from_sdcard(&BOOTLOADER_AREA, BOARDLOADER_TOTAL_SIZE, BOOTLOADER_TOTAL_SIZE); - display_printf("done\n"); + term_printf("done\n"); sdcard_power_off(); ensure(flash_lock_write(), NULL); diff --git a/core/embed/trezorhal/stm32f4/common.c b/core/embed/trezorhal/stm32f4/common.c index 427f10b0be..79ff1645ca 100644 --- a/core/embed/trezorhal/stm32f4/common.c +++ b/core/embed/trezorhal/stm32f4/common.c @@ -24,6 +24,7 @@ #include "common.h" #include "display.h" #include "model.h" +#include "terminal.h" #ifdef FANCY_FATAL_ERROR #include "rust_ui.h" @@ -72,15 +73,15 @@ error_uni(const char *label, const char *msg, const char *footer) { screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD"); display_refresh(); #else - display_print_color(COLOR_WHITE, COLOR_FATAL_ERROR); + term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR); if (label) { - display_printf("%s\n", label); + term_printf("%s\n", label); } if (msg) { - display_printf("%s\n", msg); + term_printf("%s\n", msg); } if (footer) { - display_printf("\n%s\n", footer); + term_printf("\n%s\n", footer); } #endif display_backlight(255); @@ -101,26 +102,26 @@ __fatal_error(const char *expr, const char *msg, const char *file, int line, "PLEASE VISIT\nTREZOR.IO/RSOD"); display_refresh(); #else - display_print_color(COLOR_WHITE, COLOR_FATAL_ERROR); - display_printf("\nINTERNAL ERROR:\n"); + term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR); + term_printf("\nINTERNAL ERROR:\n"); if (expr) { - display_printf("expr: %s\n", expr); + term_printf("expr: %s\n", expr); } if (msg) { - display_printf("msg : %s\n", msg); + term_printf("msg : %s\n", msg); } if (file) { - display_printf("file: %s:%d\n", file, line); + term_printf("file: %s:%d\n", file, line); } if (func) { - display_printf("func: %s\n", func); + term_printf("func: %s\n", func); } #ifdef SCM_REVISION const uint8_t *rev = (const uint8_t *)SCM_REVISION; - display_printf("rev : %02x%02x%02x%02x%02x\n", rev[0], rev[1], rev[2], rev[3], - rev[4]); + term_printf("rev : %02x%02x%02x%02x%02x\n", rev[0], rev[1], rev[2], rev[3], + rev[4]); #endif - display_printf("\nPlease contact Trezor support.\n"); + term_printf("\nPlease contact Trezor support.\n"); #endif trezor_shutdown(); } @@ -134,14 +135,14 @@ error_shutdown(const char *label, const char *msg) { screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD"); display_refresh(); #else - display_print_color(COLOR_WHITE, COLOR_FATAL_ERROR); + term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR); if (label) { - display_printf("%s\n", label); + term_printf("%s\n", label); } if (msg) { - display_printf("%s\n", msg); + term_printf("%s\n", msg); } - display_printf("\nPLEASE VISIT TREZOR.IO/RSOD\n"); + term_printf("\nPLEASE VISIT TREZOR.IO/RSOD\n"); #endif display_backlight(255); trezor_shutdown(); diff --git a/core/embed/trezorhal/unix/common.c b/core/embed/trezorhal/unix/common.c index 7f7a16bf63..8abb4887e7 100644 --- a/core/embed/trezorhal/unix/common.c +++ b/core/embed/trezorhal/unix/common.c @@ -56,15 +56,15 @@ error_uni(const char *label, const char *msg, const char *footer) { screen_fatal_error_rust(label, msg, "PLEASE VISIT\nTREZOR.IO/RSOD"); display_refresh(); #else - display_print_color(COLOR_WHITE, COLOR_FATAL_ERROR); + term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR); if (label) { - display_printf("%s\n", label); + term_printf("%s\n", label); } if (msg) { - display_printf("%s\n", msg); + term_printf("%s\n", msg); } if (footer) { - display_printf("\n%s\n", footer); + term_printf("\n%s\n", footer); } #endif display_backlight(255); @@ -93,33 +93,33 @@ __fatal_error(const char *expr, const char *msg, const char *file, int line, display_refresh(); #else - display_print_color(COLOR_WHITE, COLOR_FATAL_ERROR); - display_printf("\nINTERNAL ERROR:\n"); + term_set_color(COLOR_WHITE, COLOR_FATAL_ERROR); + term_printf("\nINTERNAL ERROR:\n"); printf("\nINTERNAL ERROR:\n"); if (expr) { - display_printf("expr: %s\n", expr); + term_printf("expr: %s\n", expr); printf("expr: %s\n", expr); } if (msg) { - display_printf("msg : %s\n", msg); + term_printf("msg : %s\n", msg); printf("msg : %s\n", msg); } if (file) { - display_printf("file: %s:%d\n", file, line); + term_printf("file: %s:%d\n", file, line); printf("file: %s:%d\n", file, line); } if (func) { - display_printf("func: %s\n", func); + term_printf("func: %s\n", func); printf("func: %s\n", func); } #ifdef SCM_REVISION const uint8_t *rev = (const uint8_t *)SCM_REVISION; - display_printf("rev : %02x%02x%02x%02x%02x\n", rev[0], rev[1], rev[2], rev[3], - rev[4]); + term_printf("rev : %02x%02x%02x%02x%02x\n", rev[0], rev[1], rev[2], rev[3], + rev[4]); printf("rev : %02x%02x%02x%02x%02x\n", rev[0], rev[1], rev[2], rev[3], rev[4]); #endif - display_printf("\n\n\nHint:\nIsn't the emulator already running?\n"); + term_printf("\n\n\nHint:\nIsn't the emulator already running?\n"); printf("Hint:\nIsn't the emulator already running?\n"); #endif hal_delay(3000);