samples: tracing: Add a sample for tracing_user

The user tracing backend allows one to implement weak symbols to perform
user specific tracing, e.g gpio toggling or spi transactions.  This adds
a qemu sample that just does a simple printk for each of the traced
functions, but could be changed to do whatever function the user
desires.

Signed-off-by: Bradley Bolen <bbolen@lexmark.com>
This commit is contained in:
Bradley Bolen 2021-08-03 11:58:52 -04:00 committed by Christopher Friedt
commit bdc80ebe16
3 changed files with 35 additions and 0 deletions

View file

@ -10,3 +10,4 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(tracing_tests)
target_sources(app PRIVATE src/main.c)
target_sources_ifdef(CONFIG_TRACING_USER app PRIVATE src/tracing_user.c)

View file

@ -0,0 +1,2 @@
CONFIG_TRACING=y
CONFIG_TRACING_USER=y

View file

@ -0,0 +1,32 @@
/*
* Copyright (c) 2020 Lexmark International, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <tracing_user.h>
void sys_trace_thread_switched_in_user(struct k_thread *thread)
{
printk("%s: %p\n", __func__, thread);
}
void sys_trace_thread_switched_out_user(struct k_thread *thread)
{
printk("%s: %p\n", __func__, thread);
}
void sys_trace_isr_enter_user(void)
{
printk("%s\n", __func__);
}
void sys_trace_isr_exit_user(void)
{
printk("%s\n", __func__);
}
void sys_trace_idle_user(void)
{
printk("%s\n", __func__);
}