diff --git a/cores/nRF5/sysview/Config/Global.h b/cores/nRF5/sysview/Config/Global.h index 97b3ab55..7a819cb8 100644 --- a/cores/nRF5/sysview/Config/Global.h +++ b/cores/nRF5/sysview/Config/Global.h @@ -52,7 +52,7 @@ * * ********************************************************************** * * -* SystemView version: V2.50 * +* SystemView version: V2.52d * * * ********************************************************************** ---------------------------------------------------------------------- diff --git a/cores/nRF5/sysview/Config/SEGGER_RTT_Conf.h b/cores/nRF5/sysview/Config/SEGGER_RTT_Conf.h index ea72f71d..45abb069 100644 --- a/cores/nRF5/sysview/Config/SEGGER_RTT_Conf.h +++ b/cores/nRF5/sysview/Config/SEGGER_RTT_Conf.h @@ -52,7 +52,7 @@ * * ********************************************************************** * * -* SystemView version: V2.50 * +* SystemView version: V2.52d * * * ********************************************************************** ---------------------------END-OF-HEADER------------------------------ @@ -60,7 +60,7 @@ 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: 6249 $ +Revision: $Rev: 12706 $ */ @@ -88,6 +88,28 @@ Revision: $Rev: 6249 $ #define SEGGER_RTT_MODE_DEFAULT SEGGER_RTT_MODE_NO_BLOCK_SKIP // Mode for pre-initialized terminal channel (buffer 0) +#define USE_RTT_ASM (0) // Use assembler version of SEGGER_RTT.c when 1 + +/********************************************************************* +* +* 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. +*/ +#define SEGGER_RTT_MEMCPY_USE_BYTELOOP 0 // 0: Use memcpy/SEGGER_RTT_MEMCPY, 1: Use a simple byte-loop +// +// 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. @@ -111,7 +133,7 @@ Revision: $Rev: 6249 $ * Rowley CrossStudio and GCC */ #if (defined __SES_ARM) || (defined __CROSSWORKS_ARM) || (defined __GNUC__) - #ifdef __ARM_ARCH_6M__ + #if (defined __ARM_ARCH_6M__) || (defined __ARM_ARCH_8M_BASE__) #define SEGGER_RTT_LOCK() { \ unsigned int LockState; \ __asm volatile ("mrs %0, primask \n\t" \ @@ -220,6 +242,20 @@ Revision: $Rev: 6249 $ } #endif +/********************************************************************* +* +* RTT lock configuration for IAR RL78 +*/ +#ifdef __ICCRL78__ + #define SEGGER_RTT_LOCK() { \ + __istate_t LockState; \ + LockState = __get_interrupt_state(); \ + __disable_interrupt(); + + #define SEGGER_RTT_UNLOCK() __set_interrupt_state(LockState); \ + } +#endif + /********************************************************************* * * RTT lock configuration for KEIL ARM diff --git a/cores/nRF5/sysview/Config/SEGGER_SYSVIEW_Conf.h b/cores/nRF5/sysview/Config/SEGGER_SYSVIEW_Conf.h index a6fef389..98c35f82 100644 --- a/cores/nRF5/sysview/Config/SEGGER_SYSVIEW_Conf.h +++ b/cores/nRF5/sysview/Config/SEGGER_SYSVIEW_Conf.h @@ -52,14 +52,14 @@ * * ********************************************************************** * * -* SystemView version: V2.50 * +* SystemView version: V2.52d * * * ********************************************************************** -------------------------- END-OF-HEADER ----------------------------- File : SEGGER_SYSVIEW_Conf.h Purpose : SEGGER SystemView configuration. -Revision: $Rev: 6249 $ +Revision: $Rev: 12706 $ */ #ifndef SEGGER_SYSVIEW_CONF_H @@ -79,8 +79,8 @@ Revision: $Rev: 6249 $ #define SEGGER_SYSVIEW_CORE_CM3 2 // Cortex-M3/M4/M7 #define SEGGER_SYSVIEW_CORE_RX 3 // Renesas RX -#if (defined __SES_ARM) || (defined __CROSSWORKS_ARM) || (defined __GNUC__) - #ifdef __ARM_ARCH_6M__ +#if (defined __SES_ARM) || (defined __CROSSWORKS_ARM) || (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__)) #define SEGGER_SYSVIEW_CORE SEGGER_SYSVIEW_CORE_CM3 @@ -123,7 +123,7 @@ Revision: $Rev: 6249 $ * * SystemView buffer configuration */ -#define SEGGER_SYSVIEW_RTT_BUFFER_SIZE 2*1024 // Number of bytes that SystemView uses for the buffer. +#define SEGGER_SYSVIEW_RTT_BUFFER_SIZE 1024 // Number of bytes that SystemView uses for the buffer. #define SEGGER_SYSVIEW_RTT_CHANNEL 1 // The RTT channel that SystemView will use. 0: Auto selection #define SEGGER_SYSVIEW_USE_STATIC_BUFFER 1 // Use a static buffer to generate events instead of a buffer on the stack @@ -157,7 +157,11 @@ Revision: $Rev: 6249 $ #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__ > 6100000) #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 diff --git a/cores/nRF5/sysview/Config/SEGGER_SYSVIEW_Config_FreeRTOS.c b/cores/nRF5/sysview/Config/SEGGER_SYSVIEW_Config_FreeRTOS.c new file mode 100644 index 00000000..ed9a02ba --- /dev/null +++ b/cores/nRF5/sysview/Config/SEGGER_SYSVIEW_Config_FreeRTOS.c @@ -0,0 +1,63 @@ +/********************************************************************* +* (c) 1995 - 2018 SEGGER Microcontroller GmbH * +* The Embedded Experts * +* www.segger.com * +********************************************************************** + +-------------------------- END-OF-HEADER ----------------------------- + +File : SEGGER_SYSVIEW_Config_FreeRTOS.c +Purpose : Sample setup configuration of SystemView with FreeRTOS. +Revision: $Rev: 7745 $ +*/ +#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 "Adafruit Bluefruit" + +// The target device name +#define SYSVIEW_DEVICE_NAME "nRF52" + +// 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 (0x20000000) + +/********************************************************************* +* +* _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 ****************************/ diff --git a/cores/nRF5/sysview/SEGGER/SEGGER.h b/cores/nRF5/sysview/SEGGER/SEGGER.h index c24699aa..058228dd 100644 --- a/cores/nRF5/sysview/SEGGER/SEGGER.h +++ b/cores/nRF5/sysview/SEGGER/SEGGER.h @@ -52,7 +52,7 @@ * * ********************************************************************** * * -* SystemView version: V2.50 * +* SystemView version: V2.52d * * * ********************************************************************** ---------------------------------------------------------------------- diff --git a/cores/nRF5/sysview/SEGGER/SEGGER_RTT.c b/cores/nRF5/sysview/SEGGER/SEGGER_RTT.c index 0bfc125b..823f94ed 100644 --- a/cores/nRF5/sysview/SEGGER/SEGGER_RTT.c +++ b/cores/nRF5/sysview/SEGGER/SEGGER_RTT.c @@ -52,7 +52,7 @@ * * ********************************************************************** * * -* SystemView version: V2.50 * +* SystemView version: V2.52d * * * ********************************************************************** ---------------------------END-OF-HEADER------------------------------ @@ -60,7 +60,7 @@ File : SEGGER_RTT.c 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: 6249 $ +Revision: $Rev: 12706 $ Additional information: Type "int" is assumed to be 32-bits in size @@ -140,8 +140,16 @@ Additional information: #define STRLEN(a) strlen((a)) #endif -#ifndef MEMCPY - #define MEMCPY(pDest, pSrc, NumBytes) memcpy((pDest), (pSrc), (NumBytes)) +#ifndef SEGGER_RTT_MEMCPY_USE_BYTELOOP + #define SEGGER_RTT_MEMCPY_USE_BYTELOOP 0 +#endif + +#ifndef SEGGER_RTT_MEMCPY + #ifdef MEMCPY + #define SEGGER_RTT_MEMCPY(pDest, pSrc, NumBytes) MEMCPY((pDest), (pSrc), (NumBytes)) + #else + #define SEGGER_RTT_MEMCPY(pDest, pSrc, NumBytes) memcpy((pDest), (pSrc), (NumBytes)) + #endif #endif #ifndef MIN @@ -329,6 +337,9 @@ static unsigned _WriteBlocking(SEGGER_RTT_BUFFER_UP* pRing, const char* pBuffer, unsigned NumBytesWritten; unsigned RdOff; unsigned WrOff; +#if SEGGER_RTT_MEMCPY_USE_BYTELOOP + char* pDst; +#endif // // Write data to buffer and handle wrap-around if necessary // @@ -343,11 +354,21 @@ static unsigned _WriteBlocking(SEGGER_RTT_BUFFER_UP* pRing, const char* pBuffer, } NumBytesToWrite = MIN(NumBytesToWrite, (pRing->SizeOfBuffer - WrOff)); // Number of bytes that can be written until buffer wrap-around NumBytesToWrite = MIN(NumBytesToWrite, NumBytes); - memcpy(pRing->pBuffer + WrOff, pBuffer, NumBytesToWrite); +#if SEGGER_RTT_MEMCPY_USE_BYTELOOP + pDst = pRing->pBuffer + WrOff; + NumBytesWritten += NumBytesToWrite; + NumBytes -= NumBytesToWrite; + WrOff += NumBytesToWrite; + while (NumBytesToWrite--) { + *pDst++ = *pBuffer++; + }; +#else + SEGGER_RTT_MEMCPY(pRing->pBuffer + WrOff, pBuffer, NumBytesToWrite); NumBytesWritten += NumBytesToWrite; pBuffer += NumBytesToWrite; NumBytes -= NumBytesToWrite; WrOff += NumBytesToWrite; +#endif if (WrOff == pRing->SizeOfBuffer) { WrOff = 0u; } @@ -379,6 +400,9 @@ static void _WriteNoCheck(SEGGER_RTT_BUFFER_UP* pRing, const char* pData, unsign unsigned NumBytesAtOnce; unsigned WrOff; unsigned Rem; +#if SEGGER_RTT_MEMCPY_USE_BYTELOOP + char* pDst; +#endif WrOff = pRing->WrOff; Rem = pRing->SizeOfBuffer - WrOff; @@ -386,17 +410,40 @@ static void _WriteNoCheck(SEGGER_RTT_BUFFER_UP* pRing, const char* pData, unsign // // All data fits before wrap around // - memcpy(pRing->pBuffer + WrOff, pData, NumBytes); +#if SEGGER_RTT_MEMCPY_USE_BYTELOOP + pDst = pRing->pBuffer + WrOff; + WrOff += NumBytes; + while (NumBytes--) { + *pDst++ = *pData++; + }; + pRing->WrOff = WrOff; +#else + SEGGER_RTT_MEMCPY(pRing->pBuffer + WrOff, pData, NumBytes); pRing->WrOff = WrOff + NumBytes; +#endif } else { // // We reach the end of the buffer, so need to wrap around // +#if SEGGER_RTT_MEMCPY_USE_BYTELOOP + pDst = pRing->pBuffer + WrOff; NumBytesAtOnce = Rem; - memcpy(pRing->pBuffer + WrOff, pData, NumBytesAtOnce); + while (NumBytesAtOnce--) { + *pDst++ = *pData++; + }; + pDst = pRing->pBuffer; NumBytesAtOnce = NumBytes - Rem; - memcpy(pRing->pBuffer, pData + Rem, NumBytesAtOnce); + while (NumBytesAtOnce--) { + *pDst++ = *pData++; + }; + pRing->WrOff = NumBytes - Rem; +#else + NumBytesAtOnce = Rem; + SEGGER_RTT_MEMCPY(pRing->pBuffer + WrOff, pData, NumBytesAtOnce); + NumBytesAtOnce = NumBytes - Rem; + SEGGER_RTT_MEMCPY(pRing->pBuffer, pData + Rem, NumBytesAtOnce); pRing->WrOff = NumBytesAtOnce; +#endif } } @@ -414,11 +461,11 @@ static void _WriteNoCheck(SEGGER_RTT_BUFFER_UP* pRing, const char* pData, unsign * TerminalId Terminal ID to switch to. */ static void _PostTerminalSwitch(SEGGER_RTT_BUFFER_UP* pRing, unsigned char TerminalId) { - char ac[2]; + unsigned char ac[2]; ac[0] = 0xFFu; ac[1] = _aTerminalId[TerminalId]; // Caller made already sure that TerminalId does not exceed our terminal limit - _WriteBlocking(pRing, ac, 2u); + _WriteBlocking(pRing, (const char*)ac, 2u); } /********************************************************************* @@ -483,6 +530,9 @@ unsigned SEGGER_RTT_ReadNoLock(unsigned BufferIndex, void* pData, unsigned Buffe unsigned WrOff; unsigned char* pBuffer; SEGGER_RTT_BUFFER_DOWN* pRing; +#if SEGGER_RTT_MEMCPY_USE_BYTELOOP + const char* pSrc; +#endif // INIT(); pRing = &_SEGGER_RTT.aDown[BufferIndex]; @@ -496,11 +546,21 @@ unsigned SEGGER_RTT_ReadNoLock(unsigned BufferIndex, void* pData, unsigned Buffe if (RdOff > WrOff) { NumBytesRem = pRing->SizeOfBuffer - RdOff; NumBytesRem = MIN(NumBytesRem, BufferSize); - memcpy(pBuffer, pRing->pBuffer + RdOff, NumBytesRem); +#if SEGGER_RTT_MEMCPY_USE_BYTELOOP + pSrc = pRing->pBuffer + RdOff; + NumBytesRead += NumBytesRem; + BufferSize -= NumBytesRem; + RdOff += NumBytesRem; + while (NumBytesRem--) { + *pBuffer++ = *pSrc++; + }; +#else + SEGGER_RTT_MEMCPY(pBuffer, pRing->pBuffer + RdOff, NumBytesRem); NumBytesRead += NumBytesRem; pBuffer += NumBytesRem; BufferSize -= NumBytesRem; RdOff += NumBytesRem; +#endif // // Handle wrap-around of buffer // @@ -514,11 +574,21 @@ unsigned SEGGER_RTT_ReadNoLock(unsigned BufferIndex, void* pData, unsigned Buffe NumBytesRem = WrOff - RdOff; NumBytesRem = MIN(NumBytesRem, BufferSize); if (NumBytesRem > 0u) { - memcpy(pBuffer, pRing->pBuffer + RdOff, NumBytesRem); +#if SEGGER_RTT_MEMCPY_USE_BYTELOOP + pSrc = pRing->pBuffer + RdOff; + NumBytesRead += NumBytesRem; + BufferSize -= NumBytesRem; + RdOff += NumBytesRem; + while (NumBytesRem--) { + *pBuffer++ = *pSrc++; + }; +#else + SEGGER_RTT_MEMCPY(pBuffer, pRing->pBuffer + RdOff, NumBytesRem); NumBytesRead += NumBytesRem; pBuffer += NumBytesRem; BufferSize -= NumBytesRem; RdOff += NumBytesRem; +#endif } if (NumBytesRead) { pRing->RdOff = RdOff; @@ -586,6 +656,9 @@ void SEGGER_RTT_WriteWithOverwriteNoLock(unsigned BufferIndex, const void* pBuff const char* pData; SEGGER_RTT_BUFFER_UP* pRing; unsigned Avail; +#if SEGGER_RTT_MEMCPY_USE_BYTELOOP + char* pDst; +#endif pData = (const char *)pBuffer; // @@ -617,26 +690,35 @@ void SEGGER_RTT_WriteWithOverwriteNoLock(unsigned BufferIndex, const void* pBuff // // Last round // -#if 1 // memcpy() is good for large amounts of data, but the overhead is too big for small amounts. Use a simple byte loop instead. - char* pDst; +#if SEGGER_RTT_MEMCPY_USE_BYTELOOP pDst = pRing->pBuffer + pRing->WrOff; - pRing->WrOff += NumBytes; - do { + Avail = NumBytes; + while (NumBytes--) { *pDst++ = *pData++; - } while (--NumBytes); + }; + pRing->WrOff += Avail; #else - memcpy(pRing->pBuffer + WrOff, pData, NumBytes); + SEGGER_RTT_MEMCPY(pRing->pBuffer + pRing->WrOff, pData, NumBytes); pRing->WrOff += NumBytes; #endif - break; //Alternatively: NumBytes = 0; + break; } else { // // Wrap-around necessary, write until wrap-around and reset WrOff // - memcpy(pRing->pBuffer + pRing->WrOff, pData, Avail); +#if SEGGER_RTT_MEMCPY_USE_BYTELOOP + pDst = pRing->pBuffer + pRing->WrOff; + NumBytes -= Avail; + while (Avail--) { + *pDst++ = *pData++; + }; + pRing->WrOff = 0; +#else + SEGGER_RTT_MEMCPY(pRing->pBuffer + pRing->WrOff, pData, Avail); pData += Avail; pRing->WrOff = 0; NumBytes -= Avail; +#endif Avail = (pRing->SizeOfBuffer - 1); } } while (NumBytes); @@ -673,6 +755,9 @@ unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pBuffer, u unsigned RdOff; unsigned WrOff; unsigned Rem; +#if SEGGER_RTT_MEMCPY_USE_BYTELOOP + char* pDst; +#endif pData = (const char *)pBuffer; // @@ -700,16 +785,15 @@ unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pBuffer, u // Avail = pRing->SizeOfBuffer - 1u - WrOff ; if (Avail >= NumBytes) { -#if 1 // memcpy() is good for large amounts of data, but the overhead is too big for small amounts. Use a simple byte loop instead. - char* pDst; +#if SEGGER_RTT_MEMCPY_USE_BYTELOOP pDst = pRing->pBuffer + WrOff; WrOff += NumBytes; - do { + while (NumBytes--) { *pDst++ = *pData++; - } while (--NumBytes); - pRing->WrOff = WrOff + NumBytes; + }; + pRing->WrOff = WrOff; #else - memcpy(pRing->pBuffer + WrOff, pData, NumBytes); + SEGGER_RTT_MEMCPY(pRing->pBuffer + WrOff, pData, NumBytes); pRing->WrOff = WrOff + NumBytes; #endif return 1; @@ -727,23 +811,55 @@ unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pBuffer, u // Rem = pRing->SizeOfBuffer - WrOff; // Space until end of buffer if (Rem > NumBytes) { - memcpy(pRing->pBuffer + WrOff, pData, NumBytes); +#if SEGGER_RTT_MEMCPY_USE_BYTELOOP + pDst = pRing->pBuffer + WrOff; + WrOff += NumBytes; + while (NumBytes--) { + *pDst++ = *pData++; + }; + pRing->WrOff = WrOff; +#else + SEGGER_RTT_MEMCPY(pRing->pBuffer + WrOff, pData, NumBytes); pRing->WrOff = WrOff + NumBytes; +#endif } else { // // We reach the end of the buffer, so need to wrap around // - memcpy(pRing->pBuffer + WrOff, pData, Rem); - memcpy(pRing->pBuffer, pData + Rem, NumBytes - Rem); +#if SEGGER_RTT_MEMCPY_USE_BYTELOOP + pDst = pRing->pBuffer + WrOff; + NumBytes -= Rem; + WrOff = NumBytes; + do { + *pDst++ = *pData++; + } while (--Rem); + pDst = pRing->pBuffer; + while (NumBytes--) { + *pDst++ = *pData++; + }; + pRing->WrOff = WrOff; +#else + SEGGER_RTT_MEMCPY(pRing->pBuffer + WrOff, pData, Rem); + SEGGER_RTT_MEMCPY(pRing->pBuffer, pData + Rem, NumBytes - Rem); pRing->WrOff = NumBytes - Rem; +#endif } return 1; } } else { Avail = RdOff - WrOff - 1u; if (Avail >= NumBytes) { - memcpy(pRing->pBuffer + WrOff, pData, NumBytes); +#if SEGGER_RTT_MEMCPY_USE_BYTELOOP + pDst = pRing->pBuffer + WrOff; + WrOff += NumBytes; + while (NumBytes--) { + *pDst++ = *pData++; + }; + pRing->WrOff = WrOff; +#else + SEGGER_RTT_MEMCPY(pRing->pBuffer + WrOff, pData, NumBytes); pRing->WrOff = WrOff + NumBytes; +#endif return 1; } } @@ -771,7 +887,7 @@ unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pBuffer, u * Number of bytes which have been stored in the "Up"-buffer. * * Notes -* (1) If there is not enough space in the "Up"-buffer, remaining characters of pBuffer are dropped. +* (1) Data is stored according to buffer flags. * (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. @@ -845,7 +961,7 @@ unsigned SEGGER_RTT_WriteNoLock(unsigned BufferIndex, const void* pBuffer, unsig * Number of bytes which have been stored in the "Up"-buffer. * * Notes -* (1) If there is not enough space in the "Up"-buffer, remaining characters of pBuffer are dropped. +* (1) Data is stored according to buffer flags. */ unsigned SEGGER_RTT_Write(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes) { unsigned Status; @@ -880,8 +996,7 @@ unsigned SEGGER_RTT_Write(unsigned BufferIndex, const void* pBuffer, unsigned Nu * Number of bytes which have been stored in the "Up"-buffer. * * Notes -* (1) If there is not enough space in the "Up"-buffer, depending on configuration, -* remaining characters may be dropped or RTT module waits until there is more space in the buffer. +* (1) Data is stored according to buffer flags. * (2) String passed to this function has to be \0 terminated * (3) \0 termination character is *not* stored in RTT buffer */ @@ -892,6 +1007,178 @@ unsigned SEGGER_RTT_WriteString(unsigned BufferIndex, const char* s) { return SEGGER_RTT_Write(BufferIndex, s, Len); } +/********************************************************************* +* +* SEGGER_RTT_PutCharSkipNoLock +* +* Function description +* Stores a single character/byte in SEGGER RTT buffer. +* SEGGER_RTT_PutCharSkipNoLock does not lock the application and +* skips the byte, if it does not fit into the buffer. +* +* Parameters +* BufferIndex Index of "Up"-buffer to be used (e.g. 0 for "Terminal"). +* c Byte to be stored. +* +* Return value +* Number of bytes which have been stored in the "Up"-buffer. +* +* Notes +* (1) If there is not enough space in the "Up"-buffer, the character 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. +*/ + +unsigned SEGGER_RTT_PutCharSkipNoLock(unsigned BufferIndex, char c) { + SEGGER_RTT_BUFFER_UP* pRing; + unsigned WrOff; + unsigned Status; + // + // Get "to-host" ring buffer. + // + pRing = &_SEGGER_RTT.aUp[BufferIndex]; + // + // Get write position and handle wrap-around if necessary + // + WrOff = pRing->WrOff + 1; + if (WrOff == pRing->SizeOfBuffer) { + WrOff = 0; + } + // + // Output byte if free space is available + // + if (WrOff != pRing->RdOff) { + pRing->pBuffer[pRing->WrOff] = c; + pRing->WrOff = WrOff; + Status = 1; + } else { + Status = 0; + } + // + return Status; +} + +/********************************************************************* +* +* SEGGER_RTT_PutCharSkip +* +* Function description +* Stores a single character/byte in SEGGER RTT buffer. +* +* Parameters +* BufferIndex Index of "Up"-buffer to be used (e.g. 0 for "Terminal"). +* c Byte to be stored. +* +* Return value +* Number of bytes which have been stored in the "Up"-buffer. +* +* Notes +* (1) If there is not enough space in the "Up"-buffer, the character is dropped. +*/ + +unsigned SEGGER_RTT_PutCharSkip(unsigned BufferIndex, char c) { + SEGGER_RTT_BUFFER_UP* pRing; + unsigned WrOff; + unsigned Status; + // + // Prepare + // + INIT(); + SEGGER_RTT_LOCK(); + // + // Get "to-host" ring buffer. + // + pRing = &_SEGGER_RTT.aUp[BufferIndex]; + // + // Get write position and handle wrap-around if necessary + // + WrOff = pRing->WrOff + 1; + if (WrOff == pRing->SizeOfBuffer) { + WrOff = 0; + } + // + // Output byte if free space is available + // + if (WrOff != pRing->RdOff) { + pRing->pBuffer[pRing->WrOff] = c; + pRing->WrOff = WrOff; + Status = 1; + } else { + Status = 0; + } + // + // Finish up. + // + SEGGER_RTT_UNLOCK(); + // + return Status; +} + + /********************************************************************* +* +* SEGGER_RTT_PutChar +* +* Function description +* Stores a single character/byte in SEGGER RTT buffer. +* +* Parameters +* BufferIndex Index of "Up"-buffer to be used (e.g. 0 for "Terminal"). +* c Byte to be stored. +* +* Return value +* Number of bytes which have been stored in the "Up"-buffer. +* +* Notes +* (1) Data is stored according to buffer flags. +*/ + +unsigned SEGGER_RTT_PutChar(unsigned BufferIndex, char c) { + SEGGER_RTT_BUFFER_UP* pRing; + unsigned WrOff; + unsigned Status; + // + // Prepare + // + INIT(); + SEGGER_RTT_LOCK(); + // + // Get "to-host" ring buffer. + // + pRing = &_SEGGER_RTT.aUp[BufferIndex]; + // + // Get write position and handle wrap-around if necessary + // + WrOff = pRing->WrOff + 1; + if (WrOff == pRing->SizeOfBuffer) { + WrOff = 0; + } + // + // Wait for free space if mode is set to blocking + // + if (pRing->Flags == SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL) { + while (WrOff == pRing->RdOff) { + ; + } + } + // + // Output byte if free space is available + // + if (WrOff != pRing->RdOff) { + pRing->pBuffer[pRing->WrOff] = c; + pRing->WrOff = WrOff; + Status = 1; + } else { + Status = 0; + } + // + // Finish up. + // + SEGGER_RTT_UNLOCK(); + // + return Status; +} + /********************************************************************* * * SEGGER_RTT_GetKey @@ -993,6 +1280,27 @@ unsigned SEGGER_RTT_HasData(unsigned BufferIndex) { return v - pRing->RdOff; } +/********************************************************************* +* +* SEGGER_RTT_HasDataUp +* +* Function description +* Check if there is data remaining to be sent in the given buffer. +* +* Return value: +* ==0: No data +* !=0: Data in buffer +* +*/ +unsigned SEGGER_RTT_HasDataUp(unsigned BufferIndex) { + SEGGER_RTT_BUFFER_UP* pRing; + unsigned v; + + pRing = &_SEGGER_RTT.aUp[BufferIndex]; + v = pRing->RdOff; + return pRing->WrOff - v; +} + /********************************************************************* * * SEGGER_RTT_AllocDownBuffer @@ -1329,7 +1637,7 @@ void SEGGER_RTT_Init (void) { * < 0 Error (e.g. if RTT is configured for non-blocking mode and there was no space in the buffer to set the new terminal Id) */ int SEGGER_RTT_SetTerminal (char TerminalId) { - char ac[2]; + unsigned char ac[2]; SEGGER_RTT_BUFFER_UP* pRing; unsigned Avail; int r; @@ -1337,19 +1645,19 @@ int SEGGER_RTT_SetTerminal (char TerminalId) { INIT(); // r = 0; - ac[0] = 0xFFU; + ac[0] = 0xFFu; if ((unsigned char)TerminalId < (unsigned char)sizeof(_aTerminalId)) { // We only support a certain number of channels ac[1] = _aTerminalId[(unsigned char)TerminalId]; pRing = &_SEGGER_RTT.aUp[0]; // Buffer 0 is always reserved for terminal I/O, so we can use index 0 here, fixed SEGGER_RTT_LOCK(); // Lock to make sure that no other task is writing into buffer, while we are and number of free bytes in buffer does not change downwards after checking and before writing if ((pRing->Flags & SEGGER_RTT_MODE_MASK) == SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL) { _ActiveTerminal = TerminalId; - _WriteBlocking(pRing, ac, 2u); + _WriteBlocking(pRing, (const char*)ac, 2u); } else { // Skipping mode or trim mode? => We cannot trim this command so handling is the same for both modes Avail = _GetAvailWriteSpace(pRing); if (Avail >= 2) { _ActiveTerminal = TerminalId; // Only change active terminal in case of success - _WriteNoCheck(pRing, ac, 2u); + _WriteNoCheck(pRing, (const char*)ac, 2u); } else { r = -1; } @@ -1397,7 +1705,7 @@ int SEGGER_RTT_TerminalOut (char TerminalId, const char* s) { // Need to be able to change terminal, write data, change back. // Compute the fixed and variable sizes. // - FragLen = strlen(s); + FragLen = STRLEN(s); // // How we output depends upon the mode... // diff --git a/cores/nRF5/sysview/SEGGER/SEGGER_RTT.h b/cores/nRF5/sysview/SEGGER/SEGGER_RTT.h index 727d7dcc..7baf00a1 100644 --- a/cores/nRF5/sysview/SEGGER/SEGGER_RTT.h +++ b/cores/nRF5/sysview/SEGGER/SEGGER_RTT.h @@ -52,7 +52,7 @@ * * ********************************************************************** * * -* SystemView version: V2.50 * +* SystemView version: V2.52d * * * ********************************************************************** ---------------------------END-OF-HEADER------------------------------ @@ -60,7 +60,7 @@ 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: 4351 $ +Revision: $Rev: 12706 $ ---------------------------------------------------------------------- */ @@ -146,6 +146,7 @@ int SEGGER_RTT_ConfigDownBuffer (unsigned BufferIndex, const cha 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); @@ -159,6 +160,9 @@ unsigned SEGGER_RTT_WriteNoLock (unsigned BufferIndex, const voi unsigned SEGGER_RTT_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); // // Function macro for performance optimization // @@ -203,44 +207,44 @@ int SEGGER_RTT_printf(unsigned BufferIndex, const char * sFormat, ...); // Control sequences, based on ANSI. // Can be used to control color, and clear the screen // -#define RTT_CTRL_RESET "" // Reset to default colors -#define RTT_CTRL_CLEAR "" // Clear screen, reposition cursor to top left +#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 "" -#define RTT_CTRL_TEXT_RED "" -#define RTT_CTRL_TEXT_GREEN "" -#define RTT_CTRL_TEXT_YELLOW "" -#define RTT_CTRL_TEXT_BLUE "" -#define RTT_CTRL_TEXT_MAGENTA "" -#define RTT_CTRL_TEXT_CYAN "" -#define RTT_CTRL_TEXT_WHITE "" +#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 "" -#define RTT_CTRL_TEXT_BRIGHT_RED "" -#define RTT_CTRL_TEXT_BRIGHT_GREEN "" -#define RTT_CTRL_TEXT_BRIGHT_YELLOW "" -#define RTT_CTRL_TEXT_BRIGHT_BLUE "" -#define RTT_CTRL_TEXT_BRIGHT_MAGENTA "" -#define RTT_CTRL_TEXT_BRIGHT_CYAN "" -#define RTT_CTRL_TEXT_BRIGHT_WHITE "" +#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 "" -#define RTT_CTRL_BG_RED "" -#define RTT_CTRL_BG_GREEN "" -#define RTT_CTRL_BG_YELLOW "" -#define RTT_CTRL_BG_BLUE "" -#define RTT_CTRL_BG_MAGENTA "" -#define RTT_CTRL_BG_CYAN "" -#define RTT_CTRL_BG_WHITE "" +#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 "" -#define RTT_CTRL_BG_BRIGHT_RED "" -#define RTT_CTRL_BG_BRIGHT_GREEN "" -#define RTT_CTRL_BG_BRIGHT_YELLOW "" -#define RTT_CTRL_BG_BRIGHT_BLUE "" -#define RTT_CTRL_BG_BRIGHT_MAGENTA "" -#define RTT_CTRL_BG_BRIGHT_CYAN "" -#define RTT_CTRL_BG_BRIGHT_WHITE "" +#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 diff --git a/cores/nRF5/sysview/SEGGER/SEGGER_SYSVIEW.c b/cores/nRF5/sysview/SEGGER/SEGGER_SYSVIEW.c index 1d8904e7..441a8574 100644 --- a/cores/nRF5/sysview/SEGGER/SEGGER_SYSVIEW.c +++ b/cores/nRF5/sysview/SEGGER/SEGGER_SYSVIEW.c @@ -52,14 +52,14 @@ * * ********************************************************************** * * -* SystemView version: V2.50 * +* SystemView version: V2.52d * * * ********************************************************************** -------------------------- END-OF-HEADER ----------------------------- File : SEGGER_SYSVIEW.c Purpose : System visualization API implementation. -Revision: $Rev: 6414 $ +Revision: $Rev: 12706 $ Additional information: Packet format: @@ -1195,7 +1195,7 @@ static void _VPrintTarget(const char* sFormat, U32 Options, va_list* pParamList) /********************************************************************* * -* Public functions +* Public code * ********************************************************************** */ @@ -2833,5 +2833,30 @@ void SEGGER_SYSVIEW_DisableEvents(U32 DisableMask) { _SYSVIEW_Globals.DisabledEvents |= DisableMask; } +/********************************************************************* +* +* SEGGER_SYSVIEW_IsStarted() +* +* Function description +* Handle incoming packets if any and check if recording is started. +* +* Return value +* 0: Recording not started. +* > 0: Recording started. +*/ +int SEGGER_SYSVIEW_IsStarted(void) { + // + // Check if host is sending data which needs to be processed. + // + if (SEGGER_RTT_HASDATA(CHANNEL_ID_DOWN)) { + if (_SYSVIEW_Globals.RecursionCnt == 0) { // Avoid uncontrolled nesting. This way, this routine can call itself once, but no more often than that. + _SYSVIEW_Globals.RecursionCnt = 1; + _HandleIncomingPacket(); + _SYSVIEW_Globals.RecursionCnt = 0; + } + } + return _SYSVIEW_Globals.EnableState; +} + /*************************** End of file ****************************/ diff --git a/cores/nRF5/sysview/SEGGER/SEGGER_SYSVIEW.h b/cores/nRF5/sysview/SEGGER/SEGGER_SYSVIEW.h index 7407ea58..d1ccc607 100644 --- a/cores/nRF5/sysview/SEGGER/SEGGER_SYSVIEW.h +++ b/cores/nRF5/sysview/SEGGER/SEGGER_SYSVIEW.h @@ -52,13 +52,13 @@ * * ********************************************************************** * * -* SystemView version: V2.50 * +* SystemView version: V2.52d * * * ********************************************************************** -------------------------- END-OF-HEADER ----------------------------- File : SEGGER_SYSVIEW.h Purpose : System visualization API. -Revision: $Rev: 5497 $ +Revision: $Rev: 12706 $ */ #ifndef SEGGER_SYSVIEW_H @@ -230,6 +230,7 @@ void SEGGER_SYSVIEW_GetSysDesc (void); void SEGGER_SYSVIEW_SendTaskList (void); void SEGGER_SYSVIEW_SendTaskInfo (const SEGGER_SYSVIEW_TASKINFO* pInfo); void SEGGER_SYSVIEW_SendSysDesc (const char* sSysDesc); +int SEGGER_SYSVIEW_IsStarted (void); /********************************************************************* * diff --git a/cores/nRF5/sysview/SEGGER/SEGGER_SYSVIEW_ConfDefaults.h b/cores/nRF5/sysview/SEGGER/SEGGER_SYSVIEW_ConfDefaults.h index c95ff34c..4cd45614 100644 --- a/cores/nRF5/sysview/SEGGER/SEGGER_SYSVIEW_ConfDefaults.h +++ b/cores/nRF5/sysview/SEGGER/SEGGER_SYSVIEW_ConfDefaults.h @@ -52,14 +52,14 @@ * * ********************************************************************** * * -* SystemView version: V2.50 * +* SystemView version: V2.52d * * * ********************************************************************** -------------------------- END-OF-HEADER ----------------------------- File : SEGGER_SYSVIEW_ConfDefaults.h Purpose : Defines defaults for configurable defines used in SEGGER SystemView. -Revision: $Rev: 6414 $ +Revision: $Rev: 12706 $ */ #ifndef SEGGER_SYSVIEW_CONFDEFAULTS_H diff --git a/cores/nRF5/sysview/SEGGER/SEGGER_SYSVIEW_Int.h b/cores/nRF5/sysview/SEGGER/SEGGER_SYSVIEW_Int.h index 7cf22a16..25013e05 100644 --- a/cores/nRF5/sysview/SEGGER/SEGGER_SYSVIEW_Int.h +++ b/cores/nRF5/sysview/SEGGER/SEGGER_SYSVIEW_Int.h @@ -52,13 +52,13 @@ * * ********************************************************************** * * -* SystemView version: V2.50 * +* SystemView version: V2.52d * * * ********************************************************************** -------------------------- END-OF-HEADER ----------------------------- File : SEGGER_SYSVIEW_Int.h Purpose : SEGGER SystemView internal header. -Revision: $Rev: 5068 $ +Revision: $Rev: 12706 $ */ #ifndef SEGGER_SYSVIEW_INT_H diff --git a/cores/nRF5/sysview/SEGGER_SYSVIEW_Config_FreeRTOS.c b/cores/nRF5/sysview/SEGGER_SYSVIEW_Config_FreeRTOS.c deleted file mode 100644 index 822c5866..00000000 --- a/cores/nRF5/sysview/SEGGER_SYSVIEW_Config_FreeRTOS.c +++ /dev/null @@ -1,114 +0,0 @@ -/********************************************************************* -* SEGGER Microcontroller GmbH & Co. KG * -* The Embedded Experts * -********************************************************************** -* * -* (c) 2015 - 2017 SEGGER Microcontroller GmbH & Co. KG * -* * -* 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 RTT protocol and J-Link. * -* * -* Redistribution and use in source and binary forms, with or * -* without modification, are permitted provided that the following * -* conditions are met: * -* * -* o Redistributions of source code must retain the above copyright * -* notice, this list of conditions and the following disclaimer. * -* * -* o Redistributions in binary form must reproduce the above * -* copyright notice, this list of conditions and the following * -* disclaimer in the documentation and/or other materials provided * -* with the distribution. * -* * -* o Neither the name of SEGGER Microcontroller GmbH & Co. KG * -* nor the names of its contributors may be used to endorse or * -* promote products derived from this software without specific * -* prior written permission. * -* * -* 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: V2.50 * -* * -********************************************************************** --------------------------- END-OF-HEADER ----------------------------- - -File : SEGGER_SYSVIEW_Config_FreeRTOS.c -Purpose : Sample setup configuration of SystemView with FreeRTOS. -Revision: $Rev: 3734 $ -*/ -#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 "Adafruit Bluefruit" - -// The target device name -#define SYSVIEW_DEVICE_NAME "nrf52" - -// 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 (0x20000000) - -/********************************************************************* -* -* _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 ****************************/ diff --git a/cores/nRF5/sysview/SEGGER_SYSVIEW_FreeRTOS.c b/cores/nRF5/sysview/SEGGER_SYSVIEW_FreeRTOS.c index 6d7f9095..1da67747 100644 --- a/cores/nRF5/sysview/SEGGER_SYSVIEW_FreeRTOS.c +++ b/cores/nRF5/sysview/SEGGER_SYSVIEW_FreeRTOS.c @@ -1,65 +1,14 @@ /********************************************************************* -* SEGGER Microcontroller GmbH & Co. KG * +* (c) 1995 - 2018 SEGGER Microcontroller GmbH * * The Embedded Experts * +* www.segger.com * ********************************************************************** -* * -* (c) 2015 - 2017 SEGGER Microcontroller GmbH & Co. KG * -* * -* 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 RTT protocol and J-Link. * -* * -* Redistribution and use in source and binary forms, with or * -* without modification, are permitted provided that the following * -* conditions are met: * -* * -* o Redistributions of source code must retain the above copyright * -* notice, this list of conditions and the following disclaimer. * -* * -* o Redistributions in binary form must reproduce the above * -* copyright notice, this list of conditions and the following * -* disclaimer in the documentation and/or other materials provided * -* with the distribution. * -* * -* o Neither the name of SEGGER Microcontroller GmbH & Co. KG * -* nor the names of its contributors may be used to endorse or * -* promote products derived from this software without specific * -* prior written permission. * -* * -* 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: V2.50 * -* * -********************************************************************** + -------------------------- END-OF-HEADER ----------------------------- File : SEGGER_SYSVIEW_FreeRTOS.c Purpose : Interface between FreeRTOS and SystemView. -Revision: $Rev: 3734 $ +Revision: $Rev: 7947 $ */ #include "FreeRTOS.h" #include "task.h" @@ -187,6 +136,47 @@ void SYSVIEW_UpdateTask(U32 xHandle, const char* pcTaskName, unsigned uxCurrentP } } +/********************************************************************* +* +* 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() @@ -206,47 +196,6 @@ void SYSVIEW_SendTaskInfo(U32 TaskID, const char* sName, unsigned Prio, U32 Stac SEGGER_SYSVIEW_SendTaskInfo(&TaskInfo); } -/********************************************************************* -* -* SYSVIEW_RecordU32x4() -* -* Function description -* Record an event with 4 parameters -*/ -void SYSVIEW_RecordU32x4(unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3) { - U8 aPacket[SEGGER_SYSVIEW_INFO_SIZE + 4 * SEGGER_SYSVIEW_QUANTA_U32]; - U8* pPayload; - // - pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket); // Prepare the packet for SystemView - pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para0); // Add the first parameter to the packet - pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para1); // Add the second parameter to the packet - pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para2); // Add the third parameter to the packet - pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para3); // Add the fourth parameter to the packet - // - SEGGER_SYSVIEW_SendPacket(&aPacket[0], pPayload, Id); // Send the packet -} - -/********************************************************************* -* -* SYSVIEW_RecordU32x5() -* -* Function description -* Record an event with 5 parameters -*/ -void SYSVIEW_RecordU32x5(unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4) { - U8 aPacket[SEGGER_SYSVIEW_INFO_SIZE + 5 * SEGGER_SYSVIEW_QUANTA_U32]; - U8* pPayload; - // - pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket); // Prepare the packet for SystemView - pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para0); // Add the first parameter to the packet - pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para1); // Add the second parameter to the packet - pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para2); // Add the third parameter to the packet - pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para3); // Add the fourth parameter to the packet - pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, Para4); // Add the fifth parameter to the packet - // - SEGGER_SYSVIEW_SendPacket(&aPacket[0], pPayload, Id); // Send the packet -} - /********************************************************************* * * Public API structures diff --git a/cores/nRF5/sysview/SEGGER_SYSVIEW_FreeRTOS.h b/cores/nRF5/sysview/SEGGER_SYSVIEW_FreeRTOS.h index 409024ff..9de9909f 100644 --- a/cores/nRF5/sysview/SEGGER_SYSVIEW_FreeRTOS.h +++ b/cores/nRF5/sysview/SEGGER_SYSVIEW_FreeRTOS.h @@ -1,65 +1,14 @@ /********************************************************************* -* SEGGER Microcontroller GmbH & Co. KG * +* (c) 1995 - 2018 SEGGER Microcontroller GmbH * * The Embedded Experts * +* www.segger.com * ********************************************************************** -* * -* (c) 2015 - 2017 SEGGER Microcontroller GmbH & Co. KG * -* * -* 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 RTT protocol and J-Link. * -* * -* Redistribution and use in source and binary forms, with or * -* without modification, are permitted provided that the following * -* conditions are met: * -* * -* o Redistributions of source code must retain the above copyright * -* notice, this list of conditions and the following disclaimer. * -* * -* o Redistributions in binary form must reproduce the above * -* copyright notice, this list of conditions and the following * -* disclaimer in the documentation and/or other materials provided * -* with the distribution. * -* * -* o Neither the name of SEGGER Microcontroller GmbH & Co. KG * -* nor the names of its contributors may be used to endorse or * -* promote products derived from this software without specific * -* prior written permission. * -* * -* 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: V2.50 * -* * -********************************************************************** + -------------------------- END-OF-HEADER ----------------------------- File : SEGGER_SYSVIEW_FreeRTOS.h Purpose : Interface between FreeRTOS and SystemView. -Revision: $Rev: 3734 $ +Revision: $Rev: 7745 $ Notes: (1) Include this file at the end of FreeRTOSConfig.h @@ -194,40 +143,64 @@ Notes: #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 traceTASK_NOTIFY_TAKE() SEGGER_SYSVIEW_RecordU32x2(apiID_OFFSET + apiID_ULTASKNOTIFYTAKE, xClearCountOnExit, xTicksToWait) -#define traceTASK_DELAY() SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_VTASKDELAY, xTicksToDelay) -#define traceTASK_DELAY_UNTIL() SEGGER_SYSVIEW_RecordVoid(apiID_OFFSET + apiID_VTASKDELAYUNTIL) -#define traceTASK_DELETE( pxTCB ) SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_VTASKDELETE, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB)) -#define traceTASK_NOTIFY_GIVE_FROM_ISR() 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() SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XTASKGENERICNOTIFY, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), ulValue, eAction, (U32)pulPreviousNotificationValue) -#define traceTASK_NOTIFY_FROM_ISR() SYSVIEW_RecordU32x5(apiID_OFFSET + apiID_XTASKGENERICNOTIFYFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), ulValue, eAction, (U32)pulPreviousNotificationValue, (U32)pxHigherPriorityTaskWoken) -#define traceTASK_NOTIFY_WAIT() SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XTASKNOTIFYWAIT, ulBitsToClearOnEntry, ulBitsToClearOnExit, (U32)pulNotificationValue, xTicksToWait) +#define traceTASK_NOTIFY_TAKE() 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() 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() SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XTASKGENERICNOTIFY, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), ulValue, eAction, (U32)pulPreviousNotificationValue) +#define traceTASK_NOTIFY_FROM_ISR() SEGGER_SYSVIEW_RecordU32x5(apiID_OFFSET + apiID_XTASKGENERICNOTIFYFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), ulValue, eAction, (U32)pulPreviousNotificationValue, (U32)pxHigherPriorityTaskWoken) +#define traceTASK_NOTIFY_WAIT() 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 ) SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), xTicksToWait, xJustPeeking) -#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 ) SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), xTicksToWait, xJustPeeking) -#define traceQUEUE_RECEIVE_FAILED( pxQueue ) SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), xTicksToWait, xJustPeeking) -#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) +#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 ) SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pvItemToQueue, xTicksToWait, xCopyPosition) + #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 ) SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), 0, 0, xCopyPosition) + #define traceQUEUE_SEND( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), 0u, 0u, xCopyPosition) #endif -#define traceQUEUE_SEND_FAILED( pxQueue ) 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 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) + + +#define traceTASK_DELETE( pxTCB ) { \ + SEGGER_SYSVIEW_RecordU32(apiID_OFFSET + apiID_VTASKDELETE, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB)); \ + SYSVIEW_DeleteTask((U32)pxTCB); \ + } + #if( portSTACK_GROWTH < 0 ) #define traceTASK_CREATE(pxNewTCB) if (pxNewTCB != NULL) { \ @@ -304,9 +277,8 @@ 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); -void SYSVIEW_RecordU32x4 (unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3); -void SYSVIEW_RecordU32x5 (unsigned Id, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4); #ifdef __cplusplus }