From 18e5627a865fae892d7332f9cac77dc01424b58e Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Tue, 24 Jan 2023 17:48:40 +0700 Subject: [PATCH] sys_view: upgrade to version 3.42 --- components/app_trace/sys_view/Config/Global.h | 2 +- .../sys_view/Config/SEGGER_RTT_Conf.h | 2 +- .../sys_view/Config/SEGGER_SYSVIEW_Conf.h | 2 +- components/app_trace/sys_view/SEGGER/SEGGER.h | 2 +- .../app_trace/sys_view/SEGGER/SEGGER_RTT.h | 2 +- .../sys_view/SEGGER/SEGGER_SYSVIEW.c | 193 +++++++++++++++++- .../sys_view/SEGGER/SEGGER_SYSVIEW.h | 13 +- .../SEGGER/SEGGER_SYSVIEW_ConfDefaults.h | 2 +- .../sys_view/SEGGER/SEGGER_SYSVIEW_Int.h | 2 +- .../esp/SEGGER_SYSVIEW_Config_FreeRTOS.c | 28 +-- .../FreeRTOSV10.4/SEGGER_SYSVIEW_FreeRTOS.c | 2 +- .../FreeRTOSV10.4/SEGGER_SYSVIEW_FreeRTOS.h | 2 +- tools/ci/check_copyright_config.yaml | 1 - 13 files changed, 212 insertions(+), 41 deletions(-) diff --git a/components/app_trace/sys_view/Config/Global.h b/components/app_trace/sys_view/Config/Global.h index 5886cbfb6e..ed2de5c3e9 100644 --- a/components/app_trace/sys_view/Config/Global.h +++ b/components/app_trace/sys_view/Config/Global.h @@ -47,7 +47,7 @@ * * ********************************************************************** * * -* SystemView version: 3.32 * +* SystemView version: 3.42 * * * ********************************************************************** ---------------------------------------------------------------------- diff --git a/components/app_trace/sys_view/Config/SEGGER_RTT_Conf.h b/components/app_trace/sys_view/Config/SEGGER_RTT_Conf.h index 0e4dd04cb2..2049b18d5b 100644 --- a/components/app_trace/sys_view/Config/SEGGER_RTT_Conf.h +++ b/components/app_trace/sys_view/Config/SEGGER_RTT_Conf.h @@ -47,7 +47,7 @@ * * ********************************************************************** * * -* SystemView version: 3.32 * +* SystemView version: 3.42 * * * ********************************************************************** ---------------------------END-OF-HEADER------------------------------ diff --git a/components/app_trace/sys_view/Config/SEGGER_SYSVIEW_Conf.h b/components/app_trace/sys_view/Config/SEGGER_SYSVIEW_Conf.h index 0ff7273034..b4bc13515d 100644 --- a/components/app_trace/sys_view/Config/SEGGER_SYSVIEW_Conf.h +++ b/components/app_trace/sys_view/Config/SEGGER_SYSVIEW_Conf.h @@ -47,7 +47,7 @@ * * ********************************************************************** * * -* SystemView version: 3.32 * +* SystemView version: 3.42 * * * ********************************************************************** -------------------------- END-OF-HEADER ----------------------------- diff --git a/components/app_trace/sys_view/SEGGER/SEGGER.h b/components/app_trace/sys_view/SEGGER/SEGGER.h index bbabce812f..be33c34ca0 100644 --- a/components/app_trace/sys_view/SEGGER/SEGGER.h +++ b/components/app_trace/sys_view/SEGGER/SEGGER.h @@ -49,7 +49,7 @@ * * ********************************************************************** * * -* SystemView version: 3.32 * +* SystemView version: 3.42 * * * ********************************************************************** ---------------------------------------------------------------------- diff --git a/components/app_trace/sys_view/SEGGER/SEGGER_RTT.h b/components/app_trace/sys_view/SEGGER/SEGGER_RTT.h index 5d27d69847..0fdb2f7177 100644 --- a/components/app_trace/sys_view/SEGGER/SEGGER_RTT.h +++ b/components/app_trace/sys_view/SEGGER/SEGGER_RTT.h @@ -47,7 +47,7 @@ * * ********************************************************************** * * -* SystemView version: 3.32 * +* SystemView version: 3.42 * * * ********************************************************************** ---------------------------END-OF-HEADER------------------------------ diff --git a/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW.c b/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW.c index 669c7b5451..10599986c8 100644 --- a/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW.c +++ b/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW.c @@ -49,14 +49,14 @@ * * ********************************************************************** * * -* SystemView version: 3.32 * +* SystemView version: 3.42 * * * ********************************************************************** -------------------------- END-OF-HEADER ----------------------------- File : SEGGER_SYSVIEW.c Purpose : System visualization API implementation. -Revision: $Rev: 26232 $ +Revision: $Rev: 28341 $ Additional information: Packet format: @@ -781,14 +781,14 @@ Send: // // Backwards U32 encode EventId. // - if (NumBytes < (1u << 14)) { // Encodes in 2 bytes + if (NumBytes < (1ul << 14)) { // Encodes in 2 bytes *--pStartPacket = (U8)(NumBytes >> 7); *--pStartPacket = (U8)(NumBytes | 0x80); - } else if (NumBytes < (1u << 21)) { // Encodes in 3 bytes + } else if (NumBytes < (1ul << 21)) { // Encodes in 3 bytes *--pStartPacket = (U8)(NumBytes >> 14); *--pStartPacket = (U8)((NumBytes >> 7) | 0x80); *--pStartPacket = (U8)(NumBytes | 0x80); - } else if (NumBytes < (1u << 28)) { // Encodes in 4 bytes + } else if (NumBytes < (1ul << 28)) { // Encodes in 4 bytes *--pStartPacket = (U8)(NumBytes >> 21); *--pStartPacket = (U8)((NumBytes >> 14) | 0x80); *--pStartPacket = (U8)((NumBytes >> 7) | 0x80); @@ -822,11 +822,11 @@ Send: if (EventId < (1u << 14)) { // Encodes in 2 bytes *--pStartPacket = (U8)(EventId >> 7); *--pStartPacket = (U8)(EventId | 0x80); - } else if (EventId < (1u << 21)) { // Encodes in 3 bytes + } else if (EventId < (1ul << 21)) { // Encodes in 3 bytes *--pStartPacket = (U8)(EventId >> 14); *--pStartPacket = (U8)((EventId >> 7) | 0x80); *--pStartPacket = (U8)(EventId | 0x80); - } else if (EventId < (1u << 28)) { // Encodes in 4 bytes + } else if (EventId < (1ul << 28)) { // Encodes in 4 bytes *--pStartPacket = (U8)(EventId >> 21); *--pStartPacket = (U8)((EventId >> 14) | 0x80); *--pStartPacket = (U8)((EventId >> 7) | 0x80); @@ -1369,7 +1369,7 @@ static void _VPrintTarget(const char* sFormat, U32 Options, va_list* pParamList) * * Function description * Initializes the SYSVIEW module. -* Must be called before the Systemview Application connects to +* Must be called before the SystemView Application connects to * the system. * * Parameters @@ -1867,7 +1867,7 @@ void SEGGER_SYSVIEW_Start(void) { * Stop recording SystemView events. * * This function is triggered by the SystemView Application on disconnect. -* For single-shot or post-mortem mode recording, it can be called +* For single-shot or postmortem mode recording, it can be called * by the application. * * Additional information @@ -1978,7 +1978,7 @@ void SEGGER_SYSVIEW_SendTaskList(void) { * * Function description * Send the system description string to the host. -* The system description is used by the Systemview Application +* The system description is used by the SystemView Application * to identify the current application and handle events accordingly. * * The system description is usually called by the system description @@ -2448,6 +2448,179 @@ void SEGGER_SYSVIEW_NameResource(U32 ResourceId, const char* sName) { RECORD_END(); } +/********************************************************************* +* +* SEGGER_SYSVIEW_HeapDefine() +* +* Function description +* Define heap. +* +* Parameters +* pHeap - Pointer to heap control structure. +* pBase - Pointer to managed heap memory. +* HeapSize - Size of managed heap memory in bytes. +* MetadataSize - Size of metadata associated with each heap allocation. +* +* Additional information +* SystemView can track allocations across multiple heaps. +* +* HeapSize must be a multiple of the natural alignment unit of the +* target. This size is subject to compression, controlled by the +* specific setting of SEGGER_SYSVIEW_ID_SHIFT. +* +* MetadataSize defines the size of the per-allocation metadata. +* For many heap implementations, the metadata size is a multiple of +* the word size of the machine and typically contains the size +* of the allocated block (used upon deallocation), optional +* pointers to the preceding and/or following blocks, and optionally +* a tag identifying the owner of the block. Note that MetadataSize +* is not compressed within the SystemView packet and is not +* required to be a multiple of 1<> SEGGER_SYSVIEW_ID_SHIFT); + ENCODE_U32(pPayload, MetadataSize); + _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_EX); + RECORD_END(); +} + +/********************************************************************* +* +* SEGGER_SYSVIEW_HeapAlloc() +* +* Function description +* Record a system-heap allocation event. +* +* Parameters +* pHeap - Pointer to heap where allocation was made. +* pUserData - Pointer to allocated user data. +* UserDataLen - Size of block allocated to hold user data, excluding any metadata. +* +* Additional information +* The user data must be correctly aligned for the architecture, which +* typically requires that the alignment is at least the alignment +* of a double or a long long. pUserData is, therefore, compressed by +* shrinking as IDs are compressed, controlled by the specific setting +* of SEGGER_SYSVIEW_ID_SHIFT. +* +* In the same way, UserDataLen must reflect the size of the allocated +* block, not the allocation size requested by the application. This +* size is also subject to compression, controlled by the specific setting +* of SEGGER_SYSVIEW_ID_SHIFT. +* +* As an example, assume the allocator is running on a Cortex-M device +* with SEGGER_SYSVIEW_ID_SHIFT set to 2 (the word alignment of the device). +* If a user requests an allocation of 5 bytes, a hypothetical heap +* allocator could allocate a block with size 32 bytes for this. The value +* of UserDataLen sent to SystemView for recording should be 32, not 5, +* and the 32 is compressed by shifting by two bits, the configured value +* of SEGGER_SYSVIEW_ID_SHIFT, and describes the number of bytes that are +* consumed from managed memory from which SystemView can calculate +* accurate heap metrics. +*/ +void SEGGER_SYSVIEW_HeapAlloc(void *pHeap, void* pUserData, unsigned int UserDataLen) { + U8* pPayload; + U8* pPayloadStart; + RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 3 * SEGGER_SYSVIEW_QUANTA_U32); + // + pPayload = pPayloadStart; + ENCODE_U32(pPayload, SYSVIEW_EVTID_EX_HEAP_ALLOC); + ENCODE_U32(pPayload, SHRINK_ID((U32)pHeap)); + ENCODE_U32(pPayload, SHRINK_ID((U32)pUserData)); + ENCODE_U32(pPayload, UserDataLen >> SEGGER_SYSVIEW_ID_SHIFT); + _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_EX); + RECORD_END(); +} + +/********************************************************************* +* +* SEGGER_SYSVIEW_HeapAllocEx() +* +* Function description +* Record a per-heap allocation event. +* +* Parameters +* pHeap - Pointer to heap where allocation was made. +* pUserData - Pointer to allocated user data. +* UserDataLen - Size of block allocated to hold user data, excluding any metadata. +* Tag - Block tag, typically used to identify the owner of the block. +* +* Additional information +* The user data must be correctly aligned for the architecture, which +* typically requires that the alignment is at least the alignment +* of a double or a long long. pUserData is, therefore, compressed by +* shrinking as IDs are compressed, controlled by the specific setting +* of SEGGER_SYSVIEW_ID_SHIFT. +* +* In the same way, UserDataLen must reflect the size of the allocated +* block, not the allocation size requested by the application. This +* size is also subject to compression, controlled by the specific setting +* of SEGGER_SYSVIEW_ID_SHIFT. +* +* As an example, assume the allocator is running on a Cortex-M device +* with SEGGER_SYSVIEW_ID_SHIFT set to 2 (the word alignment of the device). +* If a user requests an allocation of 5 bytes, a hypothetical heap +* allocator could allocate a block with size 32 bytes for this. The value +* of UserDataLen sent to SystemView for recording should be 32, not 5, +* and the 32 is compressed by shifting by two bits, the configured value +* of SEGGER_SYSVIEW_ID_SHIFT, and describes the number of bytes that are +* consumed from managed memory from which SystemView can calculate +* accurate heap metrics. +* +* See also +* SEGGER_SYSVIEW_HeapAlloc(). +*/ +void SEGGER_SYSVIEW_HeapAllocEx(void *pHeap, void* pUserData, unsigned int UserDataLen, unsigned int Tag) { + U8* pPayload; + U8* pPayloadStart; + RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 5 * SEGGER_SYSVIEW_QUANTA_U32); + // + pPayload = pPayloadStart; + ENCODE_U32(pPayload, SYSVIEW_EVTID_EX_HEAP_ALLOC_EX); + ENCODE_U32(pPayload, SHRINK_ID((U32)pHeap)); + ENCODE_U32(pPayload, SHRINK_ID((U32)pUserData)); + ENCODE_U32(pPayload, UserDataLen >> SEGGER_SYSVIEW_ID_SHIFT); + ENCODE_U32(pPayload, Tag); + _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_EX); + RECORD_END(); +} + +/********************************************************************* +* +* SEGGER_SYSVIEW_HeapFree() +* +* Function description +* Record a heap deallocation event. +* +* Parameters +* pHeap - Pointer to heap where allocation was made. +* pUserData - Pointer to allocated user data. +* +* Additional information +* SystemViews track allocations and knows the size of the +* allocated data. +*/ +void SEGGER_SYSVIEW_HeapFree(void* pHeap, void* pUserData) { + U8* pPayload; + U8* pPayloadStart; + RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32); + // + pPayload = pPayloadStart; + ENCODE_U32(pPayload, SYSVIEW_EVTID_EX_HEAP_FREE); + ENCODE_U32(pPayload, SHRINK_ID((U32)pHeap)); + ENCODE_U32(pPayload, SHRINK_ID((U32)pUserData)); + _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_EX); + RECORD_END(); +} + /********************************************************************* * * SEGGER_SYSVIEW_SendPacket() diff --git a/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW.h b/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW.h index 34f8a2360d..b9cbac605b 100644 --- a/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW.h +++ b/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW.h @@ -49,13 +49,13 @@ * * ********************************************************************** * * -* SystemView version: 3.32 * +* SystemView version: 3.42 * * * ********************************************************************** -------------------------- END-OF-HEADER ----------------------------- File : SEGGER_SYSVIEW.h Purpose : System visualization API. -Revision: $Rev: 26226 $ +Revision: $Rev: 28237 $ */ #ifndef SEGGER_SYSVIEW_H @@ -137,6 +137,10 @@ extern "C" { // #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 // // Event masks to disable/enable events // @@ -301,6 +305,11 @@ 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); int SEGGER_SYSVIEW_SendPacket (U8* pPacket, U8* pPayloadEnd, unsigned int EventId); diff --git a/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW_ConfDefaults.h b/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW_ConfDefaults.h index e2364f70db..c617e0db81 100644 --- a/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW_ConfDefaults.h +++ b/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW_ConfDefaults.h @@ -49,7 +49,7 @@ * * ********************************************************************** * * -* SystemView version: 3.32 * +* SystemView version: 3.42 * * * ********************************************************************** -------------------------- END-OF-HEADER ----------------------------- diff --git a/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW_Int.h b/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW_Int.h index 40c4e240fa..ded0b96b56 100644 --- a/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW_Int.h +++ b/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW_Int.h @@ -47,7 +47,7 @@ * * ********************************************************************** * * -* SystemView version: 3.32 * +* SystemView version: 3.42 * * * ********************************************************************** -------------------------- END-OF-HEADER ----------------------------- diff --git a/components/app_trace/sys_view/Sample/FreeRTOSV10.4/Config/esp/SEGGER_SYSVIEW_Config_FreeRTOS.c b/components/app_trace/sys_view/Sample/FreeRTOSV10.4/Config/esp/SEGGER_SYSVIEW_Config_FreeRTOS.c index 9e7a4aed47..5dfbc869ce 100644 --- a/components/app_trace/sys_view/Sample/FreeRTOSV10.4/Config/esp/SEGGER_SYSVIEW_Config_FreeRTOS.c +++ b/components/app_trace/sys_view/Sample/FreeRTOSV10.4/Config/esp/SEGGER_SYSVIEW_Config_FreeRTOS.c @@ -1,16 +1,16 @@ /* - * SPDX-FileCopyrightText: 2015-2017 SEGGER Microcontroller GmbH & Co. KG + * SPDX-FileCopyrightText: 1995-2021 SEGGER Microcontroller GmbH * - * SPDX-License-Identifier: BSD-3-Clause + * SPDX-License-Identifier: BSD-1-Clause * * SPDX-FileContributor: 2017-2022 Espressif Systems (Shanghai) CO LTD */ /********************************************************************* -* SEGGER Microcontroller GmbH & Co. KG * +* SEGGER Microcontroller GmbH * * The Embedded Experts * ********************************************************************** * * -* (c) 2015 - 2017 SEGGER Microcontroller GmbH & Co. KG * +* (c) 1995 - 2021 SEGGER Microcontroller GmbH * * * * www.segger.com Support: support@segger.com * * * @@ -24,24 +24,14 @@ * * * 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. * +* 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 * -* conditions are met: * +* condition is 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. * +* 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, * @@ -59,14 +49,14 @@ * * ********************************************************************** * * -* SystemView version: V2.42 * +* SystemView version: 3.42 * * * ********************************************************************** -------------------------- END-OF-HEADER ----------------------------- File : SEGGER_SYSVIEW_Config_FreeRTOS.c Purpose : Sample setup configuration of SystemView with FreeRTOS. -Revision: $Rev: 3734 $ +Revision: $Rev: 7745 $ */ #include "sdkconfig.h" #include "freertos/FreeRTOS.h" diff --git a/components/app_trace/sys_view/Sample/FreeRTOSV10.4/SEGGER_SYSVIEW_FreeRTOS.c b/components/app_trace/sys_view/Sample/FreeRTOSV10.4/SEGGER_SYSVIEW_FreeRTOS.c index e1dccb7e1e..6754a322c8 100644 --- a/components/app_trace/sys_view/Sample/FreeRTOSV10.4/SEGGER_SYSVIEW_FreeRTOS.c +++ b/components/app_trace/sys_view/Sample/FreeRTOSV10.4/SEGGER_SYSVIEW_FreeRTOS.c @@ -49,7 +49,7 @@ * * ********************************************************************** * * -* SystemView version: 3.32 * +* SystemView version: 3.42 * * * ********************************************************************** -------------------------- END-OF-HEADER ----------------------------- diff --git a/components/app_trace/sys_view/Sample/FreeRTOSV10.4/SEGGER_SYSVIEW_FreeRTOS.h b/components/app_trace/sys_view/Sample/FreeRTOSV10.4/SEGGER_SYSVIEW_FreeRTOS.h index b9066a8fe4..9bfa9b0a92 100644 --- a/components/app_trace/sys_view/Sample/FreeRTOSV10.4/SEGGER_SYSVIEW_FreeRTOS.h +++ b/components/app_trace/sys_view/Sample/FreeRTOSV10.4/SEGGER_SYSVIEW_FreeRTOS.h @@ -49,7 +49,7 @@ * * ********************************************************************** * * -* SystemView version: 3.32 * +* SystemView version: 3.42 * * * ********************************************************************** -------------------------- END-OF-HEADER ----------------------------- diff --git a/tools/ci/check_copyright_config.yaml b/tools/ci/check_copyright_config.yaml index 8a63073a18..4569bd455a 100644 --- a/tools/ci/check_copyright_config.yaml +++ b/tools/ci/check_copyright_config.yaml @@ -109,7 +109,6 @@ systemview: allowed_licenses: - Apache-2.0 - BSD-1-Clause - - BSD-3-Clause license_for_new_files: Apache-2.0 spiffs: