SEGGER_SYSVIEW_Conf.h 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /*
  2. * SPDX-FileCopyrightText: 2015-2017 SEGGER Microcontroller GmbH & Co. KG
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. /*********************************************************************
  7. * SEGGER Microcontroller GmbH & Co. KG *
  8. * The Embedded Experts *
  9. **********************************************************************
  10. * *
  11. * (c) 2015 - 2017 SEGGER Microcontroller GmbH & Co. KG *
  12. * *
  13. * www.segger.com Support: support@segger.com *
  14. * *
  15. **********************************************************************
  16. * *
  17. * SEGGER SystemView * Real-time application analysis *
  18. * *
  19. **********************************************************************
  20. * *
  21. * All rights reserved. *
  22. * *
  23. * SEGGER strongly recommends to not make any changes *
  24. * to or modify the source code of this software in order to stay *
  25. * compatible with the RTT protocol and J-Link. *
  26. * *
  27. * Redistribution and use in source and binary forms, with or *
  28. * without modification, are permitted provided that the following *
  29. * conditions are met: *
  30. * *
  31. * o Redistributions of source code must retain the above copyright *
  32. * notice, this list of conditions and the following disclaimer. *
  33. * *
  34. * o Redistributions in binary form must reproduce the above *
  35. * copyright notice, this list of conditions and the following *
  36. * disclaimer in the documentation and/or other materials provided *
  37. * with the distribution. *
  38. * *
  39. * o Neither the name of SEGGER Microcontroller GmbH & Co. KG *
  40. * nor the names of its contributors may be used to endorse or *
  41. * promote products derived from this software without specific *
  42. * prior written permission. *
  43. * *
  44. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
  45. * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
  46. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
  47. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
  48. * DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
  49. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
  50. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
  51. * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
  52. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
  53. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
  54. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
  55. * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
  56. * DAMAGE. *
  57. * *
  58. **********************************************************************
  59. * *
  60. * SystemView version: V2.42 *
  61. * *
  62. **********************************************************************
  63. -------------------------- END-OF-HEADER -----------------------------
  64. File : SEGGER_SYSVIEW_Conf.h
  65. Purpose : SEGGER SystemView configuration.
  66. Revision: $Rev: 5927 $
  67. */
  68. #ifndef SEGGER_SYSVIEW_CONF_H
  69. #define SEGGER_SYSVIEW_CONF_H
  70. #include "soc/soc.h"
  71. /*********************************************************************
  72. *
  73. * Defines, fixed
  74. *
  75. **********************************************************************
  76. */
  77. //
  78. // Constants for known core configuration
  79. //
  80. #define SEGGER_SYSVIEW_CORE_OTHER 0
  81. #define SEGGER_SYSVIEW_CORE_CM0 1 // Cortex-M0/M0+/M1
  82. #define SEGGER_SYSVIEW_CORE_CM3 2 // Cortex-M3/M4/M7
  83. #define SEGGER_SYSVIEW_CORE_RX 3 // Renesas RX
  84. #if (defined __SES_ARM) || (defined __CROSSWORKS_ARM) || (defined __GNUC__)
  85. #ifdef __ARM_ARCH_6M__
  86. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
  87. #elif (defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__))
  88. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
  89. #endif
  90. #elif defined(__ICCARM__)
  91. #if (defined (__ARM6M__) && (__CORE__ == __ARM6M__))
  92. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
  93. #elif ((defined (__ARM7M__) && (__CORE__ == __ARM7M__)) || (defined (__ARM7EM__) && (__CORE__ == __ARM7EM__)))
  94. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
  95. #endif
  96. #elif defined(__CC_ARM)
  97. #if (defined(__TARGET_ARCH_6S_M))
  98. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
  99. #elif (defined(__TARGET_ARCH_7_M) || defined(__TARGET_ARCH_7E_M))
  100. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
  101. #endif
  102. #elif defined(__TI_ARM__)
  103. #ifdef __TI_ARM_V6M0__
  104. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
  105. #elif (defined(__TI_ARM_V7M3__) || defined(__TI_ARM_V7M4__))
  106. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
  107. #endif
  108. #elif defined(__ICCRX__)
  109. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_RX
  110. #elif defined(__RX)
  111. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_RX
  112. #endif
  113. #ifndef SEGGER_SYSVIEW_CORE
  114. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_OTHER
  115. #endif
  116. /*********************************************************************
  117. *
  118. * Defines, configurable
  119. *
  120. **********************************************************************
  121. */
  122. /*********************************************************************
  123. *
  124. * SystemView buffer configuration
  125. */
  126. #define SEGGER_SYSVIEW_RTT_BUFFER_SIZE 1024 // Number of bytes that SystemView uses for the buffer.
  127. #define SEGGER_SYSVIEW_RTT_CHANNEL 1 // The RTT channel that SystemView will use. 0: Auto selection
  128. #define SEGGER_SYSVIEW_USE_STATIC_BUFFER 1 // Use a static buffer to generate events instead of a buffer on the stack
  129. #define SEGGER_SYSVIEW_POST_MORTEM_MODE 0 // 1: Enable post mortem analysis mode
  130. /*********************************************************************
  131. *
  132. * SystemView timestamp configuration
  133. */
  134. #if SEGGER_SYSVIEW_CORE == SEGGER_SYSVIEW_CORE_CM3
  135. #define SEGGER_SYSVIEW_GET_TIMESTAMP() (*(U32 *)(0xE0001004)) // Retrieve a system timestamp. Cortex-M cycle counter.
  136. #define SEGGER_SYSVIEW_TIMESTAMP_BITS 32 // Define number of valid bits low-order delivered by clock source
  137. #else
  138. #define SEGGER_SYSVIEW_GET_TIMESTAMP() SEGGER_SYSVIEW_X_GetTimestamp() // Retrieve a system timestamp via user-defined function
  139. #define SEGGER_SYSVIEW_TIMESTAMP_BITS 32 // Define number of valid bits low-order delivered by SEGGER_SYSVIEW_X_GetTimestamp()
  140. #endif
  141. /*********************************************************************
  142. *
  143. * SystemView Id configuration
  144. */
  145. //TODO: optimise it
  146. #define SEGGER_SYSVIEW_ID_BASE SOC_DROM_LOW // Default value for the lowest Id reported by the application. Can be overridden by the application via SEGGER_SYSVIEW_SetRAMBase(). (i.e. 0x20000000 when all Ids are an address in this RAM)
  147. #define SEGGER_SYSVIEW_ID_SHIFT 0 // Number of bits to shift the Id to save bandwidth. (i.e. 2 when Ids are 4 byte aligned)
  148. /*********************************************************************
  149. *
  150. * SystemView interrupt configuration
  151. */
  152. #if SEGGER_SYSVIEW_CORE == SEGGER_SYSVIEW_CORE_CM3
  153. #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)
  154. #elif SEGGER_SYSVIEW_CORE == SEGGER_SYSVIEW_CORE_CM0
  155. #if defined(__ICCARM__)
  156. #define SEGGER_SYSVIEW_GET_INTERRUPT_ID() (__get_IPSR()) // Workaround for IAR, which might do a byte-access to 0xE000ED04. Read IPSR instead.
  157. #else
  158. #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)
  159. #endif
  160. #else
  161. #define SEGGER_SYSVIEW_GET_INTERRUPT_ID() SEGGER_SYSVIEW_X_GetInterruptId() // Get the currently active interrupt Id from the user-provided function.
  162. #endif
  163. unsigned SEGGER_SYSVIEW_X_SysView_Lock(void);
  164. void SEGGER_SYSVIEW_X_SysView_Unlock(unsigned int_state);
  165. // to be recursive save IRQ status on the stack of the caller
  166. #define SEGGER_SYSVIEW_LOCK() unsigned _SYSVIEW_int_state = SEGGER_SYSVIEW_X_SysView_Lock()
  167. #define SEGGER_SYSVIEW_UNLOCK() SEGGER_SYSVIEW_X_SysView_Unlock(_SYSVIEW_int_state)
  168. #endif // SEGGER_SYSVIEW_CONF_H
  169. /*************************** End of file ****************************/