1# Debug configuration options
2
3# Copyright (c) 2015 Wind River Systems, Inc.
4# SPDX-License-Identifier: Apache-2.0
5
6DT_CHOSEN_Z_CONSOLE := zephyr,console
7
8config TRACING
9	bool "Tracing Support"
10	imply THREAD_NAME
11	imply THREAD_STACK_INFO
12	imply THREAD_MONITOR
13	select INSTRUMENT_THREAD_SWITCHING
14	help
15	  Enable system tracing. This requires a backend such as SEGGER
16	  Systemview to be enabled as well.
17
18if TRACING
19
20config TRACING_CORE
21	bool
22	help
23	  Automatically selected by formats that require the core
24	  tracing infrastructure.
25
26choice
27	prompt "Tracing Format"
28	default TRACING_NONE
29
30config TRACING_NONE
31	bool "No tracing format selected"
32	help
33	  None of the available tracing formats is selected.
34
35config PERCEPIO_TRACERECORDER
36	bool "Percepio Tracealyzer support"
37	select THREAD_NAME
38	select INIT_STACKS
39	select THREAD_MONITOR
40	depends on ZEPHYR_TRACERECORDER_MODULE
41
42config SEGGER_SYSTEMVIEW
43	bool "Segger SystemView support"
44	select CONSOLE
45	select RTT_CONSOLE
46	select USE_SEGGER_RTT
47	select THREAD_MONITOR
48	select SEGGER_RTT_CUSTOM_LOCKING
49
50config TRACING_CTF
51	bool "Tracing via Common Trace Format support"
52	select TRACING_CORE
53	help
54	  Enable tracing to a Common Trace Format stream.
55
56config TRACING_TEST
57	bool "Tracing for test usage"
58	select TRACING_CORE
59	help
60	  Enable tracing for testing kinds of format purpose. It must
61	  implement the tracing hooks defined in tracing_test.h
62
63config TRACING_USER
64	bool "Tracing using user-defined functions"
65	help
66	  Use user-defined functions for tracing task switching and irqs
67
68endchoice
69
70
71config TRACING_CTF_TIMESTAMP
72	bool "Enable CTF internal timestamp"
73	default y
74	depends on TRACING_CTF
75	help
76	  Timestamp prefix will be added to the beginning of CTF
77	  event internally.
78
79choice
80	prompt "Tracing Method"
81	default TRACING_ASYNC
82
83config TRACING_SYNC
84	bool "Synchronous Tracing"
85	select RING_BUFFER
86	help
87	  Enable synchronous tracing. This requires the backend to be
88	  very low-latency.
89
90config TRACING_ASYNC
91	bool "Asynchronous Tracing"
92	select RING_BUFFER
93	help
94	  Enable asynchronous tracing. This will buffer all the tracing
95	  packets to the ring buffer first, tracing thread will try to
96	  output as much data as possible from the buffer when tracing
97	  thread get scheduled.
98
99endchoice
100
101config TRACING_THREAD_STACK_SIZE
102	int "Stack size of tracing thread"
103	default 1024
104	depends on TRACING_ASYNC
105	help
106	  Stack size of tracing thread.
107
108config TRACING_THREAD_WAIT_THRESHOLD
109	int "Tracing thread waiting threshold"
110	default 100
111	depends on TRACING_ASYNC
112	help
113	  Tracing thread waiting period given in milliseconds after
114	  every first packet put to tracing buffer.
115
116config TRACING_BUFFER_SIZE
117	int "Size of tracing buffer"
118	default 2048 if TRACING_ASYNC
119	default TRACING_PACKET_MAX_SIZE if TRACING_SYNC
120	range 32 65536
121	help
122	  Size of tracing buffer. If TRACING_ASYNC is enabled, tracing buffer
123	  is used as a ring buffer to buffer data packet and string packet. If
124	  TRACING_SYNC is enabled, the buffer is used to hold the formated data.
125
126config TRACING_PACKET_MAX_SIZE
127	int "Max size of one tracing packet"
128	default 32
129	help
130	  Max size of one tracing packet.
131
132choice
133	prompt "Tracing Backend"
134	default TRACING_BACKEND_UART
135
136config TRACING_BACKEND_UART
137	bool "Enable UART backend"
138	depends on UART_CONSOLE
139
140	help
141	  Use UART to output tracing data.
142
143config TRACING_BACKEND_USB
144	bool "Enable USB backend"
145	depends on USB_DEVICE_STACK
146	depends on TRACING_ASYNC
147	help
148	  Use USB to output tracing data.
149
150config TRACING_BACKEND_POSIX
151	bool "Enable posix architecture (native) backend"
152	depends on TRACING_SYNC
153	depends on ARCH_POSIX
154	help
155	  Use posix architecture to output tracing data to file system.
156
157config TRACING_BACKEND_RAM
158	bool "Enable RAM backend"
159	help
160	  Use a ram buffer to output tracing data which can
161	  be dumped to a file at runtime with a debugger.
162	  See gdb dump binary memory documentation for example.
163
164config RAM_TRACING_BUFFER_SIZE
165	int "Ram Tracing buffer size"
166	default 4096
167	depends on TRACING_BACKEND_RAM
168	help
169	  Size of the RAM trace buffer. Trace will be discarded if the
170	  length is exceeded.
171
172endchoice
173
174config TRACING_BACKEND_UART_NAME
175	string "Device Name of UART Device for UART backend"
176	default "$(dt_chosen_label,$(DT_CHOSEN_Z_CONSOLE))" if HAS_DTS
177	default "UART_0"
178	depends on TRACING_BACKEND_UART
179	help
180	  This option specifies the name of UART device to be used for
181	  tracing backend.
182
183config TRACING_USB_MPS
184	int "USB backend max packet size"
185	default 64
186	depends on TRACING_BACKEND_USB
187	help
188	  USB tracing backend max packet size(endpoint MPS).
189
190config TRACING_HANDLE_HOST_CMD
191	bool "Enable host command handle"
192	select UART_INTERRUPT_DRIVEN if TRACING_BACKEND_UART
193	help
194	  When enabled tracing will handle cmd from host to dynamically
195	  enable and disable tracing to have host capture tracing stream
196	  data conveniently.
197
198config TRACING_CMD_BUFFER_SIZE
199	int "Size of tracing command buffer"
200	default 32
201	range 32 128
202	help
203	  Size of tracing command buffer.
204
205menu "Tracing Configuration"
206
207config SYSCALL_TRACING
208	bool "Enable tracing Syscalls"
209	default y
210	help
211	  Enable tracing Syscalls.
212
213config TRACING_THREAD
214	bool "Enable tracing Threads"
215	default y
216	help
217	  Enable tracing Threads.
218
219config TRACING_WORK
220	bool "Enable tracing Work"
221	default y
222	help
223	  Enable tracing Work and Work queue events
224
225config TRACING_ISR
226	bool "Enable tracing ISRs"
227	default y
228	help
229	  Enable tracing ISRs. This requires the backend to be
230	  very low-latency.
231
232config TRACING_SEMAPHORE
233	bool "Enable tracing Semaphores"
234	default y
235	help
236	  Enable tracing Semaphores.
237
238config TRACING_MUTEX
239	bool "Enable tracing Mutexes"
240	default y
241	help
242	  Enable tracing Mutexes.
243
244config TRACING_CONDVAR
245	bool "Enable tracing Condition Variables"
246	default y
247	help
248	  Enable tracing Condition Variables
249
250config TRACING_QUEUE
251	bool "Enable tracing Queues"
252	default y
253	help
254	  Enable tracing Queues.
255
256config TRACING_FIFO
257	bool "Enable tracing FIFO queues"
258	default y
259	help
260	  Enable tracing FIFO queues.
261
262config TRACING_LIFO
263	bool "Enable tracing LIFO queues"
264	default y
265	help
266	  Enable tracing LIFO queues.
267
268config TRACING_STACK
269	bool "Enable tracing Memory Stacks"
270	default y
271	help
272	  Enable tracing Memory Stacks.
273
274config TRACING_MESSAGE_QUEUE
275	bool "Enable tracing Message Queues"
276	default y
277	help
278	  Enable tracing Message Queues.
279
280config TRACING_MAILBOX
281	bool "Enable tracing Mailboxes"
282	default y
283	help
284	  Enable tracing Mailboxes.
285
286config TRACING_PIPE
287	bool "Enable tracing Pipes"
288	default y
289	help
290	  Enable tracing Pipes.
291
292config TRACING_HEAP
293	bool "Enable tracing Memory Heaps"
294	default y
295	help
296	  Enable tracing Memory Heaps.
297
298config TRACING_MEMORY_SLAB
299	bool "Enable tracing Memory Slabs"
300	default y
301	help
302	  Enable tracing Memory Slabs.
303
304config TRACING_TIMER
305	bool "Enable tracing Timers"
306	default y
307	help
308	  Enable tracing Timers.
309
310endmenu  # Tracing Configuration
311
312endif
313
314source "subsys/tracing/sysview/Kconfig"
315