diff --git a/core/embed/sys/dbg/inc/sys/dbg_printf.h b/core/embed/sys/dbg/inc/sys/dbg_printf.h
new file mode 100644
index 0000000000..72a8edd38b
--- /dev/null
+++ b/core/embed/sys/dbg/inc/sys/dbg_printf.h
@@ -0,0 +1,30 @@
+/*
+ * 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 .
+ */
+
+#pragma once
+
+#ifdef KERNEL_MODE
+
+// vprintf-like functions for debugging
+void dbg_vprintf(const char* fmt, va_list args);
+
+// printf-like functions for debugging
+void dbg_printf(const char* fmt, ...);
+
+#endif // KERNEL_MODE
diff --git a/core/embed/sys/dbg/stm32/dbg_printf.c b/core/embed/sys/dbg/stm32/dbg_printf.c
new file mode 100644
index 0000000000..f15b894dd8
--- /dev/null
+++ b/core/embed/sys/dbg/stm32/dbg_printf.c
@@ -0,0 +1,47 @@
+/*
+ * 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 .
+ */
+
+#ifdef KERNEL_MODE
+
+#include
+#include
+#include
+
+void dbg_vprintf(const char* fmt, va_list args) {
+ char temp[80];
+ mini_vsnprintf(temp, sizeof(temp), fmt, args);
+
+ irq_key_t irq_key = irq_lock();
+ for (size_t i = 0; i < sizeof(temp); i++) {
+ if (temp[i] == '\0') {
+ break;
+ }
+ ITM_SendChar(temp[i]);
+ }
+ irq_unlock(irq_key);
+}
+
+void dbg_printf(const char* fmt, ...) {
+ va_list args;
+ va_start(args, fmt);
+ dbg_vprintf(fmt, args);
+ va_end(args);
+}
+
+#endif // KERNEL_MODE
diff --git a/core/site_scons/models/stm32f4_common.py b/core/site_scons/models/stm32f4_common.py
index f1b744df41..28d1469956 100644
--- a/core/site_scons/models/stm32f4_common.py
+++ b/core/site_scons/models/stm32f4_common.py
@@ -17,6 +17,7 @@ def stm32f4_common_files(env, defines, sources, paths):
"embed/sec/secure_aes/inc",
"embed/sec/time_estimate/inc",
"embed/sys/bsp/stm32f4",
+ "embed/sys/dbg/inc",
"embed/sys/irq/inc",
"embed/sys/linker/inc",
"embed/sys/mpu/inc",
@@ -68,6 +69,7 @@ def stm32f4_common_files(env, defines, sources, paths):
"embed/sec/rng/stm32/rng.c",
"embed/sec/secret/stm32f4/secret.c",
"embed/sec/time_estimate/stm32/time_estimate.c",
+ "embed/sys/dbg/stm32/dbg_printf.c",
"embed/sys/linker/linker_utils.c",
"embed/sys/mpu/stm32f4/mpu.c",
"embed/sys/pvd/stm32/pvd.c",
diff --git a/core/site_scons/models/stm32u5_common.py b/core/site_scons/models/stm32u5_common.py
index 0d4b7844e1..a12b293201 100644
--- a/core/site_scons/models/stm32u5_common.py
+++ b/core/site_scons/models/stm32u5_common.py
@@ -18,8 +18,9 @@ def stm32u5_common_files(env, defines, sources, paths):
"embed/sec/secret/inc",
"embed/sec/secure_aes/inc",
"embed/sec/time_estimate/inc",
- "embed/sys/irq/inc",
"embed/sys/bsp/stm32u5",
+ "embed/sys/dbg/inc",
+ "embed/sys/irq/inc",
"embed/sys/linker/inc",
"embed/sys/mpu/inc",
"embed/sys/pvd/inc",
@@ -86,6 +87,7 @@ def stm32u5_common_files(env, defines, sources, paths):
"embed/sec/secret/stm32u5/secret.c",
"embed/sec/secure_aes/stm32u5/secure_aes.c",
"embed/sec/time_estimate/stm32/time_estimate.c",
+ "embed/sys/dbg/stm32/dbg_printf.c",
"embed/sys/linker/linker_utils.c",
"embed/sys/mpu/stm32u5/mpu.c",
"embed/sys/pvd/stm32/pvd.c",