Skip to content

Commit 22071d6

Browse files
tleksell-pegalak
authored andcommitted
Tracing: TRACING_NONE Compilation Fix
Fixed several compilation errors that resulted from selecting TRACING without specifying a tracing system (Tracerecorder, CTF, Systemview). In this case (TRACING_NONE), some default trace hooks (in tracing.h) were incorrectly named resulting in compilation errors. The legacy sys_trace_isr_enter, sys_trace_isr_exit, and sys_trace_idle also caused problems since these were only given as defines, resulting in undefined reference errors since they are required by the assembly files calling these. To solve this issue I've added a stub file "tracing_none.c" (only compiled if TRACING_NONE) and declared the functions in tracing.h if no tracing system is selected. Signed-off-by: Torbjörn Leksell <[email protected]>
1 parent 38e1063 commit 22071d6

File tree

3 files changed

+74
-35
lines changed

3 files changed

+74
-35
lines changed

include/tracing/tracing.h

Lines changed: 52 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,6 @@
1919

2020
#else
2121

22-
/**
23-
* @brief Tracing APIs
24-
* @defgroup tracing_apis Tracing APIs
25-
* @{
26-
*/
27-
28-
/**
29-
* @brief Called when entering an ISR
30-
*/
31-
#define sys_trace_isr_enter()
32-
33-
/**
34-
* @brief Called when exiting an ISR
35-
*/
36-
#define sys_trace_isr_exit()
37-
38-
/**
39-
* @brief Called when exiting an ISR and switching to scheduler
40-
*/
41-
#define sys_trace_isr_exit_to_scheduler()
42-
43-
/**
44-
* @brief Called when the cpu enters the idle state
45-
*/
46-
#define sys_trace_idle()
47-
/**
48-
* @}
49-
*/
50-
51-
5222
/**
5323
* @brief Thread Tracing APIs
5424
* @defgroup thread_tracing_apis Thread Tracing APIs
@@ -190,16 +160,32 @@
190160
#define sys_port_trace_k_thread_priority_set(thread)
191161

192162
/**
193-
* @brief Called when a thread is being suspended
163+
* @brief Called when a thread enters the k_thread_suspend
164+
* function.
194165
* @param thread Thread object
195166
*/
196-
#define sys_port_trace_k_thread_suspend(thread)
167+
#define sys_port_trace_k_thread_suspend_enter(thread)
197168

198169
/**
199-
* @brief Called when a thread is being resumed from suspension
170+
* @brief Called when a thread exits the k_thread_suspend
171+
* function.
200172
* @param thread Thread object
201173
*/
202-
#define sys_port_trace_k_thread_resume(thread)
174+
#define sys_port_trace_k_thread_suspend_exit(thread)
175+
176+
/**
177+
* @brief Called when a thread enters the resume from suspension
178+
* function.
179+
* @param thread Thread object
180+
*/
181+
#define sys_port_trace_k_thread_resume_enter(thread)
182+
183+
/**
184+
* @brief Called when a thread exits the resumed from suspension
185+
* function.
186+
* @param thread Thread object
187+
*/
188+
#define sys_port_trace_k_thread_resume_exit(thread)
203189

204190
/**
205191
* @brief Called when the thread scheduler is locked
@@ -1067,7 +1053,7 @@
10671053
* @param queue Queue object
10681054
* @param ret Return value
10691055
*/
1070-
#define sys_port_trace_queue_remove_exit(queue, ret)
1056+
#define sys_port_trace_k_queue_remove_exit(queue, ret)
10711057

10721058
/**
10731059
* @brief Trace Queue unique append enter
@@ -1936,7 +1922,38 @@
19361922

19371923
#if defined CONFIG_PERCEPIO_TRACERECORDER
19381924
#include "tracing_tracerecorder.h"
1925+
#else
1926+
/**
1927+
* @brief Tracing APIs
1928+
* @defgroup tracing_apis Tracing APIs
1929+
* @{
1930+
*/
1931+
1932+
/**
1933+
* @brief Called when entering an ISR
1934+
*/
1935+
void sys_trace_isr_enter(void);
1936+
1937+
/**
1938+
* @brief Called when exiting an ISR
1939+
*/
1940+
void sys_trace_isr_exit(void);
1941+
1942+
/**
1943+
* @brief Called when exiting an ISR and switching to scheduler
1944+
*/
1945+
void sys_trace_isr_exit_to_scheduler(void);
1946+
1947+
/**
1948+
* @brief Called when the cpu enters the idle state
1949+
*/
1950+
void sys_trace_idle(void);
1951+
1952+
/**
1953+
* @}
1954+
*/
19391955
#endif
19401956

1957+
19411958
#endif
19421959
#endif

subsys/tracing/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ zephyr_sources_ifdef(
3939

4040
endif()
4141

42+
if(NOT CONFIG_PERCEPIO_TRACERECORDER AND NOT CONFIG_TRACING_CTF
43+
AND NOT CONFIG_SEGGER_SYSTEMVIEW AND NOT CONFIG_TRACING_TEST)
44+
zephyr_sources(tracing_none.c)
45+
endif()
46+
4247
zephyr_include_directories_ifdef(
4348
CONFIG_TRACING
4449
${ZEPHYR_BASE}/kernel/include

subsys/tracing/tracing_none.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright (c) 2019 Intel corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <init.h>
8+
#include <string.h>
9+
#include <kernel.h>
10+
11+
void sys_trace_isr_enter(void) {}
12+
13+
void sys_trace_isr_exit(void) {}
14+
15+
void sys_trace_isr_exit_to_scheduler(void) {}
16+
17+
void sys_trace_idle(void) {}

0 commit comments

Comments
 (0)