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