SmartSnippets DA1459x SDK
SEGGER_SYSVIEW_ConfDefaults.h
1 /*********************************************************************
2 * SEGGER Microcontroller GmbH *
3 * The Embedded Experts *
4 **********************************************************************
5 * *
6 * (c) 1995 - 2021 SEGGER Microcontroller GmbH *
7 * *
8 * www.segger.com Support: support@segger.com *
9 * *
10 **********************************************************************
11 * *
12 * SEGGER SystemView * Real-time application analysis *
13 * *
14 **********************************************************************
15 * *
16 * All rights reserved. *
17 * *
18 * SEGGER strongly recommends to not make any changes *
19 * to or modify the source code of this software in order to stay *
20 * compatible with the SystemView and RTT protocol, and J-Link. *
21 * *
22 * Redistribution and use in source and binary forms, with or *
23 * without modification, are permitted provided that the following *
24 * condition is met: *
25 * *
26 * o Redistributions of source code must retain the above copyright *
27 * notice, this condition and the following disclaimer. *
28 * *
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
30 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
31 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
32 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
33 * DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
34 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
35 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
36 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
37 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
38 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
39 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
40 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
41 * DAMAGE. *
42 * *
43 **********************************************************************
44 * *
45 * SystemView version: 3.30 *
46 * *
47 **********************************************************************
48 -------------------------- END-OF-HEADER -----------------------------
49 File : SEGGER_SYSVIEW_ConfDefaults.h
50 Purpose : Defines defaults for configurable defines used in
51  SEGGER SystemView.
52 Revision: $Rev: 21319 $
53 */
54 
55 #ifndef SEGGER_SYSVIEW_CONFDEFAULTS_H
56 #define SEGGER_SYSVIEW_CONFDEFAULTS_H
57 
58 #if (dg_configSYSTEMVIEW == 1)
59 
60 /*********************************************************************
61 *
62 * #include Section
63 *
64 **********************************************************************
65 */
66 
67 #include "SEGGER_SYSVIEW_Conf.h"
68 #include "SEGGER_RTT_Conf.h"
69 
70 #ifdef __cplusplus
71 extern "C" {
72 #endif
73 
74 /*********************************************************************
75 *
76 * Defines, fixed
77 *
78 **********************************************************************
79 */
80 //
81 // Use auto-detection for SEGGER_SYSVIEW_CORE define
82 // based on compiler-/toolchain-specific defines
83 // to define SEGGER_SYSVIEW_GET_INTERRUPT_ID and SEGGER_SYSVIEW_GET_TIMESTAMP
84 //
85 #define SEGGER_SYSVIEW_CORE_OTHER 0
86 #define SEGGER_SYSVIEW_CORE_CM0 1 // Cortex-M0/M0+/M1
87 #define SEGGER_SYSVIEW_CORE_CM3 2 // Cortex-M3/M4/M7
88 #define SEGGER_SYSVIEW_CORE_RX 3 // Renesas RX
89 #ifndef SEGGER_SYSVIEW_CORE
90  #if (defined __SES_ARM) || (defined __CROSSWORKS_ARM) || (defined __SEGGER_CC__) || (defined __GNUC__) || (defined __clang__)
91  #if (defined __ARM_ARCH_6M__) || (defined __ARM_ARCH_8M_BASE__)
92  #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
93  #elif (defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_8M_MAIN__))
94  #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
95  #endif
96  #elif defined(__ICCARM__)
97  #if (defined (__ARM6M__) && (__CORE__ == __ARM6M__)) \
98  || (defined (__ARM8M_BASELINE__) && (__CORE__ == __ARM8M_BASELINE__))
99  #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
100  #elif (defined (__ARM7EM__) && (__CORE__ == __ARM7EM__)) \
101  || (defined (__ARM7M__) && (__CORE__ == __ARM7M__)) \
102  || (defined (__ARM8M_MAINLINE__) && (__CORE__ == __ARM8M_MAINLINE__)) \
103  || (defined (__ARM8M_MAINLINE__) && (__CORE__ == __ARM8M_MAINLINE__))
104  #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
105  #endif
106  #elif defined(__CC_ARM)
107  #if (defined(__TARGET_ARCH_6S_M))
108  #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
109  #elif (defined(__TARGET_ARCH_7_M) || defined(__TARGET_ARCH_7E_M))
110  #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
111  #endif
112  #elif defined(__TI_ARM__)
113  #ifdef __TI_ARM_V6M0__
114  #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
115  #elif (defined(__TI_ARM_V7M3__) || defined(__TI_ARM_V7M4__))
116  #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
117  #endif
118  #elif defined(__ICCRX__)
119  #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_RX
120  #elif defined(__RX)
121  #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_RX
122  #endif
123 
124  #ifndef SEGGER_SYSVIEW_CORE
125  #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_OTHER
126  #endif
127 #endif
128 
129 
130 /*********************************************************************
131 *
132 * Defines, defaults
133 *
134 **********************************************************************
135 */
136 /*********************************************************************
137 *
138 * Define: SEGGER_SYSVIEW_APP_NAME
139 *
140 * Description
141 * The application name to be displayed in SystemView.
142 * Default
143 * "SystemView-enabled Application"
144 * Notes
145 * Convenience define to be used for SEGGER_SYSVIEW_SendSysDesc().
146 */
147 #ifndef SEGGER_SYSVIEW_APP_NAME
148  #define SEGGER_SYSVIEW_APP_NAME "SystemView-enabled Application"
149 #endif
150 
151 /*********************************************************************
152 *
153 * Define: SEGGER_SYSVIEW_DEVICE_NAME
154 *
155 * Description
156 * The target device name to be displayed in SystemView.
157 * Default
158 * "undefined device"
159 * Notes
160 * Convenience define to be used for SEGGER_SYSVIEW_SendSysDesc().
161 */
162 #ifndef SEGGER_SYSVIEW_DEVICE_NAME
163  #define SEGGER_SYSVIEW_DEVICE_NAME "undefined device"
164 #endif
165 
166 /*********************************************************************
167 *
168 * Define: SEGGER_SYSVIEW_GET_INTERRUPT_ID()
169 *
170 * Description
171 * Function macro to retrieve the Id of the currently active
172 * interrupt.
173 * Default
174 * Call user-supplied function SEGGER_SYSVIEW_X_GetInterruptId().
175 * Notes
176 * For some known compilers and cores, a ready-to-use, core-specific
177 * default is set.
178 * ARMv7M: Read ICSR[8:0] (active vector)
179 * ARMv6M: Read ICSR[5:0] (active vector)
180 */
181 #ifndef SEGGER_SYSVIEW_GET_INTERRUPT_ID
182  #if SEGGER_SYSVIEW_CORE == SEGGER_SYSVIEW_CORE_CM3
183  #define SEGGER_SYSVIEW_GET_INTERRUPT_ID() ((*(U32*)(0xE000ED04)) & 0x1FF) // Get the currently active interrupt Id. (i.e. read Cortex-M ICSR[8:0] = active vector)
184  #elif SEGGER_SYSVIEW_CORE == SEGGER_SYSVIEW_CORE_CM0
185  #if defined(__ICCARM__)
186  #if (__VER__ > 6010000)
187  #define SEGGER_SYSVIEW_GET_INTERRUPT_ID() (__get_IPSR()) // Workaround for IAR, which might do a byte-access to 0xE000ED04. Read IPSR instead.
188  #else
189  #define SEGGER_SYSVIEW_GET_INTERRUPT_ID() ((*(U32*)(0xE000ED04)) & 0x3F) // Older versions of IAR do not include __get_IPSR, but might also not optimize to byte-access.
190  #endif
191  #else
192  #define SEGGER_SYSVIEW_GET_INTERRUPT_ID() ((*(U32*)(0xE000ED04)) & 0x3F) // Get the currently active interrupt Id. (i.e. read Cortex-M ICSR[5:0] = active vector)
193  #endif
194  #else
195  #define SEGGER_SYSVIEW_GET_INTERRUPT_ID() SEGGER_SYSVIEW_X_GetInterruptId() // Get the currently active interrupt Id from the user-provided function.
196  #endif
197 #endif
198 
199 /*********************************************************************
200 *
201 * Define: SEGGER_SYSVIEW_GET_TIMESTAMP()
202 *
203 * Description
204 * Function macro to retrieve a system timestamp for SYSVIEW events.
205 * Default
206 * Call user-supplied function SEGGER_SYSVIEW_X_GetTimestamp().
207 * Notes
208 * For some known compilers and cores, a ready-to-use, core-specific
209 * default is set.
210 * ARMv7M: Read Cortex-M Cycle Count register.
211 *
212 * The system timestamp clock frequency has to be passed in
213 * SEGGER_SYSVIEW_Init().
214 */
215 #ifndef SEGGER_SYSVIEW_GET_TIMESTAMP
216  #if defined (SEGGER_SYSVIEW_CORE) && (SEGGER_SYSVIEW_CORE == SEGGER_SYSVIEW_CORE_CM3)
217  #define SEGGER_SYSVIEW_GET_TIMESTAMP() (*(U32 *)(0xE0001004)) // Retrieve a system timestamp. Cortex-M cycle counter.
218  #else
219  #define SEGGER_SYSVIEW_GET_TIMESTAMP() SEGGER_SYSVIEW_X_GetTimestamp() // Retrieve a system timestamp via user-defined function
220  #endif
221 #endif
222 
223 /*********************************************************************
224 *
225 * Define: SEGGER_SYSVIEW_TIMESTAMP_BITS
226 *
227 * Description
228 * Number of valid (low-order) bits delivered in system timestamp.
229 * Default
230 * 32
231 * Notes
232 * Value has to match system timestamp clock source.
233 */
234 // Define number of valid bits low-order delivered by clock source.
235 #ifndef SEGGER_SYSVIEW_TIMESTAMP_BITS
236  #define SEGGER_SYSVIEW_TIMESTAMP_BITS 32
237 #endif
238 
239 /*********************************************************************
240 *
241 * Define: SEGGER_SYSVIEW_RTT_CHANNEL
242 *
243 * Description
244 * The RTT channel that SystemView will use.
245 * Default
246 * 0: Auto selection.
247 * Notes
248 * Value has to be lower than SEGGER_RTT_MAX_NUM_UP_BUFFERS.
249 */
250 #ifndef SEGGER_SYSVIEW_RTT_CHANNEL
251  #define SEGGER_SYSVIEW_RTT_CHANNEL 0
252 #endif
253 // Sanity check of RTT channel
254 #if (SEGGER_SYSVIEW_RTT_CHANNEL == 0) && (SEGGER_RTT_MAX_NUM_UP_BUFFERS < 2)
255  #error "SEGGER_RTT_MAX_NUM_UP_BUFFERS in SEGGER_RTT_Conf.h has to be > 1!"
256 #elif (SEGGER_SYSVIEW_RTT_CHANNEL >= SEGGER_RTT_MAX_NUM_UP_BUFFERS)
257  #error "SEGGER_RTT_MAX_NUM_UP_BUFFERS in SEGGER_RTT_Conf.h has to be > SEGGER_SYSVIEW_RTT_CHANNEL!"
258 #endif
259 
260 /*********************************************************************
261 *
262 * Define: SEGGER_SYSVIEW_RTT_BUFFER_SIZE
263 *
264 * Description
265 * Number of bytes that SystemView uses for the RTT buffer.
266 * Default
267 * 1024
268 */
269 #ifndef SEGGER_SYSVIEW_RTT_BUFFER_SIZE
270  #define SEGGER_SYSVIEW_RTT_BUFFER_SIZE 1024
271 #endif
272 
273 /*********************************************************************
274 *
275 * Define: SEGGER_SYSVIEW_SECTION
276 *
277 * Description
278 * Section to place the SystemView RTT Buffer into.
279 * Default
280 * undefined: Do not place into a specific section.
281 * Notes
282 * If SEGGER_RTT_SECTION is defined, the default changes to use
283 * this section for the SystemView RTT Buffer, too.
284 */
285 #if !(defined SEGGER_SYSVIEW_SECTION) && (defined SEGGER_RTT_SECTION)
286  #define SEGGER_SYSVIEW_SECTION SEGGER_RTT_SECTION
287 #endif
288 
289 /*********************************************************************
290 *
291 * Define: SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE
292 *
293 * Description
294 * Largest cache line size (in bytes) in the target system.
295 * Default
296 * 0
297 * Notes
298 * Required in systems with caches to make sure that the SystemView
299 * RTT buffer can be aligned accordingly.
300 */
301 #ifndef SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE
302  #define SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE 0
303 #endif
304 
305 /*********************************************************************
306 *
307 * Define: SEGGER_SYSVIEW_ID_BASE
308 *
309 * Description
310 * Lowest Id reported by the application.
311 * Default
312 * 0
313 * Notes
314 * Value is usually subtracted from mailboxes, semaphores, tasks,
315 * .... addresses, to compress event parameters.
316 * Should be the lowest RAM address of the system.
317 */
318 #ifndef SEGGER_SYSVIEW_ID_BASE
319  #define SEGGER_SYSVIEW_ID_BASE 0
320 #endif
321 
322 /*********************************************************************
323 *
324 * Define: SEGGER_SYSVIEW_ID_SHIFT
325 *
326 * Description
327 * Number of bits to shift Ids.
328 * Default
329 * 0
330 * Notes
331 * Ids are shifted to compress event parameters.
332 * Should match the alignment of Ids (addresses),
333 * e.g. 2 when Ids are 4 byte aligned.
334 */
335 #ifndef SEGGER_SYSVIEW_ID_SHIFT
336  #define SEGGER_SYSVIEW_ID_SHIFT 0
337 #endif
338 
339 /*********************************************************************
340 *
341 * Define: SEGGER_SYSVIEW_MAX_ARGUMENTS
342 *
343 * Description
344 * Maximum number of arguments which are handled with SystemView
345 * print routines or may be encoded in one recording function.
346 * routines.
347 * Default
348 * 16
349 */
350 #ifndef SEGGER_SYSVIEW_MAX_ARGUMENTS
351  #define SEGGER_SYSVIEW_MAX_ARGUMENTS 16
352 #endif
353 
354 /*********************************************************************
355 *
356 * Define: SEGGER_SYSVIEW_MAX_STRING_LEN
357 *
358 * Description
359 * Maximum string length which can be used in SystemView print and
360 * system description routines.
361 * Default
362 * 128
363 */
364 #ifndef SEGGER_SYSVIEW_MAX_STRING_LEN
365  #define SEGGER_SYSVIEW_MAX_STRING_LEN 128
366 #endif
367 
368 /*********************************************************************
369 *
370 * Define: SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT
371 *
372 * Description
373 * If enabled, on SEGGER_SYSVIEW_PrintHost, check the format string
374 * and if it includes unsupported formatters, use formatting on the
375 * target instead.
376 * Default
377 * 0: Disabled.
378 */
379 #ifndef SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT
380  #define SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT 0
381 #endif
382 
383 /*********************************************************************
384 *
385 * Define: SEGGER_SYSVIEW_USE_INTERNAL_RECORDER
386 *
387 * Description
388 * If set, an internal recorder, such as UART or IP is used.
389 * Default
390 * 0: Disabled.
391 * Notes
392 * Convenience define to be used by SEGGER_SYSVIEW_Conf(),
393 * such as in embOS configuration to enable Cortex-M cycle counter.
394 */
395 #ifndef SEGGER_SYSVIEW_USE_INTERNAL_RECORDER
396  #define SEGGER_SYSVIEW_USE_INTERNAL_RECORDER 0
397 #endif
398 
399 /*********************************************************************
400 *
401 * Define: SEGGER_SYSVIEW_CAN_RESTART
402 *
403 * Description
404 * If enabled, send the SystemView start sequence on every start
405 * command, not just on the first one.
406 * Enables restart when SystemView disconnected unexpectedly.
407 * Default
408 * 1: Enabled
409 */
410 #ifndef SEGGER_SYSVIEW_CAN_RESTART
411  #define SEGGER_SYSVIEW_CAN_RESTART 1
412 #endif
413 
414 /*********************************************************************
415 *
416 * Define: SEGGER_SYSVIEW_START_ON_INIT
417 *
418 * Description
419 * Enable calling SEGGER_SYSVIEW_Start() after initialization.
420 * Default
421 * 0: Disabled.
422 * Notes
423 * Convenience define to be used by SEGGER_SYSVIEW_Conf(),
424 * such as in embOS configuration.
425 */
426 #ifndef SEGGER_SYSVIEW_START_ON_INIT
427  #define SEGGER_SYSVIEW_START_ON_INIT 0
428 #endif
429 
430 /*********************************************************************
431 *
432 * Define: SEGGER_SYSVIEW_USE_STATIC_BUFFER
433 *
434 * Description
435 * If enabled, use a static buffer instead of a buffer on the stack
436 * for SystemView event packets.
437 * Default
438 * 1: Enabled.
439 * Notes
440 * If enabled, the static memory use by SystemView is increased by
441 * the maximum packet size. SystemView is locked on entry of a
442 * recording function.
443 * If disabled, the stack usage by SystemView recording functions
444 * might be increased by up to the maximum packet size. SystemView
445 * is locked when writing the packet to the RTT buffer.
446 */
447 #ifndef SEGGER_SYSVIEW_USE_STATIC_BUFFER
448  #define SEGGER_SYSVIEW_USE_STATIC_BUFFER 1
449 #endif
450 
451 /*********************************************************************
452 *
453 * Define: SEGGER_SYSVIEW_MAX_PACKET_SIZE
454 *
455 * Description
456 * Maximum packet size for a SystemView event.
457 * Default
458 * Automatically calculated.
459 * Notes
460 * The maximum packet size is mainly defined by the maximum string
461 * length and the maximum number of arguments.
462 */
463 #ifndef SEGGER_SYSVIEW_MAX_PACKET_SIZE
464  #define SEGGER_SYSVIEW_MAX_PACKET_SIZE (SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_MAX_STRING_LEN + 2 * SEGGER_SYSVIEW_QUANTA_U32 + SEGGER_SYSVIEW_MAX_ARGUMENTS * SEGGER_SYSVIEW_QUANTA_U32)
465 #endif
466 
467 /*********************************************************************
468 *
469 * Define: SEGGER_SYSVIEW_POST_MORTEM_MODE
470 *
471 * Description
472 * If enabled, SystemView records for post-mortem analysis instead
473 * of real-time analysis.
474 * Default
475 * 0: Disabled.
476 * Notes
477 * For more information refer to
478 * https://www.segger.com/products/development-tools/systemview/technology/post-mortem-mode
479 */
480 #ifndef SEGGER_SYSVIEW_POST_MORTEM_MODE
481  #define SEGGER_SYSVIEW_POST_MORTEM_MODE 0
482 #endif
483 
484 /*********************************************************************
485 *
486 * Define: SEGGER_SYSVIEW_SYNC_PERIOD_SHIFT
487 *
488 * Description
489 * Configure how frequently syncronization is sent in post-mortem
490 * mode.
491 * Default
492 * 8: (1 << 8) = Every 256 Events.
493 * Notes
494 * In post-mortem mode, at least one sync has to be in the RTT buffer.
495 * Recommended sync frequency: Buffer Size / 16
496 * For more information refer to
497 * https://www.segger.com/products/development-tools/systemview/technology/post-mortem-mode
498 */
499 #ifndef SEGGER_SYSVIEW_SYNC_PERIOD_SHIFT
500  #define SEGGER_SYSVIEW_SYNC_PERIOD_SHIFT 8
501 #endif
502 
503 /*********************************************************************
504 *
505 * Define: SEGGER_SYSVIEW_ON_EVENT_RECORDED()
506 *
507 * Description
508 * Function macro to notify recorder about a new event in buffer.
509 * Default
510 * undefined: Do not notify recorder.
511 * Notes
512 * Used for non-J-Link recorder,
513 * such as to enable transmission via UART or notify IP task.
514 */
515 #ifndef SEGGER_SYSVIEW_ON_EVENT_RECORDED
516  #define SEGGER_SYSVIEW_ON_EVENT_RECORDED(NumBytes)
517 #endif
518 
519 /*********************************************************************
520 *
521 * Define: SEGGER_SYSVIEW_LOCK()
522 *
523 * Description
524 * Function macro to (nestable) lock SystemView recording.
525 * Default
526 * Use RTT Locking mechanism (defined by SEGGER_RTT_LOCK()).
527 * Notes
528 * If SystemView recording is not locked, recording events from
529 * interrupts and tasks may lead to unpredictable, undefined, event
530 * data.
531 */
532 #ifndef SEGGER_SYSVIEW_LOCK
533  #define SEGGER_SYSVIEW_LOCK() SEGGER_RTT_LOCK()
534 #endif
535 
536 /*********************************************************************
537 *
538 * Define: SEGGER_SYSVIEW_UNLOCK
539 *
540 * Description
541 * Function macro to unlock SystemView recording.
542 * Default
543 * Use RTT Unlocking mechanism (defined by SEGGER_RTT_UNLOCK()).
544 */
545 #ifndef SEGGER_SYSVIEW_UNLOCK
546  #define SEGGER_SYSVIEW_UNLOCK() SEGGER_RTT_UNLOCK()
547 #endif
548 
549 #ifdef __cplusplus
550 }
551 #endif
552 
553 #endif /* (dg_configSYSTEMVIEW == 1) */
554 
555 #endif
556 
557 /*************************** End of file ****************************/