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:
parent
cc8ab95760
commit
bdc80ebe16
3 changed files with 35 additions and 0 deletions
|
@ -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)
|
||||
|
|
2
samples/subsys/tracing/prj_user.conf
Normal file
2
samples/subsys/tracing/prj_user.conf
Normal file
|
@ -0,0 +1,2 @@
|
|||
CONFIG_TRACING=y
|
||||
CONFIG_TRACING_USER=y
|
32
samples/subsys/tracing/src/tracing_user.c
Normal file
32
samples/subsys/tracing/src/tracing_user.c
Normal 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__);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue