1# Copyright (c) 2021 Percepio AB
2# SPDX-License-Identifier: Apache-2.0
3
4menu "RTT Config"
5config PERCEPIO_TRC_CFG_STREAM_PORT_RTT_UP_BUFFER_SIZE
6	int "RTT buffer size up"
7	default 5000
8	range 0 1048576
9	help
10	  Defines the size of the "up" RTT buffer (target -> host) to use for writing
11	  the trace data, for RTT buffer 1 or higher.
12
13	  This setting is ignored for RTT buffer 0, which can't be reconfigured
14	  in runtime and therefore hard-coded to use the defines in SEGGER_RTT_Conf.h.
15
16	  Default buffer size for Tracealyzer is 5000 bytes.
17	  If you have a stand-alone J-Link probe, the can be decreased to around 1 KB.
18	  But integrated J-Link OB interfaces are slower and needs about 5-10 KB,
19	  depending on the amount of data produced.
20
21config PERCEPIO_TRC_CFG_STREAM_PORT_RTT_DOWN_BUFFER_SIZE
22	int "RTT buffer size down"
23	default 32
24	range 0 1048576
25	help
26	  Defines the size of the "down" RTT buffer (host -> target) to use for reading
27	  commands from Tracealyzer, for RTT buffer 1 or higher.
28
29	  Default buffer size for Tracealyzer is 32 bytes.
30
31	  This setting is ignored for RTT buffer 0, which can't be reconfigured
32	  in runtime and therefore hard-coded to use the defines in SEGGER_RTT_Conf.h.
33
34config PERCEPIO_TRC_CFG_STREAM_PORT_RTT_UP_BUFFER_INDEX
35	int "RTT buffer up index"
36	default 1
37	range 0 32
38	help
39	  Defines the RTT buffer to use for writing the trace data. Make sure that
40	  the PC application has the same setting (File->Settings).
41
42	  Default: 1
43
44	  We don't recommend using RTT buffer 0, since mainly intended for terminals.
45	  If you prefer to use buffer 0, it must be configured in SEGGER_RTT_Conf.h.
46
47config PERCEPIO_TRC_CFG_STREAM_PORT_RTT_DOWN_BUFFER_INDEX
48	int "RTT buffer down index"
49	default 1
50	range 0 32
51	help
52	  Defines the RTT buffer to use for reading the trace data. Make sure that
53	  the PC application has the same setting (File->Settings).
54
55	  Default: 1
56
57	  We don't recommend using RTT buffer 0, since mainly intended for terminals.
58	  If you prefer to use buffer 0, it must be configured in SEGGER_RTT_Conf.h.
59
60choice PERCEPIO_TRC_CFG_STREAM_PORT_RTT_MODE
61	prompt "RTT Blocking Mode"
62	default PERCEPIO_TRC_CFG_STREAM_PORT_RTT_MODE_NO_BLOCK_SKIP
63	help
64	  This stream port for J-Link streaming relies on SEGGER RTT, that contains an
65	  internal RAM buffer read by the J-Link probes during execution.
66
67	  Possible values:
68	    - PERCEPIO_TRC_CFG_STREAM_PORT_RTT_MODE_BLOCK_IF_FIFO_FULL
69	    - PERCEPIO_TRC_CFG_STREAM_PORT_RTT_MODE_NO_BLOCK_SKIP (default)
70
71	  Using PERCEPIO_TRC_CFG_STREAM_PORT_RTT_MODE_BLOCK_IF_FIFO_FULL ensure that you get a
72	  complete and valid trace. This may however cause blocking if your streaming
73	  interface isn't fast enough, which may disturb the real-time behavior.
74
75	  We therefore recommend PERCEPIO_TRC_CFG_STREAM_PORT_RTT_MODE_NO_BLOCK_SKIP. In this mode,
76	  Tracealyzer will report lost events if the transfer is not
77	  fast enough. In that case, try increasing the size of the "up buffer".
78
79config PERCEPIO_TRC_CFG_STREAM_PORT_RTT_MODE_NO_BLOCK_SKIP
80	bool "Skip: Do not block, output nothing."
81
82config PERCEPIO_TRC_CFG_STREAM_PORT_RTT_MODE_BLOCK_IF_FIFO_FULL
83	bool "Block: Wait until there is space in the buffer."
84endchoice
85
86menu "Hidden RTT Settings"
87	visible if n
88config PERCEPIO_TRC_CFG_STREAM_PORT_USE_INTERNAL_BUFFER
89	bool "Use internal buffer"
90	default n
91endmenu # Hidden RTT Settings
92
93if PERCEPIO_TRC_CFG_STREAM_PORT_USE_INTERNAL_BUFFER
94config PERCEPIO_TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_SIZE
95	int "Internal buffer size"
96	range 32 10485760
97	default 10240
98
99choice PERCEPIO_TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_TRANSFER_MODE
100	prompt "Internal buffer transfer mode"
101	default PERCEPIO_TRC_INTERNAL_EVENT_BUFFER_OPTION_TRANSFER_MODE_ALL
102
103config PERCEPIO_TRC_INTERNAL_EVENT_BUFFER_OPTION_TRANSFER_MODE_ALL
104	bool "Transfer all"
105
106config PERCEPIO_TRC_INTERNAL_EVENT_BUFFER_OPTION_TRANSFER_MODE_CHUNK
107	bool "Transfer chunks"
108endchoice
109
110if PERCEPIO_TRC_INTERNAL_EVENT_BUFFER_OPTION_TRANSFER_MODE_CHUNK
111config PERCEPIO_TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_SIZE
112	int "Chunk size"
113	range 4 10485760
114	default 2048
115
116config PERCEPIO_TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_SIZE_LIMIT
117	int "Transfer size limit for immediate re-transfer"
118	range 4 10485760
119	default 1024
120	help
121	  Defines the number of transferred bytes needed to trigger another immediate transfer.
122	  This will increase throughput by immediately doing a transfer and not wait for another xTraceTzCtrl() loop.
123
124config PERCEPIO_TRC_CFG_STREAM_PORT_INTERNAL_BUFFER_CHUNK_TRANSFER_AGAIN_COUNT_LIMIT
125	int "Immediate re-transfer count limit"
126	range 1 20
127	default 5
128	help
129	  Defines the maximum number of times to trigger another immediate transfer before returning to xTraceTzCtrl().
130	  This will increase throughput by immediately doing a transfer and not wait for another xTraceTzCtrl() loop.
131endif # PERCEPIO_TRC_INTERNAL_EVENT_BUFFER_OPTION_TRANSFER_MODE_CHUNK
132endif # PERCEPIO_TRC_CFG_STREAM_PORT_USE_INTERNAL_BUFFER
133
134config PERCEPIO_TRC_CFG_STREAM_PORT_RTT_NO_LOCK_WRITE
135	bool "No lock write"
136	default y if PERCEPIO_TRC_CFG_RECORDER_RTOS_ZEPHYR
137	help
138	  Sets if RTT should write without locking or not when writing
139	  RTT data. This should normally be disabled with an exception being
140	  Zephyr, where the SEGGER RTT locks aren't necessary and causes
141	  problems if enabled.
142endmenu # menu "RTT Config"
143