SEGGER_SYSVIEW_Conf.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /*********************************************************************
  2. * SEGGER Microcontroller GmbH & Co. KG *
  3. * The Embedded Experts *
  4. **********************************************************************
  5. * *
  6. * (c) 2015 - 2017 SEGGER Microcontroller GmbH & Co. KG *
  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 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. * conditions are met: *
  25. * *
  26. * o Redistributions of source code must retain the above copyright *
  27. * notice, this list of conditions and the following disclaimer. *
  28. * *
  29. * o Redistributions in binary form must reproduce the above *
  30. * copyright notice, this list of conditions and the following *
  31. * disclaimer in the documentation and/or other materials provided *
  32. * with the distribution. *
  33. * *
  34. * o Neither the name of SEGGER Microcontroller GmbH & Co. KG *
  35. * nor the names of its contributors may be used to endorse or *
  36. * promote products derived from this software without specific *
  37. * prior written permission. *
  38. * *
  39. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
  40. * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
  41. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
  42. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
  43. * DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
  44. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
  45. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
  46. * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
  47. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
  48. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
  49. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
  50. * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
  51. * DAMAGE. *
  52. * *
  53. **********************************************************************
  54. * *
  55. * SystemView version: V2.52a *
  56. * *
  57. **********************************************************************
  58. -------------------------- END-OF-HEADER -----------------------------
  59. File : SEGGER_SYSVIEW_Conf.h
  60. Purpose : SEGGER SystemView configuration.
  61. Revision: $Rev: 6249 $
  62. */
  63. #ifndef SEGGER_SYSVIEW_CONF_H
  64. #define SEGGER_SYSVIEW_CONF_H
  65. #include "rtthread.h"
  66. /*********************************************************************
  67. *
  68. * Defines, fixed
  69. *
  70. **********************************************************************
  71. */
  72. //
  73. // Constants for known core configuration
  74. //
  75. #define SEGGER_SYSVIEW_CORE_OTHER 0
  76. #define SEGGER_SYSVIEW_CORE_CM0 1 // Cortex-M0/M0+/M1
  77. #define SEGGER_SYSVIEW_CORE_CM3 2 // Cortex-M3/M4/M7/M85
  78. #define SEGGER_SYSVIEW_CORE_RX 3 // Renesas RX
  79. #if (defined __SES_ARM) || (defined __CROSSWORKS_ARM) || (defined __GNUC__) || (defined __clang__)
  80. #if (defined __ARM_ARCH_6M__) || (defined __ARM_ARCH_8M_BASE__)
  81. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
  82. #elif (defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_8M_MAIN__)) || (defined __ARM_ARCH_8_1M_MAIN__)
  83. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
  84. #endif
  85. #elif defined(__ICCARM__)
  86. #if (defined (__ARM6M__) && (__CORE__ == __ARM6M__)) \
  87. || (defined (__ARM8M_BASELINE__) && (__CORE__ == __ARM8M_BASELINE__))
  88. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
  89. #elif (defined (__ARM7EM__) && (__CORE__ == __ARM7EM__)) \
  90. || (defined (__ARM7M__) && (__CORE__ == __ARM7M__)) \
  91. || (defined (__ARM8M_MAINLINE__) && (__CORE__ == __ARM8M_MAINLINE__)) \
  92. || (defined (__ARM8M_MAINLINE__) && (__CORE__ == __ARM8M_MAINLINE__))
  93. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
  94. #endif
  95. #elif defined(__CC_ARM)
  96. #if (defined(__TARGET_ARCH_6S_M))
  97. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
  98. #elif (defined(__TARGET_ARCH_7_M) || defined(__TARGET_ARCH_7E_M))
  99. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
  100. #endif
  101. #elif defined(__TI_ARM__)
  102. #ifdef __TI_ARM_V6M0__
  103. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
  104. #elif (defined(__TI_ARM_V7M3__) || defined(__TI_ARM_V7M4__))
  105. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
  106. #endif
  107. #elif defined(__ICCRX__)
  108. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_RX
  109. #elif defined(__RX)
  110. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_RX
  111. #endif
  112. #ifndef SEGGER_SYSVIEW_CORE
  113. #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_OTHER
  114. #endif
  115. /*********************************************************************
  116. *
  117. * Defines, configurable
  118. *
  119. **********************************************************************
  120. */
  121. /*********************************************************************
  122. *
  123. * SystemView buffer configuration
  124. */
  125. #ifndef PKG_USING_SYSTEMVIEW
  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. #else
  131. #define SEGGER_SYSVIEW_RTT_BUFFER_SIZE PKG_SEGGER_SYSVIEW_RTT_BUFFER_SIZE
  132. #ifdef PKG_SEGGER_SYSVIEW_RTT_CHANNEL
  133. #define SEGGER_SYSVIEW_RTT_CHANNEL 1
  134. #endif
  135. #ifdef PKG_SEGGER_SYSVIEW_USE_STATIC_BUFFER
  136. #define SEGGER_SYSVIEW_USE_STATIC_BUFFER 1
  137. #endif
  138. #ifdef PKG_SEGGER_SYSVIEW_POST_MORTEM_MODE
  139. #define SEGGER_SYSVIEW_POST_MORTEM_MODE 1
  140. #endif
  141. #endif
  142. /*********************************************************************
  143. *
  144. * SystemView timestamp configuration
  145. */
  146. #if SEGGER_SYSVIEW_CORE == SEGGER_SYSVIEW_CORE_CM3
  147. #define SEGGER_SYSVIEW_GET_TIMESTAMP() (*(U32 *)(0xE0001004)) // Retrieve a system timestamp. Cortex-M cycle counter.
  148. #define SEGGER_SYSVIEW_TIMESTAMP_BITS 32 // Define number of valid bits low-order delivered by clock source
  149. #else
  150. #define SEGGER_SYSVIEW_GET_TIMESTAMP() SEGGER_SYSVIEW_X_GetTimestamp() // Retrieve a system timestamp via user-defined function
  151. #define SEGGER_SYSVIEW_TIMESTAMP_BITS 32 // Define number of valid bits low-order delivered by SEGGER_SYSVIEW_X_GetTimestamp()
  152. #endif
  153. /*********************************************************************
  154. *
  155. * SystemView Id configuration
  156. */
  157. #ifndef PKG_USING_SYSTEMVIEW
  158. #define SEGGER_SYSVIEW_ID_BASE 0x10000000 // 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)
  159. #define SEGGER_SYSVIEW_ID_SHIFT 2 // Number of bits to shift the Id to save bandwidth. (i.e. 2 when Ids are 4 byte aligned)
  160. #else
  161. #define SEGGER_SYSVIEW_ID_BASE PKG_SEGGER_SYSVIEW_ID_BASE
  162. #define SEGGER_SYSVIEW_ID_SHIFT PKG_SEGGER_SYSVIEW_ID_SHIFT
  163. #endif
  164. /*********************************************************************
  165. *
  166. * SystemView interrupt configuration
  167. */
  168. #if SEGGER_SYSVIEW_CORE == SEGGER_SYSVIEW_CORE_CM3
  169. #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)
  170. #elif SEGGER_SYSVIEW_CORE == SEGGER_SYSVIEW_CORE_CM0
  171. #if defined(__ICCARM__)
  172. #define SEGGER_SYSVIEW_GET_INTERRUPT_ID() (__get_IPSR()) // Workaround for IAR, which might do a byte-access to 0xE000ED04. Read IPSR instead.
  173. #else
  174. #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)
  175. #endif
  176. #else
  177. #define SEGGER_SYSVIEW_GET_INTERRUPT_ID() SEGGER_SYSVIEW_X_GetInterruptId() // Get the currently active interrupt Id from the user-provided function.
  178. #endif
  179. #endif // SEGGER_SYSVIEW_CONF_H
  180. /*************************** End of file ****************************/