chore(debug): sysView support (#6303)

This commit is contained in:
3djc
2025-06-17 13:23:31 +10:00
committed by GitHub
parent 8eb144feca
commit 128771c43d
39 changed files with 13298 additions and 8 deletions
+1
View File
@@ -14,3 +14,4 @@ radio/src/tests/gtest*.tar.gz
.cache
compile_commands.json
/ys_Doc
/.idea
-3
View File
@@ -5,9 +5,6 @@
path = radio/src/thirdparty/FreeRTOS
url = https://github.com/FreeRTOS/FreeRTOS-Kernel.git
shallow = true
[submodule "radio/src/thirdparty/Segger_RTT"]
path = radio/src/thirdparty/Segger_RTT
url = https://github.com/adfernandes/segger-rtt.git
[submodule "radio/src/thirdparty/stb"]
path = radio/src/thirdparty/stb
url = https://github.com/nothings/stb.git
+20 -1
View File
@@ -309,9 +309,28 @@ if(DEBUG STREQUAL RTT_NO_USB)
add_definitions(-DDEBUG_DISABLE_USB)
endif()
if(DEBUG STREQUAL RTT_SYSVIEW)
set(DEBUG ON)
set(DEBUG_SEGGER_RTT ON)
set(DEBUG_SEGGER_SYSVIEW ON)
endif()
if(DEBUG_SEGGER_RTT AND NOT NATIVE_BUILD)
add_definitions(-DDEBUG_SEGGER_RTT -DSEGGER_RTT_BUFFER_SECTION=".ram")
set(SRC ${SRC} ${THIRDPARTY_DIR}/Segger_RTT/RTT/SEGGER_RTT.c)
include_directories(${THIRDPARTY_DIR}/Segger/Config)
include_directories(${THIRDPARTY_DIR}/Segger/Sample)
include_directories(${THIRDPARTY_DIR}/Segger/SEGGER)
set(SRC ${SRC} ${THIRDPARTY_DIR}/Segger/SEGGER/SEGGER_RTT.c)
set(SRC ${SRC} ${THIRDPARTY_DIR}/Segger/SEGGER/SEGGER_RTT_ASM_ARMv7M.S)
set(SRC ${SRC} ${THIRDPARTY_DIR}/Segger/SEGGER/SEGGER_RTT_printf.c)
endif()
if(DEBUG_SEGGER_SYSVIEW AND NOT NATIVE_BUILD)
add_definitions(-DDEBUG_SEGGER_SYSVIEW)
include_directories(${THIRDPARTY_DIR}/Segger/Sample/FreeRTOSV11)
set(SRC ${SRC} ${THIRDPARTY_DIR}/Segger/SEGGER/SEGGER_SYSVIEW.c)
set(SRC ${SRC} ${THIRDPARTY_DIR}/Segger/Sample/FreeRTOSV11/SEGGER_SYSVIEW_FreeRTOS.c)
set(SRC ${SRC} ${THIRDPARTY_DIR}/Segger/Sample/FreeRTOSV11/Config/Cortex-M/SEGGER_SYSVIEW_Config_FreeRTOS.c)
endif()
if(DEBUG_WINDOWS)
+3
View File
@@ -124,3 +124,6 @@ standard names. */
#define vPortSVCHandler SVC_Handler
#define xPortPendSVHandler PendSV_Handler
#define xPortSysTickHandler SysTick_Handler
#if defined(DEBUG_SEGGER_SYSVIEW)
#include "SEGGER_SYSVIEW_FreeRTOS.h"
#endif
+1 -1
View File
@@ -32,7 +32,7 @@ endif()
if(DEBUG_SEGGER_RTT)
set(BOOTLOADER_SRC ${BOOTLOADER_SRC}
${RADIO_SRC_DIR}/thirdparty/Segger_RTT/RTT/SEGGER_RTT.c
${RADIO_SRC_DIR}/thirdparty/Segger/SEGGER/SEGGER_RTT.c
)
endif()
+1 -1
View File
@@ -36,7 +36,7 @@
#endif
#if defined(DEBUG_SEGGER_RTT)
#include "thirdparty/Segger_RTT/RTT/SEGGER_RTT.h"
#include "thirdparty/Segger/SEGGER/SEGGER_RTT.h"
#endif
#define REBOOT_CMD_DFU 0x55464442
+4
View File
@@ -1580,6 +1580,10 @@ int main()
initialise_monitor_handles();
#endif
#if defined(DEBUG_SEGGER_SYSVIEW)
SEGGER_SYSVIEW_Conf();
SEGGER_SYSVIEW_Start();
#endif
#if !defined(SIMU)
/* Ensure all priority bits are assigned as preemption priority bits. */
+1 -1
View File
@@ -47,7 +47,7 @@
#endif
#if defined(DEBUG_SEGGER_RTT)
#include "thirdparty/Segger_RTT/RTT/SEGGER_RTT.h"
#include "thirdparty/Segger/SEGGER/SEGGER_RTT.h"
#endif
#define PRINTF_BUFFER_SIZE 128
+113
View File
@@ -0,0 +1,113 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
----------------------------------------------------------------------
File : Global.h
Purpose : Global types
In case your application already has a Global.h, you should
merge the files. In order to use Segger code, the types
U8, U16, U32, I8, I16, I32 need to be defined in Global.h;
additional definitions do not hurt.
Revision: $Rev: 12501 $
---------------------------END-OF-HEADER------------------------------
*/
#ifndef GLOBAL_H // Guard against multiple inclusion
#define GLOBAL_H
#define U8 unsigned char
#define I8 signed char
#define U16 unsigned short
#define I16 signed short
#ifdef __x86_64__
#define U32 unsigned
#define I32 int
#else
#define U32 unsigned long
#define I32 signed long
#endif
//
// CC_NO_LONG_SUPPORT can be defined to compile test
// without long support for compilers that do not
// support C99 and its long type.
//
#ifdef CC_NO_LONG_SUPPORT
#define PTR_ADDR U32
#else // Supports long type.
#if defined(_WIN32) && !defined(__clang__) && !defined(__MINGW32__)
//
// Microsoft VC6 compiler related
//
#define U64 unsigned __int64
#define U128 unsigned __int128
#define I64 __int64
#define I128 __int128
#if _MSC_VER <= 1200
#define U64_C(x) x##UI64
#else
#define U64_C(x) x##ULL
#endif
#else
//
// C99 compliant compiler
//
#define U64 unsigned long long
#define I64 signed long long
#define U64_C(x) x##ULL
#endif
#if (defined(_WIN64) || defined(__LP64__)) // 64-bit symbols used by Visual Studio and GCC, maybe others as well.
#define PTR_ADDR U64
#else
#define PTR_ADDR U32
#endif
#endif // Supports long type.
#endif // Avoid multiple inclusion
/*************************** End of file ****************************/
+441
View File
@@ -0,0 +1,441 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
---------------------------END-OF-HEADER------------------------------
File : SEGGER_RTT_Conf.h
Purpose : Implementation of SEGGER real-time transfer (RTT) which
allows real-time communication on targets which support
debugger memory accesses while the CPU is running.
Revision: $Rev: 24316 $
*/
#ifndef SEGGER_RTT_CONF_H
#define SEGGER_RTT_CONF_H
#define RTT_USE_ASM 1
#ifdef __IAR_SYSTEMS_ICC__
#include <intrinsics.h>
#endif
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
//
// Take in and set to correct values for Cortex-A systems with CPU cache
//
//#define SEGGER_RTT_CPU_CACHE_LINE_SIZE (32) // Largest cache line size (in bytes) in the current system
//#define SEGGER_RTT_UNCACHED_OFF (0xFB000000) // Address alias where RTT CB and buffers can be accessed uncached
//
// Most common case:
// Up-channel 0: RTT
// Up-channel 1: SystemView
//
#ifndef SEGGER_RTT_MAX_NUM_UP_BUFFERS
#define SEGGER_RTT_MAX_NUM_UP_BUFFERS (3) // Max. number of up-buffers (T->H) available on this target (Default: 3)
#endif
//
// Most common case:
// Down-channel 0: RTT
// Down-channel 1: SystemView
//
#ifndef SEGGER_RTT_MAX_NUM_DOWN_BUFFERS
#define SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (3) // Max. number of down-buffers (H->T) available on this target (Default: 3)
#endif
#ifndef BUFFER_SIZE_UP
#define BUFFER_SIZE_UP (1024) // Size of the buffer for terminal output of target, up to host (Default: 1k)
#endif
#ifndef BUFFER_SIZE_DOWN
#define BUFFER_SIZE_DOWN (16) // Size of the buffer for terminal input to target from host (Usually keyboard input) (Default: 16)
#endif
#ifndef SEGGER_RTT_PRINTF_BUFFER_SIZE
#define SEGGER_RTT_PRINTF_BUFFER_SIZE (64u) // Size of buffer for RTT printf to bulk-send chars via RTT (Default: 64)
#endif
#ifndef SEGGER_RTT_MODE_DEFAULT
#define SEGGER_RTT_MODE_DEFAULT SEGGER_RTT_MODE_NO_BLOCK_SKIP // Mode for pre-initialized terminal channel (buffer 0)
#endif
/*********************************************************************
*
* RTT memcpy configuration
*
* memcpy() is good for large amounts of data,
* but the overhead is big for small amounts, which are usually stored via RTT.
* With SEGGER_RTT_MEMCPY_USE_BYTELOOP a simple byte loop can be used instead.
*
* SEGGER_RTT_MEMCPY() can be used to replace standard memcpy() in RTT functions.
* This is may be required with memory access restrictions,
* such as on Cortex-A devices with MMU.
*/
#ifndef SEGGER_RTT_MEMCPY_USE_BYTELOOP
#define SEGGER_RTT_MEMCPY_USE_BYTELOOP 0 // 0: Use memcpy/SEGGER_RTT_MEMCPY, 1: Use a simple byte-loop
#endif
//
// Example definition of SEGGER_RTT_MEMCPY to external memcpy with GCC toolchains and Cortex-A targets
//
//#if ((defined __SES_ARM) || (defined __CROSSWORKS_ARM) || (defined __GNUC__)) && (defined (__ARM_ARCH_7A__))
// #define SEGGER_RTT_MEMCPY(pDest, pSrc, NumBytes) SEGGER_memcpy((pDest), (pSrc), (NumBytes))
//#endif
//
// Target is not allowed to perform other RTT operations while string still has not been stored completely.
// Otherwise we would probably end up with a mixed string in the buffer.
// If using RTT from within interrupts, multiple tasks or multi processors, define the SEGGER_RTT_LOCK() and SEGGER_RTT_UNLOCK() function here.
//
// SEGGER_RTT_MAX_INTERRUPT_PRIORITY can be used in the sample lock routines on Cortex-M3/4.
// Make sure to mask all interrupts which can send RTT data, i.e. generate SystemView events, or cause task switches.
// When high-priority interrupts must not be masked while sending RTT data, SEGGER_RTT_MAX_INTERRUPT_PRIORITY needs to be adjusted accordingly.
// (Higher priority = lower priority number)
// Default value for embOS: 128u
// Default configuration in FreeRTOS: configMAX_SYSCALL_INTERRUPT_PRIORITY: ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
// In case of doubt mask all interrupts: 1 << (8 - BASEPRI_PRIO_BITS) i.e. 1 << 5 when 3 bits are implemented in NVIC
// or define SEGGER_RTT_LOCK() to completely disable interrupts.
//
#ifndef SEGGER_RTT_MAX_INTERRUPT_PRIORITY
#define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20) // Interrupt priority to lock on SEGGER_RTT_LOCK on Cortex-M3/4 (Default: 0x20)
#endif
/*********************************************************************
*
* RTT lock configuration for SEGGER Embedded Studio,
* Rowley CrossStudio and GCC
*/
#if ((defined(__SES_ARM) || defined(__SES_RISCV) || defined(__CROSSWORKS_ARM) || defined(__GNUC__) || defined(__clang__)) && !defined (__CC_ARM) && !defined(WIN32))
#if (defined(__ARM_ARCH_6M__) || defined(__ARM_ARCH_8M_BASE__))
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
__asm volatile ("mrs %0, primask \n\t" \
"movs r1, #1 \n\t" \
"msr primask, r1 \n\t" \
: "=r" (_SEGGER_RTT__LockState) \
: \
: "r1", "cc" \
);
#define SEGGER_RTT_UNLOCK() __asm volatile ("msr primask, %0 \n\t" \
: \
: "r" (_SEGGER_RTT__LockState) \
: \
); \
}
#elif (defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_8M_MAIN__) || defined(__ARM_ARCH_8_1M_MAIN__))
#ifndef SEGGER_RTT_MAX_INTERRUPT_PRIORITY
#define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20)
#endif
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
__asm volatile ("mrs %0, basepri \n\t" \
"mov r1, %1 \n\t" \
"msr basepri, r1 \n\t" \
: "=r" (_SEGGER_RTT__LockState) \
: "i"(SEGGER_RTT_MAX_INTERRUPT_PRIORITY) \
: "r1", "cc" \
);
#define SEGGER_RTT_UNLOCK() __asm volatile ("msr basepri, %0 \n\t" \
: \
: "r" (_SEGGER_RTT__LockState) \
: \
); \
}
#elif (defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__))
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
__asm volatile ("mrs r1, CPSR \n\t" \
"mov %0, r1 \n\t" \
"orr r1, r1, #0xC0 \n\t" \
"msr CPSR_c, r1 \n\t" \
: "=r" (_SEGGER_RTT__LockState) \
: \
: "r1", "cc" \
);
#define SEGGER_RTT_UNLOCK() __asm volatile ("mov r0, %0 \n\t" \
"mrs r1, CPSR \n\t" \
"bic r1, r1, #0xC0 \n\t" \
"and r0, r0, #0xC0 \n\t" \
"orr r1, r1, r0 \n\t" \
"msr CPSR_c, r1 \n\t" \
: \
: "r" (_SEGGER_RTT__LockState) \
: "r0", "r1", "cc" \
); \
}
#elif defined(__riscv) || defined(__riscv_xlen)
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
__asm volatile ("csrr %0, mstatus \n\t" \
"csrci mstatus, 8 \n\t" \
"andi %0, %0, 8 \n\t" \
: "=r" (_SEGGER_RTT__LockState) \
: \
: \
);
#define SEGGER_RTT_UNLOCK() __asm volatile ("csrr a1, mstatus \n\t" \
"or %0, %0, a1 \n\t" \
"csrs mstatus, %0 \n\t" \
: \
: "r" (_SEGGER_RTT__LockState) \
: "a1" \
); \
}
#else
#define SEGGER_RTT_LOCK()
#define SEGGER_RTT_UNLOCK()
#endif
#endif
/*********************************************************************
*
* RTT lock configuration for IAR EWARM
*/
#ifdef __ICCARM__
#if (defined (__ARM6M__) && (__CORE__ == __ARM6M__)) || \
(defined (__ARM8M_BASELINE__) && (__CORE__ == __ARM8M_BASELINE__))
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
_SEGGER_RTT__LockState = __get_PRIMASK(); \
__set_PRIMASK(1);
#define SEGGER_RTT_UNLOCK() __set_PRIMASK(_SEGGER_RTT__LockState); \
}
#elif (defined (__ARM7EM__) && (__CORE__ == __ARM7EM__)) || \
(defined (__ARM7M__) && (__CORE__ == __ARM7M__)) || \
(defined (__ARM8M_MAINLINE__) && (__CORE__ == __ARM8M_MAINLINE__)) || \
(defined (__ARM8M_MAINLINE__) && (__CORE__ == __ARM8M_MAINLINE__))
#ifndef SEGGER_RTT_MAX_INTERRUPT_PRIORITY
#define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20)
#endif
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
_SEGGER_RTT__LockState = __get_BASEPRI(); \
__set_BASEPRI(SEGGER_RTT_MAX_INTERRUPT_PRIORITY);
#define SEGGER_RTT_UNLOCK() __set_BASEPRI(_SEGGER_RTT__LockState); \
}
#elif (defined (__ARM7A__) && (__CORE__ == __ARM7A__)) || \
(defined (__ARM7R__) && (__CORE__ == __ARM7R__))
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
__asm volatile ("mrs r1, CPSR \n\t" \
"mov %0, r1 \n\t" \
"orr r1, r1, #0xC0 \n\t" \
"msr CPSR_c, r1 \n\t" \
: "=r" (_SEGGER_RTT__LockState) \
: \
: "r1", "cc" \
);
#define SEGGER_RTT_UNLOCK() __asm volatile ("mov r0, %0 \n\t" \
"mrs r1, CPSR \n\t" \
"bic r1, r1, #0xC0 \n\t" \
"and r0, r0, #0xC0 \n\t" \
"orr r1, r1, r0 \n\t" \
"msr CPSR_c, r1 \n\t" \
: \
: "r" (_SEGGER_RTT__LockState) \
: "r0", "r1", "cc" \
); \
}
#endif
#endif
/*********************************************************************
*
* RTT lock configuration for IAR RX
*/
#ifdef __ICCRX__
#define SEGGER_RTT_LOCK() { \
unsigned long _SEGGER_RTT__LockState; \
_SEGGER_RTT__LockState = __get_interrupt_state(); \
__disable_interrupt();
#define SEGGER_RTT_UNLOCK() __set_interrupt_state(_SEGGER_RTT__LockState); \
}
#endif
/*********************************************************************
*
* RTT lock configuration for IAR RL78
*/
#ifdef __ICCRL78__
#define SEGGER_RTT_LOCK() { \
__istate_t _SEGGER_RTT__LockState; \
_SEGGER_RTT__LockState = __get_interrupt_state(); \
__disable_interrupt();
#define SEGGER_RTT_UNLOCK() __set_interrupt_state(_SEGGER_RTT__LockState); \
}
#endif
/*********************************************************************
*
* RTT lock configuration for KEIL ARM
*/
#ifdef __CC_ARM
#if (defined __TARGET_ARCH_6S_M)
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
register unsigned char _SEGGER_RTT__PRIMASK __asm( "primask"); \
_SEGGER_RTT__LockState = _SEGGER_RTT__PRIMASK; \
_SEGGER_RTT__PRIMASK = 1u; \
__schedule_barrier();
#define SEGGER_RTT_UNLOCK() _SEGGER_RTT__PRIMASK = _SEGGER_RTT__LockState; \
__schedule_barrier(); \
}
#elif (defined(__TARGET_ARCH_7_M) || defined(__TARGET_ARCH_7E_M))
#ifndef SEGGER_RTT_MAX_INTERRUPT_PRIORITY
#define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20)
#endif
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
register unsigned char BASEPRI __asm( "basepri"); \
_SEGGER_RTT__LockState = BASEPRI; \
BASEPRI = SEGGER_RTT_MAX_INTERRUPT_PRIORITY; \
__schedule_barrier();
#define SEGGER_RTT_UNLOCK() BASEPRI = _SEGGER_RTT__LockState; \
__schedule_barrier(); \
}
#endif
#endif
/*********************************************************************
*
* RTT lock configuration for TI ARM
*/
#ifdef __TI_ARM__
#if defined (__TI_ARM_V6M0__)
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
_SEGGER_RTT__LockState = __get_PRIMASK(); \
__set_PRIMASK(1);
#define SEGGER_RTT_UNLOCK() __set_PRIMASK(_SEGGER_RTT__LockState); \
}
#elif (defined (__TI_ARM_V7M3__) || defined (__TI_ARM_V7M4__))
#ifndef SEGGER_RTT_MAX_INTERRUPT_PRIORITY
#define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20)
#endif
#define SEGGER_RTT_LOCK() { \
unsigned int _SEGGER_RTT__LockState; \
_SEGGER_RTT__LockState = _set_interrupt_priority(SEGGER_RTT_MAX_INTERRUPT_PRIORITY);
#define SEGGER_RTT_UNLOCK() _set_interrupt_priority(_SEGGER_RTT__LockState); \
}
#endif
#endif
/*********************************************************************
*
* RTT lock configuration for CCRX
*/
#ifdef __RX
#include <machine.h>
#define SEGGER_RTT_LOCK() { \
unsigned long _SEGGER_RTT__LockState; \
_SEGGER_RTT__LockState = get_psw() & 0x010000; \
clrpsw_i();
#define SEGGER_RTT_UNLOCK() set_psw(get_psw() | _SEGGER_RTT__LockState); \
}
#endif
/*********************************************************************
*
* RTT lock configuration for embOS Simulation on Windows
* (Can also be used for generic RTT locking with embOS)
*/
#if defined(WIN32) || defined(SEGGER_RTT_LOCK_EMBOS)
void OS_SIM_EnterCriticalSection(void);
void OS_SIM_LeaveCriticalSection(void);
#define SEGGER_RTT_LOCK() { \
OS_SIM_EnterCriticalSection();
#define SEGGER_RTT_UNLOCK() OS_SIM_LeaveCriticalSection(); \
}
#endif
/*********************************************************************
*
* RTT lock configuration fallback
*/
#ifndef SEGGER_RTT_LOCK
#define SEGGER_RTT_LOCK() // Lock RTT (nestable) (i.e. disable interrupts)
#endif
#ifndef SEGGER_RTT_UNLOCK
#define SEGGER_RTT_UNLOCK() // Unlock RTT (nestable) (i.e. enable previous interrupt lock state)
#endif
/*********************************************************************
*
* If SEGGER_RTT_SECTION is defined but SEGGER_RTT_BUFFER_SECTION
* is not, use the same section for SEGGER_RTT_BUFFER_SECTION.
*/
#ifndef SEGGER_RTT_BUFFER_SECTION
#if defined(SEGGER_RTT_SECTION)
#define SEGGER_RTT_BUFFER_SECTION SEGGER_RTT_SECTION
#endif
#endif
#endif
/*************************** End of file ****************************/
+102
View File
@@ -0,0 +1,102 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Conf.h
Purpose : SEGGER SystemView configuration file.
Set defines which deviate from the defaults (see SEGGER_SYSVIEW_ConfDefaults.h) here.
Revision: $Rev: 21292 $
Additional information:
Required defines which must be set are:
SEGGER_SYSVIEW_GET_TIMESTAMP
SEGGER_SYSVIEW_GET_INTERRUPT_ID
For known compilers and cores, these might be set to good defaults
in SEGGER_SYSVIEW_ConfDefaults.h.
SystemView needs a (nestable) locking mechanism.
If not defined, the RTT locking mechanism is used,
which then needs to be properly configured.
*/
#ifndef SEGGER_SYSVIEW_CONF_H
#define SEGGER_SYSVIEW_CONF_H
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_SECTION
*
* Description
* Section to place the SystemView RTT Buffer into.
* Default
* undefined: Do not place into a specific section.
* Notes
* If SEGGER_RTT_SECTION is defined, the default changes to use
* this section for the SystemView RTT Buffer, too.
*/
#if !(defined SEGGER_SYSVIEW_SECTION) && (defined SEGGER_RTT_BUFFER_SECTION)
#define SEGGER_SYSVIEW_SECTION SEGGER_RTT_BUFFER_SECTION
#endif
/*********************************************************************
* TODO: Add your defines here. *
**********************************************************************
*/
#endif // SEGGER_SYSVIEW_CONF_H
/*************************** End of file ****************************/
+248
View File
@@ -0,0 +1,248 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
----------------------------------------------------------------------
File : SEGGER.h
Purpose : Global types etc & general purpose utility functions
Revision: $Rev: 18102 $
---------------------------END-OF-HEADER------------------------------
*/
#ifndef SEGGER_H // Guard against multiple inclusion
#define SEGGER_H
#include <stdarg.h> // For va_list.
#include "Global.h" // Type definitions: U8, U16, U32, I8, I16, I32
#if defined(__cplusplus)
extern "C" { /* Make sure we have C-declarations in C++ programs */
#endif
/*********************************************************************
*
* Keywords/specifiers
*
**********************************************************************
*/
#ifndef INLINE
#if (defined(__ICCARM__) || defined(__RX) || defined(__ICCRX__))
//
// Other known compilers.
//
#define INLINE inline
#else
#if (defined(_WIN32) && !defined(__clang__))
//
// Microsoft VC6 and newer.
// Force inlining without cost checking.
//
#define INLINE __forceinline
#elif defined(__GNUC__) || defined(__clang__)
//
// Force inlining with GCC + clang
//
#define INLINE inline __attribute__((always_inline))
#elif (defined(__CC_ARM))
//
// Force inlining with ARMCC (Keil)
//
#define INLINE __inline
#else
//
// Unknown compilers.
//
#define INLINE
#endif
#endif
#endif
/*********************************************************************
*
* Function-like macros
*
**********************************************************************
*/
#define SEGGER_COUNTOF(a) (sizeof((a))/sizeof((a)[0]))
#define SEGGER_MIN(a,b) (((a) < (b)) ? (a) : (b))
#define SEGGER_MAX(a,b) (((a) > (b)) ? (a) : (b))
#ifndef SEGGER_USE_PARA // Some compiler complain about unused parameters.
#define SEGGER_USE_PARA(Para) (void)Para // This works for most compilers.
#endif
#define SEGGER_ADDR2PTR(Type, Addr) (/*lint -e(923) -e(9078)*/((Type*)((PTR_ADDR)(Addr)))) // Allow cast from address to pointer.
#define SEGGER_PTR2ADDR(p) (/*lint -e(923) -e(9078)*/((PTR_ADDR)(p))) // Allow cast from pointer to address.
#define SEGGER_PTR2PTR(Type, p) (/*lint -e(740) -e(826) -e(9079) -e(9087)*/((Type*)(p))) // Allow cast from one pointer type to another (ignore different size).
#define SEGGER_PTR_DISTANCE(p0, p1) (SEGGER_PTR2ADDR(p0) - SEGGER_PTR2ADDR(p1))
/*********************************************************************
*
* Defines
*
**********************************************************************
*/
#define SEGGER_PRINTF_FLAG_ADJLEFT (1 << 0)
#define SEGGER_PRINTF_FLAG_SIGNFORCE (1 << 1)
#define SEGGER_PRINTF_FLAG_SIGNSPACE (1 << 2)
#define SEGGER_PRINTF_FLAG_PRECEED (1 << 3)
#define SEGGER_PRINTF_FLAG_ZEROPAD (1 << 4)
#define SEGGER_PRINTF_FLAG_NEGATIVE (1 << 5)
/*********************************************************************
*
* Types
*
**********************************************************************
*/
typedef struct {
char* pBuffer;
int BufferSize;
int Cnt;
} SEGGER_BUFFER_DESC;
typedef struct {
unsigned int CacheLineSize; // 0: No Cache. Most Systems such as ARM9 use a 32 bytes cache line size.
void (*pfDMB) (void); // Optional DMB function for Data Memory Barrier to make sure all memory operations are completed.
void (*pfClean) (void *p, unsigned long NumBytes); // Optional clean function for cached memory.
void (*pfInvalidate)(void *p, unsigned long NumBytes); // Optional invalidate function for cached memory.
} SEGGER_CACHE_CONFIG;
typedef struct SEGGER_SNPRINTF_CONTEXT_struct SEGGER_SNPRINTF_CONTEXT;
struct SEGGER_SNPRINTF_CONTEXT_struct {
void* pContext; // Application specific context.
SEGGER_BUFFER_DESC* pBufferDesc; // Buffer descriptor to use for output.
void (*pfFlush)(SEGGER_SNPRINTF_CONTEXT* pContext); // Callback executed once the buffer is full. Callback decides if the buffer gets cleared to store more or not.
};
typedef struct {
void (*pfStoreChar) (SEGGER_BUFFER_DESC* pBufferDesc, SEGGER_SNPRINTF_CONTEXT* pContext, char c);
int (*pfPrintUnsigned) (SEGGER_BUFFER_DESC* pBufferDesc, SEGGER_SNPRINTF_CONTEXT* pContext, U32 v, unsigned Base, char Flags, int Width, int Precision);
int (*pfPrintInt) (SEGGER_BUFFER_DESC* pBufferDesc, SEGGER_SNPRINTF_CONTEXT* pContext, I32 v, unsigned Base, char Flags, int Width, int Precision);
} SEGGER_PRINTF_API;
typedef void (*SEGGER_pFormatter)(SEGGER_BUFFER_DESC* pBufferDesc, SEGGER_SNPRINTF_CONTEXT* pContext, const SEGGER_PRINTF_API* pApi, va_list* pParamList, char Lead, int Width, int Precision);
typedef struct SEGGER_PRINTF_FORMATTER {
struct SEGGER_PRINTF_FORMATTER* pNext; // Pointer to next formatter.
SEGGER_pFormatter pfFormatter; // Formatter function.
char Specifier; // Format specifier.
} SEGGER_PRINTF_FORMATTER;
typedef struct {
U32 (*pfGetHPTimestamp)(void); // Mandatory, pfGetHPTimestamp
int (*pfGetUID) (U8 abUID[16]); // Optional, pfGetUID
} SEGGER_BSP_API;
/*********************************************************************
*
* Utility functions
*
**********************************************************************
*/
//
// Memory operations.
//
void SEGGER_ARM_memcpy(void* pDest, const void* pSrc, int NumBytes);
void SEGGER_memcpy (void* pDest, const void* pSrc, unsigned NumBytes);
void SEGGER_memxor (void* pDest, const void* pSrc, unsigned NumBytes);
//
// String functions.
//
int SEGGER_atoi (const char* s);
int SEGGER_isalnum (int c);
int SEGGER_isalpha (int c);
unsigned SEGGER_strlen (const char* s);
int SEGGER_tolower (int c);
int SEGGER_strcasecmp (const char* sText1, const char* sText2);
int SEGGER_strncasecmp(const char *sText1, const char *sText2, unsigned Count);
//
// Buffer/printf related.
//
void SEGGER_StoreChar (SEGGER_BUFFER_DESC* pBufferDesc, char c);
void SEGGER_PrintUnsigned(SEGGER_BUFFER_DESC* pBufferDesc, U32 v, unsigned Base, int Precision);
void SEGGER_PrintInt (SEGGER_BUFFER_DESC* pBufferDesc, I32 v, unsigned Base, int Precision);
int SEGGER_snprintf (char* pBuffer, int BufferSize, const char* sFormat, ...);
int SEGGER_vsnprintf (char* pBuffer, int BufferSize, const char* sFormat, va_list ParamList);
int SEGGER_vsnprintfEx (SEGGER_SNPRINTF_CONTEXT* pContext, const char* sFormat, va_list ParamList);
int SEGGER_PRINTF_AddFormatter (SEGGER_PRINTF_FORMATTER* pFormatter, SEGGER_pFormatter pfFormatter, char c);
void SEGGER_PRINTF_AddDoubleFormatter (void);
void SEGGER_PRINTF_AddIPFormatter (void);
void SEGGER_PRINTF_AddBLUEFormatter (void);
void SEGGER_PRINTF_AddCONNECTFormatter(void);
void SEGGER_PRINTF_AddSSLFormatter (void);
void SEGGER_PRINTF_AddSSHFormatter (void);
void SEGGER_PRINTF_AddHTMLFormatter (void);
//
// BSP abstraction API.
//
int SEGGER_BSP_GetUID (U8 abUID[16]);
int SEGGER_BSP_GetUID32(U32* pUID);
void SEGGER_BSP_SetAPI (const SEGGER_BSP_API* pAPI);
void SEGGER_BSP_SeedUID (void);
//
// Other API.
//
void SEGGER_VERSION_GetString(char acText[8], unsigned Version);
#if defined(__cplusplus)
} /* Make sure we have C-declarations in C++ programs */
#endif
#endif // Avoid multiple inclusion
/*************************** End of file ****************************/
File diff suppressed because it is too large Load Diff
+519
View File
@@ -0,0 +1,519 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
---------------------------END-OF-HEADER------------------------------
File : SEGGER_RTT.h
Purpose : Implementation of SEGGER real-time transfer which allows
real-time communication on targets which support debugger
memory accesses while the CPU is running.
Revision: $Rev: 25842 $
----------------------------------------------------------------------
*/
#ifndef SEGGER_RTT_H
#define SEGGER_RTT_H
#include "SEGGER_RTT_Conf.h"
/*********************************************************************
*
* Defines, defaults
*
**********************************************************************
*/
#ifndef RTT_USE_ASM
//
// Some cores support out-of-order memory accesses (reordering of memory accesses in the core)
// For such cores, we need to define a memory barrier to guarantee the order of certain accesses to the RTT ring buffers.
// Needed for:
// Cortex-M7 (ARMv7-M)
// Cortex-M23 (ARM-v8M)
// Cortex-M33 (ARM-v8M)
// Cortex-A/R (ARM-v7A/R)
//
// We do not explicitly check for "Embedded Studio" as the compiler in use determines what we support.
// You can use an external toolchain like IAR inside ES. So there is no point in checking for "Embedded Studio"
//
#if (defined __CROSSWORKS_ARM) // Rowley Crossworks
#define _CC_HAS_RTT_ASM_SUPPORT 1
#if (defined __ARM_ARCH_7M__) // Cortex-M3
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#elif (defined __ARM_ARCH_7EM__) // Cortex-M4/M7
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#elif (defined __ARM_ARCH_8M_BASE__) // Cortex-M23
#define _CORE_HAS_RTT_ASM_SUPPORT 0
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#elif (defined __ARM_ARCH_8M_MAIN__) // Cortex-M33
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#elif (defined(__ARM_ARCH_8_1M_MAIN__)) // Cortex-M85
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#else
#define _CORE_HAS_RTT_ASM_SUPPORT 0
#endif
#elif (defined __ARMCC_VERSION)
//
// ARM compiler
// ARM compiler V6.0 and later is clang based.
// Our ASM part is compatible to clang.
//
#if (__ARMCC_VERSION >= 6000000)
#define _CC_HAS_RTT_ASM_SUPPORT 1
#else
#define _CC_HAS_RTT_ASM_SUPPORT 0
#endif
#if (defined __ARM_ARCH_6M__) // Cortex-M0 / M1
#define _CORE_HAS_RTT_ASM_SUPPORT 0 // No ASM support for this architecture
#elif (defined __ARM_ARCH_7M__) // Cortex-M3
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#elif (defined __ARM_ARCH_7EM__) // Cortex-M4/M7
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#elif (defined __ARM_ARCH_8M_BASE__) // Cortex-M23
#define _CORE_HAS_RTT_ASM_SUPPORT 0
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#elif (defined __ARM_ARCH_8M_MAIN__) // Cortex-M33
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#elif (defined __ARM_ARCH_8_1M_MAIN__) // Cortex-M85
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#elif \
((defined __ARM_ARCH_7A__) || (defined __ARM_ARCH_7R__)) || \
((defined __ARM_ARCH_8A__) || (defined __ARM_ARCH_8R__))
//
// Cortex-A/R ARMv7-A/R & ARMv8-A/R
//
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#else
#define _CORE_HAS_RTT_ASM_SUPPORT 0
#endif
#elif ((defined __GNUC__) || (defined __clang__))
//
// GCC / Clang
//
#define _CC_HAS_RTT_ASM_SUPPORT 1
// ARM 7/9: __ARM_ARCH_5__ / __ARM_ARCH_5E__ / __ARM_ARCH_5T__ / __ARM_ARCH_5T__ / __ARM_ARCH_5TE__
#if (defined __ARM_ARCH_7M__) // Cortex-M3
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#elif (defined __ARM_ARCH_7EM__) // Cortex-M4/M7
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#define _CORE_NEEDS_DMB 1 // Only Cortex-M7 needs a DMB but we cannot distinguish M4 and M7 here...
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#elif (defined __ARM_ARCH_8M_BASE__) // Cortex-M23
#define _CORE_HAS_RTT_ASM_SUPPORT 0
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#elif (defined __ARM_ARCH_8M_MAIN__) // Cortex-M33
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#elif (defined __ARM_ARCH_8_1M_MAIN__) // Cortex-M85
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#elif \
(defined __ARM_ARCH_7A__) || (defined __ARM_ARCH_7R__) || \
(defined __ARM_ARCH_8A__) || (defined __ARM_ARCH_8R__)
//
// Cortex-A/R ARMv7-A/R & ARMv8-A/R
//
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() __asm volatile ("dmb\n" : : :);
#else
#define _CORE_HAS_RTT_ASM_SUPPORT 0
#endif
#elif ((defined __IASMARM__) || (defined __ICCARM__))
//
// IAR assembler/compiler
//
#define _CC_HAS_RTT_ASM_SUPPORT 1
#if (__VER__ < 6300000)
#define VOLATILE
#else
#define VOLATILE volatile
#endif
#if (defined __ARM7M__) // Needed for old versions that do not know the define yet
#if (__CORE__ == __ARM7M__) // Cortex-M3
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#endif
#endif
#if (defined __ARM7EM__)
#if (__CORE__ == __ARM7EM__) // Cortex-M4/M7
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() asm VOLATILE ("DMB");
#endif
#endif
#if (defined __ARM8M_BASELINE__)
#if (__CORE__ == __ARM8M_BASELINE__) // Cortex-M23
#define _CORE_HAS_RTT_ASM_SUPPORT 0
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() asm VOLATILE ("DMB");
#endif
#endif
#if (defined __ARM8M_MAINLINE__)
#if (__CORE__ == __ARM8M_MAINLINE__) // Cortex-M33
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() asm VOLATILE ("DMB");
#endif
#endif
#if (defined __ARM8EM_MAINLINE__)
#if (__CORE__ == __ARM8EM_MAINLINE__) // Cortex-???
#define _CORE_HAS_RTT_ASM_SUPPORT 1
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() asm VOLATILE ("DMB");
#endif
#endif
#if\
((defined __ARM7A__) && (__CORE__ == __ARM7A__)) || \
((defined __ARM7R__) && (__CORE__ == __ARM7R__)) || \
((defined __ARM8A__) && (__CORE__ == __ARM8A__)) || \
((defined __ARM8R__) && (__CORE__ == __ARM8R__))
//
// Cortex-A/R ARMv7-A/R & ARMv8-A/R
//
#define _CORE_NEEDS_DMB 1
#define RTT__DMB() asm VOLATILE ("DMB");
#endif
#else
//
// Other compilers
//
#define _CC_HAS_RTT_ASM_SUPPORT 0
#define _CORE_HAS_RTT_ASM_SUPPORT 0
#endif
//
// If IDE and core support the ASM version, enable ASM version by default
//
#ifndef _CORE_HAS_RTT_ASM_SUPPORT
#define _CORE_HAS_RTT_ASM_SUPPORT 0 // Default for unknown cores
#endif
#if (_CC_HAS_RTT_ASM_SUPPORT && _CORE_HAS_RTT_ASM_SUPPORT)
#define RTT_USE_ASM (1)
#else
#define RTT_USE_ASM (0)
#endif
#endif
#ifndef _CORE_NEEDS_DMB
#define _CORE_NEEDS_DMB 0
#endif
#ifndef RTT__DMB
#if _CORE_NEEDS_DMB
#error "Don't know how to place inline assembly for DMB"
#else
#define RTT__DMB()
#endif
#endif
#ifndef SEGGER_RTT_CPU_CACHE_LINE_SIZE
#define SEGGER_RTT_CPU_CACHE_LINE_SIZE (0) // On most target systems where RTT is used, we do not have a CPU cache, therefore 0 is a good default here
#endif
#ifndef SEGGER_RTT_UNCACHED_OFF
#if SEGGER_RTT_CPU_CACHE_LINE_SIZE
#error "SEGGER_RTT_UNCACHED_OFF must be defined when setting SEGGER_RTT_CPU_CACHE_LINE_SIZE != 0"
#else
#define SEGGER_RTT_UNCACHED_OFF (0)
#endif
#endif
#if RTT_USE_ASM
#if SEGGER_RTT_CPU_CACHE_LINE_SIZE
#error "RTT_USE_ASM is not available if SEGGER_RTT_CPU_CACHE_LINE_SIZE != 0"
#endif
#endif
#ifndef SEGGER_RTT_ASM // defined when SEGGER_RTT.h is included from assembly file
#include <stdlib.h>
#include <stdarg.h>
#include <stdint.h>
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
//
// Determine how much we must pad the control block to make it a multiple of a cache line in size
// Assuming: U8 = 1B
// U16 = 2B
// U32 = 4B
// U8/U16/U32* = 4B
//
#if SEGGER_RTT_CPU_CACHE_LINE_SIZE // Avoid division by zero in case we do not have any cache
#define SEGGER_RTT__ROUND_UP_2_CACHE_LINE_SIZE(NumBytes) (((NumBytes + SEGGER_RTT_CPU_CACHE_LINE_SIZE - 1) / SEGGER_RTT_CPU_CACHE_LINE_SIZE) * SEGGER_RTT_CPU_CACHE_LINE_SIZE)
#else
#define SEGGER_RTT__ROUND_UP_2_CACHE_LINE_SIZE(NumBytes) (NumBytes)
#endif
#define SEGGER_RTT__CB_SIZE (16 + 4 + 4 + (SEGGER_RTT_MAX_NUM_UP_BUFFERS * 24) + (SEGGER_RTT_MAX_NUM_DOWN_BUFFERS * 24))
#define SEGGER_RTT__CB_PADDING (SEGGER_RTT__ROUND_UP_2_CACHE_LINE_SIZE(SEGGER_RTT__CB_SIZE) - SEGGER_RTT__CB_SIZE)
/*********************************************************************
*
* Types
*
**********************************************************************
*/
//
// Description for a circular buffer (also called "ring buffer")
// which is used as up-buffer (T->H)
//
typedef struct {
const char* sName; // Optional name. Standard names so far are: "Terminal", "SysView", "J-Scope_t4i4"
char* pBuffer; // Pointer to start of buffer
unsigned SizeOfBuffer; // Buffer size in bytes. Note that one byte is lost, as this implementation does not fill up the buffer in order to avoid the problem of being unable to distinguish between full and empty.
unsigned WrOff; // Position of next item to be written by either target.
volatile unsigned RdOff; // Position of next item to be read by host. Must be volatile since it may be modified by host.
unsigned Flags; // Contains configuration flags. Flags[31:24] are used for validity check and must be zero. Flags[23:2] are reserved for future use. Flags[1:0] = RTT operating mode.
} SEGGER_RTT_BUFFER_UP;
//
// Description for a circular buffer (also called "ring buffer")
// which is used as down-buffer (H->T)
//
typedef struct {
const char* sName; // Optional name. Standard names so far are: "Terminal", "SysView", "J-Scope_t4i4"
char* pBuffer; // Pointer to start of buffer
unsigned SizeOfBuffer; // Buffer size in bytes. Note that one byte is lost, as this implementation does not fill up the buffer in order to avoid the problem of being unable to distinguish between full and empty.
volatile unsigned WrOff; // Position of next item to be written by host. Must be volatile since it may be modified by host.
unsigned RdOff; // Position of next item to be read by target (down-buffer).
unsigned Flags; // Contains configuration flags. Flags[31:24] are used for validity check and must be zero. Flags[23:2] are reserved for future use. Flags[1:0] = RTT operating mode.
} SEGGER_RTT_BUFFER_DOWN;
//
// RTT control block which describes the number of buffers available
// as well as the configuration for each buffer
//
//
typedef struct {
char acID[16]; // Initialized to "SEGGER RTT"
int MaxNumUpBuffers; // Initialized to SEGGER_RTT_MAX_NUM_UP_BUFFERS (type. 2)
int MaxNumDownBuffers; // Initialized to SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (type. 2)
SEGGER_RTT_BUFFER_UP aUp[SEGGER_RTT_MAX_NUM_UP_BUFFERS]; // Up buffers, transferring information up from target via debug probe to host
SEGGER_RTT_BUFFER_DOWN aDown[SEGGER_RTT_MAX_NUM_DOWN_BUFFERS]; // Down buffers, transferring information down from host via debug probe to target
#if SEGGER_RTT__CB_PADDING
unsigned char aDummy[SEGGER_RTT__CB_PADDING];
#endif
} SEGGER_RTT_CB;
/*********************************************************************
*
* Global data
*
**********************************************************************
*/
extern SEGGER_RTT_CB _SEGGER_RTT;
/*********************************************************************
*
* RTT API functions
*
**********************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
int SEGGER_RTT_AllocDownBuffer (const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags);
int SEGGER_RTT_AllocUpBuffer (const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags);
int SEGGER_RTT_ConfigUpBuffer (unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags);
int SEGGER_RTT_ConfigDownBuffer (unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags);
int SEGGER_RTT_GetKey (void);
unsigned SEGGER_RTT_HasData (unsigned BufferIndex);
int SEGGER_RTT_HasKey (void);
unsigned SEGGER_RTT_HasDataUp (unsigned BufferIndex);
void SEGGER_RTT_Init (void);
unsigned SEGGER_RTT_Read (unsigned BufferIndex, void* pBuffer, unsigned BufferSize);
unsigned SEGGER_RTT_ReadNoLock (unsigned BufferIndex, void* pData, unsigned BufferSize);
int SEGGER_RTT_SetNameDownBuffer (unsigned BufferIndex, const char* sName);
int SEGGER_RTT_SetNameUpBuffer (unsigned BufferIndex, const char* sName);
int SEGGER_RTT_SetFlagsDownBuffer (unsigned BufferIndex, unsigned Flags);
int SEGGER_RTT_SetFlagsUpBuffer (unsigned BufferIndex, unsigned Flags);
int SEGGER_RTT_WaitKey (void);
unsigned SEGGER_RTT_Write (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
unsigned SEGGER_RTT_WriteNoLock (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
unsigned SEGGER_RTT_WriteSkipNoLock (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
unsigned SEGGER_RTT_ASM_WriteSkipNoLock (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
unsigned SEGGER_RTT_WriteString (unsigned BufferIndex, const char* s);
void SEGGER_RTT_WriteWithOverwriteNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
unsigned SEGGER_RTT_PutChar (unsigned BufferIndex, char c);
unsigned SEGGER_RTT_PutCharSkip (unsigned BufferIndex, char c);
unsigned SEGGER_RTT_PutCharSkipNoLock (unsigned BufferIndex, char c);
unsigned SEGGER_RTT_GetAvailWriteSpace (unsigned BufferIndex);
unsigned SEGGER_RTT_GetBytesInBuffer (unsigned BufferIndex);
//
// Function macro for performance optimization
//
#define SEGGER_RTT_HASDATA(n) (((SEGGER_RTT_BUFFER_DOWN*)((uintptr_t)&_SEGGER_RTT.aDown[n] + SEGGER_RTT_UNCACHED_OFF))->WrOff - ((SEGGER_RTT_BUFFER_DOWN*)((uintptr_t)&_SEGGER_RTT.aDown[n] + SEGGER_RTT_UNCACHED_OFF))->RdOff)
#if RTT_USE_ASM
#define SEGGER_RTT_WriteSkipNoLock SEGGER_RTT_ASM_WriteSkipNoLock
#endif
/*********************************************************************
*
* RTT transfer functions to send RTT data via other channels.
*
**********************************************************************
*/
unsigned SEGGER_RTT_ReadUpBuffer (unsigned BufferIndex, void* pBuffer, unsigned BufferSize);
unsigned SEGGER_RTT_ReadUpBufferNoLock (unsigned BufferIndex, void* pData, unsigned BufferSize);
unsigned SEGGER_RTT_WriteDownBuffer (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
unsigned SEGGER_RTT_WriteDownBufferNoLock (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes);
#define SEGGER_RTT_HASDATA_UP(n) (((SEGGER_RTT_BUFFER_UP*)((uintptr_t)&_SEGGER_RTT.aUp[n] + SEGGER_RTT_UNCACHED_OFF))->WrOff - ((SEGGER_RTT_BUFFER_UP*)((uintptr_t)&_SEGGER_RTT.aUp[n] + SEGGER_RTT_UNCACHED_OFF))->RdOff) // Access uncached to make sure we see changes made by the J-Link side and all of our changes go into HW directly
/*********************************************************************
*
* RTT "Terminal" API functions
*
**********************************************************************
*/
int SEGGER_RTT_SetTerminal (unsigned char TerminalId);
int SEGGER_RTT_TerminalOut (unsigned char TerminalId, const char* s);
/*********************************************************************
*
* RTT printf functions (require SEGGER_RTT_printf.c)
*
**********************************************************************
*/
int SEGGER_RTT_printf(unsigned BufferIndex, const char * sFormat, ...);
int SEGGER_RTT_vprintf(unsigned BufferIndex, const char * sFormat, va_list * pParamList);
#ifdef __cplusplus
}
#endif
#endif // ifndef(SEGGER_RTT_ASM)
//
// For some environments, NULL may not be defined until certain headers are included
//
#ifndef NULL
#define NULL ((void*)0)
#endif
/*********************************************************************
*
* Defines
*
**********************************************************************
*/
//
// Operating modes. Define behavior if buffer is full (not enough space for entire message)
//
#define SEGGER_RTT_MODE_NO_BLOCK_SKIP (0) // Skip. Do not block, output nothing. (Default)
#define SEGGER_RTT_MODE_NO_BLOCK_TRIM (1) // Trim: Do not block, output as much as fits.
#define SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL (2) // Block: Wait until there is space in the buffer.
#define SEGGER_RTT_MODE_MASK (3)
//
// Control sequences, based on ANSI.
// Can be used to control color, and clear the screen
//
#define RTT_CTRL_RESET "\x1B[0m" // Reset to default colors
#define RTT_CTRL_CLEAR "\x1B[2J" // Clear screen, reposition cursor to top left
#define RTT_CTRL_TEXT_BLACK "\x1B[2;30m"
#define RTT_CTRL_TEXT_RED "\x1B[2;31m"
#define RTT_CTRL_TEXT_GREEN "\x1B[2;32m"
#define RTT_CTRL_TEXT_YELLOW "\x1B[2;33m"
#define RTT_CTRL_TEXT_BLUE "\x1B[2;34m"
#define RTT_CTRL_TEXT_MAGENTA "\x1B[2;35m"
#define RTT_CTRL_TEXT_CYAN "\x1B[2;36m"
#define RTT_CTRL_TEXT_WHITE "\x1B[2;37m"
#define RTT_CTRL_TEXT_BRIGHT_BLACK "\x1B[1;30m"
#define RTT_CTRL_TEXT_BRIGHT_RED "\x1B[1;31m"
#define RTT_CTRL_TEXT_BRIGHT_GREEN "\x1B[1;32m"
#define RTT_CTRL_TEXT_BRIGHT_YELLOW "\x1B[1;33m"
#define RTT_CTRL_TEXT_BRIGHT_BLUE "\x1B[1;34m"
#define RTT_CTRL_TEXT_BRIGHT_MAGENTA "\x1B[1;35m"
#define RTT_CTRL_TEXT_BRIGHT_CYAN "\x1B[1;36m"
#define RTT_CTRL_TEXT_BRIGHT_WHITE "\x1B[1;37m"
#define RTT_CTRL_BG_BLACK "\x1B[24;40m"
#define RTT_CTRL_BG_RED "\x1B[24;41m"
#define RTT_CTRL_BG_GREEN "\x1B[24;42m"
#define RTT_CTRL_BG_YELLOW "\x1B[24;43m"
#define RTT_CTRL_BG_BLUE "\x1B[24;44m"
#define RTT_CTRL_BG_MAGENTA "\x1B[24;45m"
#define RTT_CTRL_BG_CYAN "\x1B[24;46m"
#define RTT_CTRL_BG_WHITE "\x1B[24;47m"
#define RTT_CTRL_BG_BRIGHT_BLACK "\x1B[4;40m"
#define RTT_CTRL_BG_BRIGHT_RED "\x1B[4;41m"
#define RTT_CTRL_BG_BRIGHT_GREEN "\x1B[4;42m"
#define RTT_CTRL_BG_BRIGHT_YELLOW "\x1B[4;43m"
#define RTT_CTRL_BG_BRIGHT_BLUE "\x1B[4;44m"
#define RTT_CTRL_BG_BRIGHT_MAGENTA "\x1B[4;45m"
#define RTT_CTRL_BG_BRIGHT_CYAN "\x1B[4;46m"
#define RTT_CTRL_BG_BRIGHT_WHITE "\x1B[4;47m"
#endif
/*************************** End of file ****************************/
@@ -0,0 +1,248 @@
/*********************************************************************
* (c) SEGGER Microcontroller GmbH *
* The Embedded Experts *
* www.segger.com *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_RTT_ASM_ARMv7M.S
Purpose : Assembler implementation of RTT functions for ARMv7M
Additional information:
This module is written to be assembler-independent and works with
GCC and clang (Embedded Studio) and IAR.
*/
#define SEGGER_RTT_ASM // Used to control processed input from header file
#include "SEGGER_RTT.h"
#if defined(STM32F4)
.cpu cortex-m4
#elif defined(STM32H7) || defined(STM32H5)
.cpu cortex-m7
#endif
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define _CCIAR 0
#define _CCCLANG 1
#if (defined __SES_ARM) || (defined __GNUC__) || (defined __clang__)
#define _CC_TYPE _CCCLANG
#define _PUB_SYM .global
#define _EXT_SYM .extern
#define _END .end
#define _WEAK .weak
#define _THUMB_FUNC .thumb_func
#define _THUMB_CODE .code 16
#define _WORD .word
#define _SECTION(Sect, Type, AlignExp) .section Sect ##, "ax"
#define _ALIGN(Exp) .align Exp
#define _PLACE_LITS .ltorg
#define _DATA_SECT_START
#define _C_STARTUP _start
#define _STACK_END __stack_end__
#define _RAMFUNC
//
// .text => Link to flash
// .fast => Link to RAM
// OtherSect => Usually link to RAM
// Alignment is 2^x
//
#elif defined (__IASMARM__)
#define _CC_TYPE _CCIAR
#define _PUB_SYM PUBLIC
#define _EXT_SYM EXTERN
#define _END END
#define _WEAK _WEAK
#define _THUMB_FUNC
#define _THUMB_CODE THUMB
#define _WORD DCD
#define _SECTION(Sect, Type, AlignExp) SECTION Sect ## : ## Type ## :REORDER:NOROOT ## (AlignExp)
#define _ALIGN(Exp) alignrom Exp
#define _PLACE_LITS
#define _DATA_SECT_START DATA
#define _C_STARTUP __iar_program_start
#define _STACK_END sfe(CSTACK)
#define _RAMFUNC SECTION_TYPE SHT_PROGBITS, SHF_WRITE | SHF_EXECINSTR
//
// .text => Link to flash
// .textrw => Link to RAM
// OtherSect => Usually link to RAM
// NOROOT => Allows linker to throw away the function, if not referenced
// Alignment is 2^x
//
#endif
#if (_CC_TYPE == _CCIAR)
NAME SEGGER_RTT_ASM_ARMv7M
#else
.syntax unified
#endif
#if defined (RTT_USE_ASM) && (RTT_USE_ASM == 1)
#define SHT_PROGBITS 0x1
/*********************************************************************
*
* Public / external symbols
*
**********************************************************************
*/
_EXT_SYM __aeabi_memcpy
_EXT_SYM __aeabi_memcpy4
_EXT_SYM _SEGGER_RTT
_PUB_SYM SEGGER_RTT_ASM_WriteSkipNoLock
/*********************************************************************
*
* SEGGER_RTT_WriteSkipNoLock
*
* Function description
* Stores a specified number of characters in SEGGER RTT
* control block which is then read by the host.
* SEGGER_RTT_WriteSkipNoLock does not lock the application and
* skips all data, if the data does not fit into the buffer.
*
* Parameters
* BufferIndex Index of "Up"-buffer to be used (e.g. 0 for "Terminal").
* pBuffer Pointer to character array. Does not need to point to a \0 terminated string.
* NumBytes Number of bytes to be stored in the SEGGER RTT control block.
* MUST be > 0!!!
* This is done for performance reasons, so no initial check has do be done.
*
* Return value
* 1: Data has been copied
* 0: No space, data has not been copied
*
* Notes
* (1) If there is not enough space in the "Up"-buffer, all data is dropped.
* (2) For performance reasons this function does not call Init()
* and may only be called after RTT has been initialized.
* Either by calling SEGGER_RTT_Init() or calling another RTT API function first.
*/
_SECTION(.text, CODE, 2)
_ALIGN(2)
_THUMB_FUNC
SEGGER_RTT_ASM_WriteSkipNoLock: // unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pData, unsigned NumBytes) {
//
// Cases:
// 1) RdOff <= WrOff => Space until wrap-around is sufficient
// 2) RdOff <= WrOff => Space after wrap-around needed (copy in 2 chunks)
// 3) RdOff < WrOff => No space in buf
// 4) RdOff > WrOff => Space is sufficient
// 5) RdOff > WrOff => No space in buf
//
// 1) is the most common case for large buffers and assuming that J-Link reads the data fast enough
//
// Register usage:
// R0 Temporary needed as RdOff, <Tmp> register later on
// R1 pData
// R2 <NumBytes>
// R3 <Tmp> register. Hold free for subroutine calls
// R4 <Rem>
// R5 pRing->pBuffer
// R6 pRing (Points to active struct SEGGER_RTT_BUFFER_DOWN)
// R7 WrOff
//
PUSH {R4-R7}
ADD R3,R0,R0, LSL #+1
LDR.W R0,=_SEGGER_RTT // pRing = &_SEGGER_RTT.aUp[BufferIndex];
ADD R0,R0,R3, LSL #+3
ADD R6,R0,#+24
LDR R0,[R6, #+16] // RdOff = pRing->RdOff;
LDR R7,[R6, #+12] // WrOff = pRing->WrOff;
LDR R5,[R6, #+4] // pRing->pBuffer
CMP R7,R0
BCC.N _CheckCase4 // if (RdOff <= WrOff) { => Case 1), 2) or 3)
//
// Handling for case 1, later on identical to case 4
//
LDR R3,[R6, #+8] // Avail = pRing->SizeOfBuffer - WrOff - 1u; => Space until wrap-around (assume 1 byte not usable for case that RdOff == 0)
SUBS R4,R3,R7 // <Rem> (Used in case we jump into case 2 afterwards)
SUBS R3,R4,#+1 // <Avail>
CMP R3,R2
BCC.N _CheckCase2 // if (Avail >= NumBytes) { => Case 1)?
_Case4:
ADDS R5,R7,R5 // pBuffer += WrOff
ADDS R0,R2,R7 // v = WrOff + NumBytes
//
// 2x unrolling for the copy loop that is used most of the time
// This is a special optimization for small SystemView packets and makes them even faster
//
_ALIGN(2)
_LoopCopyStraight: // memcpy(pRing->pBuffer + WrOff, pData, NumBytes);
LDRB R3,[R1], #+1
STRB R3,[R5], #+1 // *pDest++ = *pSrc++
SUBS R2,R2,#+1
BEQ _CSDone
LDRB R3,[R1], #+1
STRB R3,[R5], #+1 // *pDest++ = *pSrc++
SUBS R2,R2,#+1
BNE _LoopCopyStraight
_CSDone:
#if _CORE_NEEDS_DMB // Do not slow down cores that do not need a DMB instruction here
DMB // Cortex-M7 may delay memory writes and also change the order in which the writes happen. Therefore, make sure that all buffer writes are finished, before updating the <WrOff> in the struct
#endif
STR R0,[R6, #+12] // pRing->WrOff = WrOff + NumBytes;
MOVS R0,#+1
POP {R4-R7}
BX LR // Return 1
_CheckCase2:
ADDS R0,R0,R3 // Avail += RdOff; => Space incl. wrap-around
CMP R0,R2
BCC.N _Case3 // if (Avail >= NumBytes) { => Case 2? => If not, we have case 3) (does not fit)
//
// Handling for case 2
//
ADDS R0,R7,R5 // v = pRing->pBuffer + WrOff => Do not change pRing->pBuffer here because 2nd chunk needs org. value
SUBS R2,R2,R4 // NumBytes -= Rem; (Rem = pRing->SizeOfBuffer - WrOff; => Space until end of buffer)
_LoopCopyBeforeWrapAround: // memcpy(pRing->pBuffer + WrOff, pData, Rem); => Copy 1st chunk
LDRB R3,[R1], #+1
STRB R3,[R0], #+1 // *pDest++ = *pSrc++
SUBS R4,R4,#+1
BNE _LoopCopyBeforeWrapAround
//
// Special case: First check that assumed RdOff == 0 calculated that last element before wrap-around could not be used
// But 2nd check (considering space until wrap-around and until RdOff) revealed that RdOff is not 0, so we can use the last element
// In this case, we may use a copy straight until buffer end anyway without needing to copy 2 chunks
// Therefore, check if 2nd memcpy is necessary at all
//
ADDS R4,R2,#+0 // Save <NumBytes> (needed as counter in loop but must be written to <WrOff> after the loop). Also use this inst to update the flags to skip 2nd loop if possible
BEQ.N _No2ChunkNeeded // if (NumBytes) {
_LoopCopyAfterWrapAround: // memcpy(pRing->pBuffer, pData + Rem, NumBytes);
LDRB R3,[R1], #+1 // pData already points to the next src byte due to copy loop increment before this loop
STRB R3,[R5], #+1 // *pDest++ = *pSrc++
SUBS R2,R2,#+1
BNE _LoopCopyAfterWrapAround
_No2ChunkNeeded:
#if _CORE_NEEDS_DMB // Do not slow down cores that do not need a DMB instruction here
DMB // Cortex-M7 may delay memory writes and also change the order in which the writes happen. Therefore, make sure that all buffer writes are finished, before updating the <WrOff> in the struct
#endif
STR R4,[R6, #+12] // pRing->WrOff = NumBytes; => Must be written after copying data because J-Link may read control block asynchronously while writing into buffer
MOVS R0,#+1
POP {R4-R7}
BX LR // Return 1
_CheckCase4:
SUBS R0,R0,R7
SUBS R0,R0,#+1 // Avail = RdOff - WrOff - 1u;
CMP R0,R2
BCS.N _Case4 // if (Avail >= NumBytes) { => Case 4) == 1) ? => If not, we have case 5) == 3) (does not fit)
_Case3:
MOVS R0,#+0
POP {R4-R7}
BX LR // Return 0
_PLACE_LITS
#endif // defined (RTT_USE_ASM) && (RTT_USE_ASM == 1)
_END
/*************************** End of file ****************************/
+521
View File
@@ -0,0 +1,521 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
---------------------------END-OF-HEADER------------------------------
File : SEGGER_RTT_printf.c
Purpose : Replacement for printf to write formatted data via RTT
Revision: $Rev: 17697 $
----------------------------------------------------------------------
*/
#include "SEGGER_RTT.h"
#include "SEGGER_RTT_Conf.h"
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
#ifndef SEGGER_RTT_PRINTF_BUFFER_SIZE
#define SEGGER_RTT_PRINTF_BUFFER_SIZE (64)
#endif
#include <stdlib.h>
#include <stdarg.h>
#define FORMAT_FLAG_LEFT_JUSTIFY (1u << 0)
#define FORMAT_FLAG_PAD_ZERO (1u << 1)
#define FORMAT_FLAG_PRINT_SIGN (1u << 2)
#define FORMAT_FLAG_ALTERNATE (1u << 3)
/*********************************************************************
*
* Types
*
**********************************************************************
*/
typedef struct {
char* pBuffer;
unsigned BufferSize;
unsigned Cnt;
int ReturnValue;
unsigned RTTBufferIndex;
} SEGGER_RTT_PRINTF_DESC;
/*********************************************************************
*
* Function prototypes
*
**********************************************************************
*/
/*********************************************************************
*
* Static code
*
**********************************************************************
*/
/*********************************************************************
*
* _StoreChar
*/
static void _StoreChar(SEGGER_RTT_PRINTF_DESC * p, char c) {
unsigned Cnt;
Cnt = p->Cnt;
if ((Cnt + 1u) <= p->BufferSize) {
*(p->pBuffer + Cnt) = c;
p->Cnt = Cnt + 1u;
p->ReturnValue++;
}
//
// Write part of string, when the buffer is full
//
if (p->Cnt == p->BufferSize) {
if (SEGGER_RTT_Write(p->RTTBufferIndex, p->pBuffer, p->Cnt) != p->Cnt) {
p->ReturnValue = -1;
} else {
p->Cnt = 0u;
}
}
}
/*********************************************************************
*
* _PrintUnsigned
*/
static void _PrintUnsigned(SEGGER_RTT_PRINTF_DESC * pBufferDesc, unsigned v, unsigned Base, unsigned NumDigits, unsigned FieldWidth, unsigned FormatFlags) {
static const char _aV2C[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
unsigned Div;
unsigned Digit;
unsigned Number;
unsigned Width;
char c;
Number = v;
Digit = 1u;
//
// Get actual field width
//
Width = 1u;
while (Number >= Base) {
Number = (Number / Base);
Width++;
}
if (NumDigits > Width) {
Width = NumDigits;
}
//
// Print leading chars if necessary
//
if ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == 0u) {
if (FieldWidth != 0u) {
if (((FormatFlags & FORMAT_FLAG_PAD_ZERO) == FORMAT_FLAG_PAD_ZERO) && (NumDigits == 0u)) {
c = '0';
} else {
c = ' ';
}
while ((FieldWidth != 0u) && (Width < FieldWidth)) {
FieldWidth--;
_StoreChar(pBufferDesc, c);
if (pBufferDesc->ReturnValue < 0) {
break;
}
}
}
}
if (pBufferDesc->ReturnValue >= 0) {
//
// Compute Digit.
// Loop until Digit has the value of the highest digit required.
// Example: If the output is 345 (Base 10), loop 2 times until Digit is 100.
//
while (1) {
if (NumDigits > 1u) { // User specified a min number of digits to print? => Make sure we loop at least that often, before checking anything else (> 1 check avoids problems with NumDigits being signed / unsigned)
NumDigits--;
} else {
Div = v / Digit;
if (Div < Base) { // Is our divider big enough to extract the highest digit from value? => Done
break;
}
}
Digit *= Base;
}
//
// Output digits
//
do {
Div = v / Digit;
v -= Div * Digit;
_StoreChar(pBufferDesc, _aV2C[Div]);
if (pBufferDesc->ReturnValue < 0) {
break;
}
Digit /= Base;
} while (Digit);
//
// Print trailing spaces if necessary
//
if ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == FORMAT_FLAG_LEFT_JUSTIFY) {
if (FieldWidth != 0u) {
while ((FieldWidth != 0u) && (Width < FieldWidth)) {
FieldWidth--;
_StoreChar(pBufferDesc, ' ');
if (pBufferDesc->ReturnValue < 0) {
break;
}
}
}
}
}
}
/*********************************************************************
*
* _PrintInt
*/
static void _PrintInt(SEGGER_RTT_PRINTF_DESC * pBufferDesc, int v, unsigned Base, unsigned NumDigits, unsigned FieldWidth, unsigned FormatFlags) {
unsigned Width;
int Number;
Number = (v < 0) ? -v : v;
//
// Get actual field width
//
Width = 1u;
while (Number >= (int)Base) {
Number = (Number / (int)Base);
Width++;
}
if (NumDigits > Width) {
Width = NumDigits;
}
if ((FieldWidth > 0u) && ((v < 0) || ((FormatFlags & FORMAT_FLAG_PRINT_SIGN) == FORMAT_FLAG_PRINT_SIGN))) {
FieldWidth--;
}
//
// Print leading spaces if necessary
//
if ((((FormatFlags & FORMAT_FLAG_PAD_ZERO) == 0u) || (NumDigits != 0u)) && ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == 0u)) {
if (FieldWidth != 0u) {
while ((FieldWidth != 0u) && (Width < FieldWidth)) {
FieldWidth--;
_StoreChar(pBufferDesc, ' ');
if (pBufferDesc->ReturnValue < 0) {
break;
}
}
}
}
//
// Print sign if necessary
//
if (pBufferDesc->ReturnValue >= 0) {
if (v < 0) {
v = -v;
_StoreChar(pBufferDesc, '-');
} else if ((FormatFlags & FORMAT_FLAG_PRINT_SIGN) == FORMAT_FLAG_PRINT_SIGN) {
_StoreChar(pBufferDesc, '+');
} else {
}
if (pBufferDesc->ReturnValue >= 0) {
//
// Print leading zeros if necessary
//
if (((FormatFlags & FORMAT_FLAG_PAD_ZERO) == FORMAT_FLAG_PAD_ZERO) && ((FormatFlags & FORMAT_FLAG_LEFT_JUSTIFY) == 0u) && (NumDigits == 0u)) {
if (FieldWidth != 0u) {
while ((FieldWidth != 0u) && (Width < FieldWidth)) {
FieldWidth--;
_StoreChar(pBufferDesc, '0');
if (pBufferDesc->ReturnValue < 0) {
break;
}
}
}
}
if (pBufferDesc->ReturnValue >= 0) {
//
// Print number without sign
//
_PrintUnsigned(pBufferDesc, (unsigned)v, Base, NumDigits, FieldWidth, FormatFlags);
}
}
}
}
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* SEGGER_RTT_vprintf
*
* Function description
* Stores a formatted string in SEGGER RTT control block.
* This data is read by the host.
*
* Parameters
* BufferIndex Index of "Up"-buffer to be used. (e.g. 0 for "Terminal")
* sFormat Pointer to format string
* pParamList Pointer to the list of arguments for the format string
*
* Return values
* >= 0: Number of bytes which have been stored in the "Up"-buffer.
* < 0: Error
*/
int SEGGER_RTT_vprintf(unsigned BufferIndex, const char * sFormat, va_list * pParamList) {
char c;
SEGGER_RTT_PRINTF_DESC BufferDesc;
int v;
unsigned char PrecisionSet;
unsigned Precision;
unsigned FormatFlags;
unsigned FieldWidth;
char acBuffer[SEGGER_RTT_PRINTF_BUFFER_SIZE];
BufferDesc.pBuffer = acBuffer;
BufferDesc.BufferSize = SEGGER_RTT_PRINTF_BUFFER_SIZE;
BufferDesc.Cnt = 0u;
BufferDesc.RTTBufferIndex = BufferIndex;
BufferDesc.ReturnValue = 0;
do {
c = *sFormat;
sFormat++;
if (c == 0u) {
break;
}
if (c == '%') {
//
// Filter out flags
//
FormatFlags = 0u;
v = 1;
do {
c = *sFormat;
switch (c) {
case '-': FormatFlags |= FORMAT_FLAG_LEFT_JUSTIFY; sFormat++; break;
case '0': FormatFlags |= FORMAT_FLAG_PAD_ZERO; sFormat++; break;
case '+': FormatFlags |= FORMAT_FLAG_PRINT_SIGN; sFormat++; break;
case '#': FormatFlags |= FORMAT_FLAG_ALTERNATE; sFormat++; break;
default: v = 0; break;
}
} while (v);
//
// filter out field with
//
FieldWidth = 0u;
do {
c = *sFormat;
if ((c < '0') || (c > '9')) {
break;
}
sFormat++;
FieldWidth = (FieldWidth * 10u) + ((unsigned)c - '0');
} while (1);
//
// Filter out precision (number of digits to display)
//
PrecisionSet = 0;
Precision = 0u;
c = *sFormat;
if (c == '.') {
sFormat++;
if (*sFormat == '*') {
sFormat++;
PrecisionSet = 1;
Precision = va_arg(*pParamList, int);
} else {
do {
c = *sFormat;
if ((c < '0') || (c > '9')) {
break;
}
PrecisionSet = 1;
sFormat++;
Precision = Precision * 10u + ((unsigned)c - '0');
} while (1);
}
}
//
// Filter out length modifier
//
c = *sFormat;
do {
if ((c == 'l') || (c == 'h')) {
sFormat++;
c = *sFormat;
} else {
break;
}
} while (1);
//
// Handle specifiers
//
switch (c) {
case 'c': {
char c0;
v = va_arg(*pParamList, int);
c0 = (char)v;
_StoreChar(&BufferDesc, c0);
break;
}
case 'd':
v = va_arg(*pParamList, int);
_PrintInt(&BufferDesc, v, 10u, Precision, FieldWidth, FormatFlags);
break;
case 'u':
v = va_arg(*pParamList, int);
_PrintUnsigned(&BufferDesc, (unsigned)v, 10u, Precision, FieldWidth, FormatFlags);
break;
case 'x':
case 'X':
v = va_arg(*pParamList, int);
_PrintUnsigned(&BufferDesc, (unsigned)v, 16u, Precision, FieldWidth, FormatFlags);
break;
case 's':
{
const char * s = va_arg(*pParamList, const char *);
if (s == NULL) {
s = "(NULL)"; // Print (NULL) instead of crashing or breaking, as it is more informative to the user.
PrecisionSet = 0; // Make sure (NULL) is printed, even when precision was set.
}
do {
c = *s;
s++;
if (c == '\0') {
break;
}
if ((PrecisionSet != 0) && (Precision == 0)) {
break;
}
_StoreChar(&BufferDesc, c);
Precision--;
} while (BufferDesc.ReturnValue >= 0);
}
break;
case 'p':
v = va_arg(*pParamList, int);
_PrintUnsigned(&BufferDesc, (unsigned)v, 16u, 8u, 8u, 0u);
break;
case '%':
_StoreChar(&BufferDesc, '%');
break;
default:
break;
}
sFormat++;
} else {
_StoreChar(&BufferDesc, c);
}
} while (BufferDesc.ReturnValue >= 0);
if (BufferDesc.ReturnValue > 0) {
//
// Write remaining data, if any
//
if (BufferDesc.Cnt != 0u) {
SEGGER_RTT_Write(BufferIndex, acBuffer, BufferDesc.Cnt);
}
BufferDesc.ReturnValue += (int)BufferDesc.Cnt;
}
return BufferDesc.ReturnValue;
}
/*********************************************************************
*
* SEGGER_RTT_printf
*
* Function description
* Stores a formatted string in SEGGER RTT control block.
* This data is read by the host.
*
* Parameters
* BufferIndex Index of "Up"-buffer to be used. (e.g. 0 for "Terminal")
* sFormat Pointer to format string, followed by the arguments for conversion
*
* Return values
* >= 0: Number of bytes which have been stored in the "Up"-buffer.
* < 0: Error
*
* Notes
* (1) Conversion specifications have following syntax:
* %[flags][FieldWidth][.Precision]ConversionSpecifier
* (2) Supported flags:
* -: Left justify within the field width
* +: Always print sign extension for signed conversions
* 0: Pad with 0 instead of spaces. Ignored when using '-'-flag or precision
* Supported conversion specifiers:
* c: Print the argument as one char
* d: Print the argument as a signed integer
* u: Print the argument as an unsigned integer
* x: Print the argument as an hexadecimal integer
* s: Print the string pointed to by the argument
* p: Print the argument as an 8-digit hexadecimal integer. (Argument shall be a pointer to void.)
*/
int SEGGER_RTT_printf(unsigned BufferIndex, const char * sFormat, ...) {
int r;
va_list ParamList;
va_start(ParamList, sFormat);
r = SEGGER_RTT_vprintf(BufferIndex, sFormat, &ParamList);
va_end(ParamList);
return r;
}
/*************************** End of file ****************************/
File diff suppressed because it is too large Load Diff
+426
View File
@@ -0,0 +1,426 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW.h
Purpose : System visualization API.
Revision: $Rev: 28768 $
*/
#ifndef SEGGER_SYSVIEW_H
#define SEGGER_SYSVIEW_H
/*********************************************************************
*
* #include Section
*
**********************************************************************
*/
#include "SEGGER.h"
#include "SEGGER_SYSVIEW_ConfDefaults.h"
#ifdef __cplusplus
extern "C" {
#endif
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define SEGGER_SYSVIEW_MAJOR 3
#define SEGGER_SYSVIEW_MINOR 32
#define SEGGER_SYSVIEW_REV 0
#define SEGGER_SYSVIEW_VERSION ((SEGGER_SYSVIEW_MAJOR * 10000) + (SEGGER_SYSVIEW_MINOR * 100) + SEGGER_SYSVIEW_REV)
#define SEGGER_SYSVIEW_INFO_SIZE 9 // Minimum size, which has to be reserved for a packet. 1-2 byte of message type, 0-2 byte of payload length, 1-5 bytes of timestamp.
#define SEGGER_SYSVIEW_QUANTA_U32 5 // Maximum number of bytes to encode a U32, should be reserved for each 32-bit value in a packet.
#define SEGGER_SYSVIEW_LOG (0u)
#define SEGGER_SYSVIEW_WARNING (1u)
#define SEGGER_SYSVIEW_ERROR (2u)
#define SEGGER_SYSVIEW_FLAG_APPEND (1u << 6)
#define SEGGER_SYSVIEW_PREPARE_PACKET(p) (p) + 4
//
// SystemView events. First 32 IDs from 0 .. 31 are reserved for these
//
#define SYSVIEW_EVTID_NOP 0 // Dummy packet.
#define SYSVIEW_EVTID_OVERFLOW 1
#define SYSVIEW_EVTID_ISR_ENTER 2
#define SYSVIEW_EVTID_ISR_EXIT 3
#define SYSVIEW_EVTID_TASK_START_EXEC 4
#define SYSVIEW_EVTID_TASK_STOP_EXEC 5
#define SYSVIEW_EVTID_TASK_START_READY 6
#define SYSVIEW_EVTID_TASK_STOP_READY 7
#define SYSVIEW_EVTID_TASK_CREATE 8
#define SYSVIEW_EVTID_TASK_INFO 9
#define SYSVIEW_EVTID_TRACE_START 10
#define SYSVIEW_EVTID_TRACE_STOP 11
#define SYSVIEW_EVTID_SYSTIME_CYCLES 12
#define SYSVIEW_EVTID_SYSTIME_US 13
#define SYSVIEW_EVTID_SYSDESC 14
#define SYSVIEW_EVTID_MARK_START 15
#define SYSVIEW_EVTID_MARK_STOP 16
#define SYSVIEW_EVTID_IDLE 17
#define SYSVIEW_EVTID_ISR_TO_SCHEDULER 18
#define SYSVIEW_EVTID_TIMER_ENTER 19
#define SYSVIEW_EVTID_TIMER_EXIT 20
#define SYSVIEW_EVTID_STACK_INFO 21
#define SYSVIEW_EVTID_MODULEDESC 22
#define SYSVIEW_EVTID_DATA_SAMPLE 23
#define SYSVIEW_EVTID_INIT 24
#define SYSVIEW_EVTID_NAME_RESOURCE 25
#define SYSVIEW_EVTID_PRINT_FORMATTED 26
#define SYSVIEW_EVTID_NUMMODULES 27
#define SYSVIEW_EVTID_END_CALL 28
#define SYSVIEW_EVTID_TASK_TERMINATE 29
#define SYSVIEW_EVTID_EX 31
//
// SystemView extended events. Sent with ID 31.
//
#define SYSVIEW_EVTID_EX_MARK 0
#define SYSVIEW_EVTID_EX_NAME_MARKER 1
#define SYSVIEW_EVTID_EX_HEAP_DEFINE 2
#define SYSVIEW_EVTID_EX_HEAP_ALLOC 3
#define SYSVIEW_EVTID_EX_HEAP_ALLOC_EX 4
#define SYSVIEW_EVTID_EX_HEAP_FREE 5
#define SYSVIEW_EVTID_EX_REGISTER_DATA 6
//
// Event masks to disable/enable events
//
#define SYSVIEW_EVTMASK_NOP (1 << SYSVIEW_EVTID_NOP)
#define SYSVIEW_EVTMASK_OVERFLOW (1 << SYSVIEW_EVTID_OVERFLOW)
#define SYSVIEW_EVTMASK_ISR_ENTER (1 << SYSVIEW_EVTID_ISR_ENTER)
#define SYSVIEW_EVTMASK_ISR_EXIT (1 << SYSVIEW_EVTID_ISR_EXIT)
#define SYSVIEW_EVTMASK_TASK_START_EXEC (1 << SYSVIEW_EVTID_TASK_START_EXEC)
#define SYSVIEW_EVTMASK_TASK_STOP_EXEC (1 << SYSVIEW_EVTID_TASK_STOP_EXEC)
#define SYSVIEW_EVTMASK_TASK_START_READY (1 << SYSVIEW_EVTID_TASK_START_READY)
#define SYSVIEW_EVTMASK_TASK_STOP_READY (1 << SYSVIEW_EVTID_TASK_STOP_READY)
#define SYSVIEW_EVTMASK_TASK_CREATE (1 << SYSVIEW_EVTID_TASK_CREATE)
#define SYSVIEW_EVTMASK_TASK_INFO (1 << SYSVIEW_EVTID_TASK_INFO)
#define SYSVIEW_EVTMASK_TRACE_START (1 << SYSVIEW_EVTID_TRACE_START)
#define SYSVIEW_EVTMASK_TRACE_STOP (1 << SYSVIEW_EVTID_TRACE_STOP)
#define SYSVIEW_EVTMASK_SYSTIME_CYCLES (1 << SYSVIEW_EVTID_SYSTIME_CYCLES)
#define SYSVIEW_EVTMASK_SYSTIME_US (1 << SYSVIEW_EVTID_SYSTIME_US)
#define SYSVIEW_EVTMASK_SYSDESC (1 << SYSVIEW_EVTID_SYSDESC)
#define SYSVIEW_EVTMASK_USER_START (1 << SYSVIEW_EVTID_USER_START)
#define SYSVIEW_EVTMASK_USER_STOP (1 << SYSVIEW_EVTID_USER_STOP)
#define SYSVIEW_EVTMASK_IDLE (1 << SYSVIEW_EVTID_IDLE)
#define SYSVIEW_EVTMASK_ISR_TO_SCHEDULER (1 << SYSVIEW_EVTID_ISR_TO_SCHEDULER)
#define SYSVIEW_EVTMASK_TIMER_ENTER (1 << SYSVIEW_EVTID_TIMER_ENTER)
#define SYSVIEW_EVTMASK_TIMER_EXIT (1 << SYSVIEW_EVTID_TIMER_EXIT)
#define SYSVIEW_EVTMASK_STACK_INFO (1 << SYSVIEW_EVTID_STACK_INFO)
#define SYSVIEW_EVTMASK_MODULEDESC (1 << SYSVIEW_EVTID_MODULEDESC)
#define SYSVIEW_EVTMASK_DATA_SAMPLE (1 << SYSVIEW_EVTID_DATA_SAMPLE)
#define SYSVIEW_EVTMASK_INIT (1 << SYSVIEW_EVTID_INIT)
#define SYSVIEW_EVTMASK_NAME_RESOURCE (1 << SYSVIEW_EVTID_NAME_RESOURCE)
#define SYSVIEW_EVTMASK_PRINT_FORMATTED (1 << SYSVIEW_EVTID_PRINT_FORMATTED)
#define SYSVIEW_EVTMASK_NUMMODULES (1 << SYSVIEW_EVTID_NUMMODULES)
#define SYSVIEW_EVTMASK_END_CALL (1 << SYSVIEW_EVTID_END_CALL)
#define SYSVIEW_EVTMASK_TASK_TERMINATE (1 << SYSVIEW_EVTID_TASK_TERMINATE)
#define SYSVIEW_EVTMASK_EX (1 << SYSVIEW_EVTID_EX)
#define SYSVIEW_EVTMASK_ALL_INTERRUPTS ( SYSVIEW_EVTMASK_ISR_ENTER \
| SYSVIEW_EVTMASK_ISR_EXIT \
| SYSVIEW_EVTMASK_ISR_TO_SCHEDULER)
#define SYSVIEW_EVTMASK_ALL_TASKS ( SYSVIEW_EVTMASK_TASK_START_EXEC \
| SYSVIEW_EVTMASK_TASK_STOP_EXEC \
| SYSVIEW_EVTMASK_TASK_START_READY \
| SYSVIEW_EVTMASK_TASK_STOP_READY \
| SYSVIEW_EVTMASK_TASK_CREATE \
| SYSVIEW_EVTMASK_TASK_INFO \
| SYSVIEW_EVTMASK_STACK_INFO \
| SYSVIEW_EVTMASK_TASK_TERMINATE)
/*********************************************************************
*
* Structures
*
**********************************************************************
*/
typedef struct {
U32 TaskID;
const char* sName;
U32 Prio;
U32 StackBase;
U32 StackSize;
U32 StackUsage;
} SEGGER_SYSVIEW_TASKINFO;
typedef struct {
U32 TaskID;
U32 StackBase;
U32 StackSize;
U32 StackUsage;
} SEGGER_SYSVIEW_STACKINFO;
typedef struct {
U32 ID;
union {
U32* pU32;
I32* pI32;
float* pFloat;
} pValue;
} SEGGER_SYSVIEW_DATA_SAMPLE;
typedef enum {
SEGGER_SYSVIEW_TYPE_U32 = 0,
SEGGER_SYSVIEW_TYPE_I32 = 1,
SEGGER_SYSVIEW_TYPE_FLOAT = 2
} SEGGER_SYSVIEW_DATA_TYPE;
typedef struct {
U32 ID;
SEGGER_SYSVIEW_DATA_TYPE DataType;
I32 Offset;
I32 RangeMin;
I32 RangeMax;
float ScalingFactor;
const char* sName;
const char* sUnit;
} SEGGER_SYSVIEW_DATA_REGISTER;
typedef struct SEGGER_SYSVIEW_MODULE_STRUCT SEGGER_SYSVIEW_MODULE;
struct SEGGER_SYSVIEW_MODULE_STRUCT {
const char* sModule;
U32 NumEvents;
U32 EventOffset;
void (*pfSendModuleDesc)(void);
SEGGER_SYSVIEW_MODULE* pNext;
};
typedef void (SEGGER_SYSVIEW_SEND_SYS_DESC_FUNC)(void);
/*********************************************************************
*
* Global data
*
**********************************************************************
*/
#ifdef EXTERN
#undef EXTERN
#endif
#ifndef SEGGER_SYSVIEW_C // Defined in SEGGER_SYSVIEW.c which includes this header beside other C-files
#define EXTERN extern
#else
#define EXTERN
#endif
EXTERN unsigned int SEGGER_SYSVIEW_TickCnt;
EXTERN unsigned int SEGGER_SYSVIEW_InterruptId;
#undef EXTERN
/*********************************************************************
*
* API functions
*
**********************************************************************
*/
typedef struct {
U64 (*pfGetTime) (void);
void (*pfSendTaskList) (void);
} SEGGER_SYSVIEW_OS_API;
/*********************************************************************
*
* Control and initialization functions
*/
void SEGGER_SYSVIEW_Init (U32 SysFreq, U32 CPUFreq, const SEGGER_SYSVIEW_OS_API *pOSAPI, SEGGER_SYSVIEW_SEND_SYS_DESC_FUNC pfSendSysDesc);
void SEGGER_SYSVIEW_SetRAMBase (U32 RAMBaseAddress);
void SEGGER_SYSVIEW_Start (void);
void SEGGER_SYSVIEW_Stop (void);
void SEGGER_SYSVIEW_GetSysDesc (void);
void SEGGER_SYSVIEW_SendTaskList (void);
void SEGGER_SYSVIEW_SendTaskInfo (const SEGGER_SYSVIEW_TASKINFO* pInfo);
void SEGGER_SYSVIEW_SendStackInfo (const SEGGER_SYSVIEW_STACKINFO* pInfo);
void SEGGER_SYSVIEW_SendSysDesc (const char* sSysDesc);
int SEGGER_SYSVIEW_IsStarted (void);
int SEGGER_SYSVIEW_GetChannelID (void);
void SEGGER_SYSVIEW_SampleData (const SEGGER_SYSVIEW_DATA_SAMPLE *pInfo);
/*********************************************************************
*
* Event recording functions
*/
void SEGGER_SYSVIEW_RecordVoid (unsigned int EventId);
void SEGGER_SYSVIEW_RecordU32 (unsigned int EventId, U32 Para0);
void SEGGER_SYSVIEW_RecordU32x2 (unsigned int EventId, U32 Para0, U32 Para1);
void SEGGER_SYSVIEW_RecordU32x3 (unsigned int EventId, U32 Para0, U32 Para1, U32 Para2);
void SEGGER_SYSVIEW_RecordU32x4 (unsigned int EventId, U32 Para0, U32 Para1, U32 Para2, U32 Para3);
void SEGGER_SYSVIEW_RecordU32x5 (unsigned int EventId, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4);
void SEGGER_SYSVIEW_RecordU32x6 (unsigned int EventId, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5);
void SEGGER_SYSVIEW_RecordU32x7 (unsigned int EventId, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5, U32 Para6);
void SEGGER_SYSVIEW_RecordU32x8 (unsigned int EventId, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5, U32 Para6, U32 Para7);
void SEGGER_SYSVIEW_RecordU32x9 (unsigned int EventId, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5, U32 Para6, U32 Para7, U32 Para8);
void SEGGER_SYSVIEW_RecordU32x10 (unsigned int EventId, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5, U32 Para6, U32 Para7, U32 Para8, U32 Para9);
void SEGGER_SYSVIEW_RecordString (unsigned int EventId, const char* pString);
void SEGGER_SYSVIEW_RecordSystime (void);
void SEGGER_SYSVIEW_RecordEnterISR (void);
void SEGGER_SYSVIEW_RecordExitISR (void);
void SEGGER_SYSVIEW_RecordExitISRToScheduler (void);
void SEGGER_SYSVIEW_RecordEnterTimer (U32 TimerId);
void SEGGER_SYSVIEW_RecordExitTimer (void);
void SEGGER_SYSVIEW_RecordEndCall (unsigned int EventID);
void SEGGER_SYSVIEW_RecordEndCallU32 (unsigned int EventID, U32 Para0);
void SEGGER_SYSVIEW_OnIdle (void);
void SEGGER_SYSVIEW_OnTaskCreate (U32 TaskId);
void SEGGER_SYSVIEW_OnTaskTerminate (U32 TaskId);
void SEGGER_SYSVIEW_OnTaskStartExec (U32 TaskId);
void SEGGER_SYSVIEW_OnTaskStopExec (void);
void SEGGER_SYSVIEW_OnTaskStartReady (U32 TaskId);
void SEGGER_SYSVIEW_OnTaskStopReady (U32 TaskId, unsigned int Cause);
void SEGGER_SYSVIEW_MarkStart (unsigned int MarkerId);
void SEGGER_SYSVIEW_MarkStop (unsigned int MarkerId);
void SEGGER_SYSVIEW_Mark (unsigned int MarkerId);
void SEGGER_SYSVIEW_NameMarker (unsigned int MarkerId, const char* sName);
void SEGGER_SYSVIEW_HeapDefine (void* pHeap, void* pBase, unsigned int HeapSize, unsigned int MetadataSize);
void SEGGER_SYSVIEW_HeapAlloc (void* pHeap, void* pUserData, unsigned int UserDataLen);
void SEGGER_SYSVIEW_HeapAllocEx (void* pHeap, void* pUserData, unsigned int UserDataLen, unsigned int Tag);
void SEGGER_SYSVIEW_HeapFree (void* pHeap, void* pUserData);
void SEGGER_SYSVIEW_NameResource (U32 ResourceId, const char* sName);
void SEGGER_SYSVIEW_RegisterData ( SEGGER_SYSVIEW_DATA_REGISTER* pInfo);
int SEGGER_SYSVIEW_SendPacket (U8* pPacket, U8* pPayloadEnd, unsigned int EventId);
/*********************************************************************
*
* Event parameter encoding functions
*/
U8* SEGGER_SYSVIEW_EncodeU32 (U8* pPayload, U32 Value);
U8* SEGGER_SYSVIEW_EncodeData (U8* pPayload, const char* pSrc, unsigned int Len);
U8* SEGGER_SYSVIEW_EncodeString (U8* pPayload, const char* s, unsigned int MaxLen);
U8* SEGGER_SYSVIEW_EncodeId (U8* pPayload, U32 Id);
U32 SEGGER_SYSVIEW_ShrinkId (U32 Id);
/*********************************************************************
*
* Middleware module registration
*/
void SEGGER_SYSVIEW_RegisterModule (SEGGER_SYSVIEW_MODULE* pModule);
void SEGGER_SYSVIEW_RecordModuleDescription (const SEGGER_SYSVIEW_MODULE* pModule, const char* sDescription);
void SEGGER_SYSVIEW_SendModule (U8 ModuleId);
void SEGGER_SYSVIEW_SendModuleDescription (void);
void SEGGER_SYSVIEW_SendNumModules (void);
/*********************************************************************
*
* printf-Style functions
*/
#ifndef SEGGER_SYSVIEW_EXCLUDE_PRINTF // Define in project to avoid warnings about variable parameter list
void SEGGER_SYSVIEW_PrintfHostEx (const char* s, U32 Options, ...);
void SEGGER_SYSVIEW_VPrintfHostEx (const char* s, U32 Options, va_list* pParamList);
void SEGGER_SYSVIEW_PrintfTargetEx (const char* s, U32 Options, ...);
void SEGGER_SYSVIEW_VPrintfTargetEx (const char* s, U32 Options, va_list* pParamList);
void SEGGER_SYSVIEW_PrintfHost (const char* s, ...);
void SEGGER_SYSVIEW_VPrintfHost (const char* s, va_list* pParamList);
void SEGGER_SYSVIEW_PrintfTarget (const char* s, ...);
void SEGGER_SYSVIEW_VPrintfTarget (const char* s, va_list* pParamList);
void SEGGER_SYSVIEW_WarnfHost (const char* s, ...);
void SEGGER_SYSVIEW_VWarnfHost (const char* s, va_list* pParamList);
void SEGGER_SYSVIEW_WarnfTarget (const char* s, ...);
void SEGGER_SYSVIEW_VWarnfTarget (const char* s, va_list* pParamList);
void SEGGER_SYSVIEW_ErrorfHost (const char* s, ...);
void SEGGER_SYSVIEW_VErrorfHost (const char* s, va_list* pParamList);
void SEGGER_SYSVIEW_ErrorfTarget (const char* s, ...);
void SEGGER_SYSVIEW_VErrorfTarget (const char* s, va_list* pParamList);
#endif
void SEGGER_SYSVIEW_Print (const char* s);
void SEGGER_SYSVIEW_Warn (const char* s);
void SEGGER_SYSVIEW_Error (const char* s);
/*********************************************************************
*
* Run-time configuration functions
*/
void SEGGER_SYSVIEW_EnableEvents (U32 EnableMask);
void SEGGER_SYSVIEW_DisableEvents (U32 DisableMask);
/*********************************************************************
*
* Application-provided functions
*/
void SEGGER_SYSVIEW_Conf (void);
U32 SEGGER_SYSVIEW_X_GetTimestamp (void);
U32 SEGGER_SYSVIEW_X_GetInterruptId (void);
void SEGGER_SYSVIEW_X_StartComm (void);
void SEGGER_SYSVIEW_X_OnEventRecorded (unsigned NumBytes);
#ifdef __cplusplus
}
#endif
/*********************************************************************
*
* Compatibility API defines
*/
#define SEGGER_SYSVIEW_OnUserStart SEGGER_SYSVIEW_MarkStart
#define SEGGER_SYSVIEW_OnUserStop SEGGER_SYSVIEW_MarkStop
#endif
/*************************** End of file ****************************/
@@ -0,0 +1,563 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_ConfDefaults.h
Purpose : Defines defaults for configurable defines used in
SEGGER SystemView.
Revision: $Rev: 26230 $
*/
#ifndef SEGGER_SYSVIEW_CONFDEFAULTS_H
#define SEGGER_SYSVIEW_CONFDEFAULTS_H
/*********************************************************************
*
* #include Section
*
**********************************************************************
*/
#include "SEGGER_SYSVIEW_Conf.h"
#include "SEGGER_RTT_Conf.h"
#ifdef __cplusplus
extern "C" {
#endif
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
//
// Use auto-detection for SEGGER_SYSVIEW_CORE define
// based on compiler-/toolchain-specific defines
// to define SEGGER_SYSVIEW_GET_INTERRUPT_ID and SEGGER_SYSVIEW_GET_TIMESTAMP
//
#define SEGGER_SYSVIEW_CORE_OTHER 0
#define SEGGER_SYSVIEW_CORE_CM0 1 // Cortex-M0/M0+/M1
#define SEGGER_SYSVIEW_CORE_CM3 2 // Cortex-M3/M4/M7
#define SEGGER_SYSVIEW_CORE_RX 3 // Renesas RX
#ifndef SEGGER_SYSVIEW_CORE
#if (defined __SES_ARM) || (defined __CROSSWORKS_ARM) || (defined __SEGGER_CC__) || (defined __GNUC__) || (defined __clang__)
#if (defined __ARM_ARCH_6M__) || (defined __ARM_ARCH_8M_BASE__)
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
#elif (defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_8M_MAIN__))
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
#endif
#elif defined(__ICCARM__)
#if (defined (__ARM6M__) && (__CORE__ == __ARM6M__)) \
|| (defined (__ARM8M_BASELINE__) && (__CORE__ == __ARM8M_BASELINE__))
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
#elif (defined (__ARM7EM__) && (__CORE__ == __ARM7EM__)) \
|| (defined (__ARM7M__) && (__CORE__ == __ARM7M__)) \
|| (defined (__ARM8M_MAINLINE__) && (__CORE__ == __ARM8M_MAINLINE__)) \
|| (defined (__ARM8M_MAINLINE__) && (__CORE__ == __ARM8M_MAINLINE__))
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
#endif
#elif defined(__CC_ARM)
#if (defined(__TARGET_ARCH_6S_M))
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
#elif (defined(__TARGET_ARCH_7_M) || defined(__TARGET_ARCH_7E_M))
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
#endif
#elif defined(__TI_ARM__)
#ifdef __TI_ARM_V6M0__
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM0
#elif (defined(__TI_ARM_V7M3__) || defined(__TI_ARM_V7M4__))
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3
#endif
#elif defined(__ICCRX__)
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_RX
#elif defined(__RX)
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_RX
#endif
#ifndef SEGGER_SYSVIEW_CORE
#define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_OTHER
#endif
#endif
/*********************************************************************
*
* Defines, defaults
*
**********************************************************************
*/
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_APP_NAME
*
* Description
* The application name to be displayed in SystemView.
* Default
* "SystemView-enabled Application"
* Notes
* Convenience define to be used for SEGGER_SYSVIEW_SendSysDesc().
*/
#ifndef SEGGER_SYSVIEW_APP_NAME
#define SEGGER_SYSVIEW_APP_NAME "SystemView-enabled Application"
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_DEVICE_NAME
*
* Description
* The target device name to be displayed in SystemView.
* Default
* "undefined device"
* Notes
* Convenience define to be used for SEGGER_SYSVIEW_SendSysDesc().
*/
#ifndef SEGGER_SYSVIEW_DEVICE_NAME
#define SEGGER_SYSVIEW_DEVICE_NAME "undefined device"
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_GET_INTERRUPT_ID()
*
* Description
* Function macro to retrieve the Id of the currently active
* interrupt.
* Default
* Call user-supplied function SEGGER_SYSVIEW_X_GetInterruptId().
* Notes
* For some known compilers and cores, a ready-to-use, core-specific
* default is set.
* ARMv7M: Read ICSR[8:0] (active vector)
* ARMv6M: Read ICSR[5:0] (active vector)
*/
#ifndef SEGGER_SYSVIEW_GET_INTERRUPT_ID
#if SEGGER_SYSVIEW_CORE == SEGGER_SYSVIEW_CORE_CM3
#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)
#elif SEGGER_SYSVIEW_CORE == SEGGER_SYSVIEW_CORE_CM0
#if defined(__ICCARM__)
#if (__VER__ > 6010000)
#define SEGGER_SYSVIEW_GET_INTERRUPT_ID() (__get_IPSR()) // Workaround for IAR, which might do a byte-access to 0xE000ED04. Read IPSR instead.
#else
#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.
#endif
#else
#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)
#endif
#else
#define SEGGER_SYSVIEW_GET_INTERRUPT_ID() SEGGER_SYSVIEW_X_GetInterruptId() // Get the currently active interrupt Id from the user-provided function.
#endif
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_GET_TIMESTAMP()
*
* Description
* Function macro to retrieve a system timestamp for SYSVIEW events.
* Default
* Call user-supplied function SEGGER_SYSVIEW_X_GetTimestamp().
* Notes
* For some known compilers and cores, a ready-to-use, core-specific
* default is set.
* ARMv7M: Read Cortex-M Cycle Count register.
*
* The system timestamp clock frequency has to be passed in
* SEGGER_SYSVIEW_Init().
*/
#ifndef SEGGER_SYSVIEW_GET_TIMESTAMP
#if defined (SEGGER_SYSVIEW_CORE) && (SEGGER_SYSVIEW_CORE == SEGGER_SYSVIEW_CORE_CM3)
#define SEGGER_SYSVIEW_GET_TIMESTAMP() (*(U32 *)(0xE0001004)) // Retrieve a system timestamp. Cortex-M cycle counter.
#else
#define SEGGER_SYSVIEW_GET_TIMESTAMP() SEGGER_SYSVIEW_X_GetTimestamp() // Retrieve a system timestamp via user-defined function
#endif
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_TIMESTAMP_BITS
*
* Description
* Number of valid (low-order) bits delivered in system timestamp.
* Default
* 32
* Notes
* Value has to match system timestamp clock source.
*/
// Define number of valid bits low-order delivered by clock source.
#ifndef SEGGER_SYSVIEW_TIMESTAMP_BITS
#define SEGGER_SYSVIEW_TIMESTAMP_BITS 32
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_RTT_CHANNEL
*
* Description
* The RTT channel that SystemView will use.
* Default
* 0: Auto selection.
* Notes
* Value has to be lower than SEGGER_RTT_MAX_NUM_UP_BUFFERS.
*/
#ifndef SEGGER_SYSVIEW_RTT_CHANNEL
#define SEGGER_SYSVIEW_RTT_CHANNEL 0
#endif
// Sanity check of RTT channel
#if (SEGGER_SYSVIEW_RTT_CHANNEL == 0) && (SEGGER_RTT_MAX_NUM_UP_BUFFERS < 2)
#error "SEGGER_RTT_MAX_NUM_UP_BUFFERS in SEGGER_RTT_Conf.h has to be > 1!"
#elif (SEGGER_SYSVIEW_RTT_CHANNEL >= SEGGER_RTT_MAX_NUM_UP_BUFFERS)
#error "SEGGER_RTT_MAX_NUM_UP_BUFFERS in SEGGER_RTT_Conf.h has to be > SEGGER_SYSVIEW_RTT_CHANNEL!"
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_RTT_BUFFER_SIZE
*
* Description
* Number of bytes that SystemView uses for the RTT buffer.
* Default
* 1024
*/
#ifndef SEGGER_SYSVIEW_RTT_BUFFER_SIZE
#define SEGGER_SYSVIEW_RTT_BUFFER_SIZE 4096
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE
*
* Description
* Largest cache line size (in bytes) in the target system.
* Default
* 0
* Notes
* Required in systems with caches to make sure that the SystemView
* RTT buffer can be aligned accordingly.
*/
#ifndef SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE
#define SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE 0
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_ID_BASE
*
* Description
* Lowest Id reported by the application.
* Default
* 0
* Notes
* Value is usually subtracted from mailboxes, semaphores, tasks,
* .... addresses, to compress event parameters.
* Should be the lowest RAM address of the system.
*/
#ifndef SEGGER_SYSVIEW_ID_BASE
#define SEGGER_SYSVIEW_ID_BASE 0
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_ID_SHIFT
*
* Description
* Number of bits to shift Ids.
* Default
* 0
* Notes
* Ids are shifted to compress event parameters.
* Should match the alignment of Ids (addresses),
* e.g. 2 when Ids are 4 byte aligned.
*/
#ifndef SEGGER_SYSVIEW_ID_SHIFT
#define SEGGER_SYSVIEW_ID_SHIFT 0
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_MAX_ARGUMENTS
*
* Description
* Maximum number of arguments which are handled with SystemView
* print routines or may be encoded in one recording function.
* routines.
* Default
* 16
*/
#ifndef SEGGER_SYSVIEW_MAX_ARGUMENTS
#define SEGGER_SYSVIEW_MAX_ARGUMENTS 16
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_MAX_STRING_LEN
*
* Description
* Maximum string length which can be used in SystemView print and
* system description routines.
* Default
* 128
*/
#ifndef SEGGER_SYSVIEW_MAX_STRING_LEN
#define SEGGER_SYSVIEW_MAX_STRING_LEN 128
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_SUPPORT_LONG_ID
*
* Description
* It set, support enconding Evend Ids longer than 14 bit.
* Default
* 1
*/
#ifndef SEGGER_SYSVIEW_SUPPORT_LONG_ID
#define SEGGER_SYSVIEW_SUPPORT_LONG_ID 1
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_SUPPORT_LONG_DATA
*
* Description
* It set, support enconding event data longer than 14 bit.
* Default
* 0
*/
#ifndef SEGGER_SYSVIEW_SUPPORT_LONG_DATA
#define SEGGER_SYSVIEW_SUPPORT_LONG_DATA 0
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT
*
* Description
* If enabled, on SEGGER_SYSVIEW_PrintHost, check the format string
* and if it includes unsupported formatters, use formatting on the
* target instead.
* Default
* 0: Disabled.
*/
#ifndef SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT
#define SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT 0
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_USE_INTERNAL_RECORDER
*
* Description
* If set, an internal recorder, such as UART or IP is used.
* Default
* 0: Disabled.
* Notes
* Convenience define to be used by SEGGER_SYSVIEW_Conf(),
* such as in embOS configuration to enable Cortex-M cycle counter.
*/
#ifndef SEGGER_SYSVIEW_USE_INTERNAL_RECORDER
#define SEGGER_SYSVIEW_USE_INTERNAL_RECORDER 0
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_CAN_RESTART
*
* Description
* If enabled, send the SystemView start sequence on every start
* command, not just on the first one.
* Enables restart when SystemView disconnected unexpectedly.
* Default
* 1: Enabled
*/
#ifndef SEGGER_SYSVIEW_CAN_RESTART
#define SEGGER_SYSVIEW_CAN_RESTART 1
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_START_ON_INIT
*
* Description
* Enable calling SEGGER_SYSVIEW_Start() after initialization.
* Default
* 0: Disabled.
* Notes
* Convenience define to be used by SEGGER_SYSVIEW_Conf(),
* such as in embOS configuration.
*/
#ifndef SEGGER_SYSVIEW_START_ON_INIT
#define SEGGER_SYSVIEW_START_ON_INIT 0
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_USE_STATIC_BUFFER
*
* Description
* If enabled, use a static buffer instead of a buffer on the stack
* for SystemView event packets.
* Default
* 1: Enabled.
* Notes
* If enabled, the static memory use by SystemView is increased by
* the maximum packet size. SystemView is locked on entry of a
* recording function.
* If disabled, the stack usage by SystemView recording functions
* might be increased by up to the maximum packet size. SystemView
* is locked when writing the packet to the RTT buffer.
*/
#ifndef SEGGER_SYSVIEW_USE_STATIC_BUFFER
#define SEGGER_SYSVIEW_USE_STATIC_BUFFER 1
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_MAX_PACKET_SIZE
*
* Description
* Maximum packet size for a SystemView event.
* Default
* Automatically calculated.
* Notes
* The maximum packet size is mainly defined by the maximum string
* length and the maximum number of arguments.
*/
#ifndef SEGGER_SYSVIEW_MAX_PACKET_SIZE
#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)
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_POST_MORTEM_MODE
*
* Description
* If enabled, SystemView records for post-mortem analysis instead
* of real-time analysis.
* Default
* 0: Disabled.
* Notes
* For more information refer to
* https://www.segger.com/products/development-tools/systemview/technology/post-mortem-mode
*/
#ifndef SEGGER_SYSVIEW_POST_MORTEM_MODE
#define SEGGER_SYSVIEW_POST_MORTEM_MODE 0
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_SYNC_PERIOD_SHIFT
*
* Description
* Configure how frequently syncronization is sent in post-mortem
* mode.
* Default
* 8: (1 << 8) = Every 256 Events.
* Notes
* In post-mortem mode, at least one sync has to be in the RTT buffer.
* Recommended sync frequency: Buffer Size / 16
* For more information refer to
* https://www.segger.com/products/development-tools/systemview/technology/post-mortem-mode
*/
#ifndef SEGGER_SYSVIEW_SYNC_PERIOD_SHIFT
#define SEGGER_SYSVIEW_SYNC_PERIOD_SHIFT 8
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_ON_EVENT_RECORDED()
*
* Description
* Function macro to notify recorder about a new event in buffer.
* Default
* undefined: Do not notify recorder.
* Notes
* Used for non-J-Link recorder,
* such as to enable transmission via UART or notify IP task.
*/
#ifndef SEGGER_SYSVIEW_ON_EVENT_RECORDED
#define SEGGER_SYSVIEW_ON_EVENT_RECORDED(NumBytes)
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_LOCK()
*
* Description
* Function macro to (nestable) lock SystemView recording.
* Default
* Use RTT Locking mechanism (defined by SEGGER_RTT_LOCK()).
* Notes
* If SystemView recording is not locked, recording events from
* interrupts and tasks may lead to unpredictable, undefined, event
* data.
*/
#ifndef SEGGER_SYSVIEW_LOCK
#define SEGGER_SYSVIEW_LOCK() SEGGER_RTT_LOCK()
#endif
/*********************************************************************
*
* Define: SEGGER_SYSVIEW_UNLOCK
*
* Description
* Function macro to unlock SystemView recording.
* Default
* Use RTT Unlocking mechanism (defined by SEGGER_RTT_UNLOCK()).
*/
#ifndef SEGGER_SYSVIEW_UNLOCK
#define SEGGER_SYSVIEW_UNLOCK() SEGGER_RTT_UNLOCK()
#endif
#ifdef __cplusplus
}
#endif
#endif
/*************************** End of file ****************************/
+99
View File
@@ -0,0 +1,99 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Int.h
Purpose : SEGGER SystemView internal header.
Revision: $Rev: 21281 $
*/
#ifndef SEGGER_SYSVIEW_INT_H
#define SEGGER_SYSVIEW_INT_H
/*********************************************************************
*
* #include Section
*
**********************************************************************
*/
#include "SEGGER_SYSVIEW.h"
#ifdef __cplusplus
extern "C" {
#endif
/*********************************************************************
*
* Private data types
*
**********************************************************************
*/
//
// Commands that Host can send to target
//
typedef enum {
SEGGER_SYSVIEW_COMMAND_ID_START = 1,
SEGGER_SYSVIEW_COMMAND_ID_STOP,
SEGGER_SYSVIEW_COMMAND_ID_GET_SYSTIME,
SEGGER_SYSVIEW_COMMAND_ID_GET_TASKLIST,
SEGGER_SYSVIEW_COMMAND_ID_GET_SYSDESC,
SEGGER_SYSVIEW_COMMAND_ID_GET_NUMMODULES,
SEGGER_SYSVIEW_COMMAND_ID_GET_MODULEDESC,
SEGGER_SYSVIEW_COMMAND_ID_HEARTBEAT = 127,
// Extended commands: Commands >= 128 have a second parameter
SEGGER_SYSVIEW_COMMAND_ID_GET_MODULE = 128
} SEGGER_SYSVIEW_COMMAND_ID;
#ifdef __cplusplus
}
#endif
#endif
/*************************** End of file ****************************/
@@ -0,0 +1,124 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
---------------------------END-OF-HEADER------------------------------
File : SEGGER_RTT_Syscalls_GCC.c
Purpose : Low-level functions for using printf() via RTT in GCC.
To use RTT for printf output, include this file in your
application.
Revision: $Rev: 24316 $
----------------------------------------------------------------------
*/
#if (defined __GNUC__) && !(defined __SES_ARM) && !(defined __CROSSWORKS_ARM) && !(defined __ARMCC_VERSION) && !(defined __CC_ARM)
#include <reent.h> // required for _write_r
#include "SEGGER_RTT.h"
/*********************************************************************
*
* Types
*
**********************************************************************
*/
//
// If necessary define the _reent struct
// to match the one passed by the used standard library.
//
struct _reent;
/*********************************************************************
*
* Function prototypes
*
**********************************************************************
*/
_ssize_t _write (int file, const void *ptr, size_t len);
_ssize_t _write_r(struct _reent *r, int file, const void *ptr, size_t len);
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* _write()
*
* Function description
* Low-level write function.
* libc subroutines will use this system routine for output to all files,
* including stdout.
* Write data via RTT.
*/
_ssize_t _write(int file, const void *ptr, size_t len) {
(void) file; /* Not used, avoid warning */
SEGGER_RTT_Write(0, ptr, len);
return len;
}
/*********************************************************************
*
* _write_r()
*
* Function description
* Low-level reentrant write function.
* libc subroutines will use this system routine for output to all files,
* including stdout.
* Write data via RTT.
*/
_ssize_t _write_r(struct _reent *r, int file, const void *ptr, size_t len) {
(void) file; /* Not used, avoid warning */
(void) r; /* Not used, avoid warning */
SEGGER_RTT_Write(0, ptr, len);
return len;
}
#endif
/****** End Of File *************************************************/
@@ -0,0 +1,119 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
---------------------------END-OF-HEADER------------------------------
File : SEGGER_RTT_Syscalls_IAR.c
Purpose : Low-level functions for using printf() via RTT in IAR.
To use RTT for printf output, include this file in your
application and set the Library Configuration to Normal.
Revision: $Rev: 24316 $
----------------------------------------------------------------------
*/
#ifdef __IAR_SYSTEMS_ICC__
//
// Since IAR EWARM V8 and EWRX V4, yfuns.h is considered as deprecated and LowLevelIOInterface.h
// shall be used instead. To not break any compatibility with older compiler versions, we have a
// version check in here.
//
#if ((defined __ICCARM__) && (__VER__ >= 8000000)) || ((defined __ICCRX__) && (__VER__ >= 400))
#include <LowLevelIOInterface.h>
#else
#include <yfuns.h>
#endif
#include "SEGGER_RTT.h"
#pragma module_name = "?__write"
/*********************************************************************
*
* Function prototypes
*
**********************************************************************
*/
size_t __write(int handle, const unsigned char * buffer, size_t size);
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* __write()
*
* Function description
* Low-level write function.
* Standard library subroutines will use this system routine
* for output to all files, including stdout.
* Write data via RTT.
*/
size_t __write(int handle, const unsigned char * buffer, size_t size) {
(void) handle; /* Not used, avoid warning */
SEGGER_RTT_Write(0, (const char*)buffer, size);
return size;
}
/*********************************************************************
*
* __write_buffered()
*
* Function description
* Low-level write function.
* Standard library subroutines will use this system routine
* for output to all files, including stdout.
* Write data via RTT.
*/
size_t __write_buffered(int handle, const unsigned char * buffer, size_t size) {
(void) handle; /* Not used, avoid warning */
SEGGER_RTT_Write(0, (const char*)buffer, size);
return size;
}
#endif
/****** End Of File *************************************************/
@@ -0,0 +1,404 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
---------------------------END-OF-HEADER------------------------------
File : RTT_Syscalls_KEIL.c
Purpose : Retargeting module for KEIL MDK-CM3.
Low-level functions for using printf() via RTT
Revision: $Rev: 29653 $
Notes : (1) https://wiki.segger.com/Keil_MDK-ARM#RTT_in_uVision
----------------------------------------------------------------------
*/
#if (defined __CC_ARM) || (defined __ARMCC_VERSION)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <rt_sys.h>
#include <rt_misc.h>
#include "SEGGER_RTT.h"
/*********************************************************************
*
* #pragmas
*
**********************************************************************
*/
#if __ARMCC_VERSION < 6000000
#pragma import(__use_no_semihosting)
#endif
#ifdef _MICROLIB
#pragma import(__use_full_stdio)
#endif
/*********************************************************************
*
* Defines non-configurable
*
**********************************************************************
*/
/* Standard IO device handles - arbitrary, but any real file system handles must be
less than 0x8000. */
#define STDIN 0x8001 // Standard Input Stream
#define STDOUT 0x8002 // Standard Output Stream
#define STDERR 0x8003 // Standard Error Stream
/*********************************************************************
*
* Public const
*
**********************************************************************
*/
#if __ARMCC_VERSION < 5000000
//const char __stdin_name[] = "STDIN";
const char __stdout_name[] = "STDOUT";
const char __stderr_name[] = "STDERR";
#endif
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* _ttywrch
*
* Function description:
* Outputs a character to the console
*
* Parameters:
* c - character to output
*
*/
void _ttywrch(int c) {
fputc(c, stdout); // stdout
fflush(stdout);
}
/*********************************************************************
*
* _sys_open
*
* Function description:
* Opens the device/file in order to do read/write operations
*
* Parameters:
* sName - sName of the device/file to open
* OpenMode - This parameter is currently ignored
*
* Return value:
* != 0 - Handle to the object to open, otherwise
* == 0 -"device" is not handled by this module
*
*/
FILEHANDLE _sys_open(const char * sName, int OpenMode) {
(void)OpenMode;
// Register standard Input Output devices.
if (strcmp(sName, __stdout_name) == 0) {
return (STDOUT);
} else if (strcmp(sName, __stderr_name) == 0) {
return (STDERR);
} else
return (0); // Not implemented
}
/*********************************************************************
*
* _sys_close
*
* Function description:
* Closes the handle to the open device/file
*
* Parameters:
* hFile - Handle to a file opened via _sys_open
*
* Return value:
* 0 - device/file closed
*
*/
int _sys_close(FILEHANDLE hFile) {
(void)hFile;
return 0; // Not implemented
}
/*********************************************************************
*
* _sys_write
*
* Function description:
* Writes the data to an open handle.
* Currently this function only outputs data to the console
*
* Parameters:
* hFile - Handle to a file opened via _sys_open
* pBuffer - Pointer to the data that shall be written
* NumBytes - Number of bytes to write
* Mode - The Mode that shall be used
*
* Return value:
* Number of bytes *not* written to the file/device
*
*/
int _sys_write(FILEHANDLE hFile, const unsigned char * pBuffer, unsigned NumBytes, int Mode) {
int r = 0;
(void)Mode;
if (hFile == STDOUT) {
SEGGER_RTT_Write(0, (const char*)pBuffer, NumBytes);
return 0;
}
return r;
}
/*********************************************************************
*
* _sys_istty
*
* Function description:
* This function shall return whether the opened file
* is a console device or not.
*
* Parameters:
* hFile - Handle to a file opened via _sys_open
*
* Return value:
* 1 - Device is a console
* 0 - Device is not a console
*
*/
int _sys_istty(FILEHANDLE hFile) {
if (hFile > 0x8000) {
return (1);
}
return (0); // Not implemented
}
/*********************************************************************
*
* _sys_seek
*
* Function description:
* Seeks via the file to a specific position
*
* Parameters:
* hFile - Handle to a file opened via _sys_open
* Pos -
*
* Return value:
* int -
*
*/
int _sys_seek(FILEHANDLE hFile, long Pos) {
(void)hFile;
(void)Pos;
return (0); // Not implemented
}
/*********************************************************************
*
* _sys_flen
*
* Function description:
* Returns the length of the opened file handle
*
* Parameters:
* hFile - Handle to a file opened via _sys_open
*
* Return value:
* Length of the file
*
*/
long _sys_flen(FILEHANDLE hFile) {
(void)hFile;
return (0); // Not implemented
}
#if (__ARMCC_VERSION <= 6000000) // The following functions are not required to be implemented for CC version > 6.
/*********************************************************************
*
* _sys_read
*
* Function description:
* Reads data from an open handle.
* Currently this modules does nothing.
*
* Parameters:
* hFile - Handle to a file opened via _sys_open
* pBuffer - Pointer to buffer to store the read data
* NumBytes - Number of bytes to read
* Mode - The Mode that shall be used
*
* Return value:
* Number of bytes read from the file/device
*
*/
int _sys_read(FILEHANDLE hFile, unsigned char * pBuffer, unsigned NumBytes, int Mode) {
(void)hFile;
(void)pBuffer;
(void)NumBytes;
(void)Mode;
return (0); // Not implemented
}
/*********************************************************************
*
* _sys_ensure
*
* Function description:
*
*
* Parameters:
* hFile - Handle to a file opened via _sys_open
*
* Return value:
* int -
*
*/
int _sys_ensure(FILEHANDLE hFile) {
(void)hFile;
return (-1); // Not implemented
}
/*********************************************************************
*
* _sys_tmpnam
*
* Function description:
* This function converts the file number fileno for a temporary
* file to a unique filename, for example, tmp0001.
*
* Parameters:
* pBuffer - Pointer to a buffer to store the name
* FileNum - file number to convert
* MaxLen - Size of the buffer
*
* Return value:
* 1 - Error
* 0 - Success
*
*/
#if __ARMCC_VERSION >= 6190000
void _sys_tmpnam(char * pBuffer, int FileNum, unsigned MaxLen) {
(void)pBuffer;
(void)FileNum;
(void)MaxLen;
return; // Not implemented
}
#else
int _sys_tmpnam(char * pBuffer, int FileNum, unsigned MaxLen) {
(void)pBuffer;
(void)FileNum;
(void)MaxLen;
return (1); // Not implemented
}
#endif
/*********************************************************************
*
* _sys_command_string
*
* Function description:
* This function shall execute a system command.
*
* Parameters:
* cmd - Pointer to the command string
* len - Length of the string
*
* Return value:
* == NULL - Command was not successfully executed
* == sCmd - Command was passed successfully
*
*/
char * _sys_command_string(char * cmd, int len) {
(void)len;
return cmd; // Not implemented
}
/*********************************************************************
*
* _sys_exit
*
* Function description:
* This function is called when the application returns from main
*
* Parameters:
* ReturnCode - Return code from the main function
*
*
*/
void _sys_exit(int ReturnCode) {
(void)ReturnCode;
while (1); // Not implemented
}
#if __ARMCC_VERSION >= 5000000
/*********************************************************************
*
* stdout_putchar
*
* Function description:
* Put a character to the stdout
*
* Parameters:
* ch - Character to output
*
*
*/
int stdout_putchar(int ch) {
(void)ch;
return ch; // Not implemented
}
#endif
#endif // #if __ARMCC_VERSION <= 6000000
#endif // #if (defined __CC_ARM) || (defined __ARMCC_VERSION)
/*************************** End of file ****************************/
@@ -0,0 +1,251 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
---------------------------END-OF-HEADER------------------------------
File : SEGGER_RTT_Syscalls_SES.c
Purpose : Reimplementation of printf, puts and __getchar using RTT
in SEGGER Embedded Studio.
To use RTT for printf output, include this file in your
application.
Revision: $Rev: 24316 $
----------------------------------------------------------------------
*/
#if (defined __SES_ARM) || (defined __SES_RISCV) || (defined __CROSSWORKS_ARM)
#include "SEGGER_RTT.h"
#include <stdarg.h>
#include <stdio.h>
#include "limits.h"
#include "__libc.h"
#include "__vfprintf.h"
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
//
// Select string formatting implementation.
//
// RTT printf formatting
// - Configurable stack usage. (SEGGER_RTT_PRINTF_BUFFER_SIZE in SEGGER_RTT_Conf.h)
// - No maximum string length.
// - Limited conversion specifiers and flags. (See SEGGER_RTT_printf.c)
// Standard library printf formatting
// - Configurable formatting capabilities.
// - Full conversion specifier and flag support.
// - Maximum string length has to be known or (slightly) slower character-wise output.
//
// #define PRINTF_USE_SEGGER_RTT_FORMATTING 0 // Use standard library formatting
// #define PRINTF_USE_SEGGER_RTT_FORMATTING 1 // Use RTT formatting
//
#ifndef PRINTF_USE_SEGGER_RTT_FORMATTING
#define PRINTF_USE_SEGGER_RTT_FORMATTING 0
#endif
//
// If using standard library formatting,
// select maximum output string buffer size or character-wise output.
//
// #define PRINTF_BUFFER_SIZE 0 // Use character-wise output
// #define PRINTF_BUFFER_SIZE 128 // Default maximum string length
//
#ifndef PRINTF_BUFFER_SIZE
#define PRINTF_BUFFER_SIZE 128
#endif
#if PRINTF_USE_SEGGER_RTT_FORMATTING // Use SEGGER RTT formatting implementation
/*********************************************************************
*
* Function prototypes
*
**********************************************************************
*/
int SEGGER_RTT_vprintf(unsigned BufferIndex, const char * sFormat, va_list * pParamList);
/*********************************************************************
*
* Global functions, printf
*
**********************************************************************
*/
/*********************************************************************
*
* printf()
*
* Function description
* print a formatted string using RTT and SEGGER RTT formatting.
*/
int printf(const char *fmt,...) {
int n;
va_list args;
va_start (args, fmt);
n = SEGGER_RTT_vprintf(0, fmt, &args);
va_end(args);
return n;
}
#elif PRINTF_BUFFER_SIZE == 0 // Use standard library formatting with character-wise output
/*********************************************************************
*
* Static functions
*
**********************************************************************
*/
static int _putchar(int x, __printf_tag_ptr ctx) {
(void)ctx;
SEGGER_RTT_Write(0, (char *)&x, 1);
return x;
}
/*********************************************************************
*
* Global functions, printf
*
**********************************************************************
*/
/*********************************************************************
*
* printf()
*
* Function description
* print a formatted string character-wise, using RTT and standard
* library formatting.
*/
int printf(const char *fmt, ...) {
int n;
va_list args;
__printf_t iod;
va_start(args, fmt);
iod.string = 0;
iod.maxchars = INT_MAX;
iod.output_fn = _putchar;
SEGGER_RTT_LOCK();
n = __vfprintf(&iod, fmt, args);
SEGGER_RTT_UNLOCK();
va_end(args);
return n;
}
#else // Use standard library formatting with static buffer
/*********************************************************************
*
* Global functions, printf
*
**********************************************************************
*/
/*********************************************************************
*
* printf()
*
* Function description
* print a formatted string using RTT and standard library formatting.
*/
int printf(const char *fmt,...) {
int n;
char aBuffer[PRINTF_BUFFER_SIZE];
va_list args;
va_start (args, fmt);
n = vsnprintf(aBuffer, sizeof(aBuffer), fmt, args);
if (n > (int)sizeof(aBuffer)) {
SEGGER_RTT_Write(0, aBuffer, sizeof(aBuffer));
} else if (n > 0) {
SEGGER_RTT_Write(0, aBuffer, n);
}
va_end(args);
return n;
}
#endif
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* puts()
*
* Function description
* print a string using RTT.
*/
int puts(const char *s) {
return SEGGER_RTT_WriteString(0, s);
}
/*********************************************************************
*
* __putchar()
*
* Function description
* Write one character via RTT.
*/
int __putchar(int x, __printf_tag_ptr ctx) {
(void)ctx;
SEGGER_RTT_Write(0, (char *)&x, 1);
return x;
}
/*********************************************************************
*
* __getchar()
*
* Function description
* Wait for and get a character via RTT.
*/
int __getchar() {
return SEGGER_RTT_WaitKey();
}
#endif
/****** End Of File *************************************************/
@@ -0,0 +1,445 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_COMM_IP_embOS_emNet.c
Purpose : SystemView Communication for IP Recorder with embOS and emNet.
Revision: $Rev: 15024 $
Additional Information
emNet needs to be initialized by the application, ideally before calling SEGGER_SYSVIEW_X_StartComm.
Example code:
static OS_STACKPTR int _IPStack[TASK_STACK_SIZE_IP_TASK/sizeof(int)]; // Stack of the IP_Task.
static OS_TASK _IPTCB; // Task-Control-Block of the IP_Task.
void MainTask(void) {
//
// Initialize emNet
//
IP_Init();
OS_CREATETASK(&_IPTCB , "IP_Task" , IP_Task , TASK_PRIO_IP_TASK , _IPStack); // Start the IP_Task.
IP_Connect(IP_INFO_GetNumInterfaces() - 1); // Connect the interface if necessary.
//
// Start SystemView communication
//
SEGGER_SYSVIEW_X_StartComm();
...
}
*/
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_Conf.h"
#include "SEGGER_RTT.h"
#include "RTOS.h"
#include "IP.h"
#include "IP_Int.h"
/*********************************************************************
*
* Defines, OS
*
**********************************************************************
*/
#define SYSVIEW_COMM_TASK_STACK_SIZE 1024
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
/*********************************************************************
*
* SYSVIEW_COMM_TASK_PRIO
* Priority of the communication task.
* Typically low to keep SystemVeiw minimally intrusive.
* Higher when there are overflows due to too long blocking time.
*
*/
#ifndef SYSVIEW_COMM_TASK_PRIO
#define SYSVIEW_COMM_TASK_PRIO 1
#endif
/*********************************************************************
*
* SYSVIEW_COMM_SEND_THRESHOLD
* Threshold for the SystemView RTT Buffer level,
* after which the data is sent to SystemView App.
*
*/
#ifndef SYSVIEW_COMM_SEND_THRESHOLD
#define SYSVIEW_COMM_SEND_THRESHOLD 512
#endif
/*********************************************************************
*
* SYSVIEW_COMM_IDLE_DELAY
* Maximum delay after which available data from the SystemView RTT
* Buffer is sent to SystemView App.
*
*/
#ifndef SYSVIEW_COMM_IDLE_DELAY
#define SYSVIEW_COMM_IDLE_DELAY 100
#endif
/*********************************************************************
*
* SYSVIEW_COMM_POLL_INTERVAL
* Polling interval to check for send threshold or idle delay timeout.
*
*/
#ifndef SYSVIEW_COMM_POLL_INTERVAL
#define SYSVIEW_COMM_POLL_INTERVAL 2
#endif
/*********************************************************************
*
* SYSVIEW_COMM_SERVER_PORT
* Communication port on which SystemView App can connect.
*
*/
#ifndef SYSVIEW_COMM_SERVER_PORT
#define SYSVIEW_COMM_SERVER_PORT 19111
#endif
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#define SYSVIEW_COMM_APP_HELLO_SIZE 32
#define SYSVIEW_COMM_TARGET_HELLO_SIZE 32
/*********************************************************************
*
* Static data, OS
*
**********************************************************************
*/
static OS_STACKPTR int _SysViewCommStack[SYSVIEW_COMM_TASK_STACK_SIZE/sizeof(int)];
static OS_TASK _SysViewCommTCB;
/*********************************************************************
*
* Static data
*
**********************************************************************
*/
// "Hello" message expected by SystemView App: SEGGER SystemView VM.mm.rr
static const U8 _abHelloMsg[SYSVIEW_COMM_TARGET_HELLO_SIZE] = { 'S', 'E', 'G', 'G', 'E', 'R', ' ', 'S', 'y', 's', 't', 'e', 'm', 'V', 'i', 'e', 'w', ' ', 'V', '0' + SEGGER_SYSVIEW_MAJOR, '.', '0' + (SEGGER_SYSVIEW_MINOR / 10), '0' + (SEGGER_SYSVIEW_MINOR % 10), '.', '0' + (SEGGER_SYSVIEW_REV / 10), '0' + (SEGGER_SYSVIEW_REV % 10), '\0', 0, 0, 0, 0, 0 };
static int _ChannelID;
static char _acBuf[SYSVIEW_COMM_SEND_THRESHOLD * 2];
/*********************************************************************
*
* Local functions, OS
*
**********************************************************************
*/
/*********************************************************************
*
* _Delay
*
* Function description
* Delay for some time.
*
*/
static void _Delay(int Ticks) {
OS_TASK_Delay(Ticks);
}
/*********************************************************************
*
* _WaitPolling
*
* Function description
* Poll SystemView Buffer to reach threshold fill level.
*
*/
static void _WaitPolling(int Timeout) {
int BytesInBuffer;
do {
BytesInBuffer = SEGGER_RTT_GetBytesInBuffer(_ChannelID);
if (BytesInBuffer >= SYSVIEW_COMM_SEND_THRESHOLD) {
break;
}
_Delay(SYSVIEW_COMM_POLL_INTERVAL);
Timeout -= SYSVIEW_COMM_POLL_INTERVAL;
} while (Timeout > 0);
}
/*********************************************************************
*
* Local functions, IP
*
**********************************************************************
*/
/*********************************************************************
*
* _WaitForIPInit
*
* Function description
* Wait for IP Stack to be initialized.
*
*/
static void _WaitForIPInit(void) {
while (IP_Global.InitCompleted == 0) {
_Delay(2);
}
}
/*********************************************************************
*
* _ListenAtTcpPort()
*
* Function description
* Creates a socket, binds it to a port and sets the socket into
* listening state.
*
* Parameter
* Port - Port which should be to wait for connections.
*
* Return value
* O.K. : Socket handle.
* Error: SOCKET_ERROR .
*/
static int _ListenAtTcpPort(U16 Port) {
int hSock;
int r;
struct sockaddr_in Addr;
//
// Create socket
//
hSock = socket(AF_INET, SOCK_STREAM, 0);
if (hSock != SOCKET_ERROR) {
//
// Bind it to the port
//
IP_MEMSET(&Addr, 0, sizeof(Addr));
Addr.sin_family = AF_INET;
Addr.sin_port = htons(Port);
Addr.sin_addr.s_addr = INADDR_ANY;
r = bind(hSock, (struct sockaddr*)&Addr, sizeof(Addr));
//
// Start listening on the socket.
//
if (r != 0) {
hSock = SOCKET_ERROR;
} else {
r = listen(hSock, 1);
if (r != 0) {
hSock = SOCKET_ERROR;
}
}
}
return hSock;
}
/*********************************************************************
*
* _SocketIsReadable
*
* Function description
* Check if data can be read from the connected socket.
*
* Parameters
* hSocket Socket to check.
*
* Return value
* == 1 O.K., socket readable
* == 0 O.K., socket not readable
*/
static int _SocketIsReadable(int hSocket, int TimeoutMs) {
I32 tv = TimeoutMs;
IP_fd_set rfds;
IP_fd_set efds;
int v;
FD_ZERO(&rfds); // Zero init file descriptor list
FD_SET(hSocket, &rfds); // Add socket to file descriptor list to be monitored by select()
FD_ZERO(&efds);
FD_SET(hSocket, &efds);
v = select(&rfds, NULL, &efds, tv); // > 0: in case of success, == 0: Timeout, < 0: Error
return v;
}
/*********************************************************************
*
* Local functions, SystemView Communication
*
**********************************************************************
*/
/*********************************************************************
*
* _SysViewCommTask
*
* Function description
* Task that handles TCP/IP connection and communication
* with SystemView App.
*
*/
static void _SysViewCommTask(void) {
int hSockListen;
int hSockSV;
int v;
int r;
int NumBytes;
char acRecv[16];
//
_ChannelID = SEGGER_SYSVIEW_GetChannelID();
//
// Wait for IP Stack to be initialized.
//
_WaitForIPInit();
//
// Try until we get a valid listening socket.
//
while (1) {
hSockListen = _ListenAtTcpPort(SYSVIEW_COMM_SERVER_PORT);
if (hSockListen == SOCKET_ERROR) {
_Delay(100);
continue; // Error, try again.
}
break;
}
//
// Wait for a connection and process the communication.
//
do {
//
// Check for a new connection.
//
hSockSV = accept(hSockListen, NULL, NULL);
if (hSockSV == SOCKET_ERROR) {
continue; // Error, try again.
}
//
// Successful connection? => Start systemview session
// First, receive <Hello> message from SysView and send back own <Hello> message
//
r = recv(hSockSV, acRecv, SYSVIEW_COMM_APP_HELLO_SIZE, 0);
if (r != SYSVIEW_COMM_APP_HELLO_SIZE) { // Failed to receive Hello message from SystemView App
closesocket(hSockSV);
hSockSV = SOCKET_ERROR;
}
r = send(hSockSV, (const char*)_abHelloMsg, SYSVIEW_COMM_TARGET_HELLO_SIZE, 0);
if (r != SYSVIEW_COMM_TARGET_HELLO_SIZE) { // Failed to send Hello message to SystemView App
closesocket(hSockSV);
hSockSV = SOCKET_ERROR;
}
//
// After a succesful connection, poll RTT buffer for data
//
while (hSockSV != SOCKET_ERROR) {
_WaitPolling(SYSVIEW_COMM_IDLE_DELAY); // Wait until there is "enough" data in the buffer to be sent.
//
// Check for data to be received from SystemView App
//
r = _SocketIsReadable(hSockSV, 0);
if (r == 1) { // Data to read from SysView available?
r = recv(hSockSV, acRecv, 1, 0); // Receive <NumBytes> to read
if (r != 1) { // Failed to receive data? => Connection lost
break;
}
v = acRecv[0];
r = recv(hSockSV, acRecv, v, 0); // Receive all data
if (r != v) { // Failed to receive data? => Connection lost
break;
}
NumBytes = SEGGER_RTT_WriteDownBufferNoLock(_ChannelID, &acRecv[0], r); // Write data into corresponding RTT buffer for application to read and handle accordingly
}
//
// Read available RTT data into send bufer and send it.
//
NumBytes = SEGGER_RTT_ReadUpBufferNoLock(_ChannelID, &_acBuf[0], sizeof(_acBuf));
if (NumBytes > 0) {
//
// Send data to SystemView App
//
r = send(hSockSV, _acBuf, NumBytes, 0);
if (NumBytes != r) { // Failed to send data? => Connection lost
break;
}
}
}
//
// Processing done. close socket handle.
//
if (hSockSV != SOCKET_ERROR) {
closesocket(hSockSV);
}
} while (1);
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SEGGER_SYSVIEW_X_StartComm()
*
* Function description
* Setup communication channel.
*/
void SEGGER_SYSVIEW_X_StartComm(void) {
//
// Initialize SystemView communication
//
OS_TASK_CREATE(&_SysViewCommTCB, "SysView Comm", SYSVIEW_COMM_TASK_PRIO, _SysViewCommTask, _SysViewCommStack);
}
/*************************** End of file ****************************/
@@ -0,0 +1,222 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
----------------------------------------------------------------------
Purpose : Implementation of the synchronous SysView recorder state machine
---------------------------END-OF-HEADER------------------------------
*/
#include "SEGGER_SYSVIEW_REC.h"
#include <SEGGER_RTT.h>
#include <SEGGER_SYSVIEW.h>
/*********************************************************************
*
* Static variables
*
**********************************************************************
*/
static enum {
WAIT_FOR_HOST_HELLO1_S,
WAIT_FOR_HOST_HELLO2_V,
WAIT_FOR_HOST_HELLO3_VERSION1,
WAIT_FOR_HOST_HELLO4_VERSION2,
SEND_CLIENT_HELLO1_S,
SEND_CLIENT_HELLO2_V,
SEND_CLIENT_HELLO3_VERSION1,
SEND_CLIENT_HELLO4_VERSION2,
RECORDING
} _State = WAIT_FOR_HOST_HELLO1_S;
static int _ChannelId = -1;
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* SYSVIEW_REC_GetOutgoing()
*
* Function description
* Get outgoing data from SystemView buffer to be transmitted.
*
* Parameters
* pBuf - Buffer to store data to.
* BufSize - Size of buffer.
*
* Return value
* > 0: Number of bytes stored to the buffer.
* = 0: No data available.
* < 0: Error (e.g. connection was not opened yet).
*/
int SYSVIEW_REC_GetOutgoing(U8 *pBuf, unsigned BufSize) {
static const U8 HelloResponse[4] = {'S', 'V', SEND_CLIENT_HELLO3_VERSION1, SEND_CLIENT_HELLO4_VERSION2};
int RetVal;
if (BufSize <= 0) {
return 0;
}
switch (_State) {
case RECORDING:
RetVal = (int)SEGGER_RTT_ReadUpBufferNoLock(_ChannelId, pBuf, BufSize);
break;
case SEND_CLIENT_HELLO4_VERSION2:
*pBuf = HelloResponse[3];
RetVal = 1;
_State = RECORDING;
break;
case SEND_CLIENT_HELLO3_VERSION1:
*pBuf = HelloResponse[2];
RetVal = 1;
_State = SEND_CLIENT_HELLO4_VERSION2;
break;
case SEND_CLIENT_HELLO2_V:
*pBuf = HelloResponse[1];
RetVal = 1;
_State = SEND_CLIENT_HELLO3_VERSION1;
break;
case SEND_CLIENT_HELLO1_S:
if (BufSize >= 4) { // check if we can answer efficiently (e.g. via IP)
pBuf[0] = HelloResponse[0];
pBuf[1] = HelloResponse[1];
pBuf[2] = HelloResponse[2];
pBuf[3] = HelloResponse[3];
RetVal = 4;
_State = RECORDING;
} else {
*pBuf = HelloResponse[0];
RetVal = 1;
_State = SEND_CLIENT_HELLO2_V;
}
break;
case WAIT_FOR_HOST_HELLO4_VERSION2: // fall through!
case WAIT_FOR_HOST_HELLO3_VERSION1: // fall through!
case WAIT_FOR_HOST_HELLO2_V: // fall through!
case WAIT_FOR_HOST_HELLO1_S: // fall through from above!
RetVal = -1; // connection not yet established
break;
}
return RetVal;
}
/*********************************************************************
*
* SYSVIEW_REC_ProcessIncoming()
*
* Function description
* Event handler to be called upon reveiving incoming data.
*
* Parameters
* pBytes - Buffer containing received data.
* NumBytes - Number of bytes in the buffer.
*
* Return value
* > 0: OK. Response ready to be sent.
* = 0: OK.
* < 0: Error.
*/
int SYSVIEW_REC_ProcessIncoming(const U8 *pBytes, unsigned NumBytes) {
int RetVal;
U8 Byte;
RetVal = 0;
while (NumBytes > 0) { // Process incoming data one byte at a time.
Byte = *pBytes;
pBytes++;
NumBytes--;
switch (_State) {
case RECORDING:
RetVal = SEGGER_RTT_WriteDownBuffer(_ChannelId, &Byte, 1);
break;
case SEND_CLIENT_HELLO4_VERSION2: // fall through!
case SEND_CLIENT_HELLO3_VERSION1: // fall through!
case SEND_CLIENT_HELLO2_V: // fall through!
case SEND_CLIENT_HELLO1_S: // fall through from above!
RetVal = -1; // need to send response first
break;
case WAIT_FOR_HOST_HELLO4_VERSION2:
_State = SEND_CLIENT_HELLO1_S; // we don't care about the clients version
RetVal = 1;
break;
case WAIT_FOR_HOST_HELLO3_VERSION1:
_State = WAIT_FOR_HOST_HELLO4_VERSION2; // we don't care about the clients version
RetVal = 0;
break;
case WAIT_FOR_HOST_HELLO2_V:
if ('V' == Byte) {
_State = WAIT_FOR_HOST_HELLO3_VERSION1;
RetVal = 0;
} else {
_State = WAIT_FOR_HOST_HELLO1_S;
RetVal = -1;
}
break;
case WAIT_FOR_HOST_HELLO1_S:
if ('S' == Byte) {
_ChannelId = SEGGER_SYSVIEW_GetChannelID();
_State = WAIT_FOR_HOST_HELLO2_V;
RetVal = 0;
} else {
_State = WAIT_FOR_HOST_HELLO1_S;
RetVal = -1;
}
break;
}
if (RetVal < 0) {
break;
}
}
return RetVal;
}
/*************************** End of file ****************************/
@@ -0,0 +1,71 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
----------------------------------------------------------------------
Purpose : Publics for the synchronous SysView recorder state machine
---------------------------END-OF-HEADER------------------------------
*/
#ifndef SEGGER_SYSVIEW_REC_H
# define SEGGER_SYSVIEW_REC_H
#include <SEGGER_SYSVIEW.h>
#if defined(__cplusplus)
extern "C" { /* Make sure we have C-declarations in C++ programs */
#endif
int SYSVIEW_REC_GetOutgoing (U8* pBuf, unsigned BufSize);
int SYSVIEW_REC_ProcessIncoming (const U8* pBytes, unsigned NumBytes);
#if defined(__cplusplus)
}
#endif
#endif // SEGGER_SYSVIEW_REC_H
/*************************** End of file ****************************/
@@ -0,0 +1,185 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
Purpose : The sample shows how to send/receive SysView via UART.
*/
/*********************************************************************
*
* #include section
*
**********************************************************************
*/
#include "BSP_UART.h"
#include "SEGGER_SYSVIEW_REC.h"
/*********************************************************************
*
* Constants
*
**********************************************************************
*/
#define _SYSVIEW_UART_PORT 0 // use 0 for RS232 adapter on ExpIf 0 header.
#define _SYSVIEW_UART_BAUDRATE 700000
#define _SYSVIEW_UART_DATABITS 8
#define _SYSVIEW_UART_PARITY BSP_UART_PARITY_NONE
#define _SYSVIEW_UART_STOPBITS 1
/*********************************************************************
*
* Static data
*
**********************************************************************
*/
static volatile int _UART_Busy = 0;
/*********************************************************************
*
* Static code
*
**********************************************************************
*/
/*********************************************************************
*
* _SysView_TrySend()
*
* Function description
* Try to send queued SysView data over the SysView output channel
*
* Return value
* > 0: Amount of data that was transmitted successfully
* == 0: No data available to be transmitted
* < 0: Transmit channel was busy, no data sent
*/
static int _SysView_TrySend(void) {
int Amount;
U8 Byte;
if (_UART_Busy) {
return -1;
} else {
Amount = SYSVIEW_REC_GetOutgoing(&Byte, 1);
if (Amount > 0) {
_UART_Busy = 1;
BSP_UART_Write1(_SYSVIEW_UART_PORT, Byte);
return Amount;
}
return 0;
}
}
/*********************************************************************
*
* _SysView_OnRxComplete()
*
* Function description
* RX-complete callback for SysView input channel
*/
static void _SysView_OnRxComplete(unsigned int Unit, unsigned char c) {
int ResponseReady;
if (Unit == _SYSVIEW_UART_PORT) {
ResponseReady = SYSVIEW_REC_ProcessIncoming(&c, 1);
if (ResponseReady > 0) {
_SysView_TrySend();
}
}
}
/*********************************************************************
*
* _SysView_OnTxComplete()
*
* Function description
* TX-complete callback for SysView output channel
*
* Return value
* == 0: There are more bytes to be sent
* != 0: Buffer empty, no more bytes to be sent.
*/
static int _SysView_OnTxComplete(unsigned int Unit) {
if (Unit == _SYSVIEW_UART_PORT) {
_UART_Busy = 0;
if (_SysView_TrySend() > 0) {
return 0;
}
}
return 1;
}
/*********************************************************************
*
* SEGGER_SYSVIEW_X_OnEventRecorded()
*
* Function description
* Callback for SysView when it has some output available
*/
void SEGGER_SYSVIEW_X_OnEventRecorded(unsigned NumBytes) {
(void)NumBytes;
_SysView_TrySend();
}
/*********************************************************************
*
* SYSVIEW_UART_Config
*/
void SYSVIEW_UART_Config(void);
void SYSVIEW_UART_Config(void) {
//
// Init SystemView REC over UART.
//
BSP_UART_Init(_SYSVIEW_UART_PORT, _SYSVIEW_UART_BAUDRATE, _SYSVIEW_UART_DATABITS, _SYSVIEW_UART_PARITY, _SYSVIEW_UART_STOPBITS);
BSP_UART_SetReadCallback(_SYSVIEW_UART_PORT, _SysView_OnRxComplete);
BSP_UART_SetWriteCallback(_SYSVIEW_UART_PORT, _SysView_OnTxComplete);
}
/**************************** end of file ***************************/
@@ -0,0 +1,104 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_FreeRTOS.c
Purpose : Sample setup configuration of SystemView with FreeRTOS.
Revision: $Rev: 7745 $
*/
#include <FreeRTOS/include/FreeRTOS.h>
#include "SEGGER_SYSVIEW.h"
extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SYSVIEW_APP_NAME "FreeRTOS Demo Application"
// The target device name
#define SYSVIEW_DEVICE_NAME "Cortex-M4"
// Frequency of the timestamp. Must match SEGGER_SYSVIEW_GET_TIMESTAMP in SEGGER_SYSVIEW_Conf.h
#define SYSVIEW_TIMESTAMP_FREQ (configCPU_CLOCK_HZ)
// System Frequency. SystemcoreClock is used in most CMSIS compatible projects.
#define SYSVIEW_CPU_FREQ configCPU_CLOCK_HZ
// The lowest RAM address used for IDs (pointers)
#define SYSVIEW_RAM_BASE (0x10000000)
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",O=FreeRTOS");
SEGGER_SYSVIEW_SendSysDesc("I#15=SysTick");
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE);
}
/*************************** End of file ****************************/
@@ -0,0 +1,252 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_FreeRTOS.c
Purpose : Interface between FreeRTOS and SystemView.
Revision: $Rev: 7947 $
*/
#include <FreeRTOS/include/FreeRTOS.h>
#include <FreeRTOS/include/task.h>
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_FreeRTOS.h"
#include "string.h" // Required for memset
typedef struct SYSVIEW_FREERTOS_TASK_STATUS SYSVIEW_FREERTOS_TASK_STATUS;
struct SYSVIEW_FREERTOS_TASK_STATUS {
U32 xHandle;
const char* pcTaskName;
unsigned uxCurrentPriority;
U32 pxStack;
unsigned uStackHighWaterMark;
};
static SYSVIEW_FREERTOS_TASK_STATUS _aTasks[SYSVIEW_FREERTOS_MAX_NOF_TASKS];
static unsigned _NumTasks;
/*********************************************************************
*
* _cbSendTaskList()
*
* Function description
* This function is part of the link between FreeRTOS and SYSVIEW.
* Called from SystemView when asked by the host, it uses SYSVIEW
* functions to send the entire task list to the host.
*/
static void _cbSendTaskList(void) {
unsigned n;
for (n = 0; n < _NumTasks; n++) {
#if INCLUDE_uxTaskGetStackHighWaterMark // Report Task Stack High Watermark
_aTasks[n].uStackHighWaterMark = uxTaskGetStackHighWaterMark((TaskHandle_t)_aTasks[n].xHandle);
#endif
SYSVIEW_SendTaskInfo((U32)_aTasks[n].xHandle, _aTasks[n].pcTaskName, (unsigned)_aTasks[n].uxCurrentPriority, (U32)_aTasks[n].pxStack, (unsigned)_aTasks[n].uStackHighWaterMark);
}
}
/*********************************************************************
*
* _cbGetTime()
*
* Function description
* This function is part of the link between FreeRTOS and SYSVIEW.
* Called from SystemView when asked by the host, returns the
* current system time in micro seconds.
*/
static U64 _cbGetTime(void) {
U64 Time;
Time = xTaskGetTickCountFromISR();
Time *= portTICK_PERIOD_MS;
Time *= 1000;
return Time;
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SYSVIEW_AddTask()
*
* Function description
* Add a task to the internal list and record its information.
*/
void SYSVIEW_AddTask(U32 xHandle, const char* pcTaskName, unsigned uxCurrentPriority, U32 pxStack, unsigned uStackHighWaterMark) {
if (memcmp(pcTaskName, "IDLE", 5) == 0) {
return;
}
if (_NumTasks >= SYSVIEW_FREERTOS_MAX_NOF_TASKS) {
SEGGER_SYSVIEW_Warn("SYSTEMVIEW: Could not record task information. Maximum number of tasks reached.");
return;
}
_aTasks[_NumTasks].xHandle = xHandle;
_aTasks[_NumTasks].pcTaskName = pcTaskName;
_aTasks[_NumTasks].uxCurrentPriority = uxCurrentPriority;
_aTasks[_NumTasks].pxStack = pxStack;
_aTasks[_NumTasks].uStackHighWaterMark = uStackHighWaterMark;
_NumTasks++;
SYSVIEW_SendTaskInfo(xHandle, pcTaskName,uxCurrentPriority, pxStack, uStackHighWaterMark);
}
/*********************************************************************
*
* SYSVIEW_UpdateTask()
*
* Function description
* Update a task in the internal list and record its information.
*/
void SYSVIEW_UpdateTask(U32 xHandle, const char* pcTaskName, unsigned uxCurrentPriority, U32 pxStack, unsigned uStackHighWaterMark) {
unsigned n;
if (memcmp(pcTaskName, "IDLE", 5) == 0) {
return;
}
for (n = 0; n < _NumTasks; n++) {
if (_aTasks[n].xHandle == xHandle) {
break;
}
}
if (n < _NumTasks) {
_aTasks[n].pcTaskName = pcTaskName;
_aTasks[n].uxCurrentPriority = uxCurrentPriority;
_aTasks[n].pxStack = pxStack;
_aTasks[n].uStackHighWaterMark = uStackHighWaterMark;
SYSVIEW_SendTaskInfo(xHandle, pcTaskName, uxCurrentPriority, pxStack, uStackHighWaterMark);
} else {
SYSVIEW_AddTask(xHandle, pcTaskName, uxCurrentPriority, pxStack, uStackHighWaterMark);
}
}
/*********************************************************************
*
* SYSVIEW_DeleteTask()
*
* Function description
* Delete a task from the internal list.
*/
void SYSVIEW_DeleteTask(U32 xHandle) {
unsigned n;
if (_NumTasks == 0) {
return; // Early out
}
for (n = 0; n < _NumTasks; n++) {
if (_aTasks[n].xHandle == xHandle) {
break;
}
}
if (n == (_NumTasks - 1)) {
//
// Task is last item in list.
// Simply zero the item and decrement number of tasks.
//
memset(&_aTasks[n], 0, sizeof(_aTasks[n]));
_NumTasks--;
} else if (n < _NumTasks) {
//
// Task is in the middle of the list.
// Move last item to current position and decrement number of tasks.
// Order of tasks does not really matter, so no need to move all following items.
//
_aTasks[n].xHandle = _aTasks[_NumTasks - 1].xHandle;
_aTasks[n].pcTaskName = _aTasks[_NumTasks - 1].pcTaskName;
_aTasks[n].uxCurrentPriority = _aTasks[_NumTasks - 1].uxCurrentPriority;
_aTasks[n].pxStack = _aTasks[_NumTasks - 1].pxStack;
_aTasks[n].uStackHighWaterMark = _aTasks[_NumTasks - 1].uStackHighWaterMark;
memset(&_aTasks[_NumTasks - 1], 0, sizeof(_aTasks[_NumTasks - 1]));
_NumTasks--;
}
}
/*********************************************************************
*
* SYSVIEW_SendTaskInfo()
*
* Function description
* Record task information.
*/
void SYSVIEW_SendTaskInfo(U32 TaskID, const char* sName, unsigned Prio, U32 StackBase, unsigned StackSize) {
SEGGER_SYSVIEW_TASKINFO TaskInfo;
memset(&TaskInfo, 0, sizeof(TaskInfo)); // Fill all elements with 0 to allow extending the structure in future version without breaking the code
TaskInfo.TaskID = TaskID;
TaskInfo.sName = sName;
TaskInfo.Prio = Prio;
TaskInfo.StackBase = StackBase;
TaskInfo.StackSize = StackSize;
SEGGER_SYSVIEW_SendTaskInfo(&TaskInfo);
}
/*********************************************************************
*
* Public API structures
*
**********************************************************************
*/
// Callbacks provided to SYSTEMVIEW by FreeRTOS
const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI = {
_cbGetTime,
_cbSendTaskList,
};
/*************************** End of file ****************************/
@@ -0,0 +1,921 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_FreeRTOS.h
Purpose : Interface between FreeRTOS and SystemView.
Tested with FreeRTOS V11.0.1
Revision: $Rev: 7745 $
Notes:
(1) Include this file at the end of FreeRTOSConfig.h
*/
#ifndef SYSVIEW_FREERTOS_H
#define SYSVIEW_FREERTOS_H
#include "SEGGER_SYSVIEW.h"
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
#ifndef portSTACK_GROWTH
#define portSTACK_GROWTH ( -1 )
#endif
#ifndef USE_LEGACY_TRACE_API
#define USE_LEGACY_TRACE_API ( 0 )
#endif
#ifndef TRACERETURN_ENABLE
#define TRACERETURN_ENABLE ( 1 )
#endif
#define SYSVIEW_FREERTOS_MAX_NOF_TASKS 8
/*********************************************************************
*
* Defines, fixed
*
**********************************************************************
*/
#if ( USE_LEGACY_TRACE_API != 0 )
#define apiID_OFFSET (32u)
#define apiID_VTASKALLOCATEMPUREGIONS (1u)
#define apiID_VTASKDELETE (2u)
#define apiID_VTASKDELAY (3u)
#define apiID_VTASKDELAYUNTIL (4u)
#define apiID_UXTASKPRIORITYGET (5u)
#define apiID_UXTASKPRIORITYGETFROMISR (6u)
#define apiID_ETASKGETSTATE (7u)
#define apiID_VTASKPRIORITYSET (8u)
#define apiID_VTASKSUSPEND (9u)
#define apiID_VTASKRESUME (10u)
#define apiID_XTASKRESUMEFROMISR (11u)
#define apiID_VTASKSTARTSCHEDULER (12u)
#define apiID_VTASKENDSCHEDULER (13u)
#define apiID_VTASKSUSPENDALL (14u)
#define apiID_XTASKRESUMEALL (15u)
#define apiID_XTASKGETTICKCOUNT (16u)
#define apiID_XTASKGETTICKCOUNTFROMISR (17u)
#define apiID_UXTASKGETNUMBEROFTASKS (18u)
#define apiID_PCTASKGETTASKNAME (19u)
#define apiID_UXTASKGETSTACKHIGHWATERMARK (20u)
#define apiID_VTASKSETAPPLICATIONTASKTAG (21u)
#define apiID_XTASKGETAPPLICATIONTASKTAG (22u)
#define apiID_VTASKSETTHREADLOCALSTORAGEPOINTER (23u)
#define apiID_PVTASKGETTHREADLOCALSTORAGEPOINTER (24u)
#define apiID_XTASKCALLAPPLICATIONTASKHOOK (25u)
#define apiID_XTASKGETIDLETASKHANDLE (26u)
#define apiID_UXTASKGETSYSTEMSTATE (27u)
#define apiID_VTASKLIST (28u)
#define apiID_VTASKGETRUNTIMESTATS (29u)
#define apiID_XTASKGENERICNOTIFY (30u)
#define apiID_XTASKGENERICNOTIFYFROMISR (31u)
#define apiID_XTASKNOTIFYWAIT (32u)
#define apiID_VTASKNOTIFYGIVEFROMISR (33u)
#define apiID_ULTASKNOTIFYTAKE (34u)
#define apiID_XTASKNOTIFYSTATECLEAR (35u)
#define apiID_XTASKGETCURRENTTASKHANDLE (36u)
#define apiID_VTASKSETTIMEOUTSTATE (37u)
#define apiID_XTASKCHECKFORTIMEOUT (38u)
#define apiID_VTASKMISSEDYIELD (39u)
#define apiID_XTASKGETSCHEDULERSTATE (40u)
#define apiID_VTASKPRIORITYINHERIT (41u)
#define apiID_XTASKPRIORITYDISINHERIT (42u)
#define apiID_XTASKGENERICCREATE (43u)
#define apiID_UXTASKGETTASKNUMBER (44u)
#define apiID_VTASKSETTASKNUMBER (45u)
#define apiID_VTASKSTEPTICK (46u)
#define apiID_ETASKCONFIRMSLEEPMODESTATUS (47u)
#define apiID_XTIMERCREATE (48u)
#define apiID_PVTIMERGETTIMERID (49u)
#define apiID_VTIMERSETTIMERID (50u)
#define apiID_XTIMERISTIMERACTIVE (51u)
#define apiID_XTIMERGETTIMERDAEMONTASKHANDLE (52u)
#define apiID_XTIMERPENDFUNCTIONCALLFROMISR (53u)
#define apiID_XTIMERPENDFUNCTIONCALL (54u)
#define apiID_PCTIMERGETTIMERNAME (55u)
#define apiID_XTIMERCREATETIMERTASK (56u)
#define apiID_XTIMERGENERICCOMMAND (57u)
#define apiID_XQUEUEGENERICSEND (58u)
#define apiID_XQUEUEPEEKFROMISR (59u)
#define apiID_XQUEUEGENERICRECEIVE (60u)
#define apiID_UXQUEUEMESSAGESWAITING (61u)
#define apiID_UXQUEUESPACESAVAILABLE (62u)
#define apiID_VQUEUEDELETE (63u)
#define apiID_XQUEUEGENERICSENDFROMISR (64u)
#define apiID_XQUEUEGIVEFROMISR (65u)
#define apiID_XQUEUERECEIVEFROMISR (66u)
#define apiID_XQUEUEISQUEUEEMPTYFROMISR (67u)
#define apiID_XQUEUEISQUEUEFULLFROMISR (68u)
#define apiID_UXQUEUEMESSAGESWAITINGFROMISR (69u)
#define apiID_XQUEUEALTGENERICSEND (70u)
#define apiID_XQUEUEALTGENERICRECEIVE (71u)
#define apiID_XQUEUECRSENDFROMISR (72u)
#define apiID_XQUEUECRRECEIVEFROMISR (73u)
#define apiID_XQUEUECRSEND (74u)
#define apiID_XQUEUECRRECEIVE (75u)
#define apiID_XQUEUECREATEMUTEX (76u)
#define apiID_XQUEUECREATECOUNTINGSEMAPHORE (77u)
#define apiID_XQUEUEGETMUTEXHOLDER (78u)
#define apiID_XQUEUETAKEMUTEXRECURSIVE (79u)
#define apiID_XQUEUEGIVEMUTEXRECURSIVE (80u)
#define apiID_VQUEUEADDTOREGISTRY (81u)
#define apiID_VQUEUEUNREGISTERQUEUE (82u)
#define apiID_XQUEUEGENERICCREATE (83u)
#define apiID_XQUEUECREATESET (84u)
#define apiID_XQUEUEADDTOSET (85u)
#define apiID_XQUEUEREMOVEFROMSET (86u)
#define apiID_XQUEUESELECTFROMSET (87u)
#define apiID_XQUEUESELECTFROMSETFROMISR (88u)
#define apiID_XQUEUEGENERICRESET (89u)
#define apiID_VLISTINITIALISE (90u)
#define apiID_VLISTINITIALISEITEM (91u)
#define apiID_VLISTINSERT (92u)
#define apiID_VLISTINSERTEND (93u)
#define apiID_UXLISTREMOVE (94u)
#define apiID_XEVENTGROUPCREATE (95u)
#define apiID_XEVENTGROUPWAITBITS (96u)
#define apiID_XEVENTGROUPCLEARBITS (97u)
#define apiID_XEVENTGROUPCLEARBITSFROMISR (98u)
#define apiID_XEVENTGROUPSETBITS (99u)
#define apiID_XEVENTGROUPSETBITSFROMISR (100u)
#define apiID_XEVENTGROUPSYNC (101u)
#define apiID_XEVENTGROUPGETBITSFROMISR (102u)
#define apiID_VEVENTGROUPDELETE (103u)
#define apiID_UXEVENTGROUPGETNUMBER (104u)
#define apiID_XSTREAMBUFFERCREATE (105u)
#define apiID_VSTREAMBUFFERDELETE (106u)
#define apiID_XSTREAMBUFFERRESET (107u)
#define apiID_XSTREAMBUFFERSEND (108u)
#define apiID_XSTREAMBUFFERSENDFROMISR (109u)
#define apiID_XSTREAMBUFFERRECEIVE (110u)
#define apiID_XSTREAMBUFFERRECEIVEFROMISR (111u)
#define apiID_XQUEUESETSEND (112u)
#endif
#define apiID_XQUEUEGENERICRESET (150u)
#define apiID_XQUEUEGENERICCREATESTATIC (151u)
#define apiID_XQUEUEGENERICCREATE (152u)
#define apiID_XQUEUECREATEMUTEX (153u)
#define apiID_XQUEUECREATEMUTEXSTATIC (154u)
#define apiID_XQUEUEGETMUTEXHOLDER (155u)
#define apiID_XQUEUEGETMUTEXHOLDERFROMISR (156u)
#define apiID_XQUEUEGIVEMUTEXRECURSIVE (157u)
#define apiID_XQUEUETAKEMUTEXRECURSIVE (158u)
#define apiID_XQUEUECREATECOUNTINGSEMAPHORESTATIC (159u)
#define apiID_XQUEUECREATECOUNTINGSEMAPHORE (160u)
#define apiID_XQUEUEGENERICSEND (161u)
#define apiID_XQUEUEGENERICSENDFROMISR (162u)
#define apiID_XQUEUEGIVEFROMISR (163u)
#define apiID_XQUEUERECEIVE (164u)
#define apiID_XQUEUESEMAPHORETAKE (165u)
#define apiID_XQUEUEPEEK (166u)
#define apiID_XQUEUERECEIVEFROMISR (167u)
#define apiID_XQUEUEPEEKFROMISR (168u)
#define apiID_UXQUEUEMESSAGESWAITING (169u)
#define apiID_UXQUEUESPACESAVAILABLE (170u)
#define apiID_UXQUEUEMESSAGESWAITINGFROMISR (171u)
#define apiID_VQUEUEDELETE (172u)
#define apiID_UXQUEUEGETQUEUENUMBER (173u)
#define apiID_VQUEUESETQUEUENUMBER (174u)
#define apiID_UCQUEUEGETQUEUETYPE (175u)
#define apiID_XQUEUEISQUEUEEMPTYFROMISR (176u)
#define apiID_XQUEUEISQUEUEFULLFROMISR (177u)
#define apiID_XQUEUECRSEND (178u)
#define apiID_XQUEUECRRECEIVE (179u)
#define apiID_XQUEUECRSENDFROMISR (180u)
#define apiID_XQUEUECRRECEIVEFROMISR (181u)
#define apiID_VQUEUEADDTOREGISTRY (182u)
#define apiID_PCQUEUEGETNAME (183u)
#define apiID_VQUEUEUNREGISTERQUEUE (184u)
#define apiID_VQUEUEWAITFORMESSAGERESTRICTED (185u)
#define apiID_XQUEUECREATESET (186u)
#define apiID_XQUEUEADDTOSET (187u)
#define apiID_XQUEUEREMOVEFROMSET (188u)
#define apiID_XQUEUESELECTFROMSET (189u)
#define apiID_XQUEUESELECTFROMSETFROMISR (190u)
#define apiID_XTASKCREATESTATIC (191u)
#define apiID_XTASKCREATERESTRICTEDSTATIC (192u)
#define apiID_XTASKCREATERESTRICTED (193u)
#define apiID_XTASKCREATE (194u)
#define apiID_VTASKDELETE (195u)
#define apiID_XTASKDELAYUNTIL (196u)
#define apiID_VTASKDELAY (197u)
#define apiID_ETASKGETSTATE (198u)
#define apiID_UXTASKPRIORITYGET (199u)
#define apiID_UXTASKPRIORITYGETFROMISR (200u)
#define apiID_VTASKPRIORITYSET (201u)
#define apiID_VTASKSUSPEND (202u)
#define apiID_VTASKRESUME (203u)
#define apiID_XTASKRESUMEFROMISR (204u)
#define apiID_VTASKSTARTSCHEDULER (205u)
#define apiID_VTASKENDSCHEDULER (206u)
#define apiID_VTASKSUSPENDALL (207u)
#define apiID_XTASKRESUMEALL (208u)
#define apiID_XTASKGETTICKCOUNT (209u)
#define apiID_XTASKGETTICKCOUNTFROMISR (210u)
#define apiID_UXTASKGETNUMBEROFTASKS (211u)
#define apiID_PCTASKGETNAME (212u)
#define apiID_XTASKGETHANDLE (213u)
#define apiID_UXTASKGETSYSTEMSTATE (214u)
#define apiID_XTASKGETIDLETASKHANDLE (215u)
#define apiID_VTASKSTEPTICK (216u)
#define apiID_XTASKCATCHUPTICKS (217u)
#define apiID_XTASKABORTDELAY (218u)
#define apiID_XTASKINCREMENTTICK (219u)
#define apiID_VTASKSETAPPLICATIONTASKTAG (220u)
#define apiID_XTASKGETAPPLICATIONTASKTAG (221u)
#define apiID_XTASKGETAPPLICATIONTASKTAGFROMISR (222u)
#define apiID_XTASKCALLAPPLICATIONTASKHOOK (223u)
#define apiID_VTASKPLACEONEVENTLIST (225u)
#define apiID_VTASKPLACEONUNORDEREDEVENTLIST (226u)
#define apiID_VTASKPLACEONEVENTLISTRESTRICTED (227u)
#define apiID_XTASKREMOVEFROMEVENTLIST (228u)
#define apiID_VTASKREMOVEFROMUNORDEREDEVENTLIST (229u)
#define apiID_VTASKSETTIMEOUTSTATE (230u)
#define apiID_VTASKINTERNALSETTIMEOUTSTATE (231u)
#define apiID_XTASKCHECKFORTIMEOUT (232u)
#define apiID_VTASKMISSEDYIELD (233u)
#define apiID_UXTASKGETTASKNUMBER (234u)
#define apiID_VTASKSETTASKNUMBER (235u)
#define apiID_ETASKCONFIRMSLEEPMODESTATUS (236u)
#define apiID_VTASKSETTHREADLOCALSTORAGEPOINTER (237u)
#define apiID_PVTASKGETTHREADLOCALSTORAGEPOINTER (238u)
#define apiID_VTASKALLOCATEMPUREGIONS (239u)
#define apiID_VTASKGETINFO (240u)
#define apiID_UXTASKGETSTACKHIGHWATERMARK2 (241u)
#define apiID_UXTASKGETSTACKHIGHWATERMARK (242u)
#define apiID_PXTASKGETSTACKSTART (243u)
#define apiID_XTASKGETCURRENTTASKHANDLE (244u)
#define apiID_XTASKGETSCHEDULERSTATE (245u)
#define apiID_XTASKPRIORITYINHERIT (246u)
#define apiID_XTASKPRIORITYDISINHERIT (247u)
#define apiID_VTASKPRIORITYDISINHERITAFTERTIMEOUT (248u)
#define apiID_VTASKENTERCRITICAL (249u)
#define apiID_VTASKEXITCRITICAL (250u)
#define apiID_VTASKLIST (251u)
#define apiID_VTASKGETRUNTIMESTATS (252u)
#define apiID_UXTASKRESETEVENTITEMVALUE (253u)
#define apiID_PVTASKINCREMENTMUTEXHELDCOUNT (254u)
#define apiID_ULTASKGENERICNOTIFYTAKE (255u)
#define apiID_XTASKGENERICNOTIFYWAIT (256u)
#define apiID_XTASKGENERICNOTIFY (257u)
#define apiID_XTASKGENERICNOTIFYFROMISR (258u)
#define apiID_VTASKGENERICNOTIFYGIVEFROMISR (259u)
#define apiID_XTASKGENERICNOTIFYSTATECLEAR (260u)
#define apiID_ULTASKGENERICNOTIFYVALUECLEAR (261u)
#define apiID_ULTASKGETIDLERUNTIMECOUNTER (262u)
#define apiID_ULTASKGETIDLERUNTIMEPERCENT (263u)
#define apiID_XTIMERCREATETIMERTASK (264u)
#define apiID_XTIMERCREATE (265u)
#define apiID_XTIMERCREATESTATIC (266u)
#define apiID_XTIMERGENERICCOMMAND (267u)
#define apiID_XTIMERGETTIMERDAEMONTASKHANDLE (268u)
#define apiID_XTIMERGETPERIOD (269u)
#define apiID_VTIMERSETRELOADMODE (270u)
#define apiID_XTIMERGETRELOADMODE (271u)
#define apiID_XTIMERGETEXPIRYTIME (272u)
#define apiID_PCTIMERGETNAME (273u)
#define apiID_XTIMERISTIMERACTIVE (274u)
#define apiID_PVTIMERGETTIMERID (275u)
#define apiID_VTIMERSETTIMERID (276u)
#define apiID_XTIMERPENDFUNCTIONCALLFROMISR (277u)
#define apiID_XTIMERPENDFUNCTIONCALL (278u)
#define apiID_UXTIMERGETTIMERNUMBER (279u)
#define apiID_VTIMERSETTIMERNUMBER (280u)
#define apiID_VLISTINITIALISE (281u)
#define apiID_VLISTINITIALISEITEM (282u)
#define apiID_VLISTINSERTEND (283u)
#define apiID_VLISTINSERT (284u)
#define apiID_UXLISTREMOVE (285u)
#define apiID_XCOROUTINECREATE (286u)
#define apiID_VCOROUTINEADDTODELAYEDLIST (287u)
#define apiID_VCOROUTINESCHEDULE (288u)
#define apiID_XCOROUTINEREMOVEFROMEVENTLIST (289u)
#define apiID_XEVENTGROUPCREATESTATIC (290u)
#define apiID_XEVENTGROUPCREATE (291u)
#define apiID_XEVENTGROUPSYNC (292u)
#define apiID_XEVENTGROUPWAITBITS (293u)
#define apiID_XEVENTGROUPCLEARBITS (294u)
#define apiID_XEVENTGROUPCLEARBITSFROMISR (295u)
#define apiID_XEVENTGROUPGETBITSFROMISR (296u)
#define apiID_XEVENTGROUPSETBITS (297u)
#define apiID_VEVENTGROUPDELETE (298u)
#define apiID_VEVENTGROUPSETBITSCALLBACK (299u)
#define apiID_VEVENTGROUPCLEARBITSCALLBACK (300u)
#define apiID_XEVENTGROUPSETBITSFROMISR (301u)
#define apiID_UXEVENTGROUPGETNUMBER (302u)
#define apiID_VEVENTGROUPSETNUMBER (303u)
#define apiID_XSTREAMBUFFERGENERICCREATE (304u)
#define apiID_XSTREAMBUFFERGENERICCREATESTATIC (305u)
#define apiID_VSTREAMBUFFERDELETE (306u)
#define apiID_XSTREAMBUFFERRESET (307u)
#define apiID_XSTREAMBUFFERSETTRIGGERLEVEL (308u)
#define apiID_XSTREAMBUFFERSPACESAVAILABLE (309u)
#define apiID_XSTREAMBUFFERBYTESAVAILABLE (310u)
#define apiID_XSTREAMBUFFERSEND (311u)
#define apiID_XSTREAMBUFFERSENDFROMISR (312u)
#define apiID_XSTREAMBUFFERRECEIVE (313u)
#define apiID_XSTREAMBUFFERNEXTMESSAGELENGTHBYTES (314u)
#define apiID_XSTREAMBUFFERRECEIVEFROMISR (315u)
#define apiID_XSTREAMBUFFERISEMPTY (316u)
#define apiID_XSTREAMBUFFERISFULL (317u)
#define apiID_XSTREAMBUFFERSENDCOMPLETEDFROMISR (318u)
#define apiID_XSTREAMBUFFERRECEIVECOMPLETEDFROMISR (319u)
#define apiID_UXSTREAMBUFFERGETSTREAMBUFFERNUMBER (320u)
#define apiID_VSTREAMBUFFERSETSTREAMBUFFERNUMBER (321u)
#define apiID_UCSTREAMBUFFERGETSTREAMBUFFERTYPE (322u)
#define apiID_XTIMERGENERICCOMMANDFROMISR (323u)
#define apiID_XTIMERGENERICCOMMANDFROMTASK (324u)
#define apiID_VTASKCOREAFFINITYSET (325u)
#define apiID_VTASKCOREAFFINITYGET (326u)
#define apiID_VTASKPREEMPTIONDISABLE (327u)
#define apiID_VTASKPREEMPTIONENABLE (328u)
#define apiID_VTASKYIELDWITHINAPI (329u)
#define apiID_VTASKENTERCRITICALFROMISR (330u)
#define apiID_VTASKEXITCRITICALFROMISR (331u)
#define apiID_ULTASKGETRUNTIMECOUNTER (332u)
#define traceSTART() SEGGER_SYSVIEW_Conf()
#define traceAPI_xQueueGenericReset(xQueue, xNewQueue) SEGGER_SYSVIEW_RecordU32x2(apiID_XQUEUEGENERICRESET, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), (U32)xNewQueue)
#define traceAPI_xQueueGenericCreateStatic(uxQueueLength, uxItemSize, pucQueueStorage, pxStaticQueue, ucQueueType) SEGGER_SYSVIEW_RecordU32x5(apiID_XQUEUEGENERICCREATESTATIC, (U32)uxQueueLength, (U32)uxItemSize, SEGGER_SYSVIEW_ShrinkId((U32)pucQueueStorage), SEGGER_SYSVIEW_ShrinkId((U32)pxStaticQueue),(U32)ucQueueType)
#define traceAPI_xQueueGenericCreate(uxQueueLength, uxItemSize, ucQueueType) SEGGER_SYSVIEW_RecordU32x3(apiID_XQUEUEGENERICCREATE, (U32)uxQueueLength,(U32)uxItemSize,(U32)ucQueueType)
#define traceAPI_xQueueCreateMutex(ucQueueType) SEGGER_SYSVIEW_RecordU32 (apiID_XQUEUECREATEMUTEX, (U32)ucQueueType)
#define traceAPI_xQueueCreateMutexStatic(ucQueueType, pxStaticQueue) SEGGER_SYSVIEW_RecordU32x2(apiID_XQUEUECREATEMUTEXSTATIC, (U32)ucQueueType, SEGGER_SYSVIEW_ShrinkId((U32)pxStaticQueue))
#define traceAPI_xQueueGetMutexHolder(xSemaphore) SEGGER_SYSVIEW_RecordU32 (apiID_XQUEUEGETMUTEXHOLDER, SEGGER_SYSVIEW_ShrinkId((U32)xSemaphore))
#define traceAPI_xQueueGetMutexHolderFromISR(xSemaphore) SEGGER_SYSVIEW_RecordU32 (apiID_XQUEUEGETMUTEXHOLDERFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xSemaphore))
#define traceAPI_xQueueGiveMutexRecursive(xMutex) SEGGER_SYSVIEW_RecordU32 (apiID_XQUEUEGIVEMUTEXRECURSIVE, SEGGER_SYSVIEW_ShrinkId((U32)xMutex))
#define traceAPI_xQueueTakeMutexRecursive(xMutex, xTicksToWait) SEGGER_SYSVIEW_RecordU32x2(apiID_XQUEUETAKEMUTEXRECURSIVE, SEGGER_SYSVIEW_ShrinkId((U32)xMutex),(U32)xTicksToWait)
#define traceAPI_xQueueCreateCountingSemaphoreStatic(uxMaxCount, uxInitialCount, pxStaticQueue) SEGGER_SYSVIEW_RecordU32x3(apiID_XQUEUECREATECOUNTINGSEMAPHORESTATIC, (U32)uxMaxCount, (U32)uxInitialCount, SEGGER_SYSVIEW_ShrinkId((U32)pxStaticQueue))
#define traceAPI_xQueueCreateCountingSemaphore(uxMaxCount, uxInitialCount) SEGGER_SYSVIEW_RecordU32x2(apiID_XQUEUECREATECOUNTINGSEMAPHORE, (U32)uxMaxCount, (U32)uxInitialCount)
#define traceAPI_xQueueGenericSend(xQueue, pvItemToQueue, xTicksToWait, xCopyPosition) SEGGER_SYSVIEW_RecordU32x4(apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvItemToQueue), (U32)xTicksToWait, (U32)xCopyPosition)
#define traceAPI_xQueueGenericSendFromISR(xQueue, pvItemToQueue, pxHigherPriorityTaskWoken, xCopyPosition) SEGGER_SYSVIEW_RecordU32x4 (apiID_XQUEUEGENERICSENDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvItemToQueue), SEGGER_SYSVIEW_ShrinkId((U32)pxHigherPriorityTaskWoken), (U32)xCopyPosition)
#define traceAPI_xQueueGiveFromISR(xQueue, pxHigherPriorityTaskWoken) SEGGER_SYSVIEW_RecordU32x2(apiID_XQUEUEGIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), SEGGER_SYSVIEW_ShrinkId((U32)pxHigherPriorityTaskWoken))
#define traceAPI_xQueueReceive(xQueue, pvBuffer, xTicksToWait) SEGGER_SYSVIEW_RecordU32x3(apiID_XQUEUERECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), (U32)xTicksToWait)
#define traceAPI_xQueueSemaphoreTake(xQueue, xTicksToWait) SEGGER_SYSVIEW_RecordU32x2(apiID_XQUEUESEMAPHORETAKE, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), (U32)xTicksToWait)
#define traceAPI_xQueuePeek(xQueue, pvBuffer, xTicksToWait) SEGGER_SYSVIEW_RecordU32x3(apiID_XQUEUEPEEK, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), (U32)xTicksToWait)
#define traceAPI_xQueueReceiveFromISR(xQueue, pvBuffer, pxHigherPriorityTaskWoken) SEGGER_SYSVIEW_RecordU32x3(apiID_XQUEUERECEIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), (U32)pxHigherPriorityTaskWoken)
#define traceAPI_xQueuePeekFromISR(xQueue, pvBuffer) SEGGER_SYSVIEW_RecordU32x2(apiID_XQUEUEPEEKFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer))
#define traceAPI_uxQueueMessagesWaiting(xQueue) SEGGER_SYSVIEW_RecordU32 (apiID_UXQUEUEMESSAGESWAITING, SEGGER_SYSVIEW_ShrinkId((U32)xQueue))
#define traceAPI_uxQueueSpacesAvailable(xQueue) SEGGER_SYSVIEW_RecordU32 (apiID_UXQUEUESPACESAVAILABLE, SEGGER_SYSVIEW_ShrinkId((U32)xQueue))
#define traceAPI_uxQueueMessagesWaitingFromISR(xQueue) SEGGER_SYSVIEW_RecordU32 (apiID_UXQUEUEMESSAGESWAITINGFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xQueue))
#define traceAPI_vQueueDelete(xQueue) SEGGER_SYSVIEW_RecordU32 (apiID_VQUEUEDELETE, SEGGER_SYSVIEW_ShrinkId((U32)xQueue))
#define traceAPI_uxQueueGetQueueNumber(xQueue) SEGGER_SYSVIEW_RecordU32 (apiID_UXQUEUEGETQUEUENUMBER, SEGGER_SYSVIEW_ShrinkId((U32)xQueue))
#define traceAPI_vQueueSetQueueNumber(xQueue, uxQueueNumber) SEGGER_SYSVIEW_RecordU32x2(apiID_VQUEUESETQUEUENUMBER, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), (U32)uxQueueNumber)
#define traceAPI_ucQueueGetQueueType(xQueue) SEGGER_SYSVIEW_RecordU32 (apiID_UCQUEUEGETQUEUETYPE, SEGGER_SYSVIEW_ShrinkId((U32)xQueue))
#define traceAPI_xQueueIsQueueEmptyFromISR(xQueue) SEGGER_SYSVIEW_RecordU32 (apiID_XQUEUEISQUEUEEMPTYFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xQueue))
#define traceAPI_xQueueIsQueueFullFromISR(xQueue) SEGGER_SYSVIEW_RecordU32 (apiID_XQUEUEISQUEUEFULLFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xQueue))
#define traceAPI_xQueueCRSend(xQueue, pvItemToQueue, xTicksToWait) SEGGER_SYSVIEW_RecordU32x3(apiID_XQUEUECRSEND, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvItemToQueue), (U32)xTicksToWait)
#define traceAPI_xQueueCRReceive(xQueue, pvBuffer, xTicksToWait) SEGGER_SYSVIEW_RecordU32x3(apiID_XQUEUECRRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), (U32)xTicksToWait)
#define traceAPI_xQueueCRSendFromISR(xQueue, pvItemToQueue, xCoRoutinePreviouslyWoken) SEGGER_SYSVIEW_RecordU32x3(apiID_XQUEUECRSENDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvItemToQueue), (U32)xCoRoutinePreviouslyWoken)
#define traceAPI_xQueueCRReceiveFromISR(xQueue, pvBuffer, pxCoRoutineWoken) SEGGER_SYSVIEW_RecordU32x3(apiID_XQUEUECRRECEIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), (U32)pxCoRoutineWoken)
#define traceAPI_vQueueAddToRegistry(xQueue, pcQueueName) SEGGER_SYSVIEW_RecordU32x2(apiID_VQUEUEADDTOREGISTRY, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), SEGGER_SYSVIEW_ShrinkId((U32)pcQueueName))
#define traceAPI_pcQueueGetName(xQueue) SEGGER_SYSVIEW_RecordU32 (apiID_PCQUEUEGETNAME, SEGGER_SYSVIEW_ShrinkId((U32)xQueue))
#define traceAPI_vQueueUnregisterQueue(xQueue) SEGGER_SYSVIEW_RecordU32 (apiID_VQUEUEUNREGISTERQUEUE, SEGGER_SYSVIEW_ShrinkId((U32)xQueue))
#define traceAPI_vQueueWaitForMessageRestricted(xQueue, xTicksToWait, xWaitIndefinitely) SEGGER_SYSVIEW_RecordU32x3(apiID_VQUEUEWAITFORMESSAGERESTRICTED, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), (U32)xTicksToWait, (U32)xWaitIndefinitely)
#define traceAPI_xQueueCreateSet(uxEventQueueLength) SEGGER_SYSVIEW_RecordU32 (apiID_XQUEUECREATESET, (U32)uxEventQueueLength)
#define traceAPI_xQueueAddToSet(xQueueOrSemaphore, xQueueSet) SEGGER_SYSVIEW_RecordU32x2(apiID_XQUEUEADDTOSET, SEGGER_SYSVIEW_ShrinkId((U32)xQueueOrSemaphore), SEGGER_SYSVIEW_ShrinkId((U32)xQueueSet))
#define traceAPI_xQueueRemoveFromSet(xQueueOrSemaphore, xQueueSet) SEGGER_SYSVIEW_RecordU32x2(apiID_XQUEUEREMOVEFROMSET, SEGGER_SYSVIEW_ShrinkId((U32)xQueueOrSemaphore), SEGGER_SYSVIEW_ShrinkId((U32)xQueueSet))
#define traceAPI_xQueueSelectFromSet(xQueueSet, xTicksToWait) SEGGER_SYSVIEW_RecordU32x2(apiID_XQUEUESELECTFROMSET, SEGGER_SYSVIEW_ShrinkId((U32)xQueueSet), (U32)xTicksToWait)
#define traceAPI_xQueueSelectFromSetFromISR(xQueueSet) SEGGER_SYSVIEW_RecordU32 (apiID_XQUEUESELECTFROMSETFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xQueueSet))
#define traceAPI_xTaskCreateStatic(pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer) SEGGER_SYSVIEW_RecordU32x7(apiID_XTASKCREATESTATIC, SEGGER_SYSVIEW_ShrinkId((U32)pxTaskCode), SEGGER_SYSVIEW_ShrinkId((U32)pcName), (U32)ulStackDepth, SEGGER_SYSVIEW_ShrinkId((U32)pvParameters), (U32)uxPriority, SEGGER_SYSVIEW_ShrinkId((U32)puxStackBuffer), SEGGER_SYSVIEW_ShrinkId((U32)pxTaskBuffer))
#define traceAPI_xTaskCreateRestrictedStatic(pxTaskDefinition, pxCreatedTask) SEGGER_SYSVIEW_RecordU32x2(apiID_XTASKCREATERESTRICTEDSTATIC, SEGGER_SYSVIEW_ShrinkId((U32)pxTaskDefinition), SEGGER_SYSVIEW_ShrinkId((U32)pxCreatedTask))
#define traceAPI_xTaskCreateRestricted(pxTaskDefinition, pxCreatedTask) SEGGER_SYSVIEW_RecordU32x2(apiID_XTASKCREATERESTRICTED, SEGGER_SYSVIEW_ShrinkId((U32)pxTaskDefinition), SEGGER_SYSVIEW_ShrinkId((U32)pxCreatedTask))
#define traceAPI_xTaskCreate(pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask) SEGGER_SYSVIEW_RecordU32x6(apiID_XTASKCREATE, SEGGER_SYSVIEW_ShrinkId((U32)pxTaskCode), SEGGER_SYSVIEW_ShrinkId((U32)pcName), (U32)usStackDepth, SEGGER_SYSVIEW_ShrinkId((U32)pvParameters), (U32)uxPriority, SEGGER_SYSVIEW_ShrinkId((U32)pxCreatedTask))
#define traceAPI_vTaskDelete(xTaskToDelete) SEGGER_SYSVIEW_RecordU32 (apiID_VTASKDELETE, SEGGER_SYSVIEW_ShrinkId((U32)xTaskToDelete))
#define traceAPI_xTaskDelayUntil(pxPreviousWakeTime, xTimeIncrement) SEGGER_SYSVIEW_RecordU32x2(apiID_XTASKDELAYUNTIL, SEGGER_SYSVIEW_ShrinkId((U32)pxPreviousWakeTime), (U32)xTimeIncrement)
#define traceAPI_vTaskDelay(xTicksToDelay) SEGGER_SYSVIEW_RecordU32 (apiID_VTASKDELAY, (U32)xTicksToDelay)
#define traceAPI_eTaskGetState(xTask) SEGGER_SYSVIEW_RecordU32 (apiID_ETASKGETSTATE, SEGGER_SYSVIEW_ShrinkId((U32)xTask))
#define traceAPI_uxTaskPriorityGet(xTask) SEGGER_SYSVIEW_RecordU32 (apiID_UXTASKPRIORITYGET, SEGGER_SYSVIEW_ShrinkId((U32)xTask))
#define traceAPI_uxTaskPriorityGetFromISR(xTask) SEGGER_SYSVIEW_RecordU32 (apiID_UXTASKPRIORITYGETFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xTask))
#define traceAPI_vTaskPrioritySet(xTask, uxNewPriority) SEGGER_SYSVIEW_RecordU32x2(apiID_VTASKPRIORITYSET, SEGGER_SYSVIEW_ShrinkId((U32)xTask), (U32)uxNewPriority)
#define traceAPI_vTaskSuspend(xTaskToSuspend) SEGGER_SYSVIEW_RecordU32 (apiID_VTASKSUSPEND, SEGGER_SYSVIEW_ShrinkId((U32)xTaskToSuspend))
#define traceAPI_vTaskResume(xTaskToResume) SEGGER_SYSVIEW_RecordU32 (apiID_VTASKRESUME, SEGGER_SYSVIEW_ShrinkId((U32)xTaskToResume))
#define traceAPI_xTaskResumeFromISR(xTaskToResume) SEGGER_SYSVIEW_RecordU32 (apiID_XTASKRESUMEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xTaskToResume))
#define traceAPI_vTaskStartScheduler() SEGGER_SYSVIEW_RecordVoid (apiID_VTASKSTARTSCHEDULER)
#define traceAPI_vTaskEndScheduler() SEGGER_SYSVIEW_RecordVoid (apiID_VTASKENDSCHEDULER)
#define traceAPI_vTaskSuspendAll() SEGGER_SYSVIEW_RecordVoid (apiID_VTASKSUSPENDALL)
#define traceAPI_xTaskResumeAll() SEGGER_SYSVIEW_RecordVoid (apiID_XTASKRESUMEALL)
#define traceAPI_xTaskGetTickCount() SEGGER_SYSVIEW_RecordVoid (apiID_XTASKGETTICKCOUNT)
#define traceAPI_xTaskGetTickCountFromISR() SEGGER_SYSVIEW_RecordVoid (apiID_XTASKGETTICKCOUNTFROMISR)
#define traceAPI_uxTaskGetNumberOfTasks() SEGGER_SYSVIEW_RecordVoid (apiID_UXTASKGETNUMBEROFTASKS)
#define traceAPI_pcTaskGetName(xTaskToQuery) SEGGER_SYSVIEW_RecordU32 (apiID_PCTASKGETNAME, SEGGER_SYSVIEW_ShrinkId((U32)xTaskToQuery))
#define traceAPI_xTaskGetHandle(pcNameToQuery) SEGGER_SYSVIEW_RecordU32 (apiID_XTASKGETHANDLE, SEGGER_SYSVIEW_ShrinkId((U32)pcNameToQuery))
#define traceAPI_uxTaskGetSystemState(pxTaskStatusArray, uxArraySize, pulTotalRunTime) SEGGER_SYSVIEW_RecordU32x3(apiID_UXTASKGETSYSTEMSTATE, SEGGER_SYSVIEW_ShrinkId((U32)pxTaskStatusArray), (U32)uxArraySize, SEGGER_SYSVIEW_ShrinkId((U32)pulTotalRunTime))
#define traceAPI_xTaskGetIdleTaskHandle() SEGGER_SYSVIEW_RecordVoid (apiID_XTASKGETIDLETASKHANDLE)
#define traceAPI_vTaskStepTick(xTicksToJump) SEGGER_SYSVIEW_RecordU32 (apiID_VTASKSTEPTICK, (U32)xTicksToJump)
#define traceAPI_xTaskCatchUpTicks(xTicksToCatchUp) SEGGER_SYSVIEW_RecordU32 (apiID_XTASKCATCHUPTICKS, (U32)xTicksToCatchUp)
#define traceAPI_xTaskAbortDelay(xTask) SEGGER_SYSVIEW_RecordU32 (apiID_XTASKABORTDELAY, SEGGER_SYSVIEW_ShrinkId((U32)xTask))
#define traceAPI_xTaskIncrementTick() SEGGER_SYSVIEW_RecordVoid (apiID_XTASKINCREMENTTICK)
#define traceAPI_vTaskSetApplicationTaskTag(xTask, pxHookFunction) SEGGER_SYSVIEW_RecordU32x2(apiID_VTASKSETAPPLICATIONTASKTAG, SEGGER_SYSVIEW_ShrinkId((U32)xTask), SEGGER_SYSVIEW_ShrinkId((U32)pxHookFunction))
#define traceAPI_xTaskGetApplicationTaskTag(xTask) SEGGER_SYSVIEW_RecordU32 (apiID_XTASKGETAPPLICATIONTASKTAG, SEGGER_SYSVIEW_ShrinkId((U32)xTask))
#define traceAPI_xTaskGetApplicationTaskTagFromISR(xTask) SEGGER_SYSVIEW_RecordU32 (apiID_XTASKGETAPPLICATIONTASKTAGFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xTask))
#define traceAPI_xTaskCallApplicationTaskHook(xTask, pvParameter) SEGGER_SYSVIEW_RecordU32x2(apiID_XTASKCALLAPPLICATIONTASKHOOK, SEGGER_SYSVIEW_ShrinkId((U32)xTask), SEGGER_SYSVIEW_ShrinkId((U32)pvParameter))
#define traceAPI_vTaskPlaceOnEventList(pxEventList, xTicksToWait) SEGGER_SYSVIEW_RecordU32x2(apiID_VTASKPLACEONEVENTLIST, SEGGER_SYSVIEW_ShrinkId((U32)pxEventList), (U32)xTicksToWait)
#define traceAPI_vTaskPlaceOnUnorderedEventList(pxEventList, xItemValue, xTicksToWait) SEGGER_SYSVIEW_RecordU32x3(apiID_VTASKPLACEONUNORDEREDEVENTLIST, SEGGER_SYSVIEW_ShrinkId((U32)pxEventList), (U32)xItemValue, (U32)xTicksToWait)
#define traceAPI_vTaskPlaceOnEventListRestricted(pxEventList, xTicksToWait, xWaitIndefinitely) SEGGER_SYSVIEW_RecordU32x3(apiID_VTASKPLACEONEVENTLISTRESTRICTED, SEGGER_SYSVIEW_ShrinkId((U32)pxEventList), (U32)xTicksToWait, (U32)xWaitIndefinitely)
#define traceAPI_xTaskRemoveFromEventList(pxEventList) SEGGER_SYSVIEW_RecordU32 (apiID_XTASKREMOVEFROMEVENTLIST, SEGGER_SYSVIEW_ShrinkId((U32)pxEventList))
#define traceAPI_vTaskRemoveFromUnorderedEventList(pxEventListItem, xItemValue) SEGGER_SYSVIEW_RecordU32x2(apiID_VTASKREMOVEFROMUNORDEREDEVENTLIST, SEGGER_SYSVIEW_ShrinkId((U32)pxEventListItem), (U32)xItemValue)
#define traceAPI_vTaskSetTimeOutState(pxTimeOut) SEGGER_SYSVIEW_RecordU32 (apiID_VTASKSETTIMEOUTSTATE, SEGGER_SYSVIEW_ShrinkId((U32)pxTimeOut))
#define traceAPI_vTaskInternalSetTimeOutState(pxTimeOut) SEGGER_SYSVIEW_RecordU32 (apiID_VTASKINTERNALSETTIMEOUTSTATE, SEGGER_SYSVIEW_ShrinkId((U32)pxTimeOut))
#define traceAPI_xTaskCheckForTimeOut(pxTimeOut, pxTicksToWait) SEGGER_SYSVIEW_RecordU32x2(apiID_XTASKCHECKFORTIMEOUT, SEGGER_SYSVIEW_ShrinkId((U32)pxTimeOut), SEGGER_SYSVIEW_ShrinkId((U32)pxTicksToWait))
#define traceAPI_vTaskMissedYield() SEGGER_SYSVIEW_RecordVoid (apiID_VTASKMISSEDYIELD)
#define traceAPI_uxTaskGetTaskNumber(xTask) SEGGER_SYSVIEW_RecordU32 (apiID_UXTASKGETTASKNUMBER, SEGGER_SYSVIEW_ShrinkId((U32)xTask))
#define traceAPI_vTaskSetTaskNumber(xTask, uxHandle) SEGGER_SYSVIEW_RecordU32x2(apiID_VTASKSETTASKNUMBER, SEGGER_SYSVIEW_ShrinkId((U32)xTask), (U32)uxHandle)
#define traceAPI_eTaskConfirmSleepModeStatus() SEGGER_SYSVIEW_RecordVoid (apiID_ETASKCONFIRMSLEEPMODESTATUS)
#define traceAPI_vTaskSetThreadLocalStoragePointer(xTaskToSet, xIndex, pvValue) SEGGER_SYSVIEW_RecordU32x3(apiID_VTASKSETTHREADLOCALSTORAGEPOINTER, SEGGER_SYSVIEW_ShrinkId((U32)xTaskToSet), (U32)xIndex, SEGGER_SYSVIEW_ShrinkId((U32)pvValue))
#define traceAPI_pvTaskGetThreadLocalStoragePointer(xTaskToQuery, xIndex) SEGGER_SYSVIEW_RecordU32x2(apiID_PVTASKGETTHREADLOCALSTORAGEPOINTER, SEGGER_SYSVIEW_ShrinkId((U32)xTaskToQuery), (U32)xIndex)
#define traceAPI_vTaskAllocateMPURegions(xTaskToModify, xRegions) SEGGER_SYSVIEW_RecordU32x2(apiID_VTASKALLOCATEMPUREGIONS, SEGGER_SYSVIEW_ShrinkId((U32)xTaskToModify), SEGGER_SYSVIEW_ShrinkId((U32)xRegions))
#define traceAPI_vTaskGetInfo(xTask, pxTaskStatus, xGetFreeStackSpace, eState) SEGGER_SYSVIEW_RecordU32x4(apiID_VTASKGETINFO, SEGGER_SYSVIEW_ShrinkId((U32)xTask), SEGGER_SYSVIEW_ShrinkId((U32)pxTaskStatus), (U32)xGetFreeStackSpace, (U32)eState)
#define traceAPI_uxTaskGetStackHighWaterMark2(xTask) SEGGER_SYSVIEW_RecordU32 (apiID_UXTASKGETSTACKHIGHWATERMARK2, SEGGER_SYSVIEW_ShrinkId((U32)xTask))
#define traceAPI_uxTaskGetStackHighWaterMark(xTask) SEGGER_SYSVIEW_RecordU32 (apiID_UXTASKGETSTACKHIGHWATERMARK, SEGGER_SYSVIEW_ShrinkId((U32)xTask))
#define traceAPI_pxTaskGetStackStart(xTask) SEGGER_SYSVIEW_RecordU32 (apiID_PXTASKGETSTACKSTART, SEGGER_SYSVIEW_ShrinkId((U32)xTask))
#define traceAPI_xTaskGetCurrentTaskHandle() SEGGER_SYSVIEW_RecordVoid (apiID_XTASKGETCURRENTTASKHANDLE)
#define traceAPI_xTaskGetSchedulerState() SEGGER_SYSVIEW_RecordVoid (apiID_XTASKGETSCHEDULERSTATE)
#define traceAPI_xTaskPriorityInherit(pxMutexHolder) SEGGER_SYSVIEW_RecordU32 (apiID_XTASKPRIORITYINHERIT, SEGGER_SYSVIEW_ShrinkId((U32)pxMutexHolder))
#define traceAPI_xTaskPriorityDisinherit(pxMutexHolder) SEGGER_SYSVIEW_RecordU32 (apiID_XTASKPRIORITYDISINHERIT,SEGGER_SYSVIEW_ShrinkId((U32)pxMutexHolder))
#define traceAPI_vTaskPriorityDisinheritAfterTimeout(pxMutexHolder, uxHighestPriorityWaitingTask) SEGGER_SYSVIEW_RecordU32x2(apiID_VTASKPRIORITYDISINHERITAFTERTIMEOUT, SEGGER_SYSVIEW_ShrinkId((U32)pxMutexHolder), (U32)uxHighestPriorityWaitingTask)
#define traceAPI_vTaskEnterCritical() SEGGER_SYSVIEW_RecordVoid (apiID_VTASKENTERCRITICAL)
#define traceAPI_vTaskExitCritical() SEGGER_SYSVIEW_RecordVoid (apiID_VTASKEXITCRITICAL)
#define traceAPI_vTaskList(pcWriteBuffer) SEGGER_SYSVIEW_RecordU32 (apiID_VTASKLIST, SEGGER_SYSVIEW_ShrinkId((U32)pcWriteBuffer))
#define traceAPI_vTaskGetRunTimeStats(pcWriteBuffer) SEGGER_SYSVIEW_RecordU32 (apiID_VTASKGETRUNTIMESTATS, SEGGER_SYSVIEW_ShrinkId((U32)pcWriteBuffer))
#define traceAPI_uxTaskResetEventItemValue() SEGGER_SYSVIEW_RecordVoid (apiID_UXTASKRESETEVENTITEMVALUE)
#define traceAPI_pvTaskIncrementMutexHeldCount() SEGGER_SYSVIEW_RecordVoid (apiID_PVTASKINCREMENTMUTEXHELDCOUNT)
#define traceAPI_ulTaskGenericNotifyTake(uxIndexToWaitOn, xClearCountOnExit, xTicksToWait) SEGGER_SYSVIEW_RecordU32x3(apiID_ULTASKGENERICNOTIFYTAKE, (U32)uxIndexToWaitOn, (U32)xClearCountOnExit, (U32)xTicksToWait)
#define traceAPI_xTaskGenericNotifyWait(uxIndexToWaitOn, ulBitsToClearOnEntry, ulBitsToClearOnExit, pulNotificationValue, xTicksToWait) SEGGER_SYSVIEW_RecordU32x5(apiID_XTASKGENERICNOTIFYWAIT, (U32)uxIndexToWaitOn, (U32)ulBitsToClearOnEntry, (U32)ulBitsToClearOnExit, (U32)pulNotificationValue, (U32)xTicksToWait)
#define traceAPI_xTaskGenericNotify(xTaskToNotify, uxIndexToNotify, ulValue, eAction, pulPreviousNotificationValue) SEGGER_SYSVIEW_RecordU32x5(apiID_XTASKGENERICNOTIFY, SEGGER_SYSVIEW_ShrinkId((U32)xTaskToNotify), (U32)uxIndexToNotify, (U32)ulValue, (U32)eAction, (U32)pulPreviousNotificationValue)
#define traceAPI_xTaskGenericNotifyFromISR(xTaskToNotify, uxIndexToNotify, ulValue, eAction, pulPreviousNotificationValue, pxHigherPriorityTaskWoken) SEGGER_SYSVIEW_RecordU32x6(apiID_XTASKGENERICNOTIFYFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xTaskToNotify), (U32)uxIndexToNotify, (U32)ulValue, (U32)eAction, SEGGER_SYSVIEW_ShrinkId((U32)pulPreviousNotificationValue), SEGGER_SYSVIEW_ShrinkId((U32)pxHigherPriorityTaskWoken))
#define traceAPI_vTaskGenericNotifyGiveFromISR(xTaskToNotify, uxIndexToNotify, pxHigherPriorityTaskWoken) SEGGER_SYSVIEW_RecordU32x3(apiID_VTASKGENERICNOTIFYGIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xTaskToNotify), (U32)uxIndexToNotify, SEGGER_SYSVIEW_ShrinkId((U32)pxHigherPriorityTaskWoken))
#define traceAPI_xTaskGenericNotifyStateClear(xTask, uxIndexToClear) SEGGER_SYSVIEW_RecordU32x2(apiID_XTASKGENERICNOTIFYSTATECLEAR, SEGGER_SYSVIEW_ShrinkId((U32)xTask), (U32)uxIndexToClear)
#define traceAPI_ulTaskGenericNotifyValueClear(xTask, uxIndexToClear, ulBitsToClear) SEGGER_SYSVIEW_RecordU32x3(apiID_ULTASKGENERICNOTIFYVALUECLEAR, SEGGER_SYSVIEW_ShrinkId((U32)xTask), (U32)uxIndexToClear, (U32)ulBitsToClear)
#define traceAPI_ulTaskGetIdleRunTimeCounter() SEGGER_SYSVIEW_RecordVoid (apiID_ULTASKGETIDLERUNTIMECOUNTER)
#define traceAPI_ulTaskGetIdleRunTimePercent() SEGGER_SYSVIEW_RecordVoid (apiID_ULTASKGETIDLERUNTIMEPERCENT)
#define traceAPI_vTaskCoreAffinitySet(xTask, uxCoreAffinityMask) SEGGER_SYSVIEW_RecordU32x2(apiID_VTASKCOREAFFINITYSET, SEGGER_SYSVIEW_ShrinkId((U32)xTask), (U32)uxCoreAffinityMask)
#define traceAPI_vTaskCoreAffinityGet(xTask) SEGGER_SYSVIEW_RecordU32 (apiID_VTASKCOREAFFINITYGET, SEGGER_SYSVIEW_ShrinkId((U32)xTask))
#define traceAPI_vTaskPreemptionDisable(xTask) SEGGER_SYSVIEW_RecordU32 (apiID_VTASKPREEMPTIONDISABLE, SEGGER_SYSVIEW_ShrinkId((U32)xTask))
#define traceAPI_vTaskPreemptionEnable(xTask) SEGGER_SYSVIEW_RecordU32 (apiID_VTASKPREEMPTIONENABLE, SEGGER_SYSVIEW_ShrinkId((U32)xTask))
#define traceAPI_vTaskYieldWithinAPI() SEGGER_SYSVIEW_RecordVoid (apiID_VTASKYIELDWITHINAPI)
#define traceAPI_vTaskEnterCriticalFromISR() SEGGER_SYSVIEW_RecordVoid (apiID_VTASKENTERCRITICALFROMISR)
#define traceAPI_vTaskExitCriticalFromISR(uxSavedInterruptStatus) SEGGER_SYSVIEW_RecordU32 (apiID_VTASKEXITCRITICALFROMISR, (U32)uxSavedInterruptStatus)
#define traceAPI_ulTaskGetRunTimeCounter(xTask) SEGGER_SYSVIEW_RecordU32 (apiID_ULTASKGETRUNTIMECOUNTER, SEGGER_SYSVIEW_ShrinkId((U32)xTask))
#define traceAPI_xTimerCreateTimerTask() SEGGER_SYSVIEW_RecordVoid (apiID_XTIMERCREATETIMERTASK)
#define traceAPI_xTimerCreate(pcTimerName, xTimerPeriodInTicks, xAutoReload, pvTimerID, pxCallbackFunction) SEGGER_SYSVIEW_RecordU32x5(apiID_XTIMERCREATE, SEGGER_SYSVIEW_ShrinkId((U32)pcTimerName), (U32)xTimerPeriodInTicks, (U32)xAutoReload, SEGGER_SYSVIEW_ShrinkId((U32)pvTimerID), SEGGER_SYSVIEW_ShrinkId((U32)pxCallbackFunction))
#define traceAPI_xTimerCreateStatic(pcTimerName, xTimerPeriodInTicks, xAutoReload, pvTimerID, pxCallbackFunction, pxTimerBuffer) SEGGER_SYSVIEW_RecordU32x6(apiID_XTIMERCREATESTATIC, SEGGER_SYSVIEW_ShrinkId((U32)pcTimerName), (U32)xTimerPeriodInTicks, (U32)xAutoReload, SEGGER_SYSVIEW_ShrinkId((U32)pvTimerID), SEGGER_SYSVIEW_ShrinkId((U32)pxCallbackFunction), SEGGER_SYSVIEW_ShrinkId((U32)pxTimerBuffer))
#define traceAPI_xTimerGenericCommand(xTimer, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait) SEGGER_SYSVIEW_RecordU32x5(apiID_XTIMERGENERICCOMMAND, SEGGER_SYSVIEW_ShrinkId((U32)xTimer), (U32)xCommandID, (U32)xOptionalValue, SEGGER_SYSVIEW_ShrinkId((U32)pxHigherPriorityTaskWoken), (U32)xTicksToWait)
#define traceAPI_xTimerGenericCommandFromTask(xTimer, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait) SEGGER_SYSVIEW_RecordU32x5(apiID_XTIMERGENERICCOMMANDFROMTASK, SEGGER_SYSVIEW_ShrinkId((U32)xTimer), (U32)xCommandID, (U32)xOptionalValue, SEGGER_SYSVIEW_ShrinkId((U32)pxHigherPriorityTaskWoken), (U32)xTicksToWait)
#define traceAPI_xTimerGenericCommandFromISR(xTimer, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait) SEGGER_SYSVIEW_RecordU32x5(apiID_XTIMERGENERICCOMMANDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xTimer), (U32)xCommandID, (U32)xOptionalValue, SEGGER_SYSVIEW_ShrinkId((U32)pxHigherPriorityTaskWoken), (U32)xTicksToWait)
#define traceAPI_xTimerGetTimerDaemonTaskHandle() SEGGER_SYSVIEW_RecordVoid (apiID_XTIMERGETTIMERDAEMONTASKHANDLE)
#define traceAPI_xTimerGetPeriod(xTimer) SEGGER_SYSVIEW_RecordU32 (apiID_XTIMERGETPERIOD, SEGGER_SYSVIEW_ShrinkId((U32)xTimer))
#define traceAPI_vTimerSetReloadMode(xTimer, xAutoReload) SEGGER_SYSVIEW_RecordU32x2(apiID_VTIMERSETRELOADMODE, SEGGER_SYSVIEW_ShrinkId((U32)xTimer), (U32)xAutoReload)
#define traceAPI_xTimerGetReloadMode(xTimer) SEGGER_SYSVIEW_RecordU32 (apiID_XTIMERGETRELOADMODE, SEGGER_SYSVIEW_ShrinkId((U32)xTimer))
#define traceAPI_xTimerGetExpiryTime(xTimer) SEGGER_SYSVIEW_RecordU32 (apiID_XTIMERGETEXPIRYTIME, SEGGER_SYSVIEW_ShrinkId((U32)xTimer))
#define traceAPI_pcTimerGetName(xTimer) SEGGER_SYSVIEW_RecordU32 (apiID_PCTIMERGETNAME, SEGGER_SYSVIEW_ShrinkId((U32)xTimer))
#define traceAPI_xTimerIsTimerActive(xTimer) SEGGER_SYSVIEW_RecordU32 (apiID_XTIMERISTIMERACTIVE, SEGGER_SYSVIEW_ShrinkId((U32)xTimer))
#define traceAPI_pvTimerGetTimerID(xTimer) SEGGER_SYSVIEW_RecordU32 (apiID_PVTIMERGETTIMERID, SEGGER_SYSVIEW_ShrinkId((U32)xTimer))
#define traceAPI_vTimerSetTimerID(xTimer, pvNewID) SEGGER_SYSVIEW_RecordU32x2(apiID_VTIMERSETTIMERID, SEGGER_SYSVIEW_ShrinkId((U32)xTimer), SEGGER_SYSVIEW_ShrinkId((U32)pvNewID))
#define traceAPI_xTimerPendFunctionCallFromISR(xFunctionToPend, pvParameter1, ulParameter2, pxHigherPriorityTaskWoken) SEGGER_SYSVIEW_RecordU32x4(apiID_XTIMERPENDFUNCTIONCALLFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xFunctionToPend), SEGGER_SYSVIEW_ShrinkId((U32)pvParameter1), (U32)ulParameter2, SEGGER_SYSVIEW_ShrinkId((U32)pxHigherPriorityTaskWoken))
#define traceAPI_xTimerPendFunctionCall(xFunctionToPend, pvParameter1, ulParameter2, xTicksToWait) SEGGER_SYSVIEW_RecordU32x4(apiID_XTIMERPENDFUNCTIONCALL, SEGGER_SYSVIEW_ShrinkId((U32)xFunctionToPend), SEGGER_SYSVIEW_ShrinkId((U32)pvParameter1), (U32)ulParameter2, (U32)xTicksToWait)
#define traceAPI_uxTimerGetTimerNumber(xTimer) SEGGER_SYSVIEW_RecordU32 (apiID_UXTIMERGETTIMERNUMBER, SEGGER_SYSVIEW_ShrinkId((U32)xTimer))
#define traceAPI_vTimerSetTimerNumber(xTimer, uxTimerNumber) SEGGER_SYSVIEW_RecordU32x2(apiID_VTIMERSETTIMERNUMBER, SEGGER_SYSVIEW_ShrinkId((U32)xTimer), (U32)uxTimerNumber)
#define traceAPI_vListInitialise(pxList) SEGGER_SYSVIEW_RecordU32 (apiID_VLISTINITIALISE, SEGGER_SYSVIEW_ShrinkId((U32)pxList))
#define traceAPI_vListInitialiseItem(pxItem) SEGGER_SYSVIEW_RecordU32 (apiID_VLISTINITIALISEITEM, SEGGER_SYSVIEW_ShrinkId((U32)pxItem))
#define traceAPI_vListInsertEnd(pxList, pxNewListItem) SEGGER_SYSVIEW_RecordU32x2(apiID_VLISTINSERTEND, SEGGER_SYSVIEW_ShrinkId((U32)pxList), SEGGER_SYSVIEW_ShrinkId((U32)pxNewListItem))
#define traceAPI_vListInsert(pxList, pxNewListItem) SEGGER_SYSVIEW_RecordU32x2(apiID_VLISTINSERT, SEGGER_SYSVIEW_ShrinkId((U32)pxList), SEGGER_SYSVIEW_ShrinkId((U32)pxNewListItem))
#define traceAPI_uxListRemove(pxItemToRemove) SEGGER_SYSVIEW_RecordU32 (apiID_UXLISTREMOVE, SEGGER_SYSVIEW_ShrinkId((U32)pxItemToRemove))
#define traceAPI_xCoRoutineCreate(pxCoRoutineCode, uxPriority, uxIndex) SEGGER_SYSVIEW_RecordU32x3(apiID_XCOROUTINECREATE, SEGGER_SYSVIEW_ShrinkId((U32)pxCoRoutineCode), (U32)uxPriority, (U32)uxIndex)
#define traceAPI_vCoRoutineAddToDelayedList(xTicksToDelay, pxEventList) SEGGER_SYSVIEW_RecordU32x2(apiID_VCOROUTINEADDTODELAYEDLIST, (U32)xTicksToDelay, SEGGER_SYSVIEW_ShrinkId((U32)pxEventList))
#define traceAPI_vCoRoutineSchedule() SEGGER_SYSVIEW_RecordVoid (apiID_VCOROUTINESCHEDULE)
#define traceAPI_xCoRoutineRemoveFromEventList(pxEventList) SEGGER_SYSVIEW_RecordU32 (apiID_XCOROUTINEREMOVEFROMEVENTLIST, SEGGER_SYSVIEW_ShrinkId((U32)pxEventList))
#define traceAPI_xEventGroupCreateStatic(pxEventGroupBuffer) SEGGER_SYSVIEW_RecordU32 (apiID_XEVENTGROUPCREATESTATIC, SEGGER_SYSVIEW_ShrinkId((U32)pxEventGroupBuffer))
#define traceAPI_xEventGroupCreate() SEGGER_SYSVIEW_RecordVoid (apiID_XEVENTGROUPCREATE)
#define traceAPI_xEventGroupSync(xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTicksToWait) SEGGER_SYSVIEW_RecordU32x4(apiID_XEVENTGROUPSYNC, SEGGER_SYSVIEW_ShrinkId((U32)xEventGroup), (U32)uxBitsToSet, (U32)uxBitsToWaitFor, (U32)xTicksToWait)
#define traceAPI_xEventGroupWaitBits(xEventGroup, uxBitsToWaitFor, xClearOnExit, xWaitForAllBits, xTicksToWait) SEGGER_SYSVIEW_RecordU32x5(apiID_XEVENTGROUPWAITBITS, SEGGER_SYSVIEW_ShrinkId((U32)xEventGroup), (U32)uxBitsToWaitFor, (U32)xClearOnExit, (U32)xWaitForAllBits, (U32)xTicksToWait)
#define traceAPI_xEventGroupClearBits(xEventGroup, uxBitsToClear) SEGGER_SYSVIEW_RecordU32x2(apiID_XEVENTGROUPCLEARBITS, SEGGER_SYSVIEW_ShrinkId((U32)xEventGroup), (U32)uxBitsToClear)
#define traceAPI_xEventGroupClearBitsFromISR(xEventGroup, uxBitsToClear) SEGGER_SYSVIEW_RecordU32x2(apiID_XEVENTGROUPCLEARBITSFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xEventGroup), (U32)uxBitsToClear)
#define traceAPI_xEventGroupGetBitsFromISR(xEventGroup) SEGGER_SYSVIEW_RecordU32 (apiID_XEVENTGROUPGETBITSFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xEventGroup))
#define traceAPI_xEventGroupSetBits(xEventGroup, uxBitsToSet) SEGGER_SYSVIEW_RecordU32x2(apiID_XEVENTGROUPSETBITS, SEGGER_SYSVIEW_ShrinkId((U32)xEventGroup), (U32)uxBitsToSet)
#define traceAPI_vEventGroupDelete(xEventGroup) SEGGER_SYSVIEW_RecordU32 (apiID_VEVENTGROUPDELETE, SEGGER_SYSVIEW_ShrinkId((U32)xEventGroup))
#define traceAPI_vEventGroupSetBitsCallback(pvEventGroup, ulBitsToSet) SEGGER_SYSVIEW_RecordU32x2(apiID_VEVENTGROUPSETBITSCALLBACK, SEGGER_SYSVIEW_ShrinkId((U32)pvEventGroup), (U32)ulBitsToSet)
#define traceAPI_vEventGroupClearBitsCallback(pvEventGroup, ulBitsToClear) SEGGER_SYSVIEW_RecordU32x2(apiID_VEVENTGROUPCLEARBITSCALLBACK, SEGGER_SYSVIEW_ShrinkId((U32)pvEventGroup), (U32)ulBitsToClear)
#define traceAPI_xEventGroupSetBitsFromISR(xEventGroup, uxBitsToSet, pxHigherPriorityTaskWoken) SEGGER_SYSVIEW_RecordU32x3(apiID_XEVENTGROUPSETBITSFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xEventGroup), (U32)uxBitsToSet, SEGGER_SYSVIEW_ShrinkId((U32)pxHigherPriorityTaskWoken))
#define traceAPI_uxEventGroupGetNumber(xEventGroup) SEGGER_SYSVIEW_RecordU32 (apiID_UXEVENTGROUPGETNUMBER, SEGGER_SYSVIEW_ShrinkId((U32)xEventGroup))
#define traceAPI_vEventGroupSetNumber(xEventGroup, uxEventGroupNumber) SEGGER_SYSVIEW_RecordU32x2(apiID_VEVENTGROUPSETNUMBER, SEGGER_SYSVIEW_ShrinkId((U32)xEventGroup), (U32)uxEventGroupNumber)
#define traceAPI_xStreamBufferGenericCreate(xBufferSizeBytes, xTriggerLevelBytes, xIsMessageBuffer, pxSendCompletedCallback, pxReceiveCompletedCallback) SEGGER_SYSVIEW_RecordU32x5(apiID_XSTREAMBUFFERGENERICCREATE, (U32)xBufferSizeBytes, (U32)xTriggerLevelBytes, (U32)xIsMessageBuffer, SEGGER_SYSVIEW_ShrinkId((U32)pxSendCompletedCallback), SEGGER_SYSVIEW_ShrinkId((U32)pxReceiveCompletedCallback))
#define traceAPI_xStreamBufferGenericCreateStatic(xBufferSizeBytes, xTriggerLevelBytes, xIsMessageBuffer, pucStreamBufferStorageArea, pxStaticStreamBuffer, pxSendCompletedCallback, pxReceiveCompletedCallback) SEGGER_SYSVIEW_RecordU32x7(apiID_XSTREAMBUFFERGENERICCREATESTATIC, (U32)xBufferSizeBytes, (U32)xTriggerLevelBytes, (U32)xIsMessageBuffer, SEGGER_SYSVIEW_ShrinkId((U32)pucStreamBufferStorageArea), SEGGER_SYSVIEW_ShrinkId((U32)pxStaticStreamBuffer), SEGGER_SYSVIEW_ShrinkId((U32)pxSendCompletedCallback), SEGGER_SYSVIEW_ShrinkId((U32)pxReceiveCompletedCallback))
#define traceAPI_vStreamBufferDelete(xStreamBuffer) SEGGER_SYSVIEW_RecordU32 (apiID_VSTREAMBUFFERDELETE, SEGGER_SYSVIEW_ShrinkId((U32)xStreamBuffer))
#define traceAPI_xStreamBufferReset(xStreamBuffer) SEGGER_SYSVIEW_RecordU32 (apiID_XSTREAMBUFFERRESET, SEGGER_SYSVIEW_ShrinkId((U32)xStreamBuffer))
#define traceAPI_xStreamBufferSetTriggerLevel(xStreamBuffer, xTriggerLevel) SEGGER_SYSVIEW_RecordU32x2(apiID_XSTREAMBUFFERSETTRIGGERLEVEL, SEGGER_SYSVIEW_ShrinkId((U32)xStreamBuffer), (U32)xTriggerLevel)
#define traceAPI_xStreamBufferSpacesAvailable(xStreamBuffer) SEGGER_SYSVIEW_RecordU32 (apiID_XSTREAMBUFFERSPACESAVAILABLE, SEGGER_SYSVIEW_ShrinkId((U32)xStreamBuffer))
#define traceAPI_xStreamBufferBytesAvailable(xStreamBuffer) SEGGER_SYSVIEW_RecordU32 (apiID_XSTREAMBUFFERBYTESAVAILABLE, SEGGER_SYSVIEW_ShrinkId((U32)xStreamBuffer))
#define traceAPI_xStreamBufferSend(xStreamBuffer, pvTxData, xDataLengthBytes, xTicksToWait) SEGGER_SYSVIEW_RecordU32x4(apiID_XSTREAMBUFFERSEND, SEGGER_SYSVIEW_ShrinkId((U32)xStreamBuffer), SEGGER_SYSVIEW_ShrinkId((U32)pvTxData), (U32)xDataLengthBytes, (U32)xTicksToWait)
#define traceAPI_xStreamBufferSendFromISR(xStreamBuffer, pvTxData, xDataLengthBytes, pxHigherPriorityTaskWoken) SEGGER_SYSVIEW_RecordU32x4(apiID_XSTREAMBUFFERSENDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xStreamBuffer), SEGGER_SYSVIEW_ShrinkId((U32)pvTxData), (U32)xDataLengthBytes, SEGGER_SYSVIEW_ShrinkId((U32)pxHigherPriorityTaskWoken))
#define traceAPI_xStreamBufferReceive(xStreamBuffer, pvRxData, xBufferLengthBytes, xTicksToWait) SEGGER_SYSVIEW_RecordU32x4(apiID_XSTREAMBUFFERRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)xStreamBuffer), SEGGER_SYSVIEW_ShrinkId((U32)pvRxData), (U32)xBufferLengthBytes, (U32)xTicksToWait)
#define traceAPI_xStreamBufferNextMessageLengthBytes(xStreamBuffer) SEGGER_SYSVIEW_RecordU32 (apiID_XSTREAMBUFFERNEXTMESSAGELENGTHBYTES, SEGGER_SYSVIEW_ShrinkId((U32)xStreamBuffer))
#define traceAPI_xStreamBufferReceiveFromISR(xStreamBuffer, pvRxData, xBufferLengthBytes, pxHigherPriorityTaskWoken) SEGGER_SYSVIEW_RecordU32x4(apiID_XSTREAMBUFFERRECEIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xStreamBuffer), SEGGER_SYSVIEW_ShrinkId((U32)pvRxData), (U32)xBufferLengthBytes, SEGGER_SYSVIEW_ShrinkId((U32)pxHigherPriorityTaskWoken))
#define traceAPI_xStreamBufferIsEmpty(xStreamBuffer) SEGGER_SYSVIEW_RecordU32 (apiID_XSTREAMBUFFERISEMPTY, SEGGER_SYSVIEW_ShrinkId((U32)xStreamBuffer))
#define traceAPI_xStreamBufferIsFull(xStreamBuffer) SEGGER_SYSVIEW_RecordU32 (apiID_XSTREAMBUFFERISFULL, SEGGER_SYSVIEW_ShrinkId((U32)xStreamBuffer))
#define traceAPI_xStreamBufferSendCompletedFromISR(xStreamBuffer,pxHigherPriorityTaskWoken) SEGGER_SYSVIEW_RecordU32x2(apiID_XSTREAMBUFFERSENDCOMPLETEDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xStreamBuffer),SEGGER_SYSVIEW_ShrinkId((U32)pxHigherPriorityTaskWoken))
#define traceAPI_xStreamBufferReceiveCompletedFromISR(xStreamBuffer, pxHigherPriorityTaskWoken) SEGGER_SYSVIEW_RecordU32x2(apiID_XSTREAMBUFFERRECEIVECOMPLETEDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xStreamBuffer), SEGGER_SYSVIEW_ShrinkId((U32)pxHigherPriorityTaskWoken))
#define traceAPI_uxStreamBufferGetStreamBufferNumber(xStreamBuffer) SEGGER_SYSVIEW_RecordU32 (apiID_UXSTREAMBUFFERGETSTREAMBUFFERNUMBER, SEGGER_SYSVIEW_ShrinkId((U32)xStreamBuffer))
#define traceAPI_vStreamBufferSetStreamBufferNumber() SEGGER_SYSVIEW_RecordVoid (apiID_VSTREAMBUFFERSETSTREAMBUFFERNUMBER)
#define traceAPI_ucStreamBufferGetStreamBufferType(xStreamBuffer) SEGGER_SYSVIEW_RecordU32 (apiID_UCSTREAMBUFFERGETSTREAMBUFFERTYPE, SEGGER_SYSVIEW_ShrinkId((U32)xStreamBuffer))
#if ( TRACERETURN_ENABLE != 0 )
#define traceRETURN_xQueueGenericReset(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUEGENERICRESET, (U32)xReturn)
#define traceRETURN_xQueueGenericCreateStatic(pxNewQueue) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUEGENERICCREATESTATIC, SEGGER_SYSVIEW_ShrinkId((U32)pxNewQueue))
#define traceRETURN_xQueueGenericCreate(pxNewQueue) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUEGENERICCREATE, SEGGER_SYSVIEW_ShrinkId((U32)pxNewQueue))
#define traceRETURN_xQueueCreateMutex(xNewQueue) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUECREATEMUTEX, SEGGER_SYSVIEW_ShrinkId((U32)xNewQueue))
#define traceRETURN_xQueueCreateMutexStatic(xNewQueue) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUECREATEMUTEXSTATIC, SEGGER_SYSVIEW_ShrinkId((U32)xNewQueue))
#define traceRETURN_xQueueGetMutexHolder(pxReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUEGETMUTEXHOLDER, SEGGER_SYSVIEW_ShrinkId((U32)pxReturn))
#define traceRETURN_xQueueGetMutexHolderFromISR(pxReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUEGETMUTEXHOLDERFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxReturn))
#define traceRETURN_xQueueGiveMutexRecursive(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUEGIVEMUTEXRECURSIVE, (U32)xReturn)
#define traceRETURN_xQueueTakeMutexRecursive(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUETAKEMUTEXRECURSIVE, (U32)xReturn)
#define traceRETURN_xQueueCreateCountingSemaphoreStatic(xHandle) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUECREATECOUNTINGSEMAPHORESTATIC, SEGGER_SYSVIEW_ShrinkId((U32)xHandle))
#define traceRETURN_xQueueCreateCountingSemaphore(xHandle) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUECREATECOUNTINGSEMAPHORE, SEGGER_SYSVIEW_ShrinkId((U32)xHandle))
#define traceRETURN_xQueueGenericSend(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUEGENERICSEND, (U32)xReturn)
#define traceRETURN_xQueueGenericSendFromISR(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUEGENERICSENDFROMISR, (U32)xReturn)
#define traceRETURN_xQueueGiveFromISR(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUEGIVEFROMISR, (U32)xReturn)
#define traceRETURN_xQueueReceive(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUERECEIVE, (U32)xReturn)
#define traceRETURN_xQueueSemaphoreTake(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUESEMAPHORETAKE, (U32)xReturn)
#define traceRETURN_xQueuePeek(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUEPEEK, (U32)xReturn)
#define traceRETURN_xQueueReceiveFromISR(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUERECEIVEFROMISR, (U32)xReturn)
#define traceRETURN_xQueuePeekFromISR(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUEPEEKFROMISR, (U32)xReturn)
#define traceRETURN_uxQueueMessagesWaiting(uxReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_UXQUEUEMESSAGESWAITING, (U32)uxReturn)
#define traceRETURN_uxQueueSpacesAvailable(uxReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_UXQUEUESPACESAVAILABLE, (U32)uxReturn)
#define traceRETURN_uxQueueMessagesWaitingFromISR(uxReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_UXQUEUEMESSAGESWAITINGFROMISR, (U32)uxReturn)
#define traceRETURN_vQueueDelete() SEGGER_SYSVIEW_RecordEndCall (apiID_VQUEUEDELETE)
#define traceRETURN_uxQueueGetQueueNumber(uxQueueNumber) SEGGER_SYSVIEW_RecordEndCallU32(apiID_UXQUEUEGETQUEUENUMBER, (U32)uxQueueNumber)
#define traceRETURN_vQueueSetQueueNumber() SEGGER_SYSVIEW_RecordEndCall (apiID_VQUEUESETQUEUENUMBER)
#define traceRETURN_ucQueueGetQueueType(ucQueueType) SEGGER_SYSVIEW_RecordEndCallU32(apiID_UCQUEUEGETQUEUETYPE, (U32)ucQueueType)
#define traceRETURN_xQueueIsQueueEmptyFromISR(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUEISQUEUEEMPTYFROMISR, (U32)xReturn)
#define traceRETURN_xQueueIsQueueFullFromISR(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUEISQUEUEFULLFROMISR, (U32)xReturn)
#define traceRETURN_xQueueCRSend(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUECRSEND, (U32)xReturn)
#define traceRETURN_xQueueCRReceive(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUECRRECEIVE, (U32)xReturn)
#define traceRETURN_xQueueCRSendFromISR(xCoRoutinePreviouslyWoken) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUECRSENDFROMISR, (U32)xCoRoutinePreviouslyWoken)
#define traceRETURN_xQueueCRReceiveFromISR(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUECRRECEIVEFROMISR, (U32)xReturn)
#define traceRETURN_vQueueAddToRegistry() SEGGER_SYSVIEW_RecordEndCall (apiID_VQUEUEADDTOREGISTRY)
#define traceRETURN_pcQueueGetName(pcReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_PCQUEUEGETNAME, SEGGER_SYSVIEW_ShrinkId((U32)pcReturn))
#define traceRETURN_vQueueUnregisterQueue() SEGGER_SYSVIEW_RecordEndCall (apiID_VQUEUEUNREGISTERQUEUE)
#define traceRETURN_vQueueWaitForMessageRestricted() SEGGER_SYSVIEW_RecordEndCall (apiID_VQUEUEWAITFORMESSAGERESTRICTED)
#define traceRETURN_xQueueCreateSet(pxQueue) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUECREATESET, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue))
#define traceRETURN_xQueueAddToSet(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUEADDTOSET, (U32)xReturn)
#define traceRETURN_xQueueRemoveFromSet(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUEREMOVEFROMSET, (U32)xReturn)
#define traceRETURN_xQueueSelectFromSet(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUESELECTFROMSET, SEGGER_SYSVIEW_ShrinkId((U32)xReturn))
#define traceRETURN_xQueueSelectFromSetFromISR(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XQUEUESELECTFROMSETFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xReturn))
#define traceRETURN_xTaskCreateStatic(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKCREATESTATIC, SEGGER_SYSVIEW_ShrinkId((U32)xReturn))
#define traceRETURN_xTaskCreateRestrictedStatic(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKCREATERESTRICTEDSTATIC, (U32)xReturn)
#define traceRETURN_xTaskCreateRestricted(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKCREATERESTRICTED, (U32)xReturn)
#define traceRETURN_xTaskCreate(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKCREATE, (U32)xReturn)
#define traceRETURN_vTaskDelete() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKDELETE)
#define traceRETURN_xTaskDelayUntil(xShouldDelay) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKDELAYUNTIL, (U32)xShouldDelay)
#define traceRETURN_vTaskDelay() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKDELAY)
#define traceRETURN_eTaskGetState(eReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_ETASKGETSTATE, (U32)eReturn)
#define traceRETURN_uxTaskPriorityGet(uxReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_UXTASKPRIORITYGET, (U32)uxReturn)
#define traceRETURN_uxTaskPriorityGetFromISR(uxReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_UXTASKPRIORITYGETFROMISR, (U32)uxReturn)
#define traceRETURN_vTaskPrioritySet() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKPRIORITYSET)
#define traceRETURN_vTaskSuspend() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKSUSPEND)
#define traceRETURN_vTaskResume() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKRESUME)
#define traceRETURN_xTaskResumeFromISR(xYieldRequired) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKRESUMEFROMISR, (U32)xYieldRequired)
#define traceRETURN_vTaskStartScheduler() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKSTARTSCHEDULER)
#define traceRETURN_vTaskEndScheduler() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKENDSCHEDULER)
#define traceRETURN_vTaskSuspendAll() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKSUSPENDALL)
#define traceRETURN_xTaskResumeAll(xAlreadyYielded) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKRESUMEALL, (U32)xAlreadyYielded)
#define traceRETURN_xTaskGetTickCount(xTicks) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKGETTICKCOUNT, (U32)xTicks)
#define traceRETURN_xTaskGetTickCountFromISR(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKGETTICKCOUNTFROMISR, (U32)xReturn)
#define traceRETURN_uxTaskGetNumberOfTasks(uxCurrentNumberOfTasks) SEGGER_SYSVIEW_RecordEndCallU32(apiID_UXTASKGETNUMBEROFTASKS, (U32)uxCurrentNumberOfTasks)
#define traceRETURN_pcTaskGetName(pcTaskName) SEGGER_SYSVIEW_RecordEndCallU32(apiID_PCTASKGETNAME, SEGGER_SYSVIEW_ShrinkId((U32)pcTaskName))
#define traceRETURN_xTaskGetHandle(pxTCB) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKGETHANDLE, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB))
#define traceRETURN_uxTaskGetSystemState(uxTask) SEGGER_SYSVIEW_RecordEndCallU32(apiID_UXTASKGETSYSTEMSTATE, (U32)uxTask)
#define traceRETURN_xTaskGetIdleTaskHandle(xIdleTaskHandle) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKGETIDLETASKHANDLE, SEGGER_SYSVIEW_ShrinkId((U32)xIdleTaskHandle))
#define traceRETURN_vTaskStepTick() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKSTEPTICK)
#define traceRETURN_xTaskCatchUpTicks(xYieldOccurred) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKCATCHUPTICKS, (U32)xYieldOccurred)
#define traceRETURN_xTaskAbortDelay(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKABORTDELAY, (U32)xReturn)
#define traceRETURN_xTaskIncrementTick(xSwitchRequired) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKINCREMENTTICK, (U32)xSwitchRequired)
#define traceRETURN_vTaskSetApplicationTaskTag() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKSETAPPLICATIONTASKTAG)
#define traceRETURN_xTaskGetApplicationTaskTag(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKGETAPPLICATIONTASKTAG, SEGGER_SYSVIEW_ShrinkId((U32)xReturn))
#define traceRETURN_xTaskGetApplicationTaskTagFromISR(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKGETAPPLICATIONTASKTAGFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)xReturn))
#define traceRETURN_xTaskCallApplicationTaskHook(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKCALLAPPLICATIONTASKHOOK, (U32)xReturn)
#define traceRETURN_vTaskPlaceOnEventList() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKPLACEONEVENTLIST)
#define traceRETURN_vTaskPlaceOnUnorderedEventList() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKPLACEONUNORDEREDEVENTLIST)
#define traceRETURN_vTaskPlaceOnEventListRestricted() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKPLACEONEVENTLISTRESTRICTED)
#define traceRETURN_xTaskRemoveFromEventList(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKREMOVEFROMEVENTLIST, (U32)xReturn)
#define traceRETURN_vTaskRemoveFromUnorderedEventList() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKREMOVEFROMUNORDEREDEVENTLIST)
#define traceRETURN_vTaskSetTimeOutState() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKSETTIMEOUTSTATE)
#define traceRETURN_vTaskInternalSetTimeOutState() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKINTERNALSETTIMEOUTSTATE )
#define traceRETURN_xTaskCheckForTimeOut(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKCHECKFORTIMEOUT, (U32)xReturn)
#define traceRETURN_vTaskMissedYield() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKMISSEDYIELD)
#define traceRETURN_uxTaskGetTaskNumber(uxReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_UXTASKGETTASKNUMBER, (U32)uxReturn)
#define traceRETURN_vTaskSetTaskNumber() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKSETTASKNUMBER)
#define traceRETURN_eTaskConfirmSleepModeStatus(eReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_ETASKCONFIRMSLEEPMODESTATUS, (U32)eReturn)
#define traceRETURN_vTaskSetThreadLocalStoragePointer() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKSETTHREADLOCALSTORAGEPOINTER)
#define traceRETURN_pvTaskGetThreadLocalStoragePointer(pvReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_PVTASKGETTHREADLOCALSTORAGEPOINTER, SEGGER_SYSVIEW_ShrinkId((U32)pvReturn))
#define traceRETURN_vTaskAllocateMPURegions() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKALLOCATEMPUREGIONS)
#define traceRETURN_vTaskGetInfo() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKGETINFO)
#define traceRETURN_uxTaskGetStackHighWaterMark2(uxReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_UXTASKGETSTACKHIGHWATERMARK2, (U32)uxReturn)
#define traceRETURN_uxTaskGetStackHighWaterMark(uxReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_UXTASKGETSTACKHIGHWATERMARK, (U32)uxReturn)
#define traceRETURN_pxTaskGetStackStart(pxStack) SEGGER_SYSVIEW_RecordEndCallU32(apiID_PXTASKGETSTACKSTART, SEGGER_SYSVIEW_ShrinkId((U32)pxStack))
#define traceRETURN_xTaskGetCurrentTaskHandle(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKGETCURRENTTASKHANDLE, SEGGER_SYSVIEW_ShrinkId((U32)xReturn))
#define traceRETURN_xTaskGetSchedulerState(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKGETSCHEDULERSTATE, (U32)xReturn)
#define traceRETURN_xTaskPriorityInherit(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKPRIORITYINHERIT, (U32)xReturn)
#define traceRETURN_xTaskPriorityDisinherit(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKPRIORITYDISINHERIT, (U32)xReturn)
#define traceRETURN_vTaskPriorityDisinheritAfterTimeout() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKPRIORITYDISINHERITAFTERTIMEOUT)
#define traceRETURN_vTaskEnterCritical() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKENTERCRITICAL)
#define traceRETURN_vTaskExitCritical() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKEXITCRITICAL)
#define traceRETURN_vTaskList() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKLIST)
#define traceRETURN_vTaskGetRunTimeStats() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKGETRUNTIMESTATS)
#define traceRETURN_uxTaskResetEventItemValue(uxReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_UXTASKRESETEVENTITEMVALUE, (U32)uxReturn)
#define traceRETURN_pvTaskIncrementMutexHeldCount(pxCurrentTCB) SEGGER_SYSVIEW_RecordEndCallU32(apiID_PVTASKINCREMENTMUTEXHELDCOUNT, SEGGER_SYSVIEW_ShrinkId((U32)pxCurrentTCB))
#define traceRETURN_ulTaskGenericNotifyTake(ulReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_ULTASKGENERICNOTIFYTAKE, (U32)ulReturn)
#define traceRETURN_xTaskGenericNotifyWait(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKGENERICNOTIFYWAIT, (U32)xReturn)
#define traceRETURN_xTaskGenericNotify(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKGENERICNOTIFY, (U32)xReturn)
#define traceRETURN_xTaskGenericNotifyFromISR(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKGENERICNOTIFYFROMISR, (U32)xReturn)
#define traceRETURN_vTaskGenericNotifyGiveFromISR() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKGENERICNOTIFYGIVEFROMISR)
#define traceRETURN_xTaskGenericNotifyStateClear(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTASKGENERICNOTIFYSTATECLEAR, (U32)xReturn)
#define traceRETURN_ulTaskGenericNotifyValueClear(ulReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_ULTASKGENERICNOTIFYVALUECLEAR, (U32)ulReturn)
#define traceRETURN_ulTaskGetIdleRunTimeCounter(ulReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_ULTASKGETIDLERUNTIMECOUNTER, (U32)ulReturn)
#define traceRETURN_ulTaskGetIdleRunTimePercent(ulReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_ULTASKGETIDLERUNTIMEPERCENT, (U32)ulReturn)
#define traceRETURN_vTaskCoreAffinitySet() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKCOREAFFINITYSET)
#define traceRETURN_vTaskCoreAffinityGet(uxCoreAffinityMask) SEGGER_SYSVIEW_RecordEndCallU32(apiID_VTASKCOREAFFINITYGET, (U32)uxCoreAffinityMask)
#define traceRETURN_vTaskPreemptionDisable() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKPREEMPTIONDISABLE)
#define traceRETURN_vTaskPreemptionEnable() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKPREEMPTIONENABLE)
#define traceRETURN_vTaskYieldWithinAPI() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKYIELDWITHINAPI)
#define traceRETURN_vTaskEnterCriticalFromISR(uxSavedInterruptStatus) SEGGER_SYSVIEW_RecordEndCallU32(apiID_VTASKYIELDWITHINAPI. (U32)uxSavedInterruptStatus)
#define traceRETURN_vTaskExitCriticalFromISR() SEGGER_SYSVIEW_RecordEndCall (apiID_VTASKEXITCRITICALFROMISR)
#define traceRETURN_ulTaskGetRunTimeCounter(ulRunTimeCounter) SEGGER_SYSVIEW_RecordEndCallU32(apiID_ULTASKGETIDLERUNTIMECOUNTER, (U32)ulRunTimeCounter)
#define traceRETURN_xTimerCreateTimerTask(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTIMERCREATETIMERTASK, (U32)xReturn)
#define traceRETURN_xTimerCreate(pxNewTimer) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTIMERCREATE, SEGGER_SYSVIEW_ShrinkId((U32)pxNewTimer))
#define traceRETURN_xTimerCreateStatic(pxNewTimer) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTIMERCREATESTATIC, SEGGER_SYSVIEW_ShrinkId((U32)pxNewTimer))
#define traceRETURN_xTimerGenericCommand(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTIMERGENERICCOMMAND, (U32)xReturn)
#define traceRETURN_xTimerGenericCommandFromTask(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTIMERGENERICCOMMANDFROMTASK, (U32)xReturn)
#define traceRETURN_xTimerGenericCommandFromISR(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTIMERGENERICCOMMANDFROMISR, (U32)xReturn)
#define traceRETURN_xTimerGetTimerDaemonTaskHandle(xTimerTaskHandle) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTIMERGETTIMERDAEMONTASKHANDLE, SEGGER_SYSVIEW_ShrinkId((U32)xTimerTaskHandle))
#define traceRETURN_xTimerGetPeriod(xTimerPeriodInTicks) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTIMERGETPERIOD, (U32)xTimerPeriodInTicks)
#define traceRETURN_vTimerSetReloadMode() SEGGER_SYSVIEW_RecordEndCall (apiID_VTIMERSETRELOADMODE)
#define traceRETURN_xTimerGetReloadMode(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTIMERGETRELOADMODE, (U32)xReturn)
#define traceRETURN_xTimerGetExpiryTime(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTIMERGETEXPIRYTIME, (U32)xReturn)
#define traceRETURN_pcTimerGetName(pcTimerName) SEGGER_SYSVIEW_RecordEndCallU32(apiID_PCTIMERGETNAME, SEGGER_SYSVIEW_ShrinkId((U32)pcTimerName))
#define traceRETURN_xTimerIsTimerActive(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTIMERISTIMERACTIVE, (U32)xReturn)
#define traceRETURN_pvTimerGetTimerID(pvReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_PVTIMERGETTIMERID, SEGGER_SYSVIEW_ShrinkId((U32)pvReturn))
#define traceRETURN_vTimerSetTimerID() SEGGER_SYSVIEW_RecordEndCall (apiID_VTIMERSETTIMERID)
#define traceRETURN_xTimerPendFunctionCallFromISR(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTIMERPENDFUNCTIONCALLFROMISR, (U32)xReturn)
#define traceRETURN_xTimerPendFunctionCall(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XTIMERPENDFUNCTIONCALL, (U32)xReturn)
#define traceRETURN_uxTimerGetTimerNumber(uxTimerNumber) SEGGER_SYSVIEW_RecordEndCallU32(apiID_UXTIMERGETTIMERNUMBER, (U32)uxTimerNumber)
#define traceRETURN_vTimerSetTimerNumber() SEGGER_SYSVIEW_RecordEndCall (apiID_VTIMERSETTIMERNUMBER)
#define traceRETURN_vListInitialise() SEGGER_SYSVIEW_RecordEndCall(apiID_VLISTINITIALISE)
#define traceRETURN_vListInitialiseItem() SEGGER_SYSVIEW_RecordEndCall(apiID_VLISTINITIALISEITEM)
#define traceRETURN_vListInsertEnd() SEGGER_SYSVIEW_RecordEndCall(apiID_VLISTINSERTEND)
#define traceRETURN_vListInsert() SEGGER_SYSVIEW_RecordEndCall(apiID_VLISTINSERT)
#define traceRETURN_uxListRemove(uxNumberOfItems) SEGGER_SYSVIEW_RecordEndCallU32(apiID_UXLISTREMOVE, (U32)uxNumberOfItems)
#define traceRETURN_xCoRoutineCreate(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XCOROUTINECREATE, (U32)xReturn)
#define traceRETURN_vCoRoutineAddToDelayedList() SEGGER_SYSVIEW_RecordEndCall (apiID_VCOROUTINEADDTODELAYEDLIST)
#define traceRETURN_vCoRoutineSchedule() SEGGER_SYSVIEW_RecordEndCall (apiID_VCOROUTINESCHEDULE)
#define traceRETURN_xCoRoutineRemoveFromEventList(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XCOROUTINEREMOVEFROMEVENTLIST, (U32)xReturn)
#define traceRETURN_xEventGroupCreateStatic(pxEventBits) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XEVENTGROUPCREATESTATIC, SEGGER_SYSVIEW_ShrinkId((U32)pxEventBits))
#define traceRETURN_xEventGroupCreate(pxEventBits) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XEVENTGROUPCREATE, SEGGER_SYSVIEW_ShrinkId((U32)pxEventBits))
#define traceRETURN_xEventGroupSync(uxReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XEVENTGROUPSYNC, (U32)uxReturn)
#define traceRETURN_xEventGroupWaitBits(uxReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XEVENTGROUPWAITBITS, (U32)uxReturn)
#define traceRETURN_xEventGroupClearBits(uxReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XEVENTGROUPCLEARBITS, (U32)uxReturn)
#define traceRETURN_xEventGroupClearBitsFromISR(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XEVENTGROUPCLEARBITSFROMISR, (U32)xReturn)
#define traceRETURN_xEventGroupGetBitsFromISR(uxReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XEVENTGROUPGETBITSFROMISR, (U32)uxReturn)
#define traceRETURN_xEventGroupSetBits(uxEventBits) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XEVENTGROUPSETBITS, (U32)uxEventBits)
#define traceRETURN_vEventGroupDelete() SEGGER_SYSVIEW_RecordEndCall (apiID_VEVENTGROUPDELETE)
#define traceRETURN_vEventGroupSetBitsCallback() SEGGER_SYSVIEW_RecordEndCall (apiID_VEVENTGROUPSETBITSCALLBACK)
#define traceRETURN_vEventGroupClearBitsCallback() SEGGER_SYSVIEW_RecordEndCall (apiID_VEVENTGROUPCLEARBITSCALLBACK)
#define traceRETURN_xEventGroupSetBitsFromISR(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XEVENTGROUPSETBITSFROMISR, (U32)xReturn)
#define traceRETURN_uxEventGroupGetNumber(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_UXEVENTGROUPGETNUMBER, (U32)xReturn)
#define traceRETURN_vEventGroupSetNumber() SEGGER_SYSVIEW_RecordEndCall (apiID_VEVENTGROUPSETNUMBER)
#define traceRETURN_xStreamBufferGenericCreate(pucAllocatedMemory) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XSTREAMBUFFERGENERICCREATE, SEGGER_SYSVIEW_ShrinkId((U32)pucAllocatedMemory))
#define traceRETURN_xStreamBufferGenericCreateStatic(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XSTREAMBUFFERGENERICCREATESTATIC, SEGGER_SYSVIEW_ShrinkId((U32)xReturn))
#define traceRETURN_vStreamBufferDelete() SEGGER_SYSVIEW_RecordEndCall (apiID_VSTREAMBUFFERDELETE)
#define traceRETURN_xStreamBufferReset(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XSTREAMBUFFERRESET, (U32)xReturn)
#define traceRETURN_xStreamBufferSetTriggerLevel(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XSTREAMBUFFERSETTRIGGERLEVEL, (U32)xReturn)
#define traceRETURN_xStreamBufferSpacesAvailable(xSpace) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XSTREAMBUFFERSPACESAVAILABLE, (U32)xSpace)
#define traceRETURN_xStreamBufferBytesAvailable(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XSTREAMBUFFERBYTESAVAILABLE, (U32)xReturn)
#define traceRETURN_xStreamBufferSend(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XSTREAMBUFFERSEND, (U32)xReturn)
#define traceRETURN_xStreamBufferSendFromISR(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XSTREAMBUFFERSENDFROMISR, (U32)xReturn)
#define traceRETURN_xStreamBufferReceive(xReceivedLength) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XSTREAMBUFFERRECEIVE, (U32)xReceivedLength)
#define traceRETURN_xStreamBufferNextMessageLengthBytes(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XSTREAMBUFFERNEXTMESSAGELENGTHBYTES, (U32)xReturn)
#define traceRETURN_xStreamBufferReceiveFromISR(xReceivedLength) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XSTREAMBUFFERRECEIVEFROMISR, (U32)xReceivedLength)
#define traceRETURN_xStreamBufferIsEmpty(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XSTREAMBUFFERISEMPTY, (U32)xReturn)
#define traceRETURN_xStreamBufferIsFull(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XSTREAMBUFFERISFULL, (U32)xReturn)
#define traceRETURN_xStreamBufferSendCompletedFromISR(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XSTREAMBUFFERSENDCOMPLETEDFROMISR, (U32)xReturn)
#define traceRETURN_xStreamBufferReceiveCompletedFromISR(xReturn) SEGGER_SYSVIEW_RecordEndCallU32(apiID_XSTREAMBUFFERRECEIVECOMPLETEDFROMISR, (U32)xReturn)
#define traceRETURN_uxStreamBufferGetStreamBufferNumber(uxStreamBufferNumber) SEGGER_SYSVIEW_RecordEndCallU32(apiID_UXSTREAMBUFFERGETSTREAMBUFFERNUMBER, (U32)uxStreamBufferNumber)
#define traceRETURN_vStreamBufferSetStreamBufferNumber() SEGGER_SYSVIEW_RecordEndCall (apiID_VSTREAMBUFFERSETSTREAMBUFFERNUMBER)
#define traceRETURN_ucStreamBufferGetStreamBufferType(ucFlags) SEGGER_SYSVIEW_RecordEndCallU32(apiID_UCSTREAMBUFFERGETSTREAMBUFFERTYPE, (U32)ucFlags)
#endif
#if ( USE_LEGACY_TRACE_API != 0 )
#define traceTASK_NOTIFY_TAKE(uxIndexToWait) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_ULTASKNOTIFYTAKE, xClearCountOnExit, xTicksToWait)
#define traceTASK_DELAY() SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_VTASKDELAY, xTicksToDelay)
#define traceTASK_DELAY_UNTIL(xTimeToWake) SEGGER_SYSVIEW_RecordVoid (apiID_OFFSET + apiID_VTASKDELAYUNTIL)
#define traceTASK_NOTIFY_GIVE_FROM_ISR(uxIndexToNotify) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_VTASKNOTIFYGIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), (U32)pxHigherPriorityTaskWoken)
#define traceTASK_PRIORITY_INHERIT( pxTCB, uxPriority ) SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_VTASKPRIORITYINHERIT, (U32)pxMutexHolder)
#define traceTASK_RESUME( pxTCB ) SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_VTASKRESUME, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB))
#define traceINCREASE_TICK_COUNT( xTicksToJump ) SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_VTASKSTEPTICK, xTicksToJump)
#define traceTASK_SUSPEND( pxTCB ) SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_VTASKSUSPEND, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB))
#define traceTASK_PRIORITY_DISINHERIT( pxTCB, uxBasePriority ) SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_XTASKPRIORITYDISINHERIT, (U32)pxMutexHolder)
#define traceTASK_RESUME_FROM_ISR( pxTCB ) SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_XTASKRESUMEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB))
#define traceTASK_NOTIFY(uxIndexToNotify) SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XTASKGENERICNOTIFY, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), ulValue, eAction, (U32)pulPreviousNotificationValue)
#define traceTASK_NOTIFY_FROM_ISR(uxIndexToWait) SEGGER_SYSVIEW_RecordU32x5(apiID_OFFSET + apiID_XTASKGENERICNOTIFYFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), ulValue, eAction, (U32)pulPreviousNotificationValue, (U32)pxHigherPriorityTaskWoken)
#define traceTASK_NOTIFY_WAIT(uxIndexToWait) SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XTASKNOTIFYWAIT, ulBitsToClearOnEntry, ulBitsToClearOnExit, (U32)pulNotificationValue, xTicksToWait)
#define traceQUEUE_CREATE( pxNewQueue ) SEGGER_SYSVIEW_RecordU32x3(apiID_OFFSET + apiID_XQUEUEGENERICCREATE, uxQueueLength, uxItemSize, ucQueueType)
#define traceQUEUE_DELETE( pxQueue ) SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_VQUEUEDELETE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue))
#define traceQUEUE_PEEK( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), xTicksToWait, 1)
#define traceQUEUE_PEEK_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XQUEUEPEEKFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer))
#define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XQUEUEPEEKFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer))
#define traceQUEUE_RECEIVE( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)0), xTicksToWait, 1)
#define traceQUEUE_RECEIVE_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)0), xTicksToWait, 1)
#define traceQUEUE_SEMAPHORE_RECEIVE( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)0), xTicksToWait, 0)
#define traceQUEUE_RECEIVE_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x3(apiID_OFFSET + apiID_XQUEUERECEIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), (U32)pxHigherPriorityTaskWoken)
#define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x3(apiID_OFFSET + apiID_XQUEUERECEIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), (U32)pxHigherPriorityTaskWoken)
#define traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_VQUEUEADDTOREGISTRY, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), (U32)pcQueueName)
#if ( configUSE_QUEUE_SETS != 1 )
#define traceQUEUE_SEND( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pvItemToQueue, xTicksToWait, xCopyPosition)
#else
#define traceQUEUE_SEND( pxQueue ) SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_XQUEUESETSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue))
#endif
#define traceQUEUE_SEND_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pvItemToQueue, xTicksToWait, xCopyPosition)
#define traceQUEUE_SEND_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XQUEUEGENERICSENDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pxHigherPriorityTaskWoken)
#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XQUEUEGENERICSENDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pxHigherPriorityTaskWoken)
#define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XSTREAMBUFFERCREATE, (U32)xIsMessageBuffer, (U32)pxStreamBuffer)
#define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XSTREAMBUFFERCREATE, (U32)xIsMessageBuffer, 0u)
#define traceSTREAM_BUFFER_DELETE( xStreamBuffer ) SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_VSTREAMBUFFERDELETE, (U32)xStreamBuffer)
#define traceSTREAM_BUFFER_RESET( xStreamBuffer ) SEGGER_SYSVIEW_RecordU32 (apiID_OFFSET + apiID_XSTREAMBUFFERRESET, (U32)xStreamBuffer)
#define traceSTREAM_BUFFER_SEND( xStreamBuffer, xBytesSent ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XSTREAMBUFFERSEND, (U32)xStreamBuffer, (U32)xBytesSent)
#define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XSTREAMBUFFERSEND, (U32)xStreamBuffer, 0u)
#define traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xBytesSent ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XSTREAMBUFFERSENDFROMISR, (U32)xStreamBuffer, (U32)xBytesSent)
#define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XSTREAMBUFFERRECEIVE, (U32)xStreamBuffer, (U32)xReceivedLength)
#define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XSTREAMBUFFERRECEIVE, (U32)xStreamBuffer, 0u)
#define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength ) SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_XSTREAMBUFFERRECEIVEFROMISR, (U32)xStreamBuffer, (U32)xReceivedLength)
#endif
#define traceTASK_DELETE( pxTCB ) { \
SEGGER_SYSVIEW_RecordU32(apiID_VTASKDELETE, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB)); \
SYSVIEW_DeleteTask((U32)pxTCB); \
}
#if( portSTACK_GROWTH < 0 )
#define traceTASK_CREATE(pxNewTCB) if (pxNewTCB != NULL) { \
SEGGER_SYSVIEW_OnTaskCreate((U32)pxNewTCB); \
SYSVIEW_AddTask((U32)pxNewTCB, \
&(pxNewTCB->pcTaskName[0]), \
pxNewTCB->uxPriority, \
(U32)pxNewTCB->pxStack, \
((U32)pxNewTCB->pxTopOfStack - (U32)pxNewTCB->pxStack) \
); \
}
#else
#define traceTASK_CREATE(pxNewTCB) if (pxNewTCB != NULL) { \
SEGGER_SYSVIEW_OnTaskCreate((U32)pxNewTCB); \
SYSVIEW_AddTask((U32)pxNewTCB, \
&(pxNewTCB->pcTaskName[0]), \
pxNewTCB->uxPriority, \
(U32)pxNewTCB->pxStack, \
(U32)(pxNewTCB->pxStack-pxNewTCB->pxTopOfStack) \
); \
}
#endif
#define traceTASK_PRIORITY_SET(pxTask, uxNewPriority) { \
SEGGER_SYSVIEW_RecordU32x2(apiID_VTASKPRIORITYSET, \
SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), \
uxNewPriority \
); \
SYSVIEW_UpdateTask((U32)pxTask, \
&(pxTask->pcTaskName[0]), \
uxNewPriority, \
(U32)pxTask->pxStack, \
0 \
); \
}
//
// Define INCLUDE_xTaskGetIdleTaskHandle as 1 in FreeRTOSConfig.h to allow identification of Idle state.
//
#if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
#define traceTASK_SWITCHED_IN() if(prvGetTCBFromHandle(NULL) == xIdleTaskHandles[0]) { \
SEGGER_SYSVIEW_OnIdle(); \
} else { \
SEGGER_SYSVIEW_OnTaskStartExec((U32)pxCurrentTCB); \
}
#else
#define traceTASK_SWITCHED_IN() { \
if (memcmp(pxCurrentTCB->pcTaskName, "IDLE", 5) != 0) { \
SEGGER_SYSVIEW_OnTaskStartExec((U32)pxCurrentTCB); \
} else { \
SEGGER_SYSVIEW_OnIdle(); \
} \
}
#endif
#define traceMOVED_TASK_TO_READY_STATE(pxTCB) SEGGER_SYSVIEW_OnTaskStartReady((U32)pxTCB)
#define traceREADDED_TASK_TO_READY_STATE(pxTCB)
#define traceMOVED_TASK_TO_DELAYED_LIST() SEGGER_SYSVIEW_OnTaskStopReady((U32)pxCurrentTCB, (1u << 2))
#define traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST() SEGGER_SYSVIEW_OnTaskStopReady((U32)pxCurrentTCB, (1u << 2))
#define traceMOVED_TASK_TO_SUSPENDED_LIST(pxTCB) SEGGER_SYSVIEW_OnTaskStopReady((U32)pxTCB, ((3u << 3) | 3))
#define traceISR_EXIT_TO_SCHEDULER() SEGGER_SYSVIEW_RecordExitISRToScheduler()
#define traceISR_EXIT() SEGGER_SYSVIEW_RecordExitISR()
#define traceISR_ENTER() SEGGER_SYSVIEW_RecordEnterISR()
/*********************************************************************
*
* API functions
*
**********************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
void SYSVIEW_AddTask (U32 xHandle, const char* pcTaskName, unsigned uxCurrentPriority, U32 pxStack, unsigned uStackHighWaterMark);
void SYSVIEW_UpdateTask (U32 xHandle, const char* pcTaskName, unsigned uxCurrentPriority, U32 pxStack, unsigned uStackHighWaterMark);
void SYSVIEW_DeleteTask (U32 xHandle);
void SYSVIEW_SendTaskInfo (U32 TaskID, const char* sName, unsigned Prio, U32 StackBase, unsigned StackSize);
#ifdef __cplusplus
}
#endif
#endif
/*************************** End of file ****************************/
@@ -0,0 +1,79 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
--------- END-OF-HEADER --------------------------------------------
File : Main_RTT_MenuApp.c
Purpose : Sample application to demonstrate RTT bi-directional functionality
*/
#define MAIN_C
#include <stdio.h>
#include "SEGGER_RTT.h"
volatile int _Cnt;
volatile int _Delay;
static char r;
/*********************************************************************
*
* main
*/
void main(void) {
SEGGER_RTT_WriteString(0, "SEGGER Real-Time-Terminal Sample\r\n");
SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_NO_BLOCK_SKIP);
do {
r = SEGGER_RTT_WaitKey();
SEGGER_RTT_Write(0, &r, 1);
r++;
} while (1);
}
/*************************** End of file ****************************/
@@ -0,0 +1,107 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
--------- END-OF-HEADER --------------------------------------------
File : Main_RTT_MenuApp.c
Purpose : Sample application to demonstrate RTT bi-directional functionality
*/
#define MAIN_C
#include <stdio.h>
#include "SEGGER_RTT.h"
volatile int _Cnt;
volatile int _Delay;
/*********************************************************************
*
* main
*/
void main(void) {
int r;
int CancelOp;
do {
_Cnt = 0;
SEGGER_RTT_WriteString(0, "SEGGER Real-Time-Terminal Sample\r\n");
SEGGER_RTT_WriteString(0, "Press <1> to continue in blocking mode (Application waits if necessary, no data lost)\r\n");
SEGGER_RTT_WriteString(0, "Press <2> to continue in non-blocking mode (Application does not wait, data lost if fifo full)\r\n");
do {
r = SEGGER_RTT_WaitKey();
} while ((r != '1') && (r != '2'));
if (r == '1') {
SEGGER_RTT_WriteString(0, "\r\nSelected <1>. Configuring RTT and starting...\r\n");
SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL);
} else {
SEGGER_RTT_WriteString(0, "\r\nSelected <2>. Configuring RTT and starting...\r\n");
SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_NO_BLOCK_SKIP);
}
CancelOp = 0;
do {
//for (_Delay = 0; _Delay < 10000; _Delay++);
SEGGER_RTT_printf(0, "Count: %d. Press <Space> to get back to menu.\r\n", _Cnt++);
r = SEGGER_RTT_HasKey();
if (r) {
CancelOp = (SEGGER_RTT_GetKey() == ' ') ? 1 : 0;
}
//
// Check if user selected to cancel the current operation
//
if (CancelOp) {
SEGGER_RTT_WriteString(0, "Operation cancelled, going back to menu...\r\n");
break;
}
} while (1);
SEGGER_RTT_GetKey();
SEGGER_RTT_WriteString(0, "\r\n");
} while (1);
}
/*************************** End of file ****************************/
@@ -0,0 +1,154 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
--------- END-OF-HEADER --------------------------------------------
File : Main_RTT_MenuApp.c
Purpose : Sample application to demonstrate RTT bi-directional functionality
*/
#define MAIN_C
#include <stdio.h>
#include "SEGGER_RTT.h"
volatile int _Cnt;
/*********************************************************************
*
* main
*/
void main(void) {
SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL);
SEGGER_RTT_WriteString(0, "SEGGER Real-Time-Terminal Sample\r\n\r\n");
SEGGER_RTT_WriteString(0, "###### Testing SEGGER_printf() ######\r\n");
SEGGER_RTT_printf(0, "printf Test: %%c, 'S' : %c.\r\n", 'S');
SEGGER_RTT_printf(0, "printf Test: %%5c, 'E' : %5c.\r\n", 'E');
SEGGER_RTT_printf(0, "printf Test: %%-5c, 'G' : %-5c.\r\n", 'G');
SEGGER_RTT_printf(0, "printf Test: %%5.3c, 'G' : %-5c.\r\n", 'G');
SEGGER_RTT_printf(0, "printf Test: %%.3c, 'E' : %-5c.\r\n", 'E');
SEGGER_RTT_printf(0, "printf Test: %%c, 'R' : %c.\r\n", 'R');
SEGGER_RTT_printf(0, "printf Test: %%s, \"RTT\" : %s.\r\n", "RTT");
SEGGER_RTT_printf(0, "printf Test: %%s, \"RTT\\r\\nRocks.\" : %s.\r\n", "RTT\r\nRocks.");
SEGGER_RTT_printf(0, "printf Test: %%u, 12345 : %u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%+u, 12345 : %+u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%.3u, 12345 : %.3u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%.6u, 12345 : %.6u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%6.3u, 12345 : %6.3u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%8.6u, 12345 : %8.6u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%08u, 12345 : %08u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%08.6u, 12345 : %08.6u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%0u, 12345 : %0u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%-.6u, 12345 : %-.6u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%-6.3u, 12345 : %-6.3u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%-8.6u, 12345 : %-8.6u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%-08u, 12345 : %-08u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%-08.6u, 12345 : %-08.6u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%-0u, 12345 : %-0u.\r\n", 12345);
SEGGER_RTT_printf(0, "printf Test: %%u, -12345 : %u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%+u, -12345 : %+u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%.3u, -12345 : %.3u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%.6u, -12345 : %.6u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%6.3u, -12345 : %6.3u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%8.6u, -12345 : %8.6u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%08u, -12345 : %08u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%08.6u, -12345 : %08.6u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%0u, -12345 : %0u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-.6u, -12345 : %-.6u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-6.3u, -12345 : %-6.3u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-8.6u, -12345 : %-8.6u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-08u, -12345 : %-08u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-08.6u, -12345 : %-08.6u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-0u, -12345 : %-0u.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%d, -12345 : %d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%+d, -12345 : %+d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%.3d, -12345 : %.3d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%.6d, -12345 : %.6d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%6.3d, -12345 : %6.3d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%8.6d, -12345 : %8.6d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%08d, -12345 : %08d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%08.6d, -12345 : %08.6d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%0d, -12345 : %0d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-.6d, -12345 : %-.6d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-6.3d, -12345 : %-6.3d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-8.6d, -12345 : %-8.6d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-08d, -12345 : %-08d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-08.6d, -12345 : %-08.6d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%-0d, -12345 : %-0d.\r\n", -12345);
SEGGER_RTT_printf(0, "printf Test: %%x, 0x1234ABC : %x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%+x, 0x1234ABC : %+x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%.3x, 0x1234ABC : %.3x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%.6x, 0x1234ABC : %.6x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%6.3x, 0x1234ABC : %6.3x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%8.6x, 0x1234ABC : %8.6x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%08x, 0x1234ABC : %08x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%08.6x, 0x1234ABC : %08.6x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%0x, 0x1234ABC : %0x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%-.6x, 0x1234ABC : %-.6x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%-6.3x, 0x1234ABC : %-6.3x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%-8.6x, 0x1234ABC : %-8.6x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%-08x, 0x1234ABC : %-08x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%-08.6x, 0x1234ABC : %-08.6x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%-0x, 0x1234ABC : %-0x.\r\n", 0x1234ABC);
SEGGER_RTT_printf(0, "printf Test: %%p, &_Cnt : %p.\r\n", &_Cnt);
SEGGER_RTT_WriteString(0, "###### SEGGER_printf() Tests done. ######\r\n");
do {
_Cnt++;
} while (1);
}
/*************************** End of file ****************************/
@@ -0,0 +1,105 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
--------- END-OF-HEADER --------------------------------------------
File : Main_RTT_SpeedTestApp.c
Purpose : Sample program for measuring RTT performance.
*/
#include "RTOS.h"
#include "BSP.h"
#include "SEGGER_RTT.h"
#include <stdio.h>
OS_STACKPTR int StackHP[128], StackLP[128]; /* Task stacks */
OS_TASK TCBHP, TCBLP; /* Task-control-blocks */
static void HPTask(void) {
while (1) {
//
// Measure time needed for RTT output
// Perform dummy write with 0 characters, so we know the overhead of toggling LEDs and RTT in general
//
// Set BP here. Then start sampling on scope
BSP_ClrLED(0);
SEGGER_RTT_Write(0, 0, 0);
BSP_SetLED(0);
BSP_ClrLED(0);
SEGGER_RTT_Write(0, "01234567890123456789012345678901234567890123456789012345678901234567890123456789\r\n", 82);
BSP_SetLED(0);
// Set BP here. Then stop sampling on scope
OS_Delay(200);
}
}
static void LPTask(void) {
while (1) {
BSP_ToggleLED(1);
OS_Delay (500);
}
}
/*********************************************************************
*
* main
*
*********************************************************************/
int main(void) {
OS_IncDI(); /* Initially disable interrupts */
OS_InitKern(); /* Initialize OS */
OS_InitHW(); /* Initialize Hardware for OS */
BSP_Init(); /* Initialize LED ports */
BSP_SetLED(0);
/* You need to create at least one task before calling OS_Start() */
OS_CREATETASK(&TCBHP, "HP Task", HPTask, 100, StackHP);
OS_CREATETASK(&TCBLP, "LP Task", LPTask, 50, StackLP);
OS_Start(); /* Start multitasking */
return 0;
}
@@ -0,0 +1,102 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_Config_ThreadX.c
Purpose : Sample setup configuration of SystemView with ThreadX.
Revision: $Rev: 7745 $
*/
#include "tx_api.h"
#include "SEGGER_SYSVIEW.h"
extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI;
extern U32 SystemCoreClock;
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
// The application name to be displayed in SystemViewer
#define SYSVIEW_APP_NAME "ThreadX Demo Application"
// The target device name
#define SYSVIEW_DEVICE_NAME "Cortex-M4"
// Frequency of the timestamp. Must match SEGGER_SYSVIEW_GET_TIMESTAMP in SEGGER_SYSVIEW_Conf.h
#define SYSVIEW_TIMESTAMP_FREQ (SystemCoreClock)
// System Frequency.
#define SYSVIEW_CPU_FREQ (SystemCoreClock)
/*********************************************************************
*
* _cbSendSystemDesc()
*
* Function description
* Sends SystemView description strings.
*/
static void _cbSendSystemDesc(void) {
SEGGER_SYSVIEW_SendSysDesc("N=" SEGGER_SYSVIEW_APP_NAME ",O=ThreadX,D="SEGGER_SYSVIEW_DEVICE_NAME);
SEGGER_SYSVIEW_SendSysDesc("I#15=SysTick");
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_Init(SYSVIEW_TIMESTAMP_FREQ, SYSVIEW_CPU_FREQ, &SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
SEGGER_SYSVIEW_SetRAMBase(SEGGER_SYSVIEW_ID_BASE);
}
/*************************** End of file ****************************/
@@ -0,0 +1,403 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_ThreadX.c
Purpose : Interface between ThreadX and SystemView.
Revision: $Rev: 7947 $
*/
#include "tx_api.h"
#include "tx_block_pool.h"
#include "tx_byte_pool.h"
#include "tx_event_flags.h"
#include "tx_semaphore.h"
#include "tx_mutex.h"
#include "tx_queue.h"
#include "tx_thread.h"
#include "tx_timer.h"
#include "SEGGER_SYSVIEW.h"
#include "SEGGER_SYSVIEW_ThreadX.h"
/*********************************************************************
*
* _cbGetTime()
*
* Function description
* This function is part of the link between ThreadX and SYSVIEW.
* Called from SystemView when asked by the host, returns the
* current system time in micro seconds.
*/
static U64 _cbGetTime(void) {
U64 Time;
Time = tx_time_get();
Time /= TX_TIMER_TICKS_PER_SECOND;
Time *= 1000000;
return Time;
}
/*********************************************************************
*
* _SendTaskList()
*
* Function description
* This function is part of the link between ThreadX and SYSVIEW.
* Uses SYSVIEW functions to send the entire task list to the host.
*/
static void _SendTaskList(void) {
TX_THREAD* pThread;
ULONG i;
if (_tx_thread_created_count == 0) {
return;
}
pThread = _tx_thread_created_ptr->tx_thread_created_next;
for (i = 0; i < _tx_thread_created_count; i++) {
SEGGER_SYSVIEW_TASKINFO TaskInfo;
memset(&TaskInfo, 0, sizeof(TaskInfo)); // Fill all elements with 0 to allow extending the structure in future version without breaking the code
TaskInfo.TaskID = TX_POINTER_TO_ULONG_CONVERT(pThread);
TaskInfo.sName = pThread->tx_thread_name;
TaskInfo.Prio = pThread->tx_thread_priority;
TaskInfo.StackBase = TX_POINTER_TO_ULONG_CONVERT(pThread->tx_thread_stack_start);
TaskInfo.StackSize = pThread->tx_thread_stack_size;
SEGGER_SYSVIEW_SendTaskInfo(&TaskInfo);
pThread = pThread->tx_thread_created_next;
}
}
/*********************************************************************
*
* _SendBlockPoolList()
*
* Function description
* This function is part of the link between ThreadX and SYSVIEW.
* Registers all block pools to SystemView.
*/
static void _SendBlockPoolList(void) {
TX_BLOCK_POOL* pBlockPool;
ULONG i;
if (_tx_block_pool_created_count == 0) {
return;
}
pBlockPool = _tx_block_pool_created_ptr->tx_block_pool_created_next;
for (i = 0; i < _tx_block_pool_created_count; i++) {
SEGGER_SYSVIEW_NameResource(TX_POINTER_TO_ULONG_CONVERT(pBlockPool), pBlockPool->tx_block_pool_name);
pBlockPool = pBlockPool->tx_block_pool_created_next;
}
}
/*********************************************************************
*
* _SendBytePoolList()
*
* Function description
* This function is part of the link between ThreadX and SYSVIEW.
* Registers all byte pools to SystemView.
*/
static void _SendBytePoolList(void) {
TX_BYTE_POOL* pBytePool;
ULONG i;
if (_tx_byte_pool_created_count == 0) {
return;
}
pBytePool = _tx_byte_pool_created_ptr->tx_byte_pool_created_next;
for (i = 0; i < _tx_byte_pool_created_count; i++) {
SEGGER_SYSVIEW_NameResource(TX_POINTER_TO_ULONG_CONVERT(pBytePool), pBytePool->tx_byte_pool_name);
pBytePool = pBytePool->tx_byte_pool_created_next;
}
}
/*********************************************************************
*
* _SendEventsFlagsList()
*
* Function description
* This function is part of the link between ThreadX and SYSVIEW.
* Registers all event flags to SystemView.
*/
static void _SendEventsFlagsList(void) {
TX_EVENT_FLAGS_GROUP* pEvent;
ULONG i;
if (_tx_event_flags_created_count == 0) {
return;
}
pEvent = _tx_event_flags_created_ptr->tx_event_flags_group_created_next;
for (i = 0; i < _tx_event_flags_created_count; i++) {
SEGGER_SYSVIEW_NameResource(TX_POINTER_TO_ULONG_CONVERT(pEvent), pEvent->tx_event_flags_group_name);
pEvent = pEvent->tx_event_flags_group_created_next;
}
}
/*********************************************************************
*
* _SendSemaphoreList()
*
* Function description
* This function is part of the link between ThreadX and SYSVIEW.
* Registers all semaphores to SystemView.
*/
static void _SendSemaphoreList(void) {
TX_SEMAPHORE* pSemaphore;
ULONG i;
if (_tx_semaphore_created_count == 0) {
return;
}
pSemaphore = _tx_semaphore_created_ptr->tx_semaphore_created_next;
for (i = 0; i < _tx_semaphore_created_count; i++) {
SEGGER_SYSVIEW_NameResource(TX_POINTER_TO_ULONG_CONVERT(pSemaphore), pSemaphore->tx_semaphore_name);
pSemaphore = pSemaphore->tx_semaphore_created_next;
}
}
/*********************************************************************
*
* _SendTimerList()
*
* Function description
* This function is part of the link between ThreadX and SYSVIEW.
* Registers all timers to SystemView.
*/
static void _SendTimerList(void) {
TX_TIMER* pTimer;
ULONG i;
if (_tx_timer_created_count == 0) {
return;
}
pTimer = _tx_timer_created_ptr->tx_timer_created_next;
for (i = 0; i < _tx_timer_created_count; i++) {
SEGGER_SYSVIEW_NameResource(TX_POINTER_TO_ULONG_CONVERT(&pTimer->tx_timer_internal), pTimer->tx_timer_name);
pTimer = pTimer->tx_timer_created_next;
}
}
/*********************************************************************
*
* _SendMutexList()
*
* Function description
* This function is part of the link between ThreadX and SYSVIEW.
* Registers all mutexes to SystemView.
*/
static void _SendMutexList(void) {
TX_MUTEX* pMutex;
ULONG i;
if (_tx_mutex_created_count == 0) {
return;
}
pMutex = _tx_mutex_created_ptr->tx_mutex_created_next;
for (i = 0; i < _tx_mutex_created_count; i++) {
SEGGER_SYSVIEW_NameResource(TX_POINTER_TO_ULONG_CONVERT(pMutex), pMutex->tx_mutex_name);
pMutex = pMutex->tx_mutex_created_next;
}
}
/*********************************************************************
*
* _SendQueueList()
*
* Function description
* This function is part of the link between ThreadX and SYSVIEW.
* Registers all queues to SystemView.
*/
static void _SendQueueList(void) {
TX_QUEUE* pQueue;
ULONG i;
if (_tx_queue_created_count == 0) {
return;
}
pQueue = _tx_queue_created_ptr->tx_queue_created_next;
for (i = 0; i < _tx_queue_created_count; i++) {
SEGGER_SYSVIEW_NameResource(TX_POINTER_TO_ULONG_CONVERT(pQueue), pQueue->tx_queue_name);
pQueue = pQueue->tx_queue_created_next;
}
}
/*********************************************************************
*
* _cbSendTaskList()
*
* Function description
* This function is part of the link between ThreadX and SYSVIEW.
* Called from SystemView when asked by the host, it uses SYSVIEW
* functions to send the entire resource list to the host.
*/
static void _cbSendResourceList(void) {
_SendTaskList();
_SendSemaphoreList();
_SendMutexList();
_SendQueueList();
_SendEventsFlagsList();
_SendBytePoolList();
_SendBlockPoolList();
_SendTimerList();
}
/*********************************************************************
*
* Global functions
*
**********************************************************************
*/
/*********************************************************************
*
* SYSVIEW_EnterTimer()
*
* Function description
* Record a SystemView EnterTimer event.
*/
void SYSVIEW_EnterTimer(void) {
SEGGER_SYSVIEW_RecordEnterTimer((U32)_tx_timer_current_ptr);
}
/*********************************************************************
*
* SYSVIEW_ExitTimer()
*
* Function description
* Record a SystemView ExitTimer event.
*/
void SYSVIEW_ExitTimer(void) {
SEGGER_SYSVIEW_RecordExitTimer();
}
/*********************************************************************
*
* trace_task_stop()
*
* Function description
* Record a SystemView TaskStopReady event.
*/
void trace_task_stop(void) {
TX_THREAD *pThread;
if (SEGGER_SYSVIEW_IsStarted() > 0) {
TX_THREAD_GET_CURRENT(pThread);
if (pThread != TX_NULL) {
SEGGER_SYSVIEW_OnTaskStopReady(TX_POINTER_TO_ULONG_CONVERT(pThread), pThread->tx_thread_state);
}
}
if (_tx_thread_execute_ptr == TX_NULL) {
SEGGER_SYSVIEW_OnIdle();
}
}
/*********************************************************************
*
* trace_task_exec()
*
* Function description
* Record a SystemView TaskStartExec event.
*/
void trace_task_exec(void) {
TX_THREAD *pThread;
if (SEGGER_SYSVIEW_IsStarted() > 0) {
TX_THREAD_GET_CURRENT(pThread);
if (pThread != TX_NULL) {
SEGGER_SYSVIEW_OnTaskStartExec(TX_POINTER_TO_ULONG_CONVERT(pThread));
}
}
}
/*********************************************************************
*
* trace_isr_enter()
*
* Function description
* Record a SystemView ISREntry event.
*/
void trace_isr_enter(void) {
SEGGER_SYSVIEW_RecordEnterISR();
}
/*********************************************************************
*
* trace_isr_exit()
*
* Function description
* Record a SystemView ISRExit event.
*/
void trace_isr_exit(void) {
if (_tx_thread_execute_ptr != TX_NULL) {
SEGGER_SYSVIEW_RecordExitISRToScheduler();
} else {
SEGGER_SYSVIEW_RecordExitISR();
}
}
/*********************************************************************
*
* Public API structures
*
**********************************************************************
*/
// Callbacks provided to SYSTEMVIEW by ThreadX
const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI = {
_cbGetTime,
_cbSendResourceList,
};
/*************************** End of file ****************************/
@@ -0,0 +1,228 @@
/*********************************************************************
* SEGGER Microcontroller GmbH *
* The Embedded Experts *
**********************************************************************
* *
* (c) 1995 - 2024 SEGGER Microcontroller GmbH *
* *
* www.segger.com Support: support@segger.com *
* *
**********************************************************************
* *
* SEGGER SystemView * Real-time application analysis *
* *
**********************************************************************
* *
* All rights reserved. *
* *
* SEGGER strongly recommends to not make any changes *
* to or modify the source code of this software in order to stay *
* compatible with the SystemView and RTT protocol, and J-Link. *
* *
* Redistribution and use in source and binary forms, with or *
* without modification, are permitted provided that the following *
* condition is met: *
* *
* o Redistributions of source code must retain the above copyright *
* notice, this condition and the following disclaimer. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
* DAMAGE. *
* *
**********************************************************************
* *
* SystemView version: 3.60e *
* *
**********************************************************************
-------------------------- END-OF-HEADER -----------------------------
File : SEGGER_SYSVIEW_ThreadX.h
Purpose : Interface between ThreadX and SystemView.
Revision: $Rev: 7745 $
Notes:
*/
#include "SEGGER_SYSVIEW.h"
#ifndef SEGGER_SEGGER_SYSVIEW_THREADX_H_
#define SEGGER_SEGGER_SYSVIEW_THREADX_H_
#define TRACE_API_TX_KERNEL_ENTER (32u)
#define TRACE_API_TX_BLOCK_ALLOCATE (33u)
#define TRACE_API_TX_BLOCK_POOL_CREATE (34u)
#define TRACE_API_TX_BLOCK_POOL_DELETE (35u)
#define TRACE_API_TX_BLOCK_POOL_INFO_GET (36u)
#define TRACE_API_TX_BLOCK_POOL_PERFORMANCE_INFO_GET (37u)
#define TRACE_API_TX_BLOCK_POOL_PERFORMANCE_SYSTEM_INFO_GET (38u)
#define TRACE_API_TX_BLOCK_PRIORITIZE (39u)
#define TRACE_API_TX_BLOCK_RELEASE (40u)
#define TRACE_API_TX_BYTE_ALLOCATE (41u)
#define TRACE_API_TX_BYTE_POOL_CREATE (42u)
#define TRACE_API_TX_BYTE_POOL_DELETE (43u)
#define TRACE_API_TX_BYTE_POOL_INFO_GET (44u)
#define TRACE_API_TX_BYTE_POOL_PERFORMANCE_INFO_GET (45u)
#define TRACE_API_TX_BYTE_POOL_PERFORMANCE_SYSTEM_INFO_GET (46u)
#define TRACE_API_TX_BYTE_POOL_PRIORITIZE (47u)
#define TRACE_API_TX_BYTE_POOL_RELEASE (48u)
#define TRACE_API_TX_EVENT_FLAGS_CREATE (49u)
#define TRACE_API_TX_EVENT_FLAGS_DELETE (50u)
#define TRACE_API_TX_EVENT_FLAGS_GET (51u)
#define TRACE_API_TX_EVENT_FLAGS_INFO_GET (52u)
#define TRACE_API_TX_EVENT_FLAGS_PERFORMANCE_INFO_GET (53u)
#define TRACE_API_TX_EVENT_FLAGS_PERFORMANCE_SYSTEM_INFO_GET (54u)
#define TRACE_API_TX_EVENT_FLAGS_SET (55u)
#define TRACE_API_TX_EVENT_FLAGS_NOTIFY (56u)
#define TRACE_API_TX_INTERRUPT_CONTROL (57u)
#define TRACE_API_TX_MUTEX_CREATE (58u)
#define TRACE_API_TX_MUTEX_DELETE (59u)
#define TRACE_API_TX_MUTEX_GET (60u)
#define TRACE_API_TX_MUTEX_INFO_GET (61u)
#define TRACE_API_TX_MUTEX_PERFORMANCE_INFO_GET (62u)
#define TRACE_API_TX_MUTEX_PERFORMANCE_SYSTEM_INFO_GET (63u)
#define TRACE_API_TX_MUTEX_PRIORITIZE (64u)
#define TRACE_API_TX_MUTEX_PUT (65u)
#define TRACE_API_TX_QUEUE_CREATE (66u)
#define TRACE_API_TX_QUEUE_DELETE (67u)
#define TRACE_API_TX_QUEUE_FLUSH (68u)
#define TRACE_API_TX_QUEUE_FRONT_SEND (69u)
#define TRACE_API_TX_QUEUE_INFO_GET (70u)
#define TRACE_API_TX_QUEUE_PERFORMACE_INFO_GET (71u)
#define TRACE_API_TX_QUEUE_PERFORMACE_SYSTEM_INFO_GET (72u)
#define TRACE_API_TX_QUEUE_PRIORITIZE (73u)
#define TRACE_API_TX_QUEUE_RECEIVE (74u)
#define TRACE_API_TX_QUEUE_SEND (75u)
#define TRACE_API_TX_QUEUE_NOTIFY (76u)
#define TRACE_API_TX_SEMAPHORE_CEILING_PUT (77u)
#define TRACE_API_TX_SEMAPHORE_CREATE (78u)
#define TRACE_API_TX_SEMAPHORE_DELETE (79u)
#define TRACE_API_TX_SEMAPHORE_GET (80u)
#define TRACE_API_TX_SEMAPHORE_INFO_GET (81u)
#define TRACE_API_TX_SEMAPHORE_PERFORMANCE_INFO_GET (82u)
#define TRACE_API_TX_SEMAPHORE_PERFORMANCE_SYSTEM_INFO_GET (83u)
#define TRACE_API_TX_SEMAPHORE_PRIORITIZE (84u)
#define TRACE_API_TX_SEMAPHORE_PUT (85u)
#define TRACE_API_TX_SEMAPHORE_PUT_NOTIFY (86u)
#define TRACE_API_TX_THREAD_CREATE (87u)
#define TRACE_API_TX_THREAD_DELETE (88u)
#define TRACE_API_TX_THREAD_ENTRY_EXIT (89u)
#define TRACE_API_TX_THREAD_IDENTIFY (90u)
#define TRACE_API_TX_THREAD_INFO_GET (91u)
#define TRACE_API_TX_THREAD_PERFOMANCE_INFO_GET (92u)
#define TRACE_API_TX_THREAD_PERFOMANCE_SYSTEM_INFO_GET (93u)
#define TRACE_API_TX_THREAD_PREEMTION_CHANGE (94u)
#define TRACE_API_TX_THREAD_PRIORITY_CHANGE (95u)
#define TRACE_API_TX_THREAD_RELINQUISH (96u)
#define TRACE_API_TX_THREAD_RESET (97u)
#define TRACE_API_TX_THREAD_RESUME (98u)
#define TRACE_API_TX_THREAD_SLEEP (99u)
#define TRACE_API_TX_THREAD_STACK_ERROR_NOTIFY (100u)
#define TRACE_API_TX_THREAD_SUSPEND (101u)
#define TRACE_API_TX_THREAD_TERMINATE (102u)
#define TRACE_API_TX_THREAD_TIME_SLICE_CHANGE (103u)
#define TRACE_API_TX_THREAD_WAIT_ABORT (104u)
#define TRACE_API_TX_TIME_GET (105u)
#define TRACE_API_TX_TIME_SET (106u)
#define TRACE_API_TX_TIMER_ACTIVATE (107u)
#define TRACE_API_TX_TIMER_CHANGE (108u)
#define TRACE_API_TX_TIMER_CREATE (109u)
#define TRACE_API_TX_TIMER_DEACTIVATE (110u)
#define TRACE_API_TX_TIMER_DELETE (111u)
#define TRACE_API_TX_TIMER_INFO_GET (112u)
#define TRACE_API_TX_TIMER_PERFORMANCE_INFO_GET (113u)
#define TRACE_API_TX_TIMER_PERFORMANCE_SYSTEM_INFO_GET (114u)
#define TRACE_API_TXE_BLOCK_ALLOCATE (115u)
#define TRACE_API_TXE_BLOCK_POOL_CREATE (116u)
#define TRACE_API_TXE_BLOCK_POOL_DELETE (117u)
#define TRACE_API_TXE_BLOCK_POOL_INFO_GET (118u)
#define TRACE_API_TXE_BLOCK_PRIORITIZE (119u)
#define TRACE_API_TXE_BLOCK_RELEASE (120u)
#define TRACE_API_TXE_BYTE_ALLOCATE (121u)
#define TRACE_API_TXE_BYTE_POOL_CREATE (122u)
#define TRACE_API_TXE_BYTE_POOL_DELETE (123u)
#define TRACE_API_TXE_BYTE_POOL_INFO_GET (124u)
#define TRACE_API_TXE_BYTE_PRIORITIZE (125u)
#define TRACE_API_TXE_BYTE_RELEASE (126u)
#define TRACE_API_TXE_EVENT_FLAGS_CREATE (127u)
#define TRACE_API_TXE_EVENT_FLAGS_DELETE (128u)
#define TRACE_API_TXE_EVENT_FLAGS_GET (129u)
#define TRACE_API_TXE_EVENT_FLAGS_INFO_GET (130u)
#define TRACE_API_TXE_EVENT_FLAGS_SET (131u)
#define TRACE_API_TXE_EVENT_FLAGS_NOTIFY (132u)
#define TRACE_API_TXE_MUTEX_CREATE (133u)
#define TRACE_API_TXE_MUTEX_DELETE (134u)
#define TRACE_API_TXE_MUTEX_GET (135u)
#define TRACE_API_TXE_MUTEX_INFO_GET (136u)
#define TRACE_API_TXE_MUTEX_PRIORITIZE (137u)
#define TRACE_API_TXE_MUTEX_PUT (138u)
#define TRACE_API_TXE_QUEUE_CREATE (139u)
#define TRACE_API_TXE_QUEUE_DELETE (140u)
#define TRACE_API_TXE_QUEUE_FLUSH (141u)
#define TRACE_API_TXE_QUEUE_FRONT_SEND (142u)
#define TRACE_API_TXE_QUEUE_INFO_GET (143u)
#define TRACE_API_TXE_QUEUE_PRIORITIZE (144u)
#define TRACE_API_TXE_QUEUE_RECEIVE (145u)
#define TRACE_API_TXE_QUEUE_SEND (146u)
#define TRACE_API_TXE_QUEUE_NOTIFY (147u)
#define TRACE_API_TXE_SEMAPHORE_CEILING_PUT (148u)
#define TRACE_API_TXE_SEMAPHORE_CREATE (149u)
#define TRACE_API_TXE_SEMAPHORE_DELETE (150u)
#define TRACE_API_TXE_SEMAPHORE_GET (151u)
#define TRACE_API_TXE_SEMAPHORE_INFO_GET (152u)
#define TRACE_API_TXE_SEMAPHORE_PRIORITIZE (153u)
#define TRACE_API_TXE_SEMAPHORE_PUT (154u)
#define TRACE_API_TXE_SEMAPHORE_PUT_NOTIFY (155u)
#define TRACE_API_TXE_THREAD_CREATE (156u)
#define TRACE_API_TXE_THREAD_DELETE (157u)
#define TRACE_API_TXE_THREAD_ENTRY_EXIT (158u)
#define TRACE_API_TXE_THREAD_INFO_GET (159u)
#define TRACE_API_TXE_THREAD_PREEMTION_CHANGE (160u)
#define TRACE_API_TXE_THREAD_PRIORITY_CHANGE (161u)
#define TRACE_API_TXE_THREAD_RELINQUISH (162u)
#define TRACE_API_TXE_THREAD_RESET (163u)
#define TRACE_API_TXE_THREAD_RESUME (164u)
#define TRACE_API_TXE_THREAD_SUSPEND (165u)
#define TRACE_API_TXE_THREAD_TERMINATE (166u)
#define TRACE_API_TXE_THREAD_TIME_SLICE_CHANGE (167u)
#define TRACE_API_TXE_THREAD_WAIT_ABORT (168u)
#define TRACE_API_TXE_TIMER_ACTIVATE (169u)
#define TRACE_API_TXE_TIMER_CHANGE (170u)
#define TRACE_API_TXE_TIMER_CREATE (171u)
#define TRACE_API_TXE_TIMER_DEACTIVATE (172u)
#define TRACE_API_TXE_TIMER_DELETE (173u)
#define TRACE_API_TXE_TIMER_INFO_GET (174u)
#define TRACE_RECORD_VOID(a) SEGGER_SYSVIEW_RecordVoid(a)
#define TRACE_RECORD_U32(a, b) SEGGER_SYSVIEW_RecordU32(a, b)
#define TRACE_RECORD_U32x2(a, b, c) SEGGER_SYSVIEW_RecordU32x2(a, b, c)
#define TRACE_RECORD_U32x3(a, b, c, d) SEGGER_SYSVIEW_RecordU32x3(a, b, c, d)
#define TRACE_RECORD_U32x4(a, b, c, d, e) SEGGER_SYSVIEW_RecordU32x4(a, b, c, d, e)
#define TRACE_RECORD_U32x5(a, b, c, d, e, f) SEGGER_SYSVIEW_RecordU32x5(a, b, c, d, e, f)
#define TRACE_RECORD_U32x6(a, b, c, d, e, f, g) SEGGER_SYSVIEW_RecordU32x6(a, b, c, d, e, f, g)
#define TRACE_RECORD_U32x7(a, b, c, d, e, f, g, h) SEGGER_SYSVIEW_RecordU32x7(a, b, c, d, e, f, g, h)
#define TRACE_RECORD_U32x8(a, b, c, d, e, f, g, h, i) SEGGER_SYSVIEW_RecordU32x8(a, b, c, d, e, f, g, h, i)
#define TRACE_RECORD_U32x9(a, b, c, d, e, f, g, h, i, j) SEGGER_SYSVIEW_RecordU32x9(a, b, c, d, e, f, g, h, i, j)
#define TRACE_RECORD_U32x10(a, b, c, d, e, f, g, h, i, j, k) SEGGER_SYSVIEW_RecordU32x10(a, b, c, d, e, f, g, h, i, j, k)
#define TRACE_RECORD_ENTER_TIMER(a) SEGGER_SYSVIEW_RecordEnterTimer(a);
#define TRACE_RECORD_EXIT_TIMER() SEGGER_SYSVIEW_RecordExitTimer();
#define TRACE_RECORD_END_CALL(a) SEGGER_SYSVIEW_RecordEndCall(a)
#define TRACE_RECORD_END_CALL_U32(a, b) SEGGER_SYSVIEW_RecordEndCallU32(a, b)
#define TRACE_NAME_RESOURCE(a, b) SEGGER_SYSVIEW_NameResource(a, b);
#define TRACE_ON_TASK_START_READY(a) SEGGER_SYSVIEW_OnTaskStartReady(a);
#endif /* SEGGER_SEGGER_SYSVIEW_THREADX_H_ */