From 1978b838b7b75d2e525771f95f3532cc623419ef Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 24 Jan 2023 16:57:26 +1100 Subject: [PATCH] shared/runtime: Use mp_printf consistently, instead of printf. Signed-off-by: Damien George --- shared/runtime/mpirq.c | 4 ++-- shared/runtime/pyexec.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/shared/runtime/mpirq.c b/shared/runtime/mpirq.c index f9a85ebbd6..acd727403b 100644 --- a/shared/runtime/mpirq.c +++ b/shared/runtime/mpirq.c @@ -81,8 +81,8 @@ void mp_irq_handler(mp_irq_obj_t *self) { // Uncaught exception; disable the callback so that it doesn't run again self->methods->trigger(self->parent, 0); self->handler = mp_const_none; - printf("Uncaught exception in IRQ callback handler\n"); - mp_obj_print_exception(&mp_plat_print, MP_OBJ_FROM_PTR(nlr.ret_val)); + mp_printf(MICROPY_ERROR_PRINTER, "Uncaught exception in IRQ callback handler\n"); + mp_obj_print_exception(MICROPY_ERROR_PRINTER, MP_OBJ_FROM_PTR(nlr.ret_val)); } gc_unlock(); mp_sched_unlock(); diff --git a/shared/runtime/pyexec.c b/shared/runtime/pyexec.c index 2c9f1e80ff..b6e7d8fe68 100644 --- a/shared/runtime/pyexec.c +++ b/shared/runtime/pyexec.c @@ -154,12 +154,12 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input // display debugging info if wanted if ((exec_flags & EXEC_FLAG_ALLOW_DEBUGGING) && repl_display_debugging_info) { mp_uint_t ticks = mp_hal_ticks_ms() - start; // TODO implement a function that does this properly - printf("took " UINT_FMT " ms\n", ticks); + mp_printf(&mp_plat_print, "took " UINT_FMT " ms\n", ticks); // qstr info { size_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes; qstr_pool_info(&n_pool, &n_qstr, &n_str_data_bytes, &n_total_bytes); - printf("qstr:\n n_pool=%u\n n_qstr=%u\n " + mp_printf(&mp_plat_print, "qstr:\n n_pool=%u\n n_qstr=%u\n " "n_str_data_bytes=%u\n n_total_bytes=%u\n", (unsigned)n_pool, (unsigned)n_qstr, (unsigned)n_str_data_bytes, (unsigned)n_total_bytes); } @@ -713,7 +713,7 @@ int pyexec_frozen_module(const char *name) { #endif default: - printf("could not find module '%s'\n", name); + mp_printf(MICROPY_ERROR_PRINTER, "could not find module '%s'\n", name); return false; } }