diff --git a/posix/include/sof/compiler_attributes.h b/posix/include/sof/compiler_attributes.h index bf88bfac4369..a223012d44ab 100644 --- a/posix/include/sof/compiler_attributes.h +++ b/posix/include/sof/compiler_attributes.h @@ -23,6 +23,10 @@ #define __unused __attribute__((unused)) #endif +#ifndef __maybe_unused +#define __maybe_unused __attribute__((unused)) +#endif + #endif #ifndef __aligned diff --git a/src/audio/module_adapter/module_adapter_ipc3.c b/src/audio/module_adapter/module_adapter_ipc3.c index 765c3e2b82fe..5adc3079708c 100644 --- a/src/audio/module_adapter/module_adapter_ipc3.c +++ b/src/audio/module_adapter/module_adapter_ipc3.c @@ -239,7 +239,7 @@ static int module_adapter_ctrl_get_set_data(struct comp_dev *dev, struct sof_ipc bool set) { int ret; - struct processing_module *mod = comp_mod(dev); + struct processing_module __maybe_unused *mod = comp_mod(dev); comp_dbg(dev, "module_adapter_ctrl_set_data() start, state %d, cmd %d", mod->priv.state, cdata->cmd); diff --git a/src/audio/pipeline/pipeline-graph.c b/src/audio/pipeline/pipeline-graph.c index 8b21774c6d19..8923caed32b3 100644 --- a/src/audio/pipeline/pipeline-graph.c +++ b/src/audio/pipeline/pipeline-graph.c @@ -283,9 +283,9 @@ int pipeline_complete(struct pipeline *p, struct comp_dev *source, }; #if !UNIT_TEST && !CONFIG_LIBRARY - int freq = clock_get_freq(cpu_get_id()); + int __maybe_unused freq = clock_get_freq(cpu_get_id()); #else - int freq = 0; + int __maybe_unused freq = 0; #endif int ret; diff --git a/src/ipc/ipc3/dai.c b/src/ipc/ipc3/dai.c index 8586dc779cff..508c07cbb065 100644 --- a/src/ipc/ipc3/dai.c +++ b/src/ipc/ipc3/dai.c @@ -203,7 +203,7 @@ int ipc_dai_data_config(struct dai_data *dd, struct comp_dev *dev) int ipc_comp_dai_config(struct ipc *ipc, struct ipc_config_dai *common_config, void *spec_config) { - struct sof_ipc_dai_config *config = spec_config; + struct sof_ipc_dai_config __maybe_unused *config = spec_config; bool comp_on_core[CONFIG_CORE_COUNT] = { false }; struct sof_ipc_reply reply; struct ipc_comp_dev *icd; diff --git a/src/trace/Kconfig b/src/trace/Kconfig index e691bc9e3cd3..5ff6b2001130 100644 --- a/src/trace/Kconfig +++ b/src/trace/Kconfig @@ -6,9 +6,12 @@ menu "Trace" config TRACE bool "Trace" + default n if ZEPHYR_SOF_MODULE default y help - Enabling traces. All traces (normal and error) are sent by dma. + Enable SOF DMA based traces compatible with the sof-logger tool. + With Zephyr, RTOS side events are not seen in the SOF trace, so native + Zephyr logging (CONFIG_ZEPHYR_LOG) is recommended instead. config TRACEV bool "Trace verbose" diff --git a/xtos/include/sof/compiler_attributes.h b/xtos/include/sof/compiler_attributes.h index 1b28e5ebad50..d961fa990613 100644 --- a/xtos/include/sof/compiler_attributes.h +++ b/xtos/include/sof/compiler_attributes.h @@ -19,6 +19,10 @@ #define __unused __attribute__((unused)) #endif +#ifndef __maybe_unused +#define __maybe_unused __attribute__((unused)) +#endif + #ifndef __aligned #define __aligned(x) __attribute__((__aligned__(x))) #endif diff --git a/zephyr/include/sof/trace/preproc.h b/zephyr/include/sof/trace/preproc.h new file mode 100644 index 000000000000..83776e6fea4e --- /dev/null +++ b/zephyr/include/sof/trace/preproc.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * + * Copyright(c) 2024 Intel Corporation. + */ + +#ifndef __SOF_TRACE_PREPROC_H__ +#define __SOF_TRACE_PREPROC_H__ + +#ifdef CONFIG_TRACE +#error "SOF dma-trace (CONFIG_TRACE) not supported in Zephyr builds. \ + Please use CONFIG_ZEPHYR_LOG instead." +#endif + +#ifndef CONFIG_ZEPHYR_LOG + +/* + * Unlike the XTOS version of this macro, this does not silence all + * compiler warnings about unused variables. + */ +#define SOF_TRACE_UNUSED(arg1, ...) ((void)arg1) + +#endif /* CONFIG_ZEPHYR_LOG */ + +#endif /* __SOF_TRACE_PREPROC_H__ */