diff --git a/soc/xtensa/intel_adsp/Kconfig b/soc/xtensa/intel_adsp/Kconfig index eaf6a243290..e01c775a46a 100644 --- a/soc/xtensa/intel_adsp/Kconfig +++ b/soc/xtensa/intel_adsp/Kconfig @@ -53,6 +53,14 @@ config IMR_DATA_ADDR Location to place .data contents in IMR memory during bootloader linkage. +config ADSP_TRACE_SIMCALL + bool "Emit SIMCALL output in addition to window tracing" + help + When true, the trace_out layer will also use a SIMCALL + instruction to emit the passed data to the standard output + of an enclosing simulator process. All window contents will + remain identical. + # Select SoC Part No. and configuration options source "soc/xtensa/intel_adsp/*/Kconfig.soc" diff --git a/soc/xtensa/intel_adsp/common/trace_out.c b/soc/xtensa/intel_adsp/common/trace_out.c index 7430bb1a16d..2db7936df19 100644 --- a/soc/xtensa/intel_adsp/common/trace_out.c +++ b/soc/xtensa/intel_adsp/common/trace_out.c @@ -74,6 +74,16 @@ void intel_adsp_trace_out(int8_t *str, size_t len) return; } +#ifdef CONFIG_ADSP_TRACE_SIMCALL + register int a2 __asm__("a2") = 4; /* SYS_write */ + register int a3 __asm__("a3") = 1; /* fd 1 == stdout */ + register int a4 __asm__("a4") = (int)str; + register int a5 __asm__("a5") = len; + + __asm__ volatile("simcall" : "+r"(a2), "+r"(a3) + : "r"(a4), "r"(a5) : "memory"); +#endif + k_spinlock_key_t key = k_spin_lock((void *)&data->lock); if (!data->initialized) {