zephyr: trace: fix builds with CONFIG_TRACE=n

When CONFIG_TRACE is disabled in Zephyr builds, they fail because
then _DECLARE_LOG_ENTRY isn't defined.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
Guennadi Liakhovetski 2022-01-06 15:51:05 +01:00 committed by Liam Girdwood
parent 1c6ae93d92
commit 98db7915b1
1 changed files with 25 additions and 25 deletions

View File

@ -96,6 +96,31 @@ struct trace_filter {
int32_t log_level; /**< new log level value */
};
/** The start of this linker output MUST match the 'ldc_entry_header'
* struct defined in the logger program running in user space.
*/
#define _DECLARE_LOG_ENTRY(lvl, format, comp_class, n_params) \
__section(".static_log." #lvl) \
static const struct { \
uint32_t level; \
uint32_t component_class; \
uint32_t params_num; \
uint32_t line_idx; \
uint32_t file_name_len; \
uint32_t text_len; \
const char file_name[sizeof(RELATIVE_FILE)]; \
const char text[sizeof(format)]; \
} log_entry = { \
lvl, \
comp_class, \
n_params, \
__LINE__, \
sizeof(RELATIVE_FILE), \
sizeof(format), \
RELATIVE_FILE, \
format \
}
#if CONFIG_TRACE
#include <stdarg.h>
@ -180,31 +205,6 @@ void mtrace_dict_entry(bool atomic_context, uint32_t log_entry_pointer, int n_ar
/** Posts a fully prepared log header + log entry */
void mtrace_event(const char *complete_packet, uint32_t length);
/** The start of this linker output MUST match the 'ldc_entry_header'
* struct defined in the logger program running in user space.
*/
#define _DECLARE_LOG_ENTRY(lvl, format, comp_class, n_params) \
__section(".static_log." #lvl) \
static const struct { \
uint32_t level; \
uint32_t component_class; \
uint32_t params_num; \
uint32_t line_idx; \
uint32_t file_name_len; \
uint32_t text_len; \
const char file_name[sizeof(RELATIVE_FILE)]; \
const char text[sizeof(format)]; \
} log_entry = { \
lvl, \
comp_class, \
n_params, \
__LINE__, \
sizeof(RELATIVE_FILE), \
sizeof(format), \
RELATIVE_FILE, \
format \
}
#ifdef CONFIG_TRACEM /* Send everything to shared memory too */
# ifdef __ZEPHYR__
/* We don't use Zephyr's dictionary yet so there's not enough space for