diff --git a/components/app_trace/CMakeLists.txt b/components/app_trace/CMakeLists.txt index 8b711b9ee8..78513c5c29 100644 --- a/components/app_trace/CMakeLists.txt +++ b/components/app_trace/CMakeLists.txt @@ -33,28 +33,6 @@ set(include_dirs "include") set(priv_include_dirs "private_include" "port/include") -if(CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW) - list(APPEND include_dirs - sys_view/Config - sys_view/SEGGER - sys_view/Sample/FreeRTOSV10.4) - - list(APPEND srcs - "sys_view/SEGGER/SEGGER_SYSVIEW.c" - "sys_view/Sample/FreeRTOSV10.4/Config/esp/SEGGER_SYSVIEW_Config_FreeRTOS.c" - "sys_view/Sample/FreeRTOSV10.4/SEGGER_SYSVIEW_FreeRTOS.c" - "sys_view/esp/SEGGER_RTT_esp.c" - "sys_view/ext/heap_trace_module.c" - "sys_view/ext/logging.c") -endif() - -if(CONFIG_HEAP_TRACING_TOHOST) - list(APPEND srcs "heap_trace_tohost.c") - if(CONFIG_IDF_TARGET_ARCH_XTENSA) - set_source_files_properties(heap_trace_tohost.c PROPERTIES COMPILE_FLAGS -Wno-frame-address) - endif() -endif() - idf_component_register(SRCS "${srcs}" INCLUDE_DIRS "${include_dirs}" PRIV_INCLUDE_DIRS "${priv_include_dirs}" diff --git a/components/app_trace/heap_trace_tohost.c b/components/app_trace/heap_trace_tohost.c deleted file mode 100644 index 7ee0bd893e..0000000000 --- a/components/app_trace/heap_trace_tohost.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "sdkconfig.h" -#include "freertos/FreeRTOS.h" -#include "esp_heap_trace.h" -#include "esp_heap_caps.h" -#if CONFIG_ESP_TRACE_TRANSPORT_APPTRACE -#include "esp_app_trace.h" -#endif -#if CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW -#include "esp_sysview_trace.h" -#endif - -#define STACK_DEPTH CONFIG_HEAP_TRACING_STACK_DEPTH - -#if CONFIG_HEAP_TRACING_TOHOST - -#if !CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW -#error None of the heap tracing backends is enabled! You must enable SystemView compatible tracing to use this feature. -#endif - -static bool s_tracing; - -esp_err_t heap_trace_init_tohost(void) -{ - if (s_tracing) { - return ESP_ERR_INVALID_STATE; - } - return ESP_OK; -} - -esp_err_t heap_trace_start(heap_trace_mode_t mode_param) -{ -#if CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW - esp_err_t ret = esp_sysview_heap_trace_start((uint32_t) -1); - if (ret != ESP_OK) { - return ret; - } -#endif - s_tracing = true; - return ESP_OK; -} - -esp_err_t heap_trace_stop(void) -{ - esp_err_t ret = ESP_ERR_NOT_SUPPORTED; -#if CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW - ret = esp_sysview_heap_trace_stop(); -#endif - s_tracing = false; - return ret; -} - -esp_err_t heap_trace_resume(void) -{ - return heap_trace_start(HEAP_TRACE_ALL); -} - -size_t heap_trace_get_count(void) -{ - return 0; -} - -esp_err_t heap_trace_get(size_t index, heap_trace_record_t *record) -{ - return ESP_ERR_NOT_SUPPORTED; -} - -esp_err_t heap_trace_summary(heap_trace_summary_t *summary) -{ - return ESP_ERR_NOT_SUPPORTED; -} - -void heap_trace_dump(void) -{ - return; -} - -void heap_trace_dump_caps(__attribute__((unused)) const uint32_t caps) -{ - return; -} - -/* Add a new allocation to the heap trace records */ -static HEAP_IRAM_ATTR void record_allocation(const heap_trace_record_t *record) -{ - if (!s_tracing) { - return; - } -#if CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW - esp_sysview_heap_trace_alloc(record->address, record->size, record->alloced_by); -#endif -} - -/* record a free event in the heap trace log - - For HEAP_TRACE_ALL, this means filling in the freed_by pointer. - For HEAP_TRACE_LEAKS, this means removing the record from the log. -*/ -static HEAP_IRAM_ATTR void record_free(void *p, void **callers) -{ - if (!s_tracing) { - return; - } -#if CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW - esp_sysview_heap_trace_free(p, callers); -#endif -} - -#include "heap_trace.inc" - -#endif /*CONFIG_HEAP_TRACING_TOHOST*/ diff --git a/components/app_trace/include/esp_sysview_trace.h b/components/app_trace/include/esp_sysview_trace.h deleted file mode 100644 index 3f6ea49b35..0000000000 --- a/components/app_trace/include/esp_sysview_trace.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2018-2025 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef ESP_SYSVIEW_TRACE_H_ -#define ESP_SYSVIEW_TRACE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include "esp_err.h" -#include "SEGGER_RTT.h" // SEGGER_RTT_ESP_Flush -#include "esp_app_trace_util.h" // ESP_APPTRACE_TMO_INFINITE - -/* Forward declaration for esp_trace integration */ -typedef struct esp_trace_encoder esp_trace_encoder_t; - -/** - * @brief Inject encoder handle to SEGGER RTT layer. - * - * This maintains proper architectural layering. SEGGER RTT can accesses it's transport - * - * @param encoder Pointer to encoder instance from esp_trace - * - * @return 0 if successful, -1 if encoder is not initialized or missing required functions. - */ -int SEGGER_RTT_ESP_SetEncoder(esp_trace_encoder_t *encoder); - -/** - * @brief Get the encoder handle for accessing transport functions. - * - * This is used by SEGGER_SYSVIEW_Config_FreeRTOS.c to access transport lock functions. - * - * @return Pointer to encoder instance, or NULL if not initialized. - */ -esp_trace_encoder_t* SEGGER_SYSVIEW_GetEncoder(void); - -/** - * @brief Flushes remaining data in SystemView trace buffer to host. - * - * @return ESP_OK. - */ -static inline esp_err_t esp_sysview_flush(void) -{ - SEGGER_RTT_ESP_Flush(); - return ESP_OK; -} - -/** - * @brief vprintf-like function to sent log messages to the host. - * - * @param format Address of format string. - * @param args List of arguments. - * - * @return Number of bytes written. - */ -int esp_sysview_vprintf(const char * format, va_list args); - -/** - * @brief Starts SystemView heap tracing. - * - * @param tmo Timeout (in us) to wait for the host to be connected. Use -1 to wait forever. - * - * @return ESP_OK on success, ESP_ERR_TIMEOUT if operation has been timed out. - */ -esp_err_t esp_sysview_heap_trace_start(uint32_t tmo); - -/** - * @brief Stops SystemView heap tracing. - * - * @return ESP_OK. - */ -esp_err_t esp_sysview_heap_trace_stop(void); - -/** - * @brief Sends heap allocation event to the host. - * - * @param addr Address of allocated block. - * @param size Size of allocated block. - * @param callers Pointer to array with callstack addresses. - * Array size must be CONFIG_HEAP_TRACING_STACK_DEPTH. - */ -void esp_sysview_heap_trace_alloc(void *addr, uint32_t size, const void *callers); - -/** - * @brief Sends heap de-allocation event to the host. - * - * @param addr Address of de-allocated block. - * @param callers Pointer to array with callstack addresses. - * Array size must be CONFIG_HEAP_TRACING_STACK_DEPTH. - */ -void esp_sysview_heap_trace_free(void *addr, const void *callers); - -#ifdef __cplusplus -} -#endif - -#endif //ESP_SYSVIEW_TRACE_H_ diff --git a/components/app_trace/linker.lf b/components/app_trace/linker.lf index 51473c671c..f0c97f6334 100644 --- a/components/app_trace/linker.lf +++ b/components/app_trace/linker.lf @@ -9,8 +9,3 @@ entries: app_trace_membufs_proto (noflash) if APPTRACE_DEST_UART = y || APPTRACE_DEST_ALL = y: port_uart (noflash) - if ESP_TRACE_LIB_SEGGER_SYSVIEW = y: - SEGGER_SYSVIEW (noflash) - SEGGER_RTT_esp (noflash) - SEGGER_SYSVIEW_Config_FreeRTOS (noflash) - SEGGER_SYSVIEW_FreeRTOS (noflash) diff --git a/components/app_trace/sdkconfig.rename b/components/app_trace/sdkconfig.rename index 59216fb3ff..432dd53de5 100644 --- a/components/app_trace/sdkconfig.rename +++ b/components/app_trace/sdkconfig.rename @@ -8,21 +8,5 @@ CONFIG_ESP32_APPTRACE_LOCK_ENABLE CONFIG_APPTRACE_LOCK_ENABLE CONFIG_ESP32_APPTRACE_ONPANIC_HOST_FLUSH_TMO CONFIG_APPTRACE_ONPANIC_HOST_FLUSH_TMO CONFIG_ESP32_APPTRACE_POSTMORTEM_FLUSH_TRAX_THRESH CONFIG_APPTRACE_POSTMORTEM_FLUSH_THRESH -CONFIG_SYSVIEW_ENABLE CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW CONFIG_SYSVIEW_TS_SOURCE_CCOUNT CONFIG_ESP_TRACE_TS_SOURCE_CCOUNT CONFIG_SYSVIEW_TS_SOURCE_ESP_TIMER CONFIG_ESP_TRACE_TS_SOURCE_ESP_TIMER -CONFIG_SYSVIEW_MAX_TASKS CONFIG_SEGGER_SYSVIEW_MAX_TASKS -CONFIG_SYSVIEW_BUF_WAIT_TMO CONFIG_SEGGER_SYSVIEW_BUF_WAIT_TMO -CONFIG_SYSVIEW_EVT_OVERFLOW_ENABLE CONFIG_SEGGER_SYSVIEW_EVT_OVERFLOW_ENABLE -CONFIG_SYSVIEW_EVT_ISR_ENTER_ENABLE CONFIG_SEGGER_SYSVIEW_EVT_ISR_ENTER_ENABLE -CONFIG_SYSVIEW_EVT_ISR_EXIT_ENABLE CONFIG_SEGGER_SYSVIEW_EVT_ISR_EXIT_ENABLE -CONFIG_SYSVIEW_EVT_ISR_TO_SCHEDULER_ENABLE CONFIG_SEGGER_SYSVIEW_EVT_ISR_TO_SCHED_ENABLE -CONFIG_SYSVIEW_EVT_TASK_START_EXEC_ENABLE CONFIG_SEGGER_SYSVIEW_EVT_TASK_START_EXEC_ENABLE -CONFIG_SYSVIEW_EVT_TASK_STOP_EXEC_ENABLE CONFIG_SEGGER_SYSVIEW_EVT_TASK_STOP_EXEC_ENABLE -CONFIG_SYSVIEW_EVT_TASK_START_READY_ENABLE CONFIG_SEGGER_SYSVIEW_EVT_TASK_START_READY_ENABLE -CONFIG_SYSVIEW_EVT_TASK_STOP_READY_ENABLE CONFIG_SEGGER_SYSVIEW_EVT_TASK_STOP_READY_ENABLE -CONFIG_SYSVIEW_EVT_TASK_CREATE_ENABLE CONFIG_SEGGER_SYSVIEW_EVT_TASK_CREATE_ENABLE -CONFIG_SYSVIEW_EVT_TASK_TERMINATE_ENABLE CONFIG_SEGGER_SYSVIEW_EVT_TASK_TERMINATE_ENABLE -CONFIG_SYSVIEW_EVT_IDLE_ENABLE CONFIG_SEGGER_SYSVIEW_EVT_IDLE_ENABLE -CONFIG_SYSVIEW_EVT_TIMER_ENTER_ENABLE CONFIG_SEGGER_SYSVIEW_EVT_TIMER_ENTER_ENABLE -CONFIG_SYSVIEW_EVT_TIMER_EXIT_ENABLE CONFIG_SEGGER_SYSVIEW_EVT_TIMER_EXIT_ENABLE diff --git a/components/app_trace/sys_view/Config/Global.h b/components/app_trace/sys_view/Config/Global.h deleted file mode 100644 index ed2de5c3e9..0000000000 --- a/components/app_trace/sys_view/Config/Global.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * SPDX-FileCopyrightText: 1995-2021 SEGGER Microcontroller GmbH - * - * SPDX-License-Identifier: BSD-1-Clause - */ -/********************************************************************* -* SEGGER Microcontroller GmbH * -* The Embedded Experts * -********************************************************************** -* * -* (c) 1995 - 2021 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.42 * -* * -********************************************************************** ----------------------------------------------------------------------- -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 ****************************/ diff --git a/components/app_trace/sys_view/Config/SEGGER_RTT_Conf.h b/components/app_trace/sys_view/Config/SEGGER_RTT_Conf.h deleted file mode 100644 index 2049b18d5b..0000000000 --- a/components/app_trace/sys_view/Config/SEGGER_RTT_Conf.h +++ /dev/null @@ -1,433 +0,0 @@ -/* - * SPDX-FileCopyrightText: 1995-2021 SEGGER Microcontroller GmbH - * - * SPDX-License-Identifier: BSD-1-Clause - */ -/********************************************************************* -* SEGGER Microcontroller GmbH * -* The Embedded Experts * -********************************************************************** -* * -* (c) 1995 - 2021 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.42 * -* * -********************************************************************** ----------------------------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 - -#ifdef __IAR_SYSTEMS_ICC__ - #include -#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__)) - #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 - #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 - -#endif -/*************************** End of file ****************************/ diff --git a/components/app_trace/sys_view/Config/SEGGER_SYSVIEW_Conf.h b/components/app_trace/sys_view/Config/SEGGER_SYSVIEW_Conf.h deleted file mode 100644 index b4bc13515d..0000000000 --- a/components/app_trace/sys_view/Config/SEGGER_SYSVIEW_Conf.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * SPDX-FileCopyrightText: 1995-2021 SEGGER Microcontroller GmbH - * - * SPDX-License-Identifier: BSD-1-Clause - */ -/********************************************************************* -* SEGGER Microcontroller GmbH * -* The Embedded Experts * -********************************************************************** -* * -* (c) 1995 - 2021 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.42 * -* * -********************************************************************** --------------------------- 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 -* -********************************************************************** -*/ - -/********************************************************************* -* TODO: Add your defines here. * -********************************************************************** -*/ - - -#endif // SEGGER_SYSVIEW_CONF_H - -/*************************** End of file ****************************/ diff --git a/components/app_trace/sys_view/Kconfig.sysview b/components/app_trace/sys_view/Kconfig.sysview deleted file mode 100644 index f9366bb49c..0000000000 --- a/components/app_trace/sys_view/Kconfig.sysview +++ /dev/null @@ -1,113 +0,0 @@ -menu "SEGGER SystemView" - depends on ESP_TRACE_LIB_SEGGER_SYSVIEW - choice SEGGER_SYSVIEW_DEST_CPU - prompt "CPU to trace" - depends on ESP_TRACE_TRANSPORT_APPTRACE && APPTRACE_DEST_UART && !ESP_SYSTEM_SINGLE_CORE_MODE - default SEGGER_SYSVIEW_DEST_CPU_0 - help - Define the CPU to trace. - - config SEGGER_SYSVIEW_DEST_CPU_0 - bool "CPU0" - help - Send tracing data for Pro CPU. - - config SEGGER_SYSVIEW_DEST_CPU_1 - bool "CPU1" - help - Send tracing data for App CPU. - - endchoice - - config SEGGER_SYSVIEW_MAX_TASKS - int "Maximum supported tasks" - range 1 64 - default 16 - help - Configures maximum supported tasks in sysview debug - - config SEGGER_SYSVIEW_BUF_WAIT_TMO - int "Trace buffer wait timeout" - default 500 - help - Configures timeout (in us) to wait for free space in trace buffer. - Set to -1 to wait forever and avoid lost events. - - config SEGGER_SYSVIEW_EVT_OVERFLOW_ENABLE - bool "Trace Buffer Overflow Event" - default y - help - Enables "Trace Buffer Overflow" event. - - config SEGGER_SYSVIEW_EVT_ISR_ENTER_ENABLE - bool "ISR Enter Event" - default y - help - Enables "ISR Enter" event. - - config SEGGER_SYSVIEW_EVT_ISR_EXIT_ENABLE - bool "ISR Exit Event" - default y - help - Enables "ISR Exit" event. - - config SEGGER_SYSVIEW_EVT_ISR_TO_SCHED_ENABLE - bool "ISR Exit to Scheduler Event" - default y - help - Enables "ISR to Scheduler" event. - - config SEGGER_SYSVIEW_EVT_TASK_START_EXEC_ENABLE - bool "Task Start Execution Event" - default y - help - Enables "Task Start Execution" event. - - config SEGGER_SYSVIEW_EVT_TASK_STOP_EXEC_ENABLE - bool "Task Stop Execution Event" - default y - help - Enables "Task Stop Execution" event. - - config SEGGER_SYSVIEW_EVT_TASK_START_READY_ENABLE - bool "Task Start Ready State Event" - default y - help - Enables "Task Start Ready State" event. - - config SEGGER_SYSVIEW_EVT_TASK_STOP_READY_ENABLE - bool "Task Stop Ready State Event" - default y - help - Enables "Task Stop Ready State" event. - - config SEGGER_SYSVIEW_EVT_TASK_CREATE_ENABLE - bool "Task Create Event" - default y - help - Enables "Task Create" event. - - config SEGGER_SYSVIEW_EVT_TASK_TERMINATE_ENABLE - bool "Task Terminate Event" - default y - help - Enables "Task Terminate" event. - - config SEGGER_SYSVIEW_EVT_IDLE_ENABLE - bool "System Idle Event" - default y - help - Enables "System Idle" event. - - config SEGGER_SYSVIEW_EVT_TIMER_ENTER_ENABLE - bool "Timer Enter Event" - default y - help - Enables "Timer Enter" event. - - config SEGGER_SYSVIEW_EVT_TIMER_EXIT_ENABLE - bool "Timer Exit Event" - default y - help - Enables "Timer Exit" event. -endmenu diff --git a/components/app_trace/sys_view/SEGGER/SEGGER.h b/components/app_trace/sys_view/SEGGER/SEGGER.h deleted file mode 100644 index f07e946619..0000000000 --- a/components/app_trace/sys_view/SEGGER/SEGGER.h +++ /dev/null @@ -1,255 +0,0 @@ -/* - * SPDX-FileCopyrightText: 1995-2021 SEGGER Microcontroller GmbH - * - * SPDX-License-Identifier: BSD-1-Clause - * - * SPDX-FileContributor: 2023 Espressif Systems (Shanghai) CO LTD - */ -/********************************************************************* -* 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.56 * -* * -********************************************************************** ----------------------------------------------------------------------- -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 // 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 ****************************/ diff --git a/components/app_trace/sys_view/SEGGER/SEGGER_RTT.h b/components/app_trace/sys_view/SEGGER/SEGGER_RTT.h deleted file mode 100644 index 15d31ea411..0000000000 --- a/components/app_trace/sys_view/SEGGER/SEGGER_RTT.h +++ /dev/null @@ -1,515 +0,0 @@ -/* - * SPDX-FileCopyrightText: 1995-2021 SEGGER Microcontroller GmbH - * - * SPDX-License-Identifier: BSD-1-Clause - */ -/********************************************************************* -* 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.56 * -* * -********************************************************************** ----------------------------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 "../Config/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__)) // Cortex-A/R 32-bit ARMv7-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__)) // Cortex-A/R 32-bit ARMv7-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__) - #if (__CORE__ == __ARM7A__) // Cortex-A 32-bit ARMv7-A - #define _CORE_NEEDS_DMB 1 - #define RTT__DMB() asm VOLATILE ("DMB"); - #endif - #endif - #if (defined __ARM7R__) - #if (__CORE__ == __ARM7R__) // Cortex-R 32-bit ARMv7-R - #define _CORE_NEEDS_DMB 1 - #define RTT__DMB() asm VOLATILE ("DMB"); - #endif - #endif -// TBD: __ARM8A__ => Cortex-A 64-bit ARMv8-A -// TBD: __ARM8R__ => Cortex-R 64-bit ARMv8-R - #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 -#include -#include - -/********************************************************************* -* -* 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); - -void SEGGER_RTT_ESP_FlushNoLock (void); -void SEGGER_RTT_ESP_Flush (void); -// -// Function macro for performance optimization -// -// @AGv: This macro is used inside SEGGER SystemView code. -// For ESP32 we use our own implementation of RTT, so this macro should not check SEGGER's RTT buffer state. -#define SEGGER_RTT_HASDATA(n) (1) - -#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) - -/********************************************************************* -* -* 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 ****************************/ diff --git a/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW.c b/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW.c deleted file mode 100644 index 4de60ada2e..0000000000 --- a/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW.c +++ /dev/null @@ -1,3645 +0,0 @@ -/* - * SPDX-FileCopyrightText: 1995-2021 SEGGER Microcontroller GmbH - * - * SPDX-License-Identifier: BSD-1-Clause - * - * SPDX-FileContributor: 2023-2024 Espressif Systems (Shanghai) CO LTD - */ -/********************************************************************* -* 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.56 * -* * -********************************************************************** --------------------------- END-OF-HEADER ----------------------------- - -File : SEGGER_SYSVIEW.c -Purpose : System visualization API implementation. -Revision: $Rev: 29105 $ - -Additional information: - Packet format: - Packets with IDs 0..23 are standard packets with known structure. - For efficiency, they do *NOT* contain a length field. - - - Packets with IDs 24..31 are standard packets with extendible - structure and contain a length field. - - - Packet ID 31 is used for SystemView extended events. - - - Packets with IDs >= 32 always contain a length field. - - - Packet IDs: - 0.. 31 : Standard packets, known by SystemView. - 32..1023 : OS-definable packets, described in a SystemView description file. - 1024..2047 : User-definable packets, described in a SystemView description file. - 2048..32767: Undefined. - - Data encoding: - Basic types (int, short, char, ...): - Basic types are encoded little endian with most-significant bit variant - encoding. - Each encoded byte contains 7 data bits [6:0] and the MSB continuation bit. - The continuation bit indicates whether the next byte belongs to the data - (bit set) or this is the last byte (bit clear). - The most significant bits of data are encoded first, proceeding to the - least significant bits in the final byte (little endian). - - Example encoding: - Data: 0x1F4 (500) - Encoded: 0xF4 (First 7 data bits 74 | Continuation bit) - 0x03 (Second 7 data bits 03, no continuation) - - Data: 0xFFFFFFFF - Encoded: 0xFF 0xFF 0xFF 0xFF 0x0F - - Data: 0xA2 (162), 0x03 (3), 0x7000 - Encoded: 0xA2 0x01 0x03 0x80 0xE0 0x01 - - Byte arrays and strings: - Byte arrays and strings are encoded as followed by the raw data. - NumBytes is encoded as a basic type with a theoretical maximum of 4G. - - Example encoding: - Data: "Hello World\0" (0x48 0x65 0x6C 0x6C 0x6F 0x20 0x57 0x6F 0x72 0x6C 0x64 0x00) - Encoded: 0x0B 0x48 0x65 0x6C 0x6C 0x6F 0x20 0x57 0x6F 0x72 0x6C 0x64 - - Examples packets: - 01 F4 03 80 80 10 // Overflow packet. Data is a single U32. - This packet means: 500 packets lost, Timestamp is 0x40000 - - 02 0F 50 // ISR(15) Enter. Timestamp 80 (0x50) - - 03 20 // ISR Exit. Timestamp 32 (0x20) (Shortest possible packet.) - - Sample code for user defined Packets: - #define MY_ID 0x400 // Any value between 0x400 and 0x7FF - void SendMyPacket(unsigned Para0, unsigned Para1, const char* s) { - U8 aPacket[SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32 + MAX_STR_LEN + 1]; - U8* pPayload; - // - pPayload = SEGGER_SYSVIEW_PPREPARE_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_EncodeString(pPayload, s, MAX_STR_LEN); // Add the string to the packet - // - SEGGER_SYSVIEW_SendPacket(&aPacket[0], pPayload, MY_ID); // Send the packet with EventId = MY_ID - } - - #define MY_ID_1 0x401 - void SendOnePara(unsigned Para0) { - SEGGER_SYSVIEW_RecordU32(MY_ID_1, Para0); - } - -*/ - -/********************************************************************* -* -* #include section -* -********************************************************************** -*/ - -#define SEGGER_SYSVIEW_C // For EXTERN statements in SEGGER_SYSVIEW.h - -#include -#include -#include -#include -#include "SEGGER_SYSVIEW_Int.h" -#include "SEGGER_RTT.h" - -/********************************************************************* -* -* Defines, fixed -* -********************************************************************** -*/ -#if SEGGER_SYSVIEW_ID_SHIFT - #define SHRINK_ID(Id) (((Id) - _SYSVIEW_Globals.RAMBaseAddress) >> SEGGER_SYSVIEW_ID_SHIFT) -#else - #define SHRINK_ID(Id) ((Id) - _SYSVIEW_Globals.RAMBaseAddress) -#endif - -#if SEGGER_SYSVIEW_RTT_CHANNEL > 0 - #define CHANNEL_ID_UP SEGGER_SYSVIEW_RTT_CHANNEL - #define CHANNEL_ID_DOWN SEGGER_SYSVIEW_RTT_CHANNEL -#else - #define CHANNEL_ID_UP _SYSVIEW_Globals.UpChannel - #define CHANNEL_ID_DOWN _SYSVIEW_Globals.DownChannel -#endif - -#if SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE - #if (SEGGER_SYSVIEW_RTT_BUFFER_SIZE % SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE) - #error "SEGGER_SYSVIEW_RTT_BUFFER_SIZE must be a multiple of SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE" - #endif -#endif - -/********************************************************************* -* -* Defines, configurable -* -********************************************************************** -*/ -// Timestamps may be less than full 32-bits, in which case we need to zero -// the unused bits to properly handle overflows. -// Note that this is a quite common scenario, as a 32-bit time such as -// SysTick might be scaled down to reduce bandwidth -// or a 16-bit hardware time might be used. -#if SEGGER_SYSVIEW_TIMESTAMP_BITS < 32 // Eliminate unused bits in case hardware timestamps are less than 32 bits - #define MAKE_DELTA_32BIT(Delta) Delta <<= 32 - SEGGER_SYSVIEW_TIMESTAMP_BITS; \ - Delta >>= 32 - SEGGER_SYSVIEW_TIMESTAMP_BITS; -#else - #define MAKE_DELTA_32BIT(Delta) -#endif - -#if SEGGER_SYSVIEW_SUPPORT_LONG_ID - #define _MAX_ID_BYTES 5u -#else - #define _MAX_ID_BYTES 2u -#endif - -#if SEGGER_SYSVIEW_SUPPORT_LONG_DATA - #define _MAX_DATA_BYTES 5u -#else - #define _MAX_DATA_BYTES 2u -#endif - -/********************************************************************* -* -* Defines, fixed -* -********************************************************************** -*/ -#define ENABLE_STATE_OFF 0 -#define ENABLE_STATE_ON 1 -#define ENABLE_STATE_DROPPING 2 - -#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) - -#define MODULE_EVENT_OFFSET (512) - -/********************************************************************* -* -* Types, local -* -********************************************************************** -*/ -typedef struct { - U8* pBuffer; - U8* pPayload; - U8* pPayloadStart; - U32 Options; - unsigned Cnt; -} SEGGER_SYSVIEW_PRINTF_DESC; - -typedef struct { - U8 EnableState; // 0: Disabled, 1: Enabled, (2: Dropping) - U8 UpChannel; - U8 RecursionCnt; - U32 SysFreq; - U32 CPUFreq; - U32 LastTxTimeStamp; - U32 RAMBaseAddress; -#if (SEGGER_SYSVIEW_POST_MORTEM_MODE == 1) - U32 PacketCount; -#else - U32 DropCount; - U8 DownChannel; -#endif - U32 DisabledEvents; - const SEGGER_SYSVIEW_OS_API* pOSAPI; - SEGGER_SYSVIEW_SEND_SYS_DESC_FUNC* pfSendSysDesc; -} SEGGER_SYSVIEW_GLOBALS; - -/********************************************************************* -* -* Function prototypes, required -* -********************************************************************** -*/ -static void _SendPacket(U8* pStartPacket, U8* pEndPacket, unsigned int EventId); - -/********************************************************************* -* -* Static data -* -********************************************************************** -*/ -static const U8 _abSync[10] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -#if SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE - #ifdef SEGGER_SYSVIEW_SECTION - // - // Alignment + special section required - // - #if (defined __GNUC__) - __attribute__ ((section (SEGGER_SYSVIEW_SECTION), aligned (SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE))) static char _UpBuffer [SEGGER_SYSVIEW_RTT_BUFFER_SIZE]; - #if (SEGGER_SYSVIEW_POST_MORTEM_MODE != 1) - __attribute__ ((section (SEGGER_SYSVIEW_SECTION), aligned (SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE))) static char _DownBuffer[8]; // Small, fixed-size buffer, for back-channel comms - #endif - #elif (defined __ICCARM__) || (defined __ICCRX__) - #pragma location=SEGGER_SYSVIEW_SECTION - #pragma data_alignment=SEGGER_RTT_CPU_CACHE_LINE_SIZE - static char _UpBuffer [SEGGER_SYSVIEW_RTT_BUFFER_SIZE]; - #if (SEGGER_SYSVIEW_POST_MORTEM_MODE != 1) - #pragma location=SEGGER_SYSVIEW_SECTION - #pragma data_alignment=SEGGER_RTT_CPU_CACHE_LINE_SIZE - static char _DownBuffer[8]; // Small, fixed-size buffer, for back-channel comms - #endif - #elif (defined __CC_ARM) - __attribute__ ((section (SEGGER_SYSVIEW_SECTION), aligned (SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE), zero_init)) static char _UpBuffer [SEGGER_SYSVIEW_RTT_BUFFER_SIZE]; - #if (SEGGER_SYSVIEW_POST_MORTEM_MODE != 1) - __attribute__ ((section (SEGGER_SYSVIEW_SECTION), aligned (SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE), zero_init)) static char _DownBuffer[8]; // Small, fixed-size buffer, for back-channel comms - #endif - #else - #error "Do not know how to place SystemView buffers in specific section" - #endif - #else - // - // Only alignment required - // - #if (defined __GNUC__) - __attribute__ ((aligned (SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE))) static char _UpBuffer [SEGGER_SYSVIEW_RTT_BUFFER_SIZE]; - #if (SEGGER_SYSVIEW_POST_MORTEM_MODE != 1) - __attribute__ ((aligned (SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE))) static char _DownBuffer[8]; // Small, fixed-size buffer, for back-channel comms - #endif - #elif (defined __ICCARM__) || (defined __ICCRX__) - #pragma data_alignment=SEGGER_RTT_CPU_CACHE_LINE_SIZE - static char _UpBuffer [SEGGER_SYSVIEW_RTT_BUFFER_SIZE]; - #if (SEGGER_SYSVIEW_POST_MORTEM_MODE != 1) - #pragma data_alignment=SEGGER_RTT_CPU_CACHE_LINE_SIZE - static char _DownBuffer[8]; // Small, fixed-size buffer, for back-channel comms - #endif - #elif (defined __CC_ARM) - __attribute__ ((aligned (SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE), zero_init)) static char _UpBuffer [SEGGER_SYSVIEW_RTT_BUFFER_SIZE]; - #if (SEGGER_SYSVIEW_POST_MORTEM_MODE != 1) - __attribute__ ((aligned (SEGGER_SYSVIEW_CPU_CACHE_LINE_SIZE), zero_init)) static char _DownBuffer[8]; // Small, fixed-size buffer, for back-channel comms - #endif - #else - #error "Do not know how to align SystemView buffers to cache line size" - #endif - #endif -#else - #ifdef SEGGER_SYSVIEW_SECTION - // - // Only special section required - // - #if (defined __GNUC__) - __attribute__ ((section (SEGGER_SYSVIEW_SECTION))) static char _UpBuffer [SEGGER_SYSVIEW_RTT_BUFFER_SIZE]; - #if (SEGGER_SYSVIEW_POST_MORTEM_MODE != 1) - __attribute__ ((section (SEGGER_SYSVIEW_SECTION))) static char _DownBuffer[8]; // Small, fixed-size buffer, for back-channel comms - #endif - #elif (defined __ICCARM__) || (defined __ICCRX__) - #pragma location=SEGGER_SYSVIEW_SECTION - static char _UpBuffer [SEGGER_SYSVIEW_RTT_BUFFER_SIZE]; - #if (SEGGER_SYSVIEW_POST_MORTEM_MODE != 1) - #pragma location=SEGGER_SYSVIEW_SECTION - static char _DownBuffer[8]; // Small, fixed-size buffer, for back-channel comms - #endif - #elif (defined __CC_ARM) - __attribute__ ((section (SEGGER_SYSVIEW_SECTION), zero_init)) static char _UpBuffer [SEGGER_SYSVIEW_RTT_BUFFER_SIZE]; - #if (SEGGER_SYSVIEW_POST_MORTEM_MODE != 1) - __attribute__ ((section (SEGGER_SYSVIEW_SECTION), zero_init)) static char _DownBuffer[8]; // Small, fixed-size buffer, for back-channel comms - #endif - #else - #error "Do not know how to place SystemView buffers in specific section" - #endif - #else - // - // Neither special section nor alignment required - // - static char _UpBuffer [SEGGER_SYSVIEW_RTT_BUFFER_SIZE]; - #if (SEGGER_SYSVIEW_POST_MORTEM_MODE != 1) - static char _DownBuffer[8]; // Small, fixed-size buffer, for back-channel comms - #endif - #endif -#endif - -static SEGGER_SYSVIEW_GLOBALS _SYSVIEW_Globals; - -static SEGGER_SYSVIEW_MODULE* _pFirstModule; -static U8 _NumModules; - -/********************************************************************* -* -* Static code -* -********************************************************************** -*/ - -#define ENCODE_U32(pDest, Value) { \ - U8* pSysviewPointer; \ - U32 SysViewData; \ - pSysviewPointer = pDest; \ - SysViewData = Value; \ - while(SysViewData > 0x7F) { \ - *pSysviewPointer++ = (U8)(SysViewData | 0x80); \ - SysViewData >>= 7; \ - }; \ - *pSysviewPointer++ = (U8)SysViewData; \ - pDest = pSysviewPointer; \ - }; - -#if (SEGGER_SYSVIEW_USE_STATIC_BUFFER == 1) -static U8 _aPacket[SEGGER_SYSVIEW_MAX_PACKET_SIZE]; - -#define RECORD_START(PacketSize) SEGGER_SYSVIEW_LOCK(); \ - pPayloadStart = _PreparePacket(_aPacket); - -#define RECORD_END() SEGGER_SYSVIEW_UNLOCK() - -#else - -#define RECORD_START(PacketSize) U8 aPacket[(PacketSize)]; \ - pPayloadStart = _PreparePacket(aPacket); \ - -#define RECORD_END() - -#endif - -/********************************************************************* -* -* _EncodeData() -* -* Function description -* Encode a byte buffer in variable-length format. -* -* Parameters -* pPayload - Pointer to where string will be encoded. -* pSrc - Pointer to data buffer to be encoded. -* NumBytes - Number of bytes in the buffer to be encoded. -* -* Return value -* Pointer to the byte following the value, i.e. the first free -* byte in the payload and the next position to store payload -* content. -* -* Additional information -* The data is encoded as a count byte followed by the contents -* of the data buffer. -* Make sure NumBytes + 1 bytes are free for the payload. -*/ -static U8* _EncodeData(U8* pPayload, const char* pSrc, unsigned int NumBytes) { - unsigned int n; - const U8* p; - - // Espressif doesn't support larger packages yet. Encode data length must be less than 255. - assert(NumBytes < 255); - // - n = 0; - p = (const U8*)pSrc; - // - // Write Len - // - if (NumBytes < 255) { - *pPayload++ = (U8)NumBytes; - } else { - *pPayload++ = 255; - *pPayload++ = ((NumBytes >> 8) & 255); - *pPayload++ = (NumBytes & 255); - } - while (n < NumBytes) { - *pPayload++ = *p++; - n++; - } - return pPayload; -} - -/********************************************************************* -* -* _EncodeFloat() -* -* Function description -* Encode a float value in variable-length format. -* -* Parameters -* pPayload - Pointer to where value will be encoded. -* Value - Value to be encoded. -* -* Return value -* Pointer to the byte following the value, i.e. the first free -* byte in the payload and the next position to store payload -* content. -*/ -static U8* _EncodeFloat(U8* pPayload, float Value) { - float Val = Value; - U8* pSysviewPointer; - U32* SysViewData; - pSysviewPointer = pPayload; - SysViewData = (U32*)&Val; - while((*SysViewData) > 0x7F) { - *pSysviewPointer++ = (U8)((*SysViewData) | 0x80); - (*SysViewData) >>= 7; - }; - *pSysviewPointer++ = (U8)(*SysViewData); - pPayload = pSysviewPointer; - - return pPayload; -} - -/********************************************************************* -* -* _EncodeStr() -* -* Function description -* Encode a string in variable-length format. -* -* Parameters -* pPayload - Pointer to where string will be encoded. -* pText - String to encode. -* Limit - Maximum number of characters to encode from string. -* -* Return value -* Pointer to the byte following the value, i.e. the first free -* byte in the payload and the next position to store payload -* content. -* -* Additional information -* The string is encoded as a count byte followed by the contents -* of the string. -* No more than 1 + Limit bytes will be encoded to the payload. -*/ -static U8 *_EncodeStr(U8 *pPayload, const char *pText, unsigned int Limit) { - U8* pLen; - const char* sStart; - - if (pText == NULL) { - *pPayload++ = (U8)0; - } else { - sStart = pText; // Remember start of string. - // - // Save space to store count byte(s). - // - pLen = pPayload++; -#if (SEGGER_SYSVIEW_MAX_STRING_LEN >= 255) // Length always encodes in 3 bytes - pPayload += 2; -#endif - // - // Limit string to maximum length and copy into payload buffer. - // - if (Limit > SEGGER_SYSVIEW_MAX_STRING_LEN) { - Limit = SEGGER_SYSVIEW_MAX_STRING_LEN; - } - while ((Limit-- > 0) && (*pText != '\0')) { - *pPayload++ = *pText++; - } - // - // Save string length to buffer. - // -#if (SEGGER_SYSVIEW_MAX_STRING_LEN >= 255) // Length always encodes in 3 bytes - Limit = (unsigned int)(pText - sStart); - *pLen++ = (U8)255; - *pLen++ = (U8)((Limit >> 8) & 255); - *pLen++ = (U8)(Limit & 255); -#else // Length always encodes in 1 byte - *pLen = (U8)(pText - sStart); -#endif - } - // - return pPayload; -} - -/********************************************************************* -* -* _PreparePacket() -* -* Function description -* Prepare a SystemView event packet header. -* -* Parameters -* pPacket - Pointer to start of packet to initialize. -* -* Return value -* Pointer to first byte of packet payload. -* -* Additional information -* The payload length and evnetId are not initialized. -* PreparePacket only reserves space for them and they are -* computed and filled in by the sending function. -*/ -static U8* _PreparePacket(U8* pPacket) { - return pPacket + _MAX_ID_BYTES + _MAX_DATA_BYTES; -} - -/********************************************************************* -* -* _HandleIncomingPacket() -* -* Function description -* Read an incoming command from the down channel and process it. -* -* Additional information -* This function is called each time after sending a packet. -* Processing incoming packets is done asynchronous. SystemView might -* already have sent event packets after the host has sent a command. -*/ -#if (SEGGER_SYSVIEW_POST_MORTEM_MODE != 1) -static void _HandleIncomingPacket(void) { - U8 Cmd; - unsigned int Status; - // - Status = SEGGER_RTT_ReadNoLock(CHANNEL_ID_DOWN, &Cmd, 1); - if (Status > 0) { - switch (Cmd) { - case SEGGER_SYSVIEW_COMMAND_ID_START: - SEGGER_SYSVIEW_Start(); - break; - case SEGGER_SYSVIEW_COMMAND_ID_STOP: - SEGGER_SYSVIEW_Stop(); - break; - case SEGGER_SYSVIEW_COMMAND_ID_GET_SYSTIME: - SEGGER_SYSVIEW_RecordSystime(); - break; - case SEGGER_SYSVIEW_COMMAND_ID_GET_TASKLIST: - SEGGER_SYSVIEW_SendTaskList(); - break; - case SEGGER_SYSVIEW_COMMAND_ID_GET_SYSDESC: - SEGGER_SYSVIEW_GetSysDesc(); - break; - case SEGGER_SYSVIEW_COMMAND_ID_GET_NUMMODULES: - SEGGER_SYSVIEW_SendNumModules(); - break; - case SEGGER_SYSVIEW_COMMAND_ID_GET_MODULEDESC: - SEGGER_SYSVIEW_SendModuleDescription(); - break; - case SEGGER_SYSVIEW_COMMAND_ID_GET_MODULE: - Status = SEGGER_RTT_ReadNoLock(CHANNEL_ID_DOWN, &Cmd, 1); - if (Status > 0) { - SEGGER_SYSVIEW_SendModule(Cmd); - } - break; - case SEGGER_SYSVIEW_COMMAND_ID_HEARTBEAT: - break; - default: - if (Cmd >= 128) { // Unknown extended command. Dummy read its parameter. - SEGGER_RTT_ReadNoLock(CHANNEL_ID_DOWN, &Cmd, 1); - } - break; - } - } -} -#endif // (SEGGER_SYSVIEW_POST_MORTEM_MODE != 1) - -/********************************************************************* -* -* _TrySendOverflowPacket() -* -* Function description -* Try to transmit an SystemView Overflow packet containing the -* number of dropped packets. -* -* Additional information -* Format as follows: -* 01 Max. packet len is 1 + 5 + 5 = 11 -* -* Example packets sent -* 01 20 40 -* -* Return value -* !=0: Success, Message sent (stored in RTT-Buffer) -* ==0: Buffer full, Message *NOT* stored -* -*/ -#if (SEGGER_SYSVIEW_POST_MORTEM_MODE != 1) -static int _TrySendOverflowPacket(void) { - U32 TimeStamp; - I32 Delta; - int Status; - U8 aPacket[11]; - U8* pPayload; - - aPacket[0] = SYSVIEW_EVTID_OVERFLOW; // 1 - pPayload = &aPacket[1]; - ENCODE_U32(pPayload, _SYSVIEW_Globals.DropCount); - // - // Compute time stamp delta and append it to packet. - // - TimeStamp = SEGGER_SYSVIEW_GET_TIMESTAMP(); - Delta = TimeStamp - _SYSVIEW_Globals.LastTxTimeStamp; - MAKE_DELTA_32BIT(Delta); - ENCODE_U32(pPayload, Delta); - // - // Try to store packet in RTT buffer and update time stamp when this was successful - // - Status = (int)SEGGER_RTT_WriteSkipNoLock(CHANNEL_ID_UP, aPacket, (unsigned int)(pPayload - aPacket)); - SEGGER_SYSVIEW_ON_EVENT_RECORDED(pPayload - aPacket); - if (Status) { - _SYSVIEW_Globals.LastTxTimeStamp = TimeStamp; - _SYSVIEW_Globals.EnableState--; // EnableState has been 2, will be 1. Always. - } else { - _SYSVIEW_Globals.DropCount++; - } - // - return Status; -} -#endif // (SEGGER_SYSVIEW_POST_MORTEM_MODE != 1) - -/********************************************************************* -* -* _SendSyncInfo() -* -* Function description -* Send SystemView sync packet and system information in -* post mortem mode. -* -* Additional information -* Sync is 10 * 0x00 without timestamp -*/ -#if (SEGGER_SYSVIEW_POST_MORTEM_MODE == 1) -static void _SendSyncInfo(void) { - // - // Add sync packet ( 10 * 0x00) - // Send system description - // Send system time - // Send task list - // Send module description - // Send module information - // - SEGGER_RTT_WriteWithOverwriteNoLock(CHANNEL_ID_UP, _abSync, 10); - SEGGER_SYSVIEW_ON_EVENT_RECORDED(10); - SEGGER_SYSVIEW_RecordVoid(SYSVIEW_EVTID_TRACE_START); - { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 4 * SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, _SYSVIEW_Globals.SysFreq); - ENCODE_U32(pPayload, _SYSVIEW_Globals.CPUFreq); - ENCODE_U32(pPayload, _SYSVIEW_Globals.RAMBaseAddress); - ENCODE_U32(pPayload, SEGGER_SYSVIEW_ID_SHIFT); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_INIT); - RECORD_END(); - } - if (_SYSVIEW_Globals.pfSendSysDesc) { - _SYSVIEW_Globals.pfSendSysDesc(); - } - SEGGER_SYSVIEW_RecordSystime(); - SEGGER_SYSVIEW_SendTaskList(); - if (_NumModules > 0) { - int n; - SEGGER_SYSVIEW_SendNumModules(); - for (n = 0; n < _NumModules; n++) { - SEGGER_SYSVIEW_SendModule(n); - } - } -} -#endif // (SEGGER_SYSVIEW_POST_MORTEM_MODE == 1) - -/********************************************************************* -* -* _SendPacket() -* -* Function description -* Send a SystemView packet over RTT. RTT channel and mode are -* configured by macros when the SystemView component is initialized. -* This function takes care of maintaining the packet drop count -* and sending overflow packets when necessary. -* The packet must be passed without Id and Length because this -* function prepends it to the packet before transmission. -* -* Parameters -* pStartPacket - Pointer to start of packet payload. -* There must be at least 4 bytes free to prepend Id and Length. -* pEndPacket - Pointer to end of packet payload. -* EventId - Id of the event to send. -* -*/ -static void _SendPacket(U8* pStartPacket, U8* pEndPacket, unsigned int EventId) { - unsigned int NumBytes; - U32 TimeStamp; - U32 Delta; -#if (SEGGER_SYSVIEW_POST_MORTEM_MODE != 1) - unsigned int Status; -#endif - -#if (SEGGER_SYSVIEW_USE_STATIC_BUFFER == 0) - SEGGER_SYSVIEW_LOCK(); -#endif - -#if (SEGGER_SYSVIEW_POST_MORTEM_MODE == 1) - if (_SYSVIEW_Globals.EnableState == 0) { - goto SendDone; - } -#else - if (_SYSVIEW_Globals.EnableState == 1) { // Enabled, no dropped packets remaining - goto Send; - } - if (_SYSVIEW_Globals.EnableState == 0) { - goto SendDone; - } - // - // Handle buffer full situations: - // Have packets been dropped before because buffer was full? - // In this case try to send and overflow packet. - // - if (_SYSVIEW_Globals.EnableState == 2) { - _TrySendOverflowPacket(); - if (_SYSVIEW_Globals.EnableState != 1) { - goto SendDone; - } - } -Send: -#endif - // - // Check if event is disabled from being recorded. - // - if (EventId < 32) { - if (_SYSVIEW_Globals.DisabledEvents & ((U32)1u << EventId)) { - goto SendDone; - } - } - // - // Prepare actual packet. - // If it is a known packet, prepend eventId only, - // otherwise prepend packet length and eventId. - // - if (EventId < 24) { - *--pStartPacket = (U8)EventId; - } else { - // - // Get data length and prepend it. - // - NumBytes = (unsigned int)(pEndPacket - pStartPacket); -#if SEGGER_SYSVIEW_SUPPORT_LONG_DATA - if (NumBytes < 127) { - #error "Seems EventId should be changed to NumBytes in the next line. Please check." - *--pStartPacket = EventId; - } else { - // - // Backwards U32 encode EventId. - // - if (NumBytes < (1ul << 14)) { // Encodes in 2 bytes - *--pStartPacket = (U8)(NumBytes >> 7); - *--pStartPacket = (U8)(NumBytes | 0x80); - } 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 < (1ul << 28)) { // Encodes in 4 bytes - *--pStartPacket = (U8)(NumBytes >> 21); - *--pStartPacket = (U8)((NumBytes >> 14) | 0x80); - *--pStartPacket = (U8)((NumBytes >> 7) | 0x80); - *--pStartPacket = (U8)(NumBytes | 0x80); - } else { // Encodes in 5 bytes - *--pStartPacket = (U8)(NumBytes >> 28); - *--pStartPacket = (U8)((NumBytes >> 21) | 0x80); - *--pStartPacket = (U8)((NumBytes >> 14) | 0x80); - *--pStartPacket = (U8)((NumBytes >> 7) | 0x80); - *--pStartPacket = (U8)(NumBytes | 0x80); - } - } -#else - if (NumBytes > 127) { - *--pStartPacket = (U8)(NumBytes >> 7); - *--pStartPacket = (U8)(NumBytes | 0x80); - } else { - *--pStartPacket = (U8)NumBytes; - } -#endif - // - // Prepend EventId. - // -#if SEGGER_SYSVIEW_SUPPORT_LONG_ID - if (EventId < 127) { - *--pStartPacket = (U8)EventId; - } else { - // - // Backwards U32 encode EventId. - // - if (EventId < (1u << 14)) { // Encodes in 2 bytes - *--pStartPacket = (U8)(EventId >> 7); - *--pStartPacket = (U8)(EventId | 0x80); - } 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 < (1ul << 28)) { // Encodes in 4 bytes - *--pStartPacket = (U8)(EventId >> 21); - *--pStartPacket = (U8)((EventId >> 14) | 0x80); - *--pStartPacket = (U8)((EventId >> 7) | 0x80); - *--pStartPacket = (U8)(EventId | 0x80); - } else { // Encodes in 5 bytes - *--pStartPacket = (U8)(EventId >> 28); - *--pStartPacket = (U8)((EventId >> 21) | 0x80); - *--pStartPacket = (U8)((EventId >> 14) | 0x80); - *--pStartPacket = (U8)((EventId >> 7) | 0x80); - *--pStartPacket = (U8)(EventId | 0x80); - } - } -#else - if (EventId > 127) { - *--pStartPacket = (U8)(EventId >> 7); - *--pStartPacket = (U8)(EventId | 0x80); - } else { - *--pStartPacket = (U8)EventId; - } -#endif - } - // - // Compute time stamp delta and append it to packet. - // - TimeStamp = SEGGER_SYSVIEW_GET_TIMESTAMP(); - Delta = TimeStamp - _SYSVIEW_Globals.LastTxTimeStamp; - MAKE_DELTA_32BIT(Delta); - ENCODE_U32(pEndPacket, Delta); -#if (SEGGER_SYSVIEW_POST_MORTEM_MODE == 1) - // - // Store packet in RTT buffer by overwriting old data and update time stamp - // - SEGGER_RTT_WriteWithOverwriteNoLock(CHANNEL_ID_UP, pStartPacket, pEndPacket - pStartPacket); - SEGGER_SYSVIEW_ON_EVENT_RECORDED(pEndPacket - pStartPacket); - _SYSVIEW_Globals.LastTxTimeStamp = TimeStamp; -#else - // - // Try to store packet in RTT buffer and update time stamp when this was successful - // - Status = SEGGER_RTT_WriteSkipNoLock(CHANNEL_ID_UP, pStartPacket, (unsigned int)(pEndPacket - pStartPacket)); - SEGGER_SYSVIEW_ON_EVENT_RECORDED(pEndPacket - pStartPacket); - if (Status) { - _SYSVIEW_Globals.LastTxTimeStamp = TimeStamp; - } else { - _SYSVIEW_Globals.EnableState++; // EnableState has been 1, will be 2. Always. - } -#endif - -#if (SEGGER_SYSVIEW_POST_MORTEM_MODE == 1) - // - // Add sync and system information periodically if we are in post mortem mode - // - 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; - if (_SYSVIEW_Globals.PacketCount++ & (1 << SEGGER_SYSVIEW_SYNC_PERIOD_SHIFT)) { - _SendSyncInfo(); - _SYSVIEW_Globals.PacketCount = 0; - } - _SYSVIEW_Globals.RecursionCnt = 0; - } -SendDone: - ; // Avoid "label at end of compound statement" error when using static buffer -#else -SendDone: - // - // Check if host is sending data which needs to be processed. - // Note that since this code is called for every packet, it is very time critical, so we do - // only what is really needed here, which is checking if there is any data - // - 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; - } - } -#endif - // -#if (SEGGER_SYSVIEW_USE_STATIC_BUFFER == 0) - SEGGER_SYSVIEW_UNLOCK(); // We are done. Unlock and return -#endif -} - -#ifndef SEGGER_SYSVIEW_EXCLUDE_PRINTF // Define in project to avoid warnings about variable parameter list -/********************************************************************* -* -* _VPrintHost() -* -* Function description -* Send a format string and its parameters to the host. -* -* Parameters -* s Pointer to format string. -* Options Options to be sent to the host. -* pParamList Pointer to the list of arguments for the format string. -*/ -static int _VPrintHost(const char* s, U32 Options, va_list* pParamList) { - U32 aParas[SEGGER_SYSVIEW_MAX_ARGUMENTS]; - U32* pParas; - U32 NumArguments; - const char* p; - char c; - U8* pPayload; - U8* pPayloadStart; -#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT - U8 HasNonScalar; - - HasNonScalar = 0; -#endif - // - // Count number of arguments by counting '%' characters in string. - // If enabled, check for non-scalar modifier flags to format string on the target. - // - p = s; - NumArguments = 0; - for (;;) { - c = *p++; - if (c == 0) { - break; - } - if (c == '%') { - c = *p; -#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT == 0 - aParas[NumArguments++] = (U32)(va_arg(*pParamList, int)); - if (NumArguments == SEGGER_SYSVIEW_MAX_ARGUMENTS) { - break; - } -#else - if (c == 's') { - HasNonScalar = 1; - break; - } else { - aParas[NumArguments++] = (U32)(va_arg(*pParamList, int)); - if (NumArguments == SEGGER_SYSVIEW_MAX_ARGUMENTS) { - break; - } - } -#endif - } - } - -#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT - if (HasNonScalar) { - return -1; - } -#endif - // - // Send string and parameters to host - // - { - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_MAX_STRING_LEN + 2 * SEGGER_SYSVIEW_QUANTA_U32 + SEGGER_SYSVIEW_MAX_ARGUMENTS * SEGGER_SYSVIEW_QUANTA_U32); - pPayload = _EncodeStr(pPayloadStart, s, SEGGER_SYSVIEW_MAX_STRING_LEN); - ENCODE_U32(pPayload, Options); - ENCODE_U32(pPayload, NumArguments); - pParas = aParas; - while (NumArguments--) { - ENCODE_U32(pPayload, (*pParas)); - pParas++; - } - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_PRINT_FORMATTED); - RECORD_END(); - } - return 0; -} - -/********************************************************************* -* -* _StoreChar() -* -* Function description -* Stores a character in the printf-buffer and sends the buffer when -* it is filled. -* -* Parameters -* p Pointer to the buffer description. -* c Character to be printed. -*/ -static void _StoreChar(SEGGER_SYSVIEW_PRINTF_DESC * p, char c) { - unsigned int Cnt; - U8* pPayload; - U32 Options; - - Cnt = p->Cnt; - if ((Cnt + 1u) <= SEGGER_SYSVIEW_MAX_STRING_LEN) { - *(p->pPayload++) = (U8)c; - p->Cnt = Cnt + 1u; - } - // - // Write part of string, when the buffer is full - // - if (p->Cnt == SEGGER_SYSVIEW_MAX_STRING_LEN) { - *(p->pPayloadStart) = (U8)p->Cnt; - pPayload = p->pPayload; - Options = p->Options; - ENCODE_U32(pPayload, Options); - ENCODE_U32(pPayload, 0); - _SendPacket(p->pPayloadStart, pPayload, SYSVIEW_EVTID_PRINT_FORMATTED); - p->pPayloadStart = _PreparePacket(p->pBuffer); - p->pPayload = p->pPayloadStart + 1u; - p->Cnt = 0u; - } -} - -/********************************************************************* -* -* _PrintUnsigned() -* -* Function description -* Print an unsigned integer with the given formatting into the -* formatted string. -* -* Parameters -* pBufferDesc Pointer to the buffer description. -* v Value to be printed. -* Base Base of the value. -* NumDigits Number of digits to be printed. -* FieldWidth Width of the printed field. -* FormatFlags Flags for formatting the value. -*/ -static void _PrintUnsigned(SEGGER_SYSVIEW_PRINTF_DESC * pBufferDesc, unsigned int v, unsigned int Base, unsigned int NumDigits, unsigned int FieldWidth, unsigned int FormatFlags) { - static const char _aV2C[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; - unsigned int Div; - unsigned int Digit; - unsigned int Number; - unsigned int 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); - } - } - } - // - // 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]); - 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, ' '); - } - } - } -} - -/********************************************************************* -* -* _PrintInt() -* -* Function description -* Print a signed integer with the given formatting into the -* formatted string. -* -* Parameters -* pBufferDesc Pointer to the buffer description. -* v Value to be printed. -* Base Base of the value. -* NumDigits Number of digits to be printed. -* FieldWidth Width of the printed field. -* FormatFlags Flags for formatting the value. -*/ -static void _PrintInt(SEGGER_SYSVIEW_PRINTF_DESC * pBufferDesc, int v, unsigned int Base, unsigned int NumDigits, unsigned int FieldWidth, unsigned int FormatFlags) { - unsigned int 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, ' '); - } - } - } - // - // Print sign if necessary - // - if (v < 0) { - v = -v; - _StoreChar(pBufferDesc, '-'); - } else if ((FormatFlags & FORMAT_FLAG_PRINT_SIGN) == FORMAT_FLAG_PRINT_SIGN) { - _StoreChar(pBufferDesc, '+'); - } else { - - } - // - // 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'); - } - } - } - // - // Print number without sign - // - _PrintUnsigned(pBufferDesc, (unsigned int)v, Base, NumDigits, FieldWidth, FormatFlags); -} - -/********************************************************************* -* -* _VPrintTarget() -* -* Function description -* Stores a formatted string. -* This data is read by the host. -* -* Parameters -* sFormat Pointer to format string. -* Options Options to be sent to the host. -* pParamList Pointer to the list of arguments for the format string. -*/ -static void _VPrintTarget(const char* sFormat, U32 Options, va_list* pParamList) { - SEGGER_SYSVIEW_PRINTF_DESC BufferDesc; - char c; - int v; - unsigned int NumDigits; - unsigned int FormatFlags; - unsigned int FieldWidth; - U8* pPayloadStart; - const char* s; -#if SEGGER_SYSVIEW_USE_STATIC_BUFFER == 0 - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_MAX_STRING_LEN + 1 + 2 * SEGGER_SYSVIEW_QUANTA_U32); - SEGGER_SYSVIEW_LOCK(); -#else - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_MAX_STRING_LEN + 1 + 2 * SEGGER_SYSVIEW_QUANTA_U32); -#endif - -#if SEGGER_SYSVIEW_USE_STATIC_BUFFER == 0 - BufferDesc.pBuffer = aPacket; -#else - BufferDesc.pBuffer = _aPacket; -#endif - BufferDesc.Cnt = 0u; - BufferDesc.pPayloadStart = pPayloadStart; - BufferDesc.pPayload = BufferDesc.pPayloadStart + 1u; - BufferDesc.Options = Options; - - 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 int)c - '0'); - } while (1); - - // - // Filter out precision (number of digits to display) - // - NumDigits = 0u; - c = *sFormat; - if (c == '.') { - sFormat++; - do { - c = *sFormat; - if ((c < '0') || (c > '9')) { - break; - } - sFormat++; - NumDigits = NumDigits * 10u + ((unsigned int)c - '0'); - } while (1); - } - // - // Filter out length modifier - // - c = *sFormat; - do { - if ((c == 'l') || (c == 'h')) { - c = *sFormat; - 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, NumDigits, FieldWidth, FormatFlags); - break; - case 'u': - v = va_arg(*pParamList, int); - _PrintUnsigned(&BufferDesc, (unsigned int)v, 10u, NumDigits, FieldWidth, FormatFlags); - break; - case 'x': - case 'X': - v = va_arg(*pParamList, int); - _PrintUnsigned(&BufferDesc, (unsigned int)v, 16u, NumDigits, FieldWidth, FormatFlags); - break; - case 's': - s = va_arg(*pParamList, const char*); - if (s == NULL) { - s = "(null)"; - } - do { - c = *s; - s++; - if (c == '\0') { - break; - } - _StoreChar(&BufferDesc, c); - } while (BufferDesc.Cnt < SEGGER_SYSVIEW_MAX_STRING_LEN); - break; - case 'p': - v = va_arg(*pParamList, int); - _PrintUnsigned(&BufferDesc, (unsigned int)v, 16u, 8u, 8u, 0u); - break; - case '%': - _StoreChar(&BufferDesc, '%'); - break; - default: - break; - } - sFormat++; - } else { - _StoreChar(&BufferDesc, c); - } - } while (*sFormat); - - // - // Write remaining data, if any - // - if (BufferDesc.Cnt != 0u) { - *(BufferDesc.pPayloadStart) = (U8)BufferDesc.Cnt; - ENCODE_U32(BufferDesc.pPayload, BufferDesc.Options); - ENCODE_U32(BufferDesc.pPayload, 0); - _SendPacket(BufferDesc.pPayloadStart, BufferDesc.pPayload, SYSVIEW_EVTID_PRINT_FORMATTED); - } -#if SEGGER_SYSVIEW_USE_STATIC_BUFFER == 0 - SEGGER_SYSVIEW_UNLOCK(); - RECORD_END(); -#else - RECORD_END(); -#endif -} -#endif // SEGGER_SYSVIEW_EXCLUDE_PRINTF - -/********************************************************************* -* -* Public code -* -********************************************************************** -*/ - -/********************************************************************* -* -* SEGGER_SYSVIEW_Init() -* -* Function description -* Initializes the SYSVIEW module. -* Must be called before the SystemView Application connects to -* the system. -* -* Parameters -* SysFreq - Frequency of timestamp, usually CPU core clock frequency. -* CPUFreq - CPU core clock frequency. -* pOSAPI - Pointer to the API structure for OS-specific functions. -* pfSendSysDesc - Pointer to record system description callback function. -* -* Additional information -* This function initializes the RTT channel used to transport -* SEGGER SystemView packets. -* The channel is assigned the label "SysView" for client software -* to identify the SystemView channel. -* -* The channel is configured with the macro SEGGER_SYSVIEW_RTT_CHANNEL. -*/ -void SEGGER_SYSVIEW_Init(U32 SysFreq, U32 CPUFreq, const SEGGER_SYSVIEW_OS_API *pOSAPI, SEGGER_SYSVIEW_SEND_SYS_DESC_FUNC pfSendSysDesc) { -#ifdef SEGGER_RTT_SECTION - // - // Explicitly initialize the RTT Control Block if it is in its dedicated section. - // - SEGGER_RTT_Init(); -#endif -#if (SEGGER_SYSVIEW_POST_MORTEM_MODE == 1) -#if SEGGER_SYSVIEW_RTT_CHANNEL > 0 - SEGGER_RTT_ConfigUpBuffer(SEGGER_SYSVIEW_RTT_CHANNEL, "SysView", &_UpBuffer[0], sizeof(_UpBuffer), SEGGER_RTT_MODE_NO_BLOCK_SKIP); -#else - _SYSVIEW_Globals.UpChannel = (U8)SEGGER_RTT_AllocUpBuffer ("SysView", &_UpBuffer[0], sizeof(_UpBuffer), SEGGER_RTT_MODE_NO_BLOCK_SKIP); -#endif - _SYSVIEW_Globals.RAMBaseAddress = SEGGER_SYSVIEW_ID_BASE; - _SYSVIEW_Globals.LastTxTimeStamp = SEGGER_SYSVIEW_GET_TIMESTAMP(); - _SYSVIEW_Globals.pOSAPI = pOSAPI; - _SYSVIEW_Globals.SysFreq = SysFreq; - _SYSVIEW_Globals.CPUFreq = CPUFreq; - _SYSVIEW_Globals.pfSendSysDesc = pfSendSysDesc; - _SYSVIEW_Globals.EnableState = 0; - _SYSVIEW_Globals.PacketCount = 0; -#else // (SEGGER_SYSVIEW_POST_MORTEM_MODE == 1) -#if SEGGER_SYSVIEW_RTT_CHANNEL > 0 - SEGGER_RTT_ConfigUpBuffer (SEGGER_SYSVIEW_RTT_CHANNEL, "SysView", &_UpBuffer[0], sizeof(_UpBuffer), SEGGER_RTT_MODE_NO_BLOCK_SKIP); - SEGGER_RTT_ConfigDownBuffer (SEGGER_SYSVIEW_RTT_CHANNEL, "SysView", &_DownBuffer[0], sizeof(_DownBuffer), SEGGER_RTT_MODE_NO_BLOCK_SKIP); -#else - _SYSVIEW_Globals.UpChannel = (U8)SEGGER_RTT_AllocUpBuffer ("SysView", &_UpBuffer[0], sizeof(_UpBuffer), SEGGER_RTT_MODE_NO_BLOCK_SKIP); - _SYSVIEW_Globals.DownChannel = _SYSVIEW_Globals.UpChannel; - SEGGER_RTT_ConfigDownBuffer (_SYSVIEW_Globals.DownChannel, "SysView", &_DownBuffer[0], sizeof(_DownBuffer), SEGGER_RTT_MODE_NO_BLOCK_SKIP); -#endif - _SYSVIEW_Globals.RAMBaseAddress = SEGGER_SYSVIEW_ID_BASE; - _SYSVIEW_Globals.LastTxTimeStamp = SEGGER_SYSVIEW_GET_TIMESTAMP(); - _SYSVIEW_Globals.pOSAPI = pOSAPI; - _SYSVIEW_Globals.SysFreq = SysFreq; - _SYSVIEW_Globals.CPUFreq = CPUFreq; - _SYSVIEW_Globals.pfSendSysDesc = pfSendSysDesc; - _SYSVIEW_Globals.EnableState = 0; -#endif // (SEGGER_SYSVIEW_POST_MORTEM_MODE == 1) -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_SetRAMBase() -* -* Function description -* Sets the RAM base address, which is subtracted from IDs in order -* to save bandwidth. -* -* Parameters -* RAMBaseAddress - Lowest RAM Address. (i.e. 0x20000000 on most Cortex-M) -*/ -void SEGGER_SYSVIEW_SetRAMBase(U32 RAMBaseAddress) { - _SYSVIEW_Globals.RAMBaseAddress = RAMBaseAddress; -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordVoid() -* -* Function description -* Formats and sends a SystemView packet with an empty payload. -* -* Parameters -* EventID - SystemView event ID. -*/ -void SEGGER_SYSVIEW_RecordVoid(unsigned int EventID) { - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE); - // - _SendPacket(pPayloadStart, pPayloadStart, EventID); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordU32() -* -* Function description -* Formats and sends a SystemView packet containing a single U32 -* parameter payload. -* -* Parameters -* EventID - SystemView event ID. -* Value - The 32-bit parameter encoded to SystemView packet payload. -*/ -void SEGGER_SYSVIEW_RecordU32(unsigned int EventID, U32 Value) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, Value); - _SendPacket(pPayloadStart, pPayload, EventID); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordU32x2() -* -* Function description -* Formats and sends a SystemView packet containing 2 U32 parameter payload. -* -* Parameters -* EventID - SystemView event ID. -* Para0 - The 32-bit parameter encoded to SystemView packet payload. -* Para1 - The 32-bit parameter encoded to SystemView packet payload. -*/ -void SEGGER_SYSVIEW_RecordU32x2(unsigned int EventID, U32 Para0, U32 Para1) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, Para0); - ENCODE_U32(pPayload, Para1); - _SendPacket(pPayloadStart, pPayload, EventID); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordU32x3() -* -* Function description -* Formats and sends a SystemView packet containing 3 U32 parameter payload. -* -* Parameters -* EventID - SystemView event ID. -* Para0 - The 32-bit parameter encoded to SystemView packet payload. -* Para1 - The 32-bit parameter encoded to SystemView packet payload. -* Para2 - The 32-bit parameter encoded to SystemView packet payload. -*/ -void SEGGER_SYSVIEW_RecordU32x3(unsigned int EventID, U32 Para0, U32 Para1, U32 Para2) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 3 * SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, Para0); - ENCODE_U32(pPayload, Para1); - ENCODE_U32(pPayload, Para2); - _SendPacket(pPayloadStart, pPayload, EventID); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordU32x4() -* -* Function description -* Formats and sends a SystemView packet containing 4 U32 parameter payload. -* -* Parameters -* EventID - SystemView event ID. -* Para0 - The 32-bit parameter encoded to SystemView packet payload. -* Para1 - The 32-bit parameter encoded to SystemView packet payload. -* Para2 - The 32-bit parameter encoded to SystemView packet payload. -* Para3 - The 32-bit parameter encoded to SystemView packet payload. -*/ -void SEGGER_SYSVIEW_RecordU32x4(unsigned int EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 4 * SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, Para0); - ENCODE_U32(pPayload, Para1); - ENCODE_U32(pPayload, Para2); - ENCODE_U32(pPayload, Para3); - _SendPacket(pPayloadStart, pPayload, EventID); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordU32x5() -* -* Function description -* Formats and sends a SystemView packet containing 5 U32 parameter payload. -* -* Parameters -* EventID - SystemView event ID. -* Para0 - The 32-bit parameter encoded to SystemView packet payload. -* Para1 - The 32-bit parameter encoded to SystemView packet payload. -* Para2 - The 32-bit parameter encoded to SystemView packet payload. -* Para3 - The 32-bit parameter encoded to SystemView packet payload. -* Para4 - The 32-bit parameter encoded to SystemView packet payload. -*/ -void SEGGER_SYSVIEW_RecordU32x5(unsigned int EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 5 * SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, Para0); - ENCODE_U32(pPayload, Para1); - ENCODE_U32(pPayload, Para2); - ENCODE_U32(pPayload, Para3); - ENCODE_U32(pPayload, Para4); - _SendPacket(pPayloadStart, pPayload, EventID); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordU32x6() -* -* Function description -* Formats and sends a SystemView packet containing 6 U32 parameter payload. -* -* Parameters -* EventID - SystemView event ID. -* Para0 - The 32-bit parameter encoded to SystemView packet payload. -* Para1 - The 32-bit parameter encoded to SystemView packet payload. -* Para2 - The 32-bit parameter encoded to SystemView packet payload. -* Para3 - The 32-bit parameter encoded to SystemView packet payload. -* Para4 - The 32-bit parameter encoded to SystemView packet payload. -* Para5 - The 32-bit parameter encoded to SystemView packet payload. -*/ -void SEGGER_SYSVIEW_RecordU32x6(unsigned int EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 6 * SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, Para0); - ENCODE_U32(pPayload, Para1); - ENCODE_U32(pPayload, Para2); - ENCODE_U32(pPayload, Para3); - ENCODE_U32(pPayload, Para4); - ENCODE_U32(pPayload, Para5); - _SendPacket(pPayloadStart, pPayload, EventID); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordU32x7() -* -* Function description -* Formats and sends a SystemView packet containing 7 U32 parameter payload. -* -* Parameters -* EventID - SystemView event ID. -* Para0 - The 32-bit parameter encoded to SystemView packet payload. -* Para1 - The 32-bit parameter encoded to SystemView packet payload. -* Para2 - The 32-bit parameter encoded to SystemView packet payload. -* Para3 - The 32-bit parameter encoded to SystemView packet payload. -* Para4 - The 32-bit parameter encoded to SystemView packet payload. -* Para5 - The 32-bit parameter encoded to SystemView packet payload. -* Para6 - The 32-bit parameter encoded to SystemView packet payload. -*/ -void SEGGER_SYSVIEW_RecordU32x7(unsigned int EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5, U32 Para6) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 7 * SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, Para0); - ENCODE_U32(pPayload, Para1); - ENCODE_U32(pPayload, Para2); - ENCODE_U32(pPayload, Para3); - ENCODE_U32(pPayload, Para4); - ENCODE_U32(pPayload, Para5); - ENCODE_U32(pPayload, Para6); - _SendPacket(pPayloadStart, pPayload, EventID); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordU32x8() -* -* Function description -* Formats and sends a SystemView packet containing 8 U32 parameter payload. -* -* Parameters -* EventID - SystemView event ID. -* Para0 - The 32-bit parameter encoded to SystemView packet payload. -* Para1 - The 32-bit parameter encoded to SystemView packet payload. -* Para2 - The 32-bit parameter encoded to SystemView packet payload. -* Para3 - The 32-bit parameter encoded to SystemView packet payload. -* Para4 - The 32-bit parameter encoded to SystemView packet payload. -* Para5 - The 32-bit parameter encoded to SystemView packet payload. -* Para6 - The 32-bit parameter encoded to SystemView packet payload. -* Para7 - The 32-bit parameter encoded to SystemView packet payload. -*/ -void SEGGER_SYSVIEW_RecordU32x8(unsigned int EventID, U32 Para0, U32 Para1, U32 Para2, U32 Para3, U32 Para4, U32 Para5, U32 Para6, U32 Para7) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 8 * SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, Para0); - ENCODE_U32(pPayload, Para1); - ENCODE_U32(pPayload, Para2); - ENCODE_U32(pPayload, Para3); - ENCODE_U32(pPayload, Para4); - ENCODE_U32(pPayload, Para5); - ENCODE_U32(pPayload, Para6); - ENCODE_U32(pPayload, Para7); - _SendPacket(pPayloadStart, pPayload, EventID); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordU32x9() -* -* Function description -* Formats and sends a SystemView packet containing 9 U32 parameter payload. -* -* Parameters -* EventID - SystemView event ID. -* Para0 - The 32-bit parameter encoded to SystemView packet payload. -* Para1 - The 32-bit parameter encoded to SystemView packet payload. -* Para2 - The 32-bit parameter encoded to SystemView packet payload. -* Para3 - The 32-bit parameter encoded to SystemView packet payload. -* Para4 - The 32-bit parameter encoded to SystemView packet payload. -* Para5 - The 32-bit parameter encoded to SystemView packet payload. -* Para6 - The 32-bit parameter encoded to SystemView packet payload. -* Para7 - The 32-bit parameter encoded to SystemView packet payload. -* Para8 - The 32-bit parameter encoded to SystemView packet payload. -*/ -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) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 9 * SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, Para0); - ENCODE_U32(pPayload, Para1); - ENCODE_U32(pPayload, Para2); - ENCODE_U32(pPayload, Para3); - ENCODE_U32(pPayload, Para4); - ENCODE_U32(pPayload, Para5); - ENCODE_U32(pPayload, Para6); - ENCODE_U32(pPayload, Para7); - ENCODE_U32(pPayload, Para8); - _SendPacket(pPayloadStart, pPayload, EventID); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordU32x10() -* -* Function description -* Formats and sends a SystemView packet containing 10 U32 parameter payload. -* -* Parameters -* EventID - SystemView event ID. -* Para0 - The 32-bit parameter encoded to SystemView packet payload. -* Para1 - The 32-bit parameter encoded to SystemView packet payload. -* Para2 - The 32-bit parameter encoded to SystemView packet payload. -* Para3 - The 32-bit parameter encoded to SystemView packet payload. -* Para4 - The 32-bit parameter encoded to SystemView packet payload. -* Para5 - The 32-bit parameter encoded to SystemView packet payload. -* Para6 - The 32-bit parameter encoded to SystemView packet payload. -* Para7 - The 32-bit parameter encoded to SystemView packet payload. -* Para8 - The 32-bit parameter encoded to SystemView packet payload. -* Para9 - The 32-bit parameter encoded to SystemView packet payload. -*/ -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) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 10 * SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, Para0); - ENCODE_U32(pPayload, Para1); - ENCODE_U32(pPayload, Para2); - ENCODE_U32(pPayload, Para3); - ENCODE_U32(pPayload, Para4); - ENCODE_U32(pPayload, Para5); - ENCODE_U32(pPayload, Para6); - ENCODE_U32(pPayload, Para7); - ENCODE_U32(pPayload, Para8); - ENCODE_U32(pPayload, Para9); - _SendPacket(pPayloadStart, pPayload, EventID); - RECORD_END(); -} -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordString() -* -* Function description -* Formats and sends a SystemView packet containing a string. -* -* Parameters -* EventID - SystemView event ID. -* pString - The string to be sent in the SystemView packet payload. -* -* Additional information -* The string is encoded as a count byte followed by the contents -* of the string. -* No more than SEGGER_SYSVIEW_MAX_STRING_LEN bytes will be encoded to the payload. -*/ -void SEGGER_SYSVIEW_RecordString(unsigned int EventID, const char* pString) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 1 + SEGGER_SYSVIEW_MAX_STRING_LEN); - // - pPayload = _EncodeStr(pPayloadStart, pString, SEGGER_SYSVIEW_MAX_STRING_LEN); - _SendPacket(pPayloadStart, pPayload, EventID); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_Start() -* -* Function description -* Start recording SystemView events. -* -* This function is triggered by the SystemView Application on connect. -* For single-shot or post-mortem mode recording, it needs to be called -* by the application. -* -* Additional information -* This function enables transmission of SystemView packets recorded -* by subsequent trace calls and records a SystemView Start event. -* -* As part of start, a SystemView Init packet is sent, containing the system -* frequency. The list of current tasks, the current system time and the -* system description string is sent, too. -* -* Notes -* SEGGER_SYSVIEW_Start and SEGGER_SYSVIEW_Stop do not nest. -* When SEGGER_SYSVIEW_CAN_RESTART is 1, each received start command -* records the system information. This is required to enable restart -* of recordings when SystemView unexpectedly disconnects without sending -* a stop command before. -*/ -void SEGGER_SYSVIEW_Start(void) { -#if (SEGGER_SYSVIEW_CAN_RESTART == 0) - if (_SYSVIEW_Globals.EnableState == 0) { -#endif - _SYSVIEW_Globals.EnableState = 1; -#if (SEGGER_SYSVIEW_POST_MORTEM_MODE == 1) - _SendSyncInfo(); -#else - SEGGER_SYSVIEW_LOCK(); - SEGGER_RTT_WriteSkipNoLock(CHANNEL_ID_UP, _abSync, 10); - SEGGER_SYSVIEW_UNLOCK(); - SEGGER_SYSVIEW_ON_EVENT_RECORDED(10); - SEGGER_SYSVIEW_RecordVoid(SYSVIEW_EVTID_TRACE_START); - { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 4 * SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, _SYSVIEW_Globals.SysFreq); - ENCODE_U32(pPayload, _SYSVIEW_Globals.CPUFreq); - ENCODE_U32(pPayload, _SYSVIEW_Globals.RAMBaseAddress); - ENCODE_U32(pPayload, SEGGER_SYSVIEW_ID_SHIFT); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_INIT); - RECORD_END(); - } - if (_SYSVIEW_Globals.pfSendSysDesc) { - _SYSVIEW_Globals.pfSendSysDesc(); - } - SEGGER_SYSVIEW_RecordSystime(); - SEGGER_SYSVIEW_SendTaskList(); - SEGGER_SYSVIEW_SendNumModules(); -#endif -#if (SEGGER_SYSVIEW_CAN_RESTART == 0) - } -#endif -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_Stop() -* -* Function description -* Stop recording SystemView events. -* -* This function is triggered by the SystemView Application on disconnect. -* For single-shot or postmortem mode recording, it can be called -* by the application. -* -* Additional information -* This function disables transmission of SystemView packets recorded -* by subsequent trace calls. If transmission is enabled when -* this function is called, a single SystemView Stop event is recorded -* to the trace, send, and then trace transmission is halted. -*/ -void SEGGER_SYSVIEW_Stop(void) { - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE); - // We should send answer for the Stop command in any case. - _SYSVIEW_Globals.EnableState = 1; - if (_SYSVIEW_Globals.EnableState) { - _SendPacket(pPayloadStart, pPayloadStart, SYSVIEW_EVTID_TRACE_STOP); - _SYSVIEW_Globals.EnableState = 0; - } - RECORD_END(); -} - -U8 SEGGER_SYSVIEW_Started(void) { - return _SYSVIEW_Globals.EnableState; -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_GetChannelID() -* -* Function description -* Returns the RTT / channel ID used by SystemView. -*/ -int SEGGER_SYSVIEW_GetChannelID(void) { - return CHANNEL_ID_UP; -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_GetSysDesc() -* -* Function description -* Triggers a send of the system information and description. -* -*/ -void SEGGER_SYSVIEW_GetSysDesc(void) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32 + SEGGER_SYSVIEW_MAX_STRING_LEN + 3/*1 or 3 bytes for string length*/); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, _SYSVIEW_Globals.SysFreq); - ENCODE_U32(pPayload, _SYSVIEW_Globals.CPUFreq); - ENCODE_U32(pPayload, _SYSVIEW_Globals.RAMBaseAddress); - ENCODE_U32(pPayload, SEGGER_SYSVIEW_ID_SHIFT); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_INIT); - RECORD_END(); - if (_SYSVIEW_Globals.pfSendSysDesc) { - _SYSVIEW_Globals.pfSendSysDesc(); - } -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_SendTaskInfo() -* -* Function description -* Send a Task Info Packet, containing TaskId for identification, -* task priority and task name. -* -* Parameters -* pInfo - Pointer to task information to send. -*/ -void SEGGER_SYSVIEW_SendTaskInfo(const SEGGER_SYSVIEW_TASKINFO *pInfo) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32 + 1 + 32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, SHRINK_ID(pInfo->TaskID)); - ENCODE_U32(pPayload, pInfo->Prio); - pPayload = _EncodeStr(pPayload, pInfo->sName, 32); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_TASK_INFO); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, SHRINK_ID(pInfo->TaskID)); - ENCODE_U32(pPayload, pInfo->StackBase); - ENCODE_U32(pPayload, pInfo->StackSize); - ENCODE_U32(pPayload, pInfo->StackUsage); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_STACK_INFO); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_SendStackInfo() -* -* Function description -* Send a Stack Info Packet, containing TaskId for identification, -* stack base, stack size and stack usage. -* -* -* Parameters -* pInfo - Pointer to stack information to send. -*/ -void SEGGER_SYSVIEW_SendStackInfo(const SEGGER_SYSVIEW_STACKINFO *pInfo) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 4 * SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, SHRINK_ID(pInfo->TaskID)); - ENCODE_U32(pPayload, pInfo->StackBase); - ENCODE_U32(pPayload, pInfo->StackSize); - ENCODE_U32(pPayload, pInfo->StackUsage); - - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_SampleData() -* -* Function description -* Send a Data Sample Packet, containing the data Id and the value. -* -* -* Parameters -* pInfo - Pointer to data sample struct to send. -*/ -void SEGGER_SYSVIEW_SampleData(const SEGGER_SYSVIEW_DATA_SAMPLE *pInfo) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, pInfo->ID); - pPayload = _EncodeFloat(pPayload, *(pInfo->pFloat_Value)); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_DATA_SAMPLE); - - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_SendTaskList() -* -* Function description -* Send all tasks descriptors to the host. -*/ -void SEGGER_SYSVIEW_SendTaskList(void) { - if (_SYSVIEW_Globals.pOSAPI && _SYSVIEW_Globals.pOSAPI->pfSendTaskList) { - _SYSVIEW_Globals.pOSAPI->pfSendTaskList(); - } -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_SendSysDesc() -* -* Function description -* Send the system description string to the host. -* 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 -* callback, to ensure it is only sent when the SystemView Application -* is connected. -* -* Parameters -* sSysDesc - Pointer to the 0-terminated system description string. -* -* Additional information -* One system description string may not exceed SEGGER_SYSVIEW_MAX_STRING_LEN characters. -* Multiple description strings can be recorded. -* -* The Following items can be described in a system description string. -* Each item is identified by its identifier, followed by '=' and the value. -* Items are separated by ','. -*/ -void SEGGER_SYSVIEW_SendSysDesc(const char *sSysDesc) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 1 + SEGGER_SYSVIEW_MAX_STRING_LEN); - // - pPayload = _EncodeStr(pPayloadStart, sSysDesc, SEGGER_SYSVIEW_MAX_STRING_LEN); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_SYSDESC); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordSystime() -* -* Function description -* Formats and sends a SystemView Systime containing a single U64 or U32 -* parameter payload. -*/ -void SEGGER_SYSVIEW_RecordSystime(void) { - U64 Systime; - // This code requeued because SystemView expect the answer from the device. - // If there is no answer, then communication will be broken. - U8 old_en = _SYSVIEW_Globals.EnableState; - _SYSVIEW_Globals.EnableState = 1; - - if (_SYSVIEW_Globals.pOSAPI && _SYSVIEW_Globals.pOSAPI->pfGetTime) { - Systime = _SYSVIEW_Globals.pOSAPI->pfGetTime(); - SEGGER_SYSVIEW_RecordU32x2(SYSVIEW_EVTID_SYSTIME_US, - (U32)(Systime), - (U32)(Systime >> 32)); - } else { - SEGGER_SYSVIEW_RecordU32(SYSVIEW_EVTID_SYSTIME_CYCLES, SEGGER_SYSVIEW_GET_TIMESTAMP()); - } - _SYSVIEW_Globals.EnableState = old_en; -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordEnterISR() -* -* Function description -* Format and send an ISR entry event. -* -* Additional information -* Example packets sent -* 02 0F 50 // ISR(15) Enter. Timestamp is 80 (0x50) -*/ -void SEGGER_SYSVIEW_RecordEnterISR(U32 IrqId) { - unsigned v; - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - v = IrqId; // SEGGER_SYSVIEW_GET_INTERRUPT_ID(); - ENCODE_U32(pPayload, v); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_ISR_ENTER); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordExitISR() -* -* Function description -* Format and send an ISR exit event. -* -* Additional information -* Format as follows: -* 03 // Max. packet len is 6 -* -* Example packets sent -* 03 20 // ISR Exit. Timestamp is 32 (0x20) -*/ -void SEGGER_SYSVIEW_RecordExitISR(void) { - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE); - // - _SendPacket(pPayloadStart, pPayloadStart, SYSVIEW_EVTID_ISR_EXIT); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordExitISRToScheduler() -* -* Function description -* Format and send an ISR exit into scheduler event. -* -* Additional information -* Format as follows: -* 18 // Max. packet len is 6 -* -* Example packets sent -* 18 20 // ISR Exit to Scheduler. Timestamp is 32 (0x20) -*/ -void SEGGER_SYSVIEW_RecordExitISRToScheduler(void) { - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE); - // - _SendPacket(pPayloadStart, pPayloadStart, SYSVIEW_EVTID_ISR_TO_SCHEDULER); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordEnterTimer() -* -* Function description -* Format and send a Timer entry event. -* -* Parameters -* TimerId - Id of the timer which starts. -*/ -void SEGGER_SYSVIEW_RecordEnterTimer(U32 TimerId) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, SHRINK_ID(TimerId)); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_TIMER_ENTER); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordExitTimer() -* -* Function description -* Format and send a Timer exit event. -*/ -void SEGGER_SYSVIEW_RecordExitTimer(void) { - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE); - // - _SendPacket(pPayloadStart, pPayloadStart, SYSVIEW_EVTID_TIMER_EXIT); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordEndCall() -* -* Function description -* Format and send an End API Call event without return value. -* -* Parameters -* EventID - Id of API function which ends. -*/ -void SEGGER_SYSVIEW_RecordEndCall(unsigned int EventID) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, EventID); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_END_CALL); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordEndCallU32() -* -* Function description -* Format and send an End API Call event with return value. -* -* Parameters -* EventID - Id of API function which ends. -* Para0 - Return value which will be returned by the API function. -*/ -void SEGGER_SYSVIEW_RecordEndCallU32(unsigned int EventID, U32 Para0) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, EventID); - ENCODE_U32(pPayload, Para0); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_END_CALL); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_OnIdle() -* -* Function description -* Record an Idle event. -*/ -void SEGGER_SYSVIEW_OnIdle(void) { - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE); - // - _SendPacket(pPayloadStart, pPayloadStart, SYSVIEW_EVTID_IDLE); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_OnTaskCreate() -* -* Function description -* Record a Task Create event. The Task Create event corresponds -* to creating a task in the OS. -* -* Parameters -* TaskId - Task ID of created task. -*/ -void SEGGER_SYSVIEW_OnTaskCreate(U32 TaskId) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - TaskId = SHRINK_ID(TaskId); - ENCODE_U32(pPayload, TaskId); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_TASK_CREATE); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_OnTaskTerminate() -* -* Function description -* Record a Task termination event. -* The Task termination event corresponds to terminating a task in -* the OS. If the TaskId is the currently active task, -* SEGGER_SYSVIEW_OnTaskStopExec may be used, either. -* -* Parameters -* TaskId - Task ID of terminated task. -*/ -void SEGGER_SYSVIEW_OnTaskTerminate(U32 TaskId) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - TaskId = SHRINK_ID(TaskId); - ENCODE_U32(pPayload, TaskId); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_TASK_TERMINATE); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_OnTaskStartExec() -* -* Function description -* Record a Task Start Execution event. The Task Start event -* corresponds to when a task has started to execute rather than -* when it is ready to execute. -* -* Parameters -* TaskId - Task ID of task that started to execute. -*/ -void SEGGER_SYSVIEW_OnTaskStartExec(U32 TaskId) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - TaskId = SHRINK_ID(TaskId); - ENCODE_U32(pPayload, TaskId); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_TASK_START_EXEC); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_OnTaskStopExec() -* -* Function description -* Record a Task Stop Execution event. The Task Stop event -* corresponds to when a task stops executing and terminates. -*/ -void SEGGER_SYSVIEW_OnTaskStopExec(void) { - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE); - // - _SendPacket(pPayloadStart, pPayloadStart, SYSVIEW_EVTID_TASK_STOP_EXEC); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_OnTaskStartReady() -* -* Function description -* Record a Task Start Ready event. -* -* Parameters -* TaskId - Task ID of task that started to execute. -*/ -void SEGGER_SYSVIEW_OnTaskStartReady(U32 TaskId) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - TaskId = SHRINK_ID(TaskId); - ENCODE_U32(pPayload, TaskId); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_TASK_START_READY); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_OnTaskStopReady() -* -* Function description -* Record a Task Stop Ready event. -* -* Parameters -* TaskId - Task ID of task that completed execution. -* Cause - Reason for task to stop (i.e. Idle/Sleep) -*/ -void SEGGER_SYSVIEW_OnTaskStopReady(U32 TaskId, unsigned int Cause) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - TaskId = SHRINK_ID(TaskId); - ENCODE_U32(pPayload, TaskId); - ENCODE_U32(pPayload, Cause); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_TASK_STOP_READY); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_MarkStart() -* -* Function description -* Record a Performance Marker Start event to start measuring runtime. -* -* Parameters -* MarkerId - User defined ID for the marker. -*/ -void SEGGER_SYSVIEW_MarkStart(unsigned MarkerId) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, MarkerId); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_MARK_START); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_MarkStop() -* -* Function description -* Record a Performance Marker Stop event to stop measuring runtime. -* -* Parameters -* MarkerId - User defined ID for the marker. -*/ -void SEGGER_SYSVIEW_MarkStop(unsigned MarkerId) { - U8 * pPayload; - U8 * pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, MarkerId); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_MARK_STOP); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_Mark() -* -* Function description -* Record a Performance Marker intermediate event. -* -* Parameters -* MarkerId - User defined ID for the marker. -*/ -void SEGGER_SYSVIEW_Mark(unsigned int MarkerId) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, SYSVIEW_EVTID_EX_MARK); - ENCODE_U32(pPayload, MarkerId); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_EX); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_NameMarker() -* -* Function description -* Send the name of a Performance Marker to be displayed in SystemView. -* -* Marker names are usually set in the system description -* callback, to ensure it is only sent when the SystemView Application -* is connected. -* -* Parameters -* MarkerId - User defined ID for the marker. -* sName - Pointer to the marker name. (Max. SEGGER_SYSVIEW_MAX_STRING_LEN Bytes) -*/ -void SEGGER_SYSVIEW_NameMarker(unsigned int MarkerId, const char* sName) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32 + 1 + SEGGER_SYSVIEW_MAX_STRING_LEN); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, SYSVIEW_EVTID_EX_NAME_MARKER); - ENCODE_U32(pPayload, MarkerId); - pPayload = _EncodeStr(pPayload, sName, SEGGER_SYSVIEW_MAX_STRING_LEN); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_EX); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_NameResource() -* -* Function description -* Send the name of a resource to be displayed in SystemView. -* -* Marker names are usually set in the system description -* callback, to ensure it is only sent when the SystemView Application -* is connected. -* -* Parameters -* ResourceId - Id of the resource to be named. i.e. its address. -* sName - Pointer to the resource name. (Max. SEGGER_SYSVIEW_MAX_STRING_LEN Bytes) -*/ -void SEGGER_SYSVIEW_NameResource(U32 ResourceId, const char* sName) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + SEGGER_SYSVIEW_QUANTA_U32 + 1 + SEGGER_SYSVIEW_MAX_STRING_LEN); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, SHRINK_ID(ResourceId)); - pPayload = _EncodeStr(pPayload, sName, SEGGER_SYSVIEW_MAX_STRING_LEN); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_NAME_RESOURCE); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RegisterData() -* -* Function description -* Register data to sample the values via SystemView. -* -* Register functions are usually set in the system description -* callback, to ensure it is only sent when the SystemView Application -* is connected. -* -* Parameters -* pInfo - Struct containing all possible properties that can be sent via this registration event. -*/ -void SEGGER_SYSVIEW_RegisterData(SEGGER_SYSVIEW_DATA_REGISTER* pInfo) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 8 * SEGGER_SYSVIEW_QUANTA_U32 + 1 + SEGGER_SYSVIEW_MAX_STRING_LEN); - // - pPayload = pPayloadStart; - ENCODE_U32(pPayload, SYSVIEW_EVTID_EX_REGISTER_DATA); - ENCODE_U32(pPayload, pInfo->ID); - pPayload = _EncodeStr(pPayload, pInfo->sName, SEGGER_SYSVIEW_MAX_STRING_LEN); - - if (pInfo->sName != 0) { - ENCODE_U32(pPayload, pInfo->DataType); - ENCODE_U32(pPayload, pInfo->Offset); - ENCODE_U32(pPayload, pInfo->RangeMin); - ENCODE_U32(pPayload, pInfo->RangeMax); - pPayload = _EncodeFloat(pPayload, pInfo->ScalingFactor); - pPayload = _EncodeStr(pPayload, pInfo->sUnit, SEGGER_SYSVIEW_MAX_STRING_LEN); - } else if (pInfo->ScalingFactor != 0) { - ENCODE_U32(pPayload, pInfo->DataType); - ENCODE_U32(pPayload, pInfo->Offset); - ENCODE_U32(pPayload, pInfo->RangeMin); - ENCODE_U32(pPayload, pInfo->RangeMax); - pPayload = _EncodeFloat(pPayload, pInfo->ScalingFactor); - } else if (pInfo->RangeMax != 0) { - ENCODE_U32(pPayload, pInfo->DataType); - ENCODE_U32(pPayload, pInfo->Offset); - ENCODE_U32(pPayload, pInfo->RangeMin); - ENCODE_U32(pPayload, pInfo->RangeMax); - } else if (pInfo->RangeMin != 0) { - ENCODE_U32(pPayload, pInfo->DataType); - ENCODE_U32(pPayload, pInfo->Offset); - ENCODE_U32(pPayload, pInfo->RangeMin); - } else if (pInfo->Offset != 0) { - ENCODE_U32(pPayload, pInfo->DataType); - ENCODE_U32(pPayload, pInfo->Offset); - } else if (pInfo->DataType != 0) { - ENCODE_U32(pPayload, pInfo->DataType); - } - - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_EX); - 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() -* -* Function description -* Send an event packet. -* -* Parameters -* pPacket - Pointer to the start of the packet. -* pPayloadEnd - Pointer to the end of the payload. -* Make sure there are at least 5 bytes free after the payload. -* EventId - Id of the event packet. -* -* Return value -* !=0: Success, Message sent. -* ==0: Buffer full, Message *NOT* sent. -*/ -int SEGGER_SYSVIEW_SendPacket(U8* pPacket, U8* pPayloadEnd, unsigned int EventId) { -#if (SEGGER_SYSVIEW_USE_STATIC_BUFFER == 1) - SEGGER_SYSVIEW_LOCK(); -#endif - _SendPacket(pPacket + 4, pPayloadEnd, EventId); -#if (SEGGER_SYSVIEW_USE_STATIC_BUFFER == 1) - SEGGER_SYSVIEW_UNLOCK(); -#endif - return 0; -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_EncodeU32() -* -* Function description -* Encode a U32 in variable-length format. -* -* Parameters -* pPayload - Pointer to where U32 will be encoded. -* Value - The 32-bit value to be encoded. -* -* Return value -* Pointer to the byte following the value, i.e. the first free -* byte in the payload and the next position to store payload -* content. -*/ -U8* SEGGER_SYSVIEW_EncodeU32(U8* pPayload, U32 Value) { - ENCODE_U32(pPayload, Value); - return pPayload; -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_EncodeString() -* -* Function description -* Encode a string in variable-length format. -* -* Parameters -* pPayload - Pointer to where string will be encoded. -* s - String to encode. -* MaxLen - Maximum number of characters to encode from string. -* -* Return value -* Pointer to the byte following the value, i.e. the first free -* byte in the payload and the next position to store payload -* content. -* -* Additional information -* The string is encoded as a count byte followed by the contents -* of the string. -* No more than 1 + MaxLen bytes will be encoded to the payload. -*/ -U8* SEGGER_SYSVIEW_EncodeString(U8* pPayload, const char* s, unsigned int MaxLen) { - return _EncodeStr(pPayload, s, MaxLen); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_EncodeData() -* -* Function description -* Encode a byte buffer in variable-length format. -* -* Parameters -* pPayload - Pointer to where string will be encoded. -* pSrc - Pointer to data buffer to be encoded. -* NumBytes - Number of bytes in the buffer to be encoded. -* -* Return value -* Pointer to the byte following the value, i.e. the first free -* byte in the payload and the next position to store payload -* content. -* -* Additional information -* The data is encoded as a count byte followed by the contents -* of the data buffer. -* Make sure NumBytes + 1 bytes are free for the payload. -*/ -U8* SEGGER_SYSVIEW_EncodeData(U8 *pPayload, const char* pSrc, unsigned int NumBytes) { - return _EncodeData(pPayload, pSrc, NumBytes); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_EncodeId() -* -* Function description -* Encode a 32-bit Id in shrunken variable-length format. -* -* Parameters -* pPayload - Pointer to where the Id will be encoded. -* Id - The 32-bit value to be encoded. -* -* Return value -* Pointer to the byte following the value, i.e. the first free -* byte in the payload and the next position to store payload -* content. -* -* Additional information -* The parameters to shrink an Id can be configured in -* SEGGER_SYSVIEW_Conf.h and via SEGGER_SYSVIEW_SetRAMBase(). -* SEGGER_SYSVIEW_ID_BASE: Lowest Id reported by the application. -* (i.e. 0x20000000 when all Ids are an address in this RAM) -* SEGGER_SYSVIEW_ID_SHIFT: Number of bits to shift the Id to -* save bandwidth. (i.e. 2 when Ids are 4 byte aligned) -*/ -U8* SEGGER_SYSVIEW_EncodeId(U8* pPayload, U32 Id) { - Id = SHRINK_ID(Id); - ENCODE_U32(pPayload, Id); - return pPayload; -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_ShrinkId() -* -* Function description -* Get the shrunken value of an Id for further processing like in -* SEGGER_SYSVIEW_NameResource(). -* -* Parameters -* Id - The 32-bit value to be shrunken. -* -* Return value -* Shrunken Id. -* -* Additional information -* The parameters to shrink an Id can be configured in -* SEGGER_SYSVIEW_Conf.h and via SEGGER_SYSVIEW_SetRAMBase(). -* SEGGER_SYSVIEW_ID_BASE: Lowest Id reported by the application. -* (i.e. 0x20000000 when all Ids are an address in this RAM) -* SEGGER_SYSVIEW_ID_SHIFT: Number of bits to shift the Id to -* save bandwidth. (i.e. 2 when Ids are 4 byte aligned) -*/ -U32 SEGGER_SYSVIEW_ShrinkId(U32 Id) { - return SHRINK_ID(Id); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RegisterModule() -* -* Function description -* Register a middleware module for recording its events. -* -* Parameters -* pModule - The middleware module information. -* -* Additional information -* SEGGER_SYSVIEW_MODULE elements: -* sDescription - Pointer to a string containing the module name and optionally the module event description. -* NumEvents - Number of events the module wants to register. -* EventOffset - Offset to be added to the event Ids. Out parameter, set by this function. Do not modify after calling this function. -* pfSendModuleDesc - Callback function pointer to send more detailed module description to SystemView Application. -* pNext - Pointer to next registered module. Out parameter, set by this function. Do not modify after calling this function. -*/ -void SEGGER_SYSVIEW_RegisterModule(SEGGER_SYSVIEW_MODULE* pModule) { - SEGGER_SYSVIEW_LOCK(); - if (_pFirstModule == 0) { - // - // No module registered, yet. - // Start list with new module. - // EventOffset is the base offset for modules - // - pModule->EventOffset = MODULE_EVENT_OFFSET; - pModule->pNext = 0; - _pFirstModule = pModule; - _NumModules = 1; - } else { - // - // Registreded module(s) present. - // Prepend new module in list. - // EventOffset set from number of events and offset of previous module. - // - pModule->EventOffset = _pFirstModule->EventOffset + _pFirstModule->NumEvents; - pModule->pNext = _pFirstModule; - _pFirstModule = pModule; - _NumModules++; - } - SEGGER_SYSVIEW_SendModule(0); - SEGGER_SYSVIEW_UNLOCK(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_RecordModuleDescription() -* -* Function description -* Sends detailed information of a registered module to the host. -* -* Parameters -* pModule - Pointer to the described module. -* sDescription - Pointer to a description string. -*/ -void SEGGER_SYSVIEW_RecordModuleDescription(const SEGGER_SYSVIEW_MODULE* pModule, const char* sDescription) { - U8 ModuleId; - SEGGER_SYSVIEW_MODULE* p; - - p = _pFirstModule; - ModuleId = 0; - do { - if (p == pModule) { - break; - } - ModuleId++; - p = p->pNext; - } while (p); - { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32 + 1 + SEGGER_SYSVIEW_MAX_STRING_LEN); - // - pPayload = pPayloadStart; - // - // Send module description - // Send event offset and number of events - // - ENCODE_U32(pPayload, ModuleId); - ENCODE_U32(pPayload, (pModule->EventOffset)); - pPayload = _EncodeStr(pPayload, sDescription, SEGGER_SYSVIEW_MAX_STRING_LEN); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_MODULEDESC); - RECORD_END(); - } -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_SendModule() -* -* Function description -* Sends the information of a registered module to the host. -* -* Parameters -* ModuleId - Id of the requested module. -*/ -void SEGGER_SYSVIEW_SendModule(U8 ModuleId) { - SEGGER_SYSVIEW_MODULE* pModule; - U32 n; - - if (_pFirstModule != 0) { - pModule = _pFirstModule; - for (n = 0; n < ModuleId; n++) { - pModule = pModule->pNext; - if (pModule == 0) { - break; - } - } - if (pModule != 0) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32 + 1 + SEGGER_SYSVIEW_MAX_STRING_LEN); - // - pPayload = pPayloadStart; - // - // Send module description - // Send event offset and number of events - // - ENCODE_U32(pPayload, ModuleId); - ENCODE_U32(pPayload, (pModule->EventOffset)); - pPayload = _EncodeStr(pPayload, pModule->sModule, SEGGER_SYSVIEW_MAX_STRING_LEN); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_MODULEDESC); - RECORD_END(); - } - if (pModule && pModule->pfSendModuleDesc) { - pModule->pfSendModuleDesc(); - } - } -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_SendModuleDescription() -* -* Function description -* Triggers a send of the registered module descriptions. -* -*/ -void SEGGER_SYSVIEW_SendModuleDescription(void) { - SEGGER_SYSVIEW_MODULE* pModule; - - if (_pFirstModule != 0) { - pModule = _pFirstModule; - do { - if (pModule->pfSendModuleDesc) { - pModule->pfSendModuleDesc(); - } - pModule = pModule->pNext; - } while (pModule); - } -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_SendNumModules() -* -* Function description -* Send the number of registered modules to the host. -*/ -void SEGGER_SYSVIEW_SendNumModules(void) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2*SEGGER_SYSVIEW_QUANTA_U32); - pPayload = pPayloadStart; - ENCODE_U32(pPayload, _NumModules); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_NUMMODULES); - RECORD_END(); -} - -#ifndef SEGGER_SYSVIEW_EXCLUDE_PRINTF // Define in project to avoid warnings about variable parameter list - -/********************************************************************* -* -* SEGGER_SYSVIEW_PrintfHostEx() -* -* Function description -* Print a string which is formatted on the host by the SystemView Application -* with Additional information. -* -* Parameters -* s - String to be formatted. -* Options - Options for the string. i.e. Log level. -* -* Additional information -* All format arguments are treated as 32-bit scalar values. -*/ -void SEGGER_SYSVIEW_PrintfHostEx(const char* s, U32 Options, ...) { - va_list ParamList; -#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT - int r; - - va_start(ParamList, Options); - r = _VPrintHost(s, Options, &ParamList); - va_end(ParamList); - - if (r == -1) { - va_start(ParamList, Options); - _VPrintTarget(s, Options, &ParamList); - va_end(ParamList); - } -#else - va_start(ParamList, Options); - _VPrintHost(s, Options, &ParamList); - va_end(ParamList); -#endif -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_VPrintfHostEx() -* -* Function description -* Print a string which is formatted on the host by the SystemView Application -* with Additional information. -* -* Parameters -* s - String to be formatted. -* Options - Options for the string. i.e. Log level. -* pParamList - Pointer to the list of arguments for the format string -* -* Additional information -* All format arguments are treated as 32-bit scalar values. -*/ -void SEGGER_SYSVIEW_VPrintfHostEx(const char* s, U32 Options, va_list *pParamList) { -#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT - int r; - va_list ParamListCopy; - va_copy(ParamListCopy, *pParamList); - - r = _VPrintHost(s, Options, pParamList); - - if (r == -1) { - _VPrintTarget(s, Options, &ParamListCopy); - } - va_end(ParamListCopy); -#else - _VPrintHost(s, Options, pParamList); -#endif -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_PrintfHost() -* -* Function description -* Print a string which is formatted on the host by the SystemView Application. -* -* Parameters -* s - String to be formatted. -* -* Additional information -* All format arguments are treated as 32-bit scalar values. -*/ -void SEGGER_SYSVIEW_PrintfHost(const char* s, ...) { - va_list ParamList; -#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT - int r; - - va_start(ParamList, s); - r = _VPrintHost(s, SEGGER_SYSVIEW_LOG, &ParamList); - va_end(ParamList); - - if (r == -1) { - va_start(ParamList, s); - _VPrintTarget(s, SEGGER_SYSVIEW_LOG, &ParamList); - va_end(ParamList); - } -#else - va_start(ParamList, s); - _VPrintHost(s, SEGGER_SYSVIEW_LOG, &ParamList); - va_end(ParamList); -#endif -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_VPrintfHost() -* -* Function description -* Print a string which is formatted on the host by the SystemView Application. -* -* Parameters -* s - String to be formatted. -* pParamList - Pointer to the list of arguments for the format string -* -* Additional information -* All format arguments are treated as 32-bit scalar values. -*/ -void SEGGER_SYSVIEW_VPrintfHost(const char* s, va_list *pParamList) { -#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT - int r; - va_list ParamListCopy; - va_copy(ParamListCopy, *pParamList); - - r = _VPrintHost(s, SEGGER_SYSVIEW_LOG, pParamList); - - if (r == -1) { - _VPrintTarget(s, SEGGER_SYSVIEW_LOG, &ParamListCopy); - } - va_end(ParamListCopy); -#else - _VPrintHost(s, SEGGER_SYSVIEW_LOG, pParamList); -#endif -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_WarnfHost() -* -* Function description -* Print a warning string which is formatted on the host by -* the SystemView Application. -* -* Parameters -* s - String to be formatted. -* -* Additional information -* All format arguments are treated as 32-bit scalar values. -*/ -void SEGGER_SYSVIEW_WarnfHost(const char* s, ...) { - va_list ParamList; -#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT - int r; - - va_start(ParamList, s); - r = _VPrintHost(s, SEGGER_SYSVIEW_WARNING, &ParamList); - va_end(ParamList); - - if (r == -1) { - va_start(ParamList, s); - _VPrintTarget(s, SEGGER_SYSVIEW_WARNING, &ParamList); - va_end(ParamList); - } -#else - va_start(ParamList, s); - _VPrintHost(s, SEGGER_SYSVIEW_WARNING, &ParamList); - va_end(ParamList); -#endif -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_VWarnfHost() -* -* Function description -* Print a warning string which is formatted on the host by -* the SystemView Application. -* -* Parameters -* s - String to be formatted. -* pParamList - Pointer to the list of arguments for the format string -* -* Additional information -* All format arguments are treated as 32-bit scalar values. -*/ -void SEGGER_SYSVIEW_VWarnfHost(const char* s, va_list *pParamList) { -#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT - int r; - va_list ParamListCopy; - va_copy(ParamListCopy, *pParamList); - - r = _VPrintHost(s, SEGGER_SYSVIEW_WARNING, pParamList); - - if (r == -1) { - _VPrintTarget(s, SEGGER_SYSVIEW_WARNING, &ParamListCopy); - } - va_end(ParamListCopy); -#else - _VPrintHost(s, SEGGER_SYSVIEW_WARNING, pParamList); -#endif -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_ErrorfHost() -* -* Function description -* Print an error string which is formatted on the host by -* the SystemView Application. -* -* Parameters -* s - String to be formatted. -* -* Additional information -* All format arguments are treated as 32-bit scalar values. -*/ -void SEGGER_SYSVIEW_ErrorfHost(const char* s, ...) { - va_list ParamList; -#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT - int r; - - va_start(ParamList, s); - r = _VPrintHost(s, SEGGER_SYSVIEW_ERROR, &ParamList); - va_end(ParamList); - - if (r == -1) { - va_start(ParamList, s); - _VPrintTarget(s, SEGGER_SYSVIEW_ERROR, &ParamList); - va_end(ParamList); - } -#else - va_start(ParamList, s); - _VPrintHost(s, SEGGER_SYSVIEW_ERROR, &ParamList); - va_end(ParamList); -#endif -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_VErrorfHost() -* -* Function description -* Print a warning string which is formatted on the host by -* the SystemView Application. -* -* Parameters -* s - String to be formatted. -* pParamList - Pointer to the list of arguments for the format string -* -* Additional information -* All format arguments are treated as 32-bit scalar values. -*/ -void SEGGER_SYSVIEW_VErrorfHost(const char* s, va_list *pParamList) { -#if SEGGER_SYSVIEW_PRINTF_IMPLICIT_FORMAT - int r; - va_list ParamListCopy; - va_copy(ParamListCopy, *pParamList); - - r = _VPrintHost(s, SEGGER_SYSVIEW_ERROR, pParamList); - - if (r == -1) { - _VPrintTarget(s, SEGGER_SYSVIEW_ERROR, &ParamListCopy); - } - va_end(ParamListCopy); -#else - _VPrintHost(s, SEGGER_SYSVIEW_ERROR, pParamList); -#endif -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_PrintfTargetEx() -* -* Function description -* Print a string which is formatted on the target before sent to -* the host with Additional information. -* -* Parameters -* s - String to be formatted. -* Options - Options for the string. i.e. Log level. -*/ -void SEGGER_SYSVIEW_PrintfTargetEx(const char* s, U32 Options, ...) { - va_list ParamList; - - va_start(ParamList, Options); - _VPrintTarget(s, Options, &ParamList); - va_end(ParamList); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_VPrintfTargetEx() -* -* Function description -* Print a string which is formatted on the target before sent to -* the host with Additional information. -* -* Parameters -* s - String to be formatted. -* Options - Options for the string. i.e. Log level. -* pParamList - Pointer to the list of arguments for the format string -*/ -void SEGGER_SYSVIEW_VPrintfTargetEx(const char* s, U32 Options, va_list *pParamList) { - _VPrintTarget(s, Options, pParamList); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_PrintfTarget() -* -* Function description -* Print a string which is formatted on the target before sent to -* the host. -* -* Parameters -* s - String to be formatted. -*/ -void SEGGER_SYSVIEW_PrintfTarget(const char* s, ...) { - va_list ParamList; - - va_start(ParamList, s); - _VPrintTarget(s, SEGGER_SYSVIEW_LOG, &ParamList); - va_end(ParamList); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_VPrintfTarget() -* -* Function description -* Print a string which is formatted on the target before sent to -* the host. -* -* Parameters -* s - String to be formatted. -* pParamList - Pointer to the list of arguments for the format string -*/ -void SEGGER_SYSVIEW_VPrintfTarget(const char* s, va_list* pParamList) { - _VPrintTarget(s, SEGGER_SYSVIEW_LOG, pParamList); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_WarnfTarget() -* -* Function description -* Print a warning string which is formatted on the target before -* sent to the host. -* -* Parameters -* s - String to be formatted. -*/ -void SEGGER_SYSVIEW_WarnfTarget(const char* s, ...) { - va_list ParamList; - - va_start(ParamList, s); - _VPrintTarget(s, SEGGER_SYSVIEW_WARNING, &ParamList); - va_end(ParamList); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_VWarnfTarget() -* -* Function description -* Print a warning string which is formatted on the target before -* sent to the host. -* -* Parameters -* s - String to be formatted. -* pParamList - Pointer to the list of arguments for the format string -*/ -void SEGGER_SYSVIEW_VWarnfTarget(const char* s, va_list* pParamList) { - _VPrintTarget(s, SEGGER_SYSVIEW_WARNING, pParamList); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_ErrorfTarget() -* -* Function description -* Print an error string which is formatted on the target before -* sent to the host. -* -* Parameters -* s - String to be formatted. -*/ -void SEGGER_SYSVIEW_ErrorfTarget(const char* s, ...) { - va_list ParamList; - - va_start(ParamList, s); - _VPrintTarget(s, SEGGER_SYSVIEW_ERROR, &ParamList); - va_end(ParamList); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_VErrorfTarget() -* -* Function description -* Print an error string which is formatted on the target before -* sent to the host. -* -* Parameters -* s - String to be formatted. -* pParamList - Pointer to the list of arguments for the format string -*/ -void SEGGER_SYSVIEW_VErrorfTarget(const char* s, va_list* pParamList) { - _VPrintTarget(s, SEGGER_SYSVIEW_ERROR, pParamList); -} -#endif // SEGGER_SYSVIEW_EXCLUDE_PRINTF - -/********************************************************************* -* -* SEGGER_SYSVIEW_Print() -* -* Function description -* Print a string to the host. -* -* Parameters -* s - String to sent. -*/ -void SEGGER_SYSVIEW_Print(const char* s) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32 + SEGGER_SYSVIEW_MAX_STRING_LEN); - // - pPayload = _EncodeStr(pPayloadStart, s, SEGGER_SYSVIEW_MAX_STRING_LEN); - ENCODE_U32(pPayload, SEGGER_SYSVIEW_LOG); - ENCODE_U32(pPayload, 0); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_PRINT_FORMATTED); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_Warn() -* -* Function description -* Print a warning string to the host. -* -* Parameters -* s - String to sent. -*/ -void SEGGER_SYSVIEW_Warn(const char* s) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32 + SEGGER_SYSVIEW_MAX_STRING_LEN); - // - pPayload = _EncodeStr(pPayloadStart, s, SEGGER_SYSVIEW_MAX_STRING_LEN); - ENCODE_U32(pPayload, SEGGER_SYSVIEW_WARNING); - ENCODE_U32(pPayload, 0); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_PRINT_FORMATTED); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_Error() -* -* Function description -* Print an error string to the host. -* -* Parameters -* s - String to sent. -*/ -void SEGGER_SYSVIEW_Error(const char* s) { - U8* pPayload; - U8* pPayloadStart; - RECORD_START(SEGGER_SYSVIEW_INFO_SIZE + 2 * SEGGER_SYSVIEW_QUANTA_U32 + SEGGER_SYSVIEW_MAX_STRING_LEN); - // - pPayload = _EncodeStr(pPayloadStart, s, SEGGER_SYSVIEW_MAX_STRING_LEN); - ENCODE_U32(pPayload, SEGGER_SYSVIEW_ERROR); - ENCODE_U32(pPayload, 0); - _SendPacket(pPayloadStart, pPayload, SYSVIEW_EVTID_PRINT_FORMATTED); - RECORD_END(); -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_EnableEvents() -* -* Function description -* Enable standard SystemView events to be generated. -* -* Parameters -* EnableMask - Events to be enabled. -*/ -void SEGGER_SYSVIEW_EnableEvents(U32 EnableMask) { - _SYSVIEW_Globals.DisabledEvents &= ~EnableMask; -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_DisableEvents() -* -* Function description -* Disable standard SystemView events to not be generated. -* -* Parameters -* DisableMask - Events to be disabled. -*/ -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) { -#if (SEGGER_SYSVIEW_POST_MORTEM_MODE != 1) - // - // 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; - } - } -#endif - return _SYSVIEW_Globals.EnableState; -} - - -/*************************** End of file ****************************/ diff --git a/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW.h b/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW.h deleted file mode 100644 index 1ada68c6fc..0000000000 --- a/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW.h +++ /dev/null @@ -1,436 +0,0 @@ -/* - * SPDX-FileCopyrightText: 1995-2021 SEGGER Microcontroller GmbH - * - * SPDX-License-Identifier: BSD-1-Clause - * - * SPDX-FileContributor: 2023-2024 Espressif Systems (Shanghai) CO LTD - */ -/********************************************************************* -* 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.56 * -* * -********************************************************************** --------------------------- 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_Value; - I32* pI32_Value; - float* pFloat_Value; - }; -} 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); - -// Checks whether tracing has been started -U8 SEGGER_SYSVIEW_Started(void); - -/********************************************************************* -* -* 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 (U32 IrqId); -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 ****************************/ diff --git a/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW_ConfDefaults.h b/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW_ConfDefaults.h deleted file mode 100644 index 08efb45ba6..0000000000 --- a/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW_ConfDefaults.h +++ /dev/null @@ -1,592 +0,0 @@ -/* - * SPDX-FileCopyrightText: 1995-2021 SEGGER Microcontroller GmbH - * - * SPDX-License-Identifier: BSD-1-Clause - * - * SPDX-FileContributor: 2023-2024 Espressif Systems (Shanghai) CO LTD - */ -/********************************************************************* -* 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.56 * -* * -********************************************************************** --------------------------- 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" - -#include "esp_assert.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 1 -#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 1024 -#endif - -/********************************************************************* -* -* 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_SECTION) - #define SEGGER_SYSVIEW_SECTION SEGGER_RTT_SECTION -#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 - -ESP_STATIC_ASSERT(SEGGER_SYSVIEW_MAX_STRING_LEN < 255, "SEGGER Sysview string length must be less than 255."); - -/********************************************************************* -* -* Define: SEGGER_SYSVIEW_SUPPORT_LONG_ID -* -* Description -* It set, support encoding 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 encoding 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 synchronization 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 - unsigned SEGGER_SYSVIEW_X_SysView_Lock(void); - #define SEGGER_SYSVIEW_LOCK() unsigned _SYSVIEW_int_state = SEGGER_SYSVIEW_X_SysView_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 - void SEGGER_SYSVIEW_X_SysView_Unlock(unsigned int_state); - #define SEGGER_SYSVIEW_UNLOCK() SEGGER_SYSVIEW_X_SysView_Unlock(_SYSVIEW_int_state) -#endif - -#ifdef __cplusplus -} -#endif - -#endif - -/*************************** End of file ****************************/ diff --git a/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW_Int.h b/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW_Int.h deleted file mode 100644 index 270fd9fc31..0000000000 --- a/components/app_trace/sys_view/SEGGER/SEGGER_SYSVIEW_Int.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * SPDX-FileCopyrightText: 1995-2021 SEGGER Microcontroller GmbH - * - * SPDX-License-Identifier: BSD-1-Clause - */ -/********************************************************************* -* 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.56 * -* * -********************************************************************** --------------------------- 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 ****************************/ diff --git a/components/app_trace/sys_view/SEGGER/sbom.yml b/components/app_trace/sys_view/SEGGER/sbom.yml deleted file mode 100644 index 7ec0b47fec..0000000000 --- a/components/app_trace/sys_view/SEGGER/sbom.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: 'SystemView' -version: '3.56' -cpe: cpe:2.3:a:segger:systemview:{}:*:*:*:*:*:*:* -supplier: 'Organization: Espressif Systems (Shanghai) CO LTD' -originator: 'Organization: SEGGER Microcontroller GmbH' -description: Real-time recording and visualization tool for embedded systems. 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 deleted file mode 100644 index eb40b843ab..0000000000 --- a/components/app_trace/sys_view/Sample/FreeRTOSV10.4/Config/esp/SEGGER_SYSVIEW_Config_FreeRTOS.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - * SPDX-FileCopyrightText: 1995-2021 SEGGER Microcontroller GmbH - * - * SPDX-License-Identifier: BSD-1-Clause - * - * SPDX-FileContributor: 2017-2025 Espressif Systems (Shanghai) CO LTD - */ -/********************************************************************* -* SEGGER Microcontroller GmbH * -* The Embedded Experts * -********************************************************************** -* * -* (c) 1995 - 2021 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.42 * -* * -********************************************************************** --------------------------- END-OF-HEADER ----------------------------- - -File : SEGGER_SYSVIEW_Config_FreeRTOS.c -Purpose : Sample setup configuration of SystemView with FreeRTOS. -Revision: $Rev: 7745 $ -*/ -#include -#include "sdkconfig.h" -#include "freertos/FreeRTOS.h" -#include "SEGGER_SYSVIEW.h" -#include "esp_intr_alloc.h" -#include "soc/soc.h" -#include "soc/interrupts.h" -#include "esp_sysview_trace.h" -#include "esp_trace_port_encoder.h" -#include "esp_trace_port_transport.h" -#include "esp_trace_util.h" - -extern const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI; - -/* Encoder reference for accessing lock functions - * This is set by SEGGER_RTT_ESP_SetEncoder() during encoder initialization */ -extern esp_trace_encoder_t* SEGGER_SYSVIEW_GetEncoder(void); - -/********************************************************************* -* -* Defines, configurable -* -********************************************************************** -*/ -// The application name to be displayed in SystemViewer -#define SYSVIEW_APP_NAME "FreeRTOS Application" - -// The target device name -#define SYSVIEW_DEVICE_NAME CONFIG_IDF_TARGET -// The target core name -#define SYSVIEW_CORE_NAME "core0" // In dual core, this will be renamed by OpenOCD as core1 - -// The lowest RAM address used for IDs (pointers) -#define SYSVIEW_RAM_BASE (SOC_DROM_LOW) - -#ifdef CONFIG_FREERTOS_TICK_SUPPORT_CORETIMER -#if CONFIG_FREERTOS_CORETIMER_0 - #define SYSTICK_INTR_ID (ETS_INTERNAL_TIMER0_INTR_SOURCE+ETS_INTERNAL_INTR_SOURCE_OFF) -#endif -#if CONFIG_FREERTOS_CORETIMER_1 - #define SYSTICK_INTR_ID (ETS_INTERNAL_TIMER1_INTR_SOURCE+ETS_INTERNAL_INTR_SOURCE_OFF) -#endif - -#elif CONFIG_FREERTOS_SYSTICK_USES_SYSTIMER - #define SYSTICK_INTR_ID (ETS_SYSTIMER_TARGET0_INTR_SOURCE) -#endif // CONFIG_FREERTOS_TICK_SUPPORT_CORETIMER - -// SystemView is single core specific: it implies that SEGGER_SYSVIEW_LOCK() -// disables IRQs (disables rescheduling globally). So we can not use finite timeouts for locks and return error -// in case of expiration, because error will not be handled and SEGGER's code will go further implying that -// everything is fine, so for multi-core env we have to wait on underlying lock forever -#define SEGGER_LOCK_WAIT_TMO ESP_TRACE_TMO_INFINITE - -/********************************************************************* -* -* _cbSendSystemDesc() -* -* Function description -* Sends SystemView description strings. -*/ -static void _cbSendSystemDesc(void) { - char irq_str[32] = "I#"; - SEGGER_SYSVIEW_SendSysDesc("N="SYSVIEW_APP_NAME",D="SYSVIEW_DEVICE_NAME",C="SYSVIEW_CORE_NAME",O=FreeRTOS"); - strcat(itoa(SYSTICK_INTR_ID, irq_str + 2, 10), "=SysTick"); - SEGGER_SYSVIEW_SendSysDesc(irq_str); - size_t isr_count = sizeof(esp_isr_names)/sizeof(esp_isr_names[0]); - for (size_t i = 0; i < isr_count; ++i) { - if (esp_isr_names[i] == NULL || (ETS_INTERNAL_INTR_SOURCE_OFF + i) == SYSTICK_INTR_ID) - continue; - strcat(itoa(ETS_INTERNAL_INTR_SOURCE_OFF + i, irq_str + 2, 10), "="); - strncat(irq_str, esp_isr_names[i], sizeof(irq_str) - strlen(irq_str) - 1); - SEGGER_SYSVIEW_SendSysDesc(irq_str); - } -} - -/********************************************************************* -* -* Global functions -* -********************************************************************** -*/ -void SEGGER_SYSVIEW_Conf(void) { - U32 disable_evts = 0; - - int timestamp_freq = esp_trace_timestamp_init(); - SEGGER_SYSVIEW_Init(timestamp_freq, esp_trace_cpu_freq_get(), - &SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc); - SEGGER_SYSVIEW_SetRAMBase(SYSVIEW_RAM_BASE); - -#if !CONFIG_SEGGER_SYSVIEW_EVT_OVERFLOW_ENABLE - disable_evts |= SYSVIEW_EVTMASK_OVERFLOW; -#endif -#if !CONFIG_SEGGER_SYSVIEW_EVT_ISR_ENTER_ENABLE - disable_evts |= SYSVIEW_EVTMASK_ISR_ENTER; -#endif -#if !CONFIG_SEGGER_SYSVIEW_EVT_ISR_EXIT_ENABLE - disable_evts |= SYSVIEW_EVTMASK_ISR_EXIT; -#endif -#if !CONFIG_SEGGER_SYSVIEW_EVT_TASK_START_EXEC_ENABLE - disable_evts |= SYSVIEW_EVTMASK_TASK_START_EXEC; -#endif -#if !CONFIG_SEGGER_SYSVIEW_EVT_TASK_STOP_EXEC_ENABLE - disable_evts |= SYSVIEW_EVTMASK_TASK_STOP_EXEC; -#endif -#if !CONFIG_SEGGER_SYSVIEW_EVT_TASK_START_READY_ENABLE - disable_evts |= SYSVIEW_EVTMASK_TASK_START_READY; -#endif -#if !CONFIG_SEGGER_SYSVIEW_EVT_TASK_STOP_READY_ENABLE - disable_evts |= SYSVIEW_EVTMASK_TASK_STOP_READY; -#endif -#if !CONFIG_SEGGER_SYSVIEW_EVT_TASK_CREATE_ENABLE - disable_evts |= SYSVIEW_EVTMASK_TASK_CREATE; -#endif -#if !CONFIG_SEGGER_SYSVIEW_EVT_TASK_TERMINATE_ENABLE - disable_evts |= SYSVIEW_EVTMASK_TASK_TERMINATE; -#endif -#if !CONFIG_SEGGER_SYSVIEW_EVT_IDLE_ENABLE - disable_evts |= SYSVIEW_EVTMASK_IDLE; -#endif -#if !CONFIG_SEGGER_SYSVIEW_EVT_ISR_TO_SCHED_ENABLE - disable_evts |= SYSVIEW_EVTMASK_ISR_TO_SCHEDULER; -#endif -#if !CONFIG_SEGGER_SYSVIEW_EVT_TIMER_ENTER_ENABLE - disable_evts |= SYSVIEW_EVTMASK_TIMER_ENTER; -#endif -#if !CONFIG_SEGGER_SYSVIEW_EVT_TIMER_EXIT_ENABLE - disable_evts |= SYSVIEW_EVTMASK_TIMER_EXIT; -#endif - SEGGER_SYSVIEW_DisableEvents(disable_evts); -} - -U32 SEGGER_SYSVIEW_X_GetTimestamp(void) -{ - return esp_trace_timestamp_get(); -} - -void SEGGER_SYSVIEW_X_RTT_Lock(void) -{ -} - -void SEGGER_SYSVIEW_X_RTT_Unlock(void) -{ -} - -unsigned SEGGER_SYSVIEW_X_SysView_Lock(void) -{ - esp_trace_encoder_t *encoder = SEGGER_SYSVIEW_GetEncoder(); - if (encoder) { - // Use encoder-level lock - return encoder->vt->take_lock(encoder, SEGGER_LOCK_WAIT_TMO); - } - return 0; -} - -void SEGGER_SYSVIEW_X_SysView_Unlock(unsigned int_state) -{ - esp_trace_encoder_t *encoder = SEGGER_SYSVIEW_GetEncoder(); - if (encoder) { - // Use encoder-level unlock - encoder->vt->give_lock(encoder, int_state); - } -} - -/*************************** End of file ****************************/ 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 deleted file mode 100644 index 679b40107f..0000000000 --- a/components/app_trace/sys_view/Sample/FreeRTOSV10.4/SEGGER_SYSVIEW_FreeRTOS.c +++ /dev/null @@ -1,270 +0,0 @@ -/* - * SPDX-FileCopyrightText: 1995-2021 SEGGER Microcontroller GmbH - * - * SPDX-License-Identifier: BSD-1-Clause - * - * SPDX-FileContributor: 2023 Espressif Systems (Shanghai) CO LTD - */ -/********************************************************************* -* SEGGER Microcontroller GmbH * -* The Embedded Experts * -********************************************************************** -* * -* (c) 1995 - 2021 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.42 * -* * -********************************************************************** --------------------------- END-OF-HEADER ----------------------------- - -File : SEGGER_SYSVIEW_FreeRTOS.c -Purpose : Interface between FreeRTOS and SystemView. -Revision: $Rev: 7947 $ -*/ -#include "freertos/FreeRTOS.h" -#include "freertos/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. -*/ -__attribute__((unused)) 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) { - - /* On multi-core we have several idle tasks with 'IDLEx' names - Not best solution, because we can filter out user tasks starting with 'IDLE'. - But we can not use 'xTaskGetIdleTaskHandle' because at the moment when this - function is called array of idle tasks handles are not initialized yet. */ - if (memcmp(pcTaskName, "IDLE", 4) == 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; - - /* On multi-core we have several idle tasks with 'IDLEx' names - Not best solution, because we can filter out user tasks starting with 'IDLE'. - But we can not use 'xTaskGetIdleTaskHandle' because at the moment when this - function is called array of idle tasks handles are not initialized yet. */ - if (memcmp(pcTaskName, "IDLE", 4) == 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 = { - /* Callback _cbGetTime locks xKernelLock inside xTaskGetTickCountFromISR, this can cause deadlock on multi-core. - To prevent deadlock, always lock xKernelLock before s_sys_view_lock. Omitting the callback here results in sending - SYSVIEW_EVTID_SYSTIME_CYCLES events instead of SYSVIEW_EVTID_SYSTIME_US */ - NULL, - _cbSendTaskList, -}; - -/*************************** End of file ****************************/ 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 deleted file mode 100644 index 5d67e93e04..0000000000 --- a/components/app_trace/sys_view/Sample/FreeRTOSV10.4/SEGGER_SYSVIEW_FreeRTOS.h +++ /dev/null @@ -1,367 +0,0 @@ -/* - * SPDX-FileCopyrightText: 1995-2021 SEGGER Microcontroller GmbH - * - * SPDX-License-Identifier: BSD-1-Clause - * - * SPDX-FileContributor: 2023 Espressif Systems (Shanghai) CO LTD - */ -/********************************************************************* -* SEGGER Microcontroller GmbH * -* The Embedded Experts * -********************************************************************** -* * -* (c) 1995 - 2021 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.42 * -* * -********************************************************************** --------------------------- END-OF-HEADER ----------------------------- - -File : SEGGER_SYSVIEW_FreeRTOS.h -Purpose : Interface between FreeRTOS and SystemView. - Tested with FreeRTOS V10.4.3 -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 -* -********************************************************************** -*/ - -#define SYSVIEW_FREERTOS_MAX_NOF_TASKS CONFIG_SEGGER_SYSVIEW_MAX_TASKS - -/********************************************************************* -* -* Defines, fixed -* -********************************************************************** -*/ -// for dual-core targets we use event ID to keep core ID bit (0 or 1) -// use the highest - 1 bit of event ID to indicate core ID -// the highest bit can not be used due to event ID encoding method -// this reduces supported ID range to [0..63] (for 1 byte IDs) plus [128..16383] (for 2 bytes IDs) -// so original continuous event IDs range is split into two sub-ranges for 1-bytes IDs and 2-bytes ones - -// events which use apiFastID_OFFSET will have 1 byte ID, -// so for the sake of bandwidth economy events which are generated more frequently should use this ID offset -// currently all used events fall into this range -#define apiFastID_OFFSET (32u) - -#define apiID_VTASKDELETE (1u) -#define apiID_VTASKDELAY (2u) -#define apiID_VTASKDELAYUNTIL (3u) -#define apiID_VTASKSUSPEND (4u) -#define apiID_ULTASKNOTIFYTAKE (5u) -#define apiID_VTASKNOTIFYGIVEFROMISR (6u) -#define apiID_VTASKPRIORITYINHERIT (7u) -#define apiID_VTASKRESUME (8u) -#define apiID_VTASKSTEPTICK (9u) -#define apiID_XTASKPRIORITYDISINHERIT (10u) -#define apiID_XTASKRESUMEFROMISR (11u) -#define apiID_XTASKGENERICNOTIFY (12u) -#define apiID_XTASKGENERICNOTIFYFROMISR (13u) -#define apiID_XTASKNOTIFYWAIT (14u) -#define apiID_XQUEUEGENERICCREATE (15u) -#define apiID_VQUEUEDELETE (16u) -#define apiID_XQUEUEGENERICRECEIVE (17u) -#define apiID_XQUEUEPEEKFROMISR (18u) -#define apiID_XQUEUERECEIVEFROMISR (19u) -#define apiID_VQUEUEADDTOREGISTRY (20u) -#define apiID_XQUEUEGENERICSEND (21u) -#define apiID_XQUEUEGENERICSENDFROMISR (22u) -#define apiID_VTASKPRIORITYSET (23u) -#define apiID_UXTASKPRIORITYGETFROMISR (24u) -#define apiID_XTASKGETTICKCOUNTFROMISR (25u) -#define apiID_XEVENTGROUPCLEARBITSFROMISR (26u) -#define apiID_XEVENTGROUPSETBITSFROMISR (27u) -#define apiID_XEVENTGROUPGETBITSFROMISR (28u) -#define apiID_XQUEUEGIVEFROMISR (29u) -#define apiID_XQUEUEISQUEUEEMPTYFROMISR (30u) -#define apiID_XQUEUEISQUEUEFULLFROMISR (31u) // the maximum allowed apiID for the first ID range - -// events which use apiSlowID_OFFSET will have 2-bytes ID -#define apiSlowID_OFFSET (127u) - -#define apiID_VTASKALLOCATEMPUREGIONS (1u) -#define apiID_UXTASKPRIORITYGET (2u) -#define apiID_ETASKGETSTATE (3u) -#define apiID_VTASKSTARTSCHEDULER (4u) -#define apiID_VTASKENDSCHEDULER (5u) -#define apiID_VTASKSUSPENDALL (6u) -#define apiID_XTASKRESUMEALL (7u) -#define apiID_XTASKGETTICKCOUNT (8u) -#define apiID_UXTASKGETNUMBEROFTASKS (9u) -#define apiID_PCTASKGETTASKNAME (10u) -#define apiID_UXTASKGETSTACKHIGHWATERMARK (11u) -#define apiID_VTASKSETAPPLICATIONTASKTAG (12u) -#define apiID_XTASKGETAPPLICATIONTASKTAG (13u) -#define apiID_VTASKSETTHREADLOCALSTORAGEPOINTER (14u) -#define apiID_PVTASKGETTHREADLOCALSTORAGEPOINTER (15u) -#define apiID_XTASKCALLAPPLICATIONTASKHOOK (16u) -#define apiID_XTASKGETIDLETASKHANDLE (17u) -#define apiID_UXTASKGETSYSTEMSTATE (18u) -#define apiID_VTASKLIST (19u) -#define apiID_VTASKGETRUNTIMESTATS (20u) -#define apiID_XTASKNOTIFYSTATECLEAR (21u) -#define apiID_XTASKGETCURRENTTASKHANDLE (22u) -#define apiID_VTASKSETTIMEOUTSTATE (23u) -#define apiID_XTASKCHECKFORTIMEOUT (24u) -#define apiID_VTASKMISSEDYIELD (25u) -#define apiID_XTASKGETSCHEDULERSTATE (26u) -#define apiID_XTASKGENERICCREATE (27u) -#define apiID_UXTASKGETTASKNUMBER (28u) -#define apiID_VTASKSETTASKNUMBER (29u) -#define apiID_ETASKCONFIRMSLEEPMODESTATUS (30u) -#define apiID_XTIMERCREATE (31u) -#define apiID_PVTIMERGETTIMERID (32u) -#define apiID_VTIMERSETTIMERID (33u) -#define apiID_XTIMERISTIMERACTIVE (34u) -#define apiID_XTIMERGETTIMERDAEMONTASKHANDLE (35u) -#define apiID_XTIMERPENDFUNCTIONCALLFROMISR (36u) -#define apiID_XTIMERPENDFUNCTIONCALL (37u) -#define apiID_PCTIMERGETTIMERNAME (38u) -#define apiID_XTIMERCREATETIMERTASK (39u) -#define apiID_XTIMERGENERICCOMMAND (40u) -#define apiID_UXQUEUEMESSAGESWAITING (41u) -#define apiID_UXQUEUESPACESAVAILABLE (42u) -#define apiID_UXQUEUEMESSAGESWAITINGFROMISR (43u) -#define apiID_XQUEUEALTGENERICSEND (44u) -#define apiID_XQUEUEALTGENERICRECEIVE (45u) -#define apiID_XQUEUECRSENDFROMISR (46u) -#define apiID_XQUEUECRRECEIVEFROMISR (47u) -#define apiID_XQUEUECRSEND (48u) -#define apiID_XQUEUECRRECEIVE (49u) -#define apiID_XQUEUECREATEMUTEX (50u) -#define apiID_XQUEUECREATECOUNTINGSEMAPHORE (51u) -#define apiID_XQUEUEGETMUTEXHOLDER (52u) -#define apiID_XQUEUETAKEMUTEXRECURSIVE (53u) -#define apiID_XQUEUEGIVEMUTEXRECURSIVE (54u) -#define apiID_VQUEUEUNREGISTERQUEUE (55u) -#define apiID_XQUEUECREATESET (56u) -#define apiID_XQUEUEADDTOSET (57u) -#define apiID_XQUEUEREMOVEFROMSET (58u) -#define apiID_XQUEUESELECTFROMSET (59u) -#define apiID_XQUEUESELECTFROMSETFROMISR (60u) -#define apiID_XQUEUEGENERICRESET (61u) -#define apiID_VLISTINITIALISE (62u) -#define apiID_VLISTINITIALISEITEM (63u) -#define apiID_VLISTINSERT (64u) -#define apiID_VLISTINSERTEND (65u) -#define apiID_UXLISTREMOVE (66u) -#define apiID_XEVENTGROUPCREATE (67u) -#define apiID_XEVENTGROUPWAITBITS (68u) -#define apiID_XEVENTGROUPCLEARBITS (69u) -#define apiID_XEVENTGROUPSETBITS (70u) -#define apiID_XEVENTGROUPSYNC (71u) -#define apiID_VEVENTGROUPDELETE (72u) -#define apiID_UXEVENTGROUPGETNUMBER (73u) -#define apiID_XSTREAMBUFFERCREATE (74u) -#define apiID_VSTREAMBUFFERDELETE (75u) -#define apiID_XSTREAMBUFFERRESET (76u) -#define apiID_XSTREAMBUFFERSEND (77u) -#define apiID_XSTREAMBUFFERSENDFROMISR (78u) -#define apiID_XSTREAMBUFFERRECEIVE (79u) -#define apiID_XSTREAMBUFFERRECEIVEFROMISR (80u) - -#ifdef CONFIG_FREERTOS_SMP - -#define traceQUEUE_SEND( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiFastID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), 0u, 0u, 0u) - -#else // CONFIG_FREERTOS_SMP - -#if ( configUSE_QUEUE_SETS != 1 ) - #define traceQUEUE_SEND( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiFastID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pvItemToQueue, xTicksToWait, xCopyPosition) -#else - #define traceQUEUE_SEND( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiFastID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), 0u, 0u, 0u) -#endif - -#endif // CONFIG_FREERTOS_SMP - - -#define traceSTART() SEGGER_SYSVIEW_Conf() - -#define traceTASK_NOTIFY_TAKE(uxIndexToWait) SEGGER_SYSVIEW_RecordU32x2(apiFastID_OFFSET + apiID_ULTASKNOTIFYTAKE, xClearCountOnExit, xTicksToWait) -#define traceTASK_DELAY() SEGGER_SYSVIEW_RecordU32 (apiFastID_OFFSET + apiID_VTASKDELAY, xTicksToDelay) -#define traceTASK_DELAY_UNTIL(xTimeToWake) SEGGER_SYSVIEW_RecordVoid (apiFastID_OFFSET + apiID_VTASKDELAYUNTIL) -#define traceTASK_NOTIFY_GIVE_FROM_ISR(uxIndexToNotify) SEGGER_SYSVIEW_RecordU32x2(apiFastID_OFFSET + apiID_VTASKNOTIFYGIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), (U32)pxHigherPriorityTaskWoken) - -#define traceTASK_PRIORITY_INHERIT( pxTCB, uxPriority ) SEGGER_SYSVIEW_RecordU32 (apiFastID_OFFSET + apiID_VTASKPRIORITYINHERIT, (U32)pxMutexHolder) -#define traceTASK_RESUME( pxTCB ) SEGGER_SYSVIEW_RecordU32 (apiFastID_OFFSET + apiID_VTASKRESUME, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB)) -#define traceINCREASE_TICK_COUNT( xTicksToJump ) SEGGER_SYSVIEW_RecordU32 (apiFastID_OFFSET + apiID_VTASKSTEPTICK, xTicksToJump) -#define traceTASK_SUSPEND( pxTCB ) SEGGER_SYSVIEW_RecordU32 (apiFastID_OFFSET + apiID_VTASKSUSPEND, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB)) -#define traceTASK_PRIORITY_DISINHERIT( pxTCB, uxBasePriority ) SEGGER_SYSVIEW_RecordU32 (apiFastID_OFFSET + apiID_XTASKPRIORITYDISINHERIT, (U32)pxMutexHolder) -#define traceTASK_RESUME_FROM_ISR( pxTCB ) SEGGER_SYSVIEW_RecordU32 (apiFastID_OFFSET + apiID_XTASKRESUMEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB)) -#define traceTASK_NOTIFY(uxIndexToNotify) SEGGER_SYSVIEW_RecordU32x4(apiFastID_OFFSET + apiID_XTASKGENERICNOTIFY, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), ulValue, eAction, (U32)pulPreviousNotificationValue) -#define traceTASK_NOTIFY_FROM_ISR(uxIndexToWait) SEGGER_SYSVIEW_RecordU32x5(apiFastID_OFFSET + apiID_XTASKGENERICNOTIFYFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB), ulValue, eAction, (U32)pulPreviousNotificationValue, (U32)pxHigherPriorityTaskWoken) -#define traceTASK_NOTIFY_WAIT(uxIndexToWait) SEGGER_SYSVIEW_RecordU32x4(apiFastID_OFFSET + apiID_XTASKNOTIFYWAIT, ulBitsToClearOnEntry, ulBitsToClearOnExit, (U32)pulNotificationValue, xTicksToWait) - -#define traceQUEUE_CREATE( pxNewQueue ) SEGGER_SYSVIEW_RecordU32x3(apiFastID_OFFSET + apiID_XQUEUEGENERICCREATE, uxQueueLength, uxItemSize, ucQueueType) -#define traceQUEUE_DELETE( pxQueue ) SEGGER_SYSVIEW_RecordU32 (apiFastID_OFFSET + apiID_VQUEUEDELETE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue)) -#define traceQUEUE_PEEK( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiFastID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), xTicksToWait, 1) -#define traceQUEUE_PEEK_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiFastID_OFFSET + apiID_XQUEUEPEEKFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer)) -#define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiFastID_OFFSET + apiID_XQUEUEPEEKFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer)) -#define traceQUEUE_RECEIVE( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiFastID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)0), xTicksToWait, 1) -#define traceQUEUE_RECEIVE_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiFastID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)0), xTicksToWait, 1) -#define traceQUEUE_SEMAPHORE_RECEIVE( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiFastID_OFFSET + apiID_XQUEUEGENERICRECEIVE, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)0), xTicksToWait, 0) -#define traceQUEUE_RECEIVE_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x3(apiFastID_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(apiFastID_OFFSET + apiID_XQUEUERECEIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), SEGGER_SYSVIEW_ShrinkId((U32)pvBuffer), (U32)pxHigherPriorityTaskWoken) -#define traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName ) SEGGER_SYSVIEW_RecordU32x2(apiFastID_OFFSET + apiID_VQUEUEADDTOREGISTRY, SEGGER_SYSVIEW_ShrinkId((U32)xQueue), (U32)pcQueueName) -#define traceQUEUE_SEND_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiFastID_OFFSET + apiID_XQUEUEGENERICSEND, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pvItemToQueue, xTicksToWait, xCopyPosition) -#define traceQUEUE_SEND_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiFastID_OFFSET + apiID_XQUEUEGENERICSENDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pvItemToQueue, (U32)pxHigherPriorityTaskWoken, xCopyPosition) -#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x4(apiFastID_OFFSET + apiID_XQUEUEGENERICSENDFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pvItemToQueue, (U32)pxHigherPriorityTaskWoken, xCopyPosition) -#define traceQUEUE_GIVE_FROM_ISR( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiFastID_OFFSET + apiID_XQUEUEGIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pxHigherPriorityTaskWoken) -#define traceQUEUE_GIVE_FROM_ISR_FAILED( pxQueue ) SEGGER_SYSVIEW_RecordU32x2(apiFastID_OFFSET + apiID_XQUEUEGIVEFROMISR, SEGGER_SYSVIEW_ShrinkId((U32)pxQueue), (U32)pxHigherPriorityTaskWoken) -#define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer ) SEGGER_SYSVIEW_RecordU32x2(apiSlowID_OFFSET + apiID_XSTREAMBUFFERCREATE, (U32)xIsMessageBuffer, (U32)pxStreamBuffer) -#define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer ) SEGGER_SYSVIEW_RecordU32x2(apiSlowID_OFFSET + apiID_XSTREAMBUFFERCREATE, (U32)xIsMessageBuffer, 0u) -#define traceSTREAM_BUFFER_DELETE( xStreamBuffer ) SEGGER_SYSVIEW_RecordU32 (apiSlowID_OFFSET + apiID_VSTREAMBUFFERDELETE, (U32)xStreamBuffer) -#define traceSTREAM_BUFFER_RESET( xStreamBuffer ) SEGGER_SYSVIEW_RecordU32 (apiSlowID_OFFSET + apiID_XSTREAMBUFFERRESET, (U32)xStreamBuffer) -#define traceSTREAM_BUFFER_SEND( xStreamBuffer, xBytesSent ) SEGGER_SYSVIEW_RecordU32x2(apiSlowID_OFFSET + apiID_XSTREAMBUFFERSEND, (U32)xStreamBuffer, (U32)xBytesSent) -#define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer ) SEGGER_SYSVIEW_RecordU32x2(apiSlowID_OFFSET + apiID_XSTREAMBUFFERSEND, (U32)xStreamBuffer, 0u) -#define traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xBytesSent ) SEGGER_SYSVIEW_RecordU32x2(apiSlowID_OFFSET + apiID_XSTREAMBUFFERSENDFROMISR, (U32)xStreamBuffer, (U32)xBytesSent) -#define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength ) SEGGER_SYSVIEW_RecordU32x2(apiSlowID_OFFSET + apiID_XSTREAMBUFFERRECEIVE, (U32)xStreamBuffer, (U32)xReceivedLength) -#define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer ) SEGGER_SYSVIEW_RecordU32x2(apiSlowID_OFFSET + apiID_XSTREAMBUFFERRECEIVE, (U32)xStreamBuffer, 0u) -#define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength ) SEGGER_SYSVIEW_RecordU32x2(apiSlowID_OFFSET + apiID_XSTREAMBUFFERRECEIVEFROMISR, (U32)xStreamBuffer, (U32)xReceivedLength) - -#define traceTASK_DELETE( pxTCB ) do { \ - SEGGER_SYSVIEW_RecordU32(apiFastID_OFFSET + apiID_VTASKDELETE, SEGGER_SYSVIEW_ShrinkId((U32)pxTCB)); \ - SYSVIEW_DeleteTask((U32)pxTCB); \ - } while(0) - - -#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(apiFastID_OFFSET+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. -// -// SMP FreeRTOS uses unpinned IDLE tasks, so sometimes IDEL0 runs on CPU1, IDLE1 runs on CPU0 and so on. -// So IDLE state detection based on 'xTaskGetIdleTaskHandle' does not work for SMP kernel. -// We could compare current task handle with every element of the array returned by 'xTaskGetIdleTaskHandle', -// but it deos not seem to be efficient enough to be worth of making code more complex and less readabl. -// So always use task name comparison mechanism for SMP kernel. -#if ( INCLUDE_xTaskGetIdleTaskHandle == 1 && !defined(CONFIG_FREERTOS_SMP)) - #define traceTASK_SWITCHED_IN() if(prvGetTCBFromHandle(NULL) == xTaskGetIdleTaskHandle()) { \ - SEGGER_SYSVIEW_OnIdle(); \ - } else { \ - SEGGER_SYSVIEW_OnTaskStartExec((U32)prvGetTCBFromHandle(NULL)); \ - } -#else - #define traceTASK_SWITCHED_IN() { \ - if (memcmp(prvGetTCBFromHandle(NULL)->pcTaskName, "IDLE", 4) != 0) { \ - SEGGER_SYSVIEW_OnTaskStartExec((U32)prvGetTCBFromHandle(NULL)); \ - } 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)prvGetTCBFromHandle(NULL), (1u << 2)) -#define traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST() SEGGER_SYSVIEW_OnTaskStopReady((U32)prvGetTCBFromHandle(NULL), (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(n) SEGGER_SYSVIEW_RecordEnterISR(n) - -/********************************************************************* -* -* 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 ****************************/ diff --git a/components/app_trace/sys_view/esp/SEGGER_RTT_esp.c b/components/app_trace/sys_view/esp/SEGGER_RTT_esp.c deleted file mode 100644 index fa93f452aa..0000000000 --- a/components/app_trace/sys_view/esp/SEGGER_RTT_esp.c +++ /dev/null @@ -1,382 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2017-2025 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "string.h" -#include "freertos/FreeRTOS.h" -#include "SEGGER_RTT.h" -#include "SEGGER_SYSVIEW.h" -#include "SEGGER_SYSVIEW_Conf.h" - -#include "esp_log.h" -#include "esp_cpu.h" -#include "esp_trace_port_transport.h" -#include "esp_trace_port_encoder.h" -#include "esp_trace_types.h" -#include "esp_private/startup_internal.h" -#include "adapters/adapter_encoder_sysview.h" - -const static char *TAG = "segger_rtt"; - -#define SYSVIEW_EVENTS_BUF_SZ 255U - -// size of down channel data buf -#define SYSVIEW_DOWN_BUF_SIZE 32 -#if CONFIG_SEGGER_SYSVIEW_BUF_WAIT_TMO == -1 -#define SEGGER_HOST_WAIT_TMO ESP_TRACE_TMO_INFINITE -#else -#define SEGGER_HOST_WAIT_TMO CONFIG_SEGGER_SYSVIEW_BUF_WAIT_TMO -#endif - -static uint8_t s_events_buf[SYSVIEW_EVENTS_BUF_SZ]; -static uint16_t s_events_buf_filled; -static uint8_t s_down_buf[SYSVIEW_DOWN_BUF_SIZE]; - -/** - * @brief Encoder reference for SEGGER RTT layer - * - * This maintains proper architectural layering: - * - SEGGER RTT is part of the SystemView encoder implementation - * - It accesses transport through the encoder's transport reference (s_encoder->tp) - * - NOT through global singleton (that would be a layer violation) - * - * Set by SEGGER_RTT_ESP_SetEncoder() during encoder init. - */ -static esp_trace_encoder_t *s_encoder = NULL; - -/********************************************************************* -* -* Public code -* -********************************************************************** -*/ - -/********************************************************************* -* -* SEGGER_RTT_ESP_SetEncoder() -* -* Function description -* Inject encoder handle from esp_trace adapter. -* This allows SEGGER RTT to access transport through the encoder's -* transport reference, maintaining proper architectural layering. -* -* Parameters -* encoder Pointer to encoder instance from esp_trace -* -* Return value -* 0 if successful, -1 if encoder is not initialized or missing required functions in transport. -*/ -int SEGGER_RTT_ESP_SetEncoder(esp_trace_encoder_t *encoder) -{ - /* Check if adapters have all required functions */ - if (!encoder || !encoder->ctx || - !encoder->vt->give_lock || - !encoder->vt->take_lock || - !encoder->tp->vt->down_buffer_config || - !encoder->tp->vt->write || - !encoder->tp->vt->flush_nolock || - !encoder->tp->vt->read || - !encoder->tp->vt->get_link_type) { - ESP_LOGE(TAG, "Encoder not initialized or missing required functions in transport"); - return -1; - } - - s_encoder = encoder; - - return 0; -} - -/********************************************************************* -* -* SEGGER_SYSVIEW_GetEncoder() -* -* Function description -* Returns the encoder handle for accessing transport functions. -* This is used by SEGGER_SYSVIEW_Config_FreeRTOS.c to access -* transport lock functions. -* -* Parameters -* None -* -* Return value -* Pointer to encoder instance, or NULL if not initialized. -*/ -esp_trace_encoder_t* SEGGER_SYSVIEW_GetEncoder(void) -{ - return s_encoder; -} - -/********************************************************************* -* -* SEGGER_RTT_ESP_GetDestCpu() -* -* Function description -* Gets the destination CPU from the encoder context. -* -* Parameters -* None -* -* Return value -* CPU ID (0 or 1) to trace -*/ -static int SEGGER_RTT_ESP_GetDestCpu(void) -{ - sysview_encoder_ctx_t *ctx = s_encoder->ctx; - return ctx->dest_cpu; -} - -/********************************************************************* -* -* SEGGER_RTT_ESP_FlushNoLock() -* -* Function description -* Flushes buffered events. -* -* Parameters -* min_sz Threshold for flushing data. If current filling level is above this value, data will be flushed. JTAG destinations only. -* tmo Timeout for operation (in us). Use ESP_APPTRACE_TMO_INFINITE to wait indefinitely. -* -* Return value -* None. -*/ -void SEGGER_RTT_ESP_FlushNoLock(void) -{ - esp_err_t res; - - if (!s_encoder) { - ESP_LOGE(TAG, "Encoder not initialized"); - return; - } - - esp_trace_transport_t *tp = s_encoder->tp; - - if (s_events_buf_filled > 0) { - res = tp->vt->write(tp, s_events_buf, s_events_buf_filled, SEGGER_HOST_WAIT_TMO); - if (res != ESP_OK) { - ESP_LOGE(TAG, "Failed to write buffered events (%d)!", res); - } - } - // flush even if we failed to write buffered events, because no new events will be sent after STOP - res = tp->vt->flush_nolock(tp); - if (res != ESP_OK) { - ESP_LOGE(TAG, "Failed to flush buffered events (%d)!", res); - } - - s_events_buf_filled = 0; -} - -/********************************************************************* -* -* SEGGER_RTT_ESP_Flush() -* -* Function description -* Flushes buffered events. -* -* -* Return value -* None. -*/ -void SEGGER_RTT_ESP_Flush(void) -{ - SEGGER_SYSVIEW_LOCK(); - SEGGER_RTT_ESP_FlushNoLock(); - SEGGER_SYSVIEW_UNLOCK(); -} - -/********************************************************************* -* -* SEGGER_RTT_ReadNoLock() -* -* Function description -* Reads characters from SEGGER real-time-terminal control block -* which have been previously stored by the host. -* Do not lock against interrupts and multiple access. -* -* Parameters -* BufferIndex Index of Down-buffer to be used (e.g. 0 for "Terminal"). -* pBuffer Pointer to buffer provided by target application, to copy characters from RTT-down-buffer to. -* BufferSize Size of the target application buffer. -* -* Return value -* Number of bytes that have been read. -*/ -unsigned SEGGER_RTT_ReadNoLock(unsigned BufferIndex, void* pData, unsigned BufferSize) -{ - if (!s_encoder) { - return 0; - } - size_t size = BufferSize; - esp_err_t res = s_encoder->tp->vt->read(s_encoder->tp, pData, &size, 0); - return res != ESP_OK ? 0 : size; -} - -/********************************************************************* -* -* 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. -* -* 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, 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. -*/ -unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes) -{ - if (!s_encoder) { - return 0; // Encoder is not initialized - } - - esp_trace_transport_t *tp = s_encoder->tp; - uint8_t *pbuf = (uint8_t *)pBuffer; - uint8_t event_id = *pbuf; - - if (tp->vt->get_link_type(tp) == ESP_TRACE_LINK_UART) { - int dest_cpu = SEGGER_RTT_ESP_GetDestCpu(); - if ( - (dest_cpu != esp_cpu_get_core_id()) && - ( - (event_id == SYSVIEW_EVTID_ISR_ENTER) || - (event_id == SYSVIEW_EVTID_ISR_EXIT) || - (event_id == SYSVIEW_EVTID_TASK_START_EXEC) || - (event_id == SYSVIEW_EVTID_TASK_STOP_EXEC) || - (event_id == SYSVIEW_EVTID_TASK_START_READY) || - (event_id == SYSVIEW_EVTID_TASK_STOP_READY) || - (event_id == SYSVIEW_EVTID_MARK_START) || - (event_id == SYSVIEW_EVTID_MARK_STOP) || - (event_id == SYSVIEW_EVTID_TIMER_ENTER) || - (event_id == SYSVIEW_EVTID_TIMER_EXIT) || - (event_id == SYSVIEW_EVTID_STACK_INFO) || - (event_id == SYSVIEW_EVTID_MODULEDESC) - ) - ) { - return NumBytes; - } - - // This is workaround for SystemView! - // Without this line SystemView will hangs on when heap tracing enabled. - if (event_id == SYSVIEW_EVTID_MODULEDESC) { - return NumBytes; - } - } - - if (NumBytes > SYSVIEW_EVENTS_BUF_SZ) { - ESP_LOGE(TAG, "Too large event %u bytes!", NumBytes); - return 0; - } - if (tp->vt->get_link_type(tp) == ESP_TRACE_LINK_DEBUG_PROBE) { - if (esp_cpu_get_core_id()) { // dual core specific code - // use the highest - 1 bit of event ID to indicate core ID - // the highest bit can not be used due to event ID encoding method - // this reduces supported ID range to [0..63] (for 1 byte IDs) plus [128..16383] (for 2 bytes IDs) - if (*pbuf & 0x80) { // 2 bytes ID - *(pbuf + 1) |= (1 << 6); - } else if (NumBytes != 10 || *pbuf != 0) { // ignore sync sequence - *pbuf |= (1 << 6); - } - } - - if (s_events_buf_filled + NumBytes > SYSVIEW_EVENTS_BUF_SZ) { - - esp_err_t res = tp->vt->write(tp, s_events_buf, s_events_buf_filled, SEGGER_HOST_WAIT_TMO); - if (res != ESP_OK) { - return 0; // skip current data buffer only, accumulated events are kept - } - s_events_buf_filled = 0; - } - } - memcpy(&s_events_buf[s_events_buf_filled], pBuffer, NumBytes); - s_events_buf_filled += NumBytes; - - if (tp->vt->get_link_type(tp) == ESP_TRACE_LINK_UART) { - esp_err_t res = tp->vt->write(tp, pBuffer, NumBytes, SEGGER_HOST_WAIT_TMO); - if (res != ESP_OK) { - return 0; // skip current data buffer only, accumulated events are kept - } - s_events_buf_filled = 0; - } - - if (event_id == SYSVIEW_EVTID_TRACE_STOP) { - SEGGER_RTT_ESP_FlushNoLock(); - } - return NumBytes; -} - -/********************************************************************* -* -* SEGGER_RTT_ConfigUpBuffer -* -* Function description -* Run-time configuration of a specific up-buffer (T->H). -* Buffer to be configured is specified by index. -* This includes: Buffer address, size, name, flags, ... -* -* Parameters -* BufferIndex Index of the buffer to configure. -* sName Pointer to a constant name string. -* pBuffer Pointer to a buffer to be used. -* BufferSize Size of the buffer. -* Flags Operating modes. Define behavior if buffer is full (not enough space for entire message). -* -* Return value -* >= 0 - O.K. -* < 0 - Error -* -* Additional information -* Buffer 0 is configured on compile-time. -* May only be called once per buffer. -* Buffer name and flags can be reconfigured using the appropriate functions. -*/ -int SEGGER_RTT_ConfigUpBuffer(unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags) -{ - s_events_buf_filled = 0; - return 0; -} - -/********************************************************************* -* -* SEGGER_RTT_ConfigDownBuffer -* -* Function description -* Run-time configuration of a specific down-buffer (H->T). -* Buffer to be configured is specified by index. -* This includes: Buffer address, size, name, flags, ... -* -* Parameters -* BufferIndex Index of the buffer to configure. -* sName Pointer to a constant name string. -* pBuffer Pointer to a buffer to be used. -* BufferSize Size of the buffer. -* Flags Operating modes. Define behavior if buffer is full (not enough space for entire message). -* -* Return value -* >= 0 O.K. -* < 0 Error -* -* Additional information -* Buffer 0 is configured on compile-time. -* May only be called once per buffer. -* Buffer name and flags can be reconfigured using the appropriate functions. -*/ -int SEGGER_RTT_ConfigDownBuffer(unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags) -{ - if (!s_encoder) { - return -1; - } - return s_encoder->tp->vt->down_buffer_config(s_encoder->tp, s_down_buf, sizeof(s_down_buf)); -} diff --git a/components/app_trace/sys_view/ext/heap_trace_module.c b/components/app_trace/sys_view/ext/heap_trace_module.c deleted file mode 100644 index fc149c2e49..0000000000 --- a/components/app_trace/sys_view/ext/heap_trace_module.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2018-2025 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include -#include -#include "SEGGER_SYSVIEW.h" -#include "SEGGER_RTT.h" -#include "esp_app_trace.h" -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" - -#include "esp_log.h" -const static char *TAG = "sysview_heap_trace"; - -#ifdef CONFIG_HEAP_TRACING_STACK_DEPTH -#define CALLSTACK_SIZE CONFIG_HEAP_TRACING_STACK_DEPTH -#else -#define CALLSTACK_SIZE 0 -#endif - -static SEGGER_SYSVIEW_MODULE s_esp_sysview_heap_module = { - .sModule = "M=ESP32 SystemView Heap Tracing Module", - .NumEvents = 2, -}; - -static bool s_mod_registered; - -esp_err_t esp_sysview_heap_trace_start(uint32_t tmo) -{ - uint32_t tmo_ticks = tmo / (1000 * portTICK_PERIOD_MS); - - ESP_EARLY_LOGV(TAG, "%s", __func__); - do { - if (tmo != (uint32_t) -1) { - // Currently timeout implementation is simple and has granularity of 1 OS tick, - // so just count down the number of times to call vTaskDelay - if (tmo_ticks-- == 0) { - return ESP_ERR_TIMEOUT; - } - } - vTaskDelay(1); - } while (!SEGGER_SYSVIEW_Started()); - - SEGGER_SYSVIEW_RegisterModule(&s_esp_sysview_heap_module); - s_mod_registered = true; - return ESP_OK; -} - -esp_err_t esp_sysview_heap_trace_stop(void) -{ - ESP_EARLY_LOGV(TAG, "%s", __func__); - SEGGER_RTT_ESP_Flush(); - return ESP_OK; -} - -void esp_sysview_heap_trace_alloc(const void *addr, uint32_t size, const void *callers) -{ - U8 aPacket[SEGGER_SYSVIEW_INFO_SIZE + (2 + CALLSTACK_SIZE)*SEGGER_SYSVIEW_QUANTA_U32]; - U8* pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket); - U32 *calls = (U32 *)callers; - - if (!s_mod_registered) { - return; - } - ESP_EARLY_LOGV(TAG, "%s %p %lu", __func__, addr, size); - pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, (U32)addr); - pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, size); - for (int i = 0; i < CALLSTACK_SIZE; i++) { - pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, calls[i]); - } - SEGGER_SYSVIEW_SendPacket(&aPacket[0], pPayload, s_esp_sysview_heap_module.EventOffset + 0); -} - -void esp_sysview_heap_trace_free(const void *addr, const void *callers) -{ - U8 aPacket[SEGGER_SYSVIEW_INFO_SIZE + (1 + CALLSTACK_SIZE)*SEGGER_SYSVIEW_QUANTA_U32]; - U8* pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket); - U32 *calls = (U32 *)callers; - - if (!s_mod_registered) { - return; - } - ESP_EARLY_LOGV(TAG, "%s %p", __func__, addr); - pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, (U32)addr); - for (int i = 0; i < CALLSTACK_SIZE; i++) { - pPayload = SEGGER_SYSVIEW_EncodeU32(pPayload, calls[i]); - } - SEGGER_SYSVIEW_SendPacket(&aPacket[0], pPayload, s_esp_sysview_heap_module.EventOffset + 1); -} diff --git a/components/app_trace/sys_view/ext/logging.c b/components/app_trace/sys_view/ext/logging.c deleted file mode 100644 index d6b7ee80d1..0000000000 --- a/components/app_trace/sys_view/ext/logging.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include -#include -#include -#include "SEGGER_SYSVIEW_Int.h" -#include "freertos/FreeRTOS.h" - -static portMUX_TYPE s_log_mutex = portMUX_INITIALIZER_UNLOCKED; - -int esp_sysview_vprintf(const char * format, va_list args) -{ - static char log_buffer[SEGGER_SYSVIEW_MAX_STRING_LEN]; - - portENTER_CRITICAL(&s_log_mutex); - size_t len = vsnprintf(log_buffer, sizeof(log_buffer), format, args); - if (len > sizeof(log_buffer) - 1) { - log_buffer[sizeof(log_buffer) - 1] = 0; - } - SEGGER_SYSVIEW_Print(log_buffer); - portEXIT_CRITICAL(&s_log_mutex); - return len; -} diff --git a/components/app_trace/test_apps/.build-test-rules.yml b/components/app_trace/test_apps/.build-test-rules.yml index fbbd2d55b1..aa5223768a 100644 --- a/components/app_trace/test_apps/.build-test-rules.yml +++ b/components/app_trace/test_apps/.build-test-rules.yml @@ -2,11 +2,7 @@ components/app_trace/test_apps: depends_components: - - app_trace - - esp_timer - - soc - - esp_hw_support - - esp_driver_uart + - esp_trace - esp_driver_gptimer disable: - if: IDF_TARGET in ["esp32h21", "esp32h4"] diff --git a/components/app_trace/test_apps/README.md b/components/app_trace/test_apps/README.md index ecca19c3a7..4b730b74b5 100644 --- a/components/app_trace/test_apps/README.md +++ b/components/app_trace/test_apps/README.md @@ -8,9 +8,4 @@ To build and run this test app for app_trace related tests: IDF_TARGET=esp32 idf.py @app_trace build flash monitor ``` -To build and run this test app for SystemView related tests: -```bash -IDF_TARGET=esp32 idf.py @sysview build flash monitor -``` - -`@app_trace` and `@sysview` arguments apply additional `idf.py` options, from [app_trace](app_trace) and [sysview](sysview) files. +`@app_trace` argument apply additional `idf.py` options, from [app_trace](app_trace) and file. diff --git a/components/app_trace/test_apps/main/test_trace.c b/components/app_trace/test_apps/main/test_trace.c index 1748821522..6c11afe16d 100644 --- a/components/app_trace/test_apps/main/test_trace.c +++ b/components/app_trace/test_apps/main/test_trace.c @@ -16,10 +16,10 @@ #include "freertos/FreeRTOS.h" #include "freertos/semphr.h" #include "freertos/task.h" +#include "esp_app_trace.h" #define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE #include "esp_log.h" -#include "esp_app_trace.h" #define ESP_APPTRACE_TEST_USE_PRINT_LOCK 0 #define ESP_APPTRACE_TEST_PRN_WRERR_MAX 5 @@ -65,7 +65,6 @@ const static char *TAG = "esp_apptrace_test"; #define ESP_APPTRACE_TEST_LOGV( format, ... ) ESP_APPTRACE_TEST_LOG_LEVEL(V, ESP_LOG_VERBOSE, format, ##__VA_ARGS__) #define ESP_APPTRACE_TEST_LOGO( format, ... ) ESP_APPTRACE_TEST_LOG_LEVEL(E, ESP_LOG_NONE, format, ##__VA_ARGS__) -#if CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW == 0 #define ESP_APPTRACE_TEST_WRITE(_b_, _s_) esp_apptrace_write(_b_, _s_, ESP_APPTRACE_TMO_INFINITE) #define ESP_APPTRACE_TEST_WRITE_FROM_ISR(_b_, _s_) esp_apptrace_write(_b_, _s_, 0UL) #define ESP_APPTRACE_TEST_WRITE_NOWAIT(_b_, _s_) esp_apptrace_write(_b_, _s_, 0) @@ -693,233 +692,3 @@ TEST_CASE("Log trace test (2 tasks)", "[trace][ignore]") xSemaphoreTake(arg2.done, portMAX_DELAY); vSemaphoreDelete(arg2.done); } - -#else // #if CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW == 0 - -typedef struct { - gptimer_handle_t gptimer; - uint32_t period; - int flags; - uint32_t id; -} esp_sysviewtrace_timer_arg_t; - -typedef struct { - SemaphoreHandle_t done; - SemaphoreHandle_t *sync; - esp_sysviewtrace_timer_arg_t *timer; - uint32_t work_count; - uint32_t sleep_tmo; - uint32_t id; -} esp_sysviewtrace_task_arg_t; - -static bool esp_sysview_test_timer_isr(gptimer_handle_t timer, const gptimer_alarm_event_data_t *edata, void *user_ctx) -{ - esp_sysviewtrace_timer_arg_t *tim_arg = (esp_sysviewtrace_timer_arg_t *)user_ctx; - (void) tim_arg; - return false; -} - -static void esp_sysviewtrace_test_task(void *p) -{ - esp_sysviewtrace_task_arg_t *arg = (esp_sysviewtrace_task_arg_t *) p; - volatile uint32_t tmp = 0; - printf("%p: run sysview task\n", xTaskGetCurrentTaskHandle()); - - if (arg->timer) { - gptimer_alarm_config_t alarm_config = { - .reload_count = 0, - .alarm_count = arg->timer->period, - .flags.auto_reload_on_alarm = true, - }; - gptimer_event_callbacks_t cbs = { - .on_alarm = esp_sysview_test_timer_isr, - }; - TEST_ESP_OK(gptimer_register_event_callbacks(arg->timer->gptimer, &cbs, arg->timer)); - TEST_ESP_OK(gptimer_enable(arg->timer->gptimer)); - TEST_ESP_OK(gptimer_set_alarm_action(arg->timer->gptimer, &alarm_config)); - TEST_ESP_OK(gptimer_start(arg->timer->gptimer)); - } - - int i = 0; - while (1) { - static uint32_t count; - printf("%" PRIu32, arg->id); - if ((++count % 80) == 0) { - printf("\n"); - } - if (arg->sync) { - xSemaphoreTake(*arg->sync, portMAX_DELAY); - } - for (uint32_t k = 0; k < arg->work_count; k++) { - tmp++; - } - vTaskDelay(arg->sleep_tmo / portTICK_PERIOD_MS); - i++; - if (arg->sync) { - xSemaphoreGive(*arg->sync); - } - } - ESP_APPTRACE_TEST_LOGI("%p: finished", xTaskGetCurrentTaskHandle()); - - xSemaphoreGive(arg->done); - vTaskDelay(1); - vTaskDelete(NULL); -} - -TEST_CASE("SysView trace test 1", "[trace][ignore]") -{ - TaskHandle_t thnd; - - esp_sysviewtrace_timer_arg_t tim_arg1 = { - .flags = ESP_INTR_FLAG_SHARED, - .id = 0, - .period = 500, - }; - esp_sysviewtrace_task_arg_t arg1 = { - .done = xSemaphoreCreateBinary(), - .sync = NULL, - .work_count = 10000, - .sleep_tmo = 1, - .timer = &tim_arg1, - .id = 0, - }; - esp_sysviewtrace_timer_arg_t tim_arg2 = { - .flags = 0, - .id = 1, - .period = 100, - }; - esp_sysviewtrace_task_arg_t arg2 = { - .done = xSemaphoreCreateBinary(), - .sync = NULL, - .work_count = 10000, - .sleep_tmo = 1, - .timer = &tim_arg2, - .id = 1, - }; - - gptimer_config_t timer_config = { - .clk_src = GPTIMER_CLK_SRC_DEFAULT, - .direction = GPTIMER_COUNT_UP, - .resolution_hz = 1000000, - }; - timer_config.flags.intr_shared = (tim_arg1.flags & ESP_INTR_FLAG_SHARED) == ESP_INTR_FLAG_SHARED; - TEST_ESP_OK(gptimer_new_timer(&timer_config, &tim_arg1.gptimer)); - timer_config.flags.intr_shared = (tim_arg2.flags & ESP_INTR_FLAG_SHARED) == ESP_INTR_FLAG_SHARED; - TEST_ESP_OK(gptimer_new_timer(&timer_config, &tim_arg2.gptimer)); - - xTaskCreatePinnedToCore(esp_sysviewtrace_test_task, "svtrace0", 2048, &arg1, 3, &thnd, 0); - ESP_APPTRACE_TEST_LOGI("Created task %p", thnd); -#if CONFIG_FREERTOS_UNICORE == 0 - xTaskCreatePinnedToCore(esp_sysviewtrace_test_task, "svtrace1", 2048, &arg2, 5, &thnd, 1); -#else - xTaskCreatePinnedToCore(esp_sysviewtrace_test_task, "svtrace1", 2048, &arg2, 5, &thnd, 0); -#endif - ESP_APPTRACE_TEST_LOGI("Created task %p", thnd); - - xSemaphoreTake(arg1.done, portMAX_DELAY); - vSemaphoreDelete(arg1.done); - xSemaphoreTake(arg2.done, portMAX_DELAY); - vSemaphoreDelete(arg2.done); - TEST_ESP_OK(gptimer_stop(tim_arg1.gptimer)); - TEST_ESP_OK(gptimer_disable(tim_arg1.gptimer)); - TEST_ESP_OK(gptimer_del_timer(tim_arg1.gptimer)); - TEST_ESP_OK(gptimer_stop(tim_arg2.gptimer)); - TEST_ESP_OK(gptimer_disable(tim_arg2.gptimer)); - TEST_ESP_OK(gptimer_del_timer(tim_arg2.gptimer)); -} - -TEST_CASE("SysView trace test 2", "[trace][ignore]") -{ - TaskHandle_t thnd; - - esp_sysviewtrace_timer_arg_t tim_arg1 = { - .flags = ESP_INTR_FLAG_SHARED, - .id = 0, - .period = 500, - }; - esp_sysviewtrace_task_arg_t arg1 = { - .done = xSemaphoreCreateBinary(), - .sync = NULL, - .work_count = 10000, - .sleep_tmo = 1, - .timer = &tim_arg1, - .id = 0, - }; - esp_sysviewtrace_timer_arg_t tim_arg2 = { - .flags = 0, - .id = 1, - .period = 100, - }; - esp_sysviewtrace_task_arg_t arg2 = { - .done = xSemaphoreCreateBinary(), - .sync = NULL, - .work_count = 10000, - .sleep_tmo = 1, - .timer = &tim_arg2, - .id = 1, - }; - - SemaphoreHandle_t test_sync = xSemaphoreCreateBinary(); - xSemaphoreGive(test_sync); - esp_sysviewtrace_task_arg_t arg3 = { - .done = xSemaphoreCreateBinary(), - .sync = &test_sync, - .work_count = 1000, - .sleep_tmo = 1, - .timer = NULL, - .id = 2, - }; - esp_sysviewtrace_task_arg_t arg4 = { - .done = xSemaphoreCreateBinary(), - .sync = &test_sync, - .work_count = 10000, - .sleep_tmo = 1, - .timer = NULL, - .id = 3, - }; - - gptimer_config_t timer_config = { - .clk_src = GPTIMER_CLK_SRC_DEFAULT, - .direction = GPTIMER_COUNT_UP, - .resolution_hz = 1000000, - }; - timer_config.flags.intr_shared = (tim_arg1.flags & ESP_INTR_FLAG_SHARED) == ESP_INTR_FLAG_SHARED; - TEST_ESP_OK(gptimer_new_timer(&timer_config, &tim_arg1.gptimer)); - timer_config.flags.intr_shared = (tim_arg2.flags & ESP_INTR_FLAG_SHARED) == ESP_INTR_FLAG_SHARED; - TEST_ESP_OK(gptimer_new_timer(&timer_config, &tim_arg2.gptimer)); - - xTaskCreatePinnedToCore(esp_sysviewtrace_test_task, "svtrace0", 2048, &arg1, 3, &thnd, 0); - printf("Created task %p\n", thnd); -#if CONFIG_FREERTOS_UNICORE == 0 - xTaskCreatePinnedToCore(esp_sysviewtrace_test_task, "svtrace1", 2048, &arg2, 4, &thnd, 1); -#else - xTaskCreatePinnedToCore(esp_sysviewtrace_test_task, "svtrace1", 2048, &arg2, 4, &thnd, 0); -#endif - printf("Created task %p\n", thnd); - - xTaskCreatePinnedToCore(esp_sysviewtrace_test_task, "svsync0", 2048, &arg3, 3, &thnd, 0); - printf("Created task %p\n", thnd); -#if CONFIG_FREERTOS_UNICORE == 0 - xTaskCreatePinnedToCore(esp_sysviewtrace_test_task, "svsync1", 2048, &arg4, 5, &thnd, 1); -#else - xTaskCreatePinnedToCore(esp_sysviewtrace_test_task, "svsync1", 2048, &arg4, 5, &thnd, 0); -#endif - printf("Created task %p\n", thnd); - - xSemaphoreTake(arg1.done, portMAX_DELAY); - vSemaphoreDelete(arg1.done); - xSemaphoreTake(arg2.done, portMAX_DELAY); - vSemaphoreDelete(arg2.done); - xSemaphoreTake(arg3.done, portMAX_DELAY); - vSemaphoreDelete(arg3.done); - xSemaphoreTake(arg4.done, portMAX_DELAY); - vSemaphoreDelete(arg4.done); - vSemaphoreDelete(test_sync); - TEST_ESP_OK(gptimer_stop(tim_arg1.gptimer)); - TEST_ESP_OK(gptimer_disable(tim_arg1.gptimer)); - TEST_ESP_OK(gptimer_del_timer(tim_arg1.gptimer)); - TEST_ESP_OK(gptimer_stop(tim_arg2.gptimer)); - TEST_ESP_OK(gptimer_disable(tim_arg2.gptimer)); - TEST_ESP_OK(gptimer_del_timer(tim_arg2.gptimer)); -} -#endif // CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW == 0 diff --git a/components/app_trace/test_apps/sdkconfig.ci.sysview b/components/app_trace/test_apps/sdkconfig.ci.sysview deleted file mode 100644 index 73ca998c6c..0000000000 --- a/components/app_trace/test_apps/sdkconfig.ci.sysview +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW=y -CONFIG_ESP_TRACE_TRANSPORT_APPTRACE=y -CONFIG_APPTRACE_DEST_JTAG=y diff --git a/components/app_trace/test_apps/sysview b/components/app_trace/test_apps/sysview deleted file mode 100644 index 88ca400769..0000000000 --- a/components/app_trace/test_apps/sysview +++ /dev/null @@ -1 +0,0 @@ --DSDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.ci.sysview" -B build/sysview -DSDKCONFIG=build/sysview/sdkconfig diff --git a/components/esp_hw_support/intr_alloc.c b/components/esp_hw_support/intr_alloc.c index 942e681c4f..df10ef4736 100644 --- a/components/esp_hw_support/intr_alloc.c +++ b/components/esp_hw_support/intr_alloc.c @@ -481,7 +481,7 @@ static void ESP_INTR_IRAM_ATTR shared_intr_isr(void *arg) esp_os_exit_critical_isr(&spinlock); } -#if CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW +#if CONFIG_ESP_TRACE_ENABLE //Common non-shared isr handler wrapper. static void ESP_INTR_IRAM_ATTR non_shared_intr_isr(void *arg) { @@ -489,7 +489,7 @@ static void ESP_INTR_IRAM_ATTR non_shared_intr_isr(void *arg) esp_os_enter_critical_isr(&spinlock); traceISR_ENTER(ns_isr_arg->source + ETS_INTERNAL_INTR_SOURCE_OFF); // FIXME: can we call ISR and check os_task_switch_is_pended() after releasing spinlock? - // when CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW = 0 ISRs for non-shared IRQs are called without spinlock + // when CONFIG_ESP_TRACE_LIB_NONE is set ISRs for non-shared IRQs are called without spinlock ns_isr_arg->isr(ns_isr_arg->isr_arg); // check if we will return to scheduler or to interrupted task after ISR if (!os_task_switch_is_pended(esp_cpu_get_core_id())) { @@ -631,7 +631,7 @@ esp_err_t esp_intr_alloc_intrstatus_bind(int source, int flags, uint32_t intrsta //Mark as unusable for other interrupt sources. This is ours now! vd->flags = VECDESC_FL_NONSHARED; if (handler) { -#if CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW +#if CONFIG_ESP_TRACE_ENABLE non_shared_isr_arg_t *ns_isr_arg = heap_caps_malloc(sizeof(non_shared_isr_arg_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); if (!ns_isr_arg) { esp_os_exit_critical(&spinlock); @@ -831,7 +831,7 @@ static esp_err_t intr_free_for_current_cpu(intr_handle_t handle) if ((handle->vector_desc->flags & VECDESC_FL_NONSHARED) || free_shared_vector) { ESP_EARLY_LOGV(TAG, "esp_intr_free: Disabling int, killing handler"); -#if CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW +#if CONFIG_ESP_TRACE_ENABLE if (!free_shared_vector) { void *isr_arg = esp_cpu_intr_get_handler_arg(handle->vector_desc->intno); if (isr_arg) { diff --git a/components/esp_trace/CMakeLists.txt b/components/esp_trace/CMakeLists.txt index f32c0d6d8d..1e26e6ce7f 100644 --- a/components/esp_trace/CMakeLists.txt +++ b/components/esp_trace/CMakeLists.txt @@ -14,11 +14,6 @@ if(CONFIG_ESP_TRACE_ENABLE) if(CONFIG_ESP_TRACE_TRANSPORT_APPTRACE) list(APPEND srcs "adapters/transport/adapter_transport_apptrace.c") endif() - - if(CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW) - list(APPEND srcs "adapters/encoder/adapter_encoder_sysview.c") - endif() - endif() set(includes diff --git a/components/esp_trace/Kconfig b/components/esp_trace/Kconfig index b6f7ec9a9b..944ac322fb 100644 --- a/components/esp_trace/Kconfig +++ b/components/esp_trace/Kconfig @@ -6,9 +6,6 @@ menu "ESP Trace Configuration" help Select the trace library to use. - config ESP_TRACE_LIB_SEGGER_SYSVIEW - bool "SEGGER SystemView" - config ESP_TRACE_LIB_EXTERNAL bool "External library from component registry" help @@ -25,12 +22,9 @@ menu "ESP Trace Configuration" config ESP_TRACE_LIB_NAME string - default "sysview" if ESP_TRACE_LIB_SEGGER_SYSVIEW default "ext" if ESP_TRACE_LIB_EXTERNAL default "none" if ESP_TRACE_LIB_NONE - rsource "$IDF_PATH/components/app_trace/sys_view/Kconfig.sysview" - choice ESP_TRACE_TRANSPORT prompt "Trace transport" default ESP_TRACE_TRANSPORT_NONE diff --git a/components/esp_trace/adapters/encoder/adapter_encoder_sysview.c b/components/esp_trace/adapters/encoder/adapter_encoder_sysview.c deleted file mode 100644 index 6061c4110d..0000000000 --- a/components/esp_trace/adapters/encoder/adapter_encoder_sysview.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include -#include -#include - -#include "esp_err.h" -#include "esp_heap_caps.h" -#include "esp_trace_types.h" -#include "esp_trace_registry.h" -#include "esp_trace_port_encoder.h" -#include "esp_trace_port_transport.h" -#include "adapters/adapter_encoder_sysview.h" -#include "esp_trace_util.h" -#include "esp_sysview_trace.h" -#include "SEGGER_SYSVIEW.h" -#include "SEGGER_RTT.h" - -/* - * This adapter is used to create a public system-wide APIs for SystemView. - * All encoding and transport operations are done by SystemView component. (SEGGER_RTT_esp.c) - */ - -#define SYSVIEW_FLUSH_TMO_US (1000 * 1000) /* 1second */ -#define SYSVIEW_FLUSH_THRESH 0 - -/** - * @brief Initializes sysview encoder. - * This function is called for each core. - * Adapter implementations do NOT need their own multi-core protection. Core does it for them. - * - * @param enc Pointer to the encoder structure. Must not be NULL. - * @param enc_cfg Pointer to the encoder configuration. Can be NULL for defaults. - * - * @return ESP_OK on success, otherwise \see esp_err_t - */ -static esp_err_t init(esp_trace_encoder_t *enc, const void *enc_cfg) -{ - static bool initialized = false; - - if (!enc) { - return ESP_ERR_INVALID_ARG; - } - - if (initialized) { - return ESP_OK; - } - - const esp_trace_sysview_config_t *cfg = enc_cfg; - int dest_cpu = 0; // Default to CPU0 - - if (cfg) { - dest_cpu = cfg->dest_cpu; - } - - // Allocate and initialize encoder context - sysview_encoder_ctx_t *ctx = heap_caps_calloc(1, sizeof(*ctx), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); - if (!ctx) { - return ESP_ERR_NO_MEM; - } - - /* Segger Sysview needs locking mechanism. */ - esp_trace_lock_init(&ctx->lock); - ctx->dest_cpu = dest_cpu; - enc->ctx = ctx; - - if (SEGGER_RTT_ESP_SetEncoder(enc) != 0) { - heap_caps_free(ctx); - enc->ctx = NULL; - return ESP_ERR_NOT_SUPPORTED; - } - - /* Configure transport for SystemView requirements */ - if (enc->tp->vt->set_config) { - uint32_t flush_tmo = SYSVIEW_FLUSH_TMO_US; - uint32_t flush_thresh = SYSVIEW_FLUSH_THRESH; - uint32_t header_size = 2; /* SystemView uses 2-byte (16-bit) trace headers */ - enc->tp->vt->set_config(enc->tp, ESP_TRACE_TRANSPORT_CFG_FLUSH_TMO, &flush_tmo); - enc->tp->vt->set_config(enc->tp, ESP_TRACE_TRANSPORT_CFG_FLUSH_THRESH, &flush_thresh); - enc->tp->vt->set_config(enc->tp, ESP_TRACE_TRANSPORT_CFG_HEADER_SIZE, &header_size); - } - - SEGGER_SYSVIEW_Conf(); - - initialized = true; - - return ESP_OK; -} - -/** - * @brief Panic handler - * - * Called during system panic to finalize encoder state. - * - * @param enc Pointer to the encoder structure. Must not be NULL. - * @param info Panic information - */ -static void panic_handler(esp_trace_encoder_t *enc, const void *info) -{ - (void)enc; - (void)info; - - SEGGER_RTT_ESP_Flush(); -} - -/** - * @brief Takes the lock of sysview encoder. - * - * @param enc Pointer to the encoder structure. Must not be NULL. - * @param tmo Timeout for the operation (in us). - */ -static unsigned int take_lock(esp_trace_encoder_t *enc, uint32_t tmo_us) -{ - sysview_encoder_ctx_t *ctx = enc->ctx; - esp_trace_lock_take(&ctx->lock, tmo_us); - - return ctx->lock.int_state; -} - -/** - * @brief Gives the lock of sysview encoder. - * - * @param enc Pointer to the encoder structure. Must not be NULL. - * @param int_state The interrupt state. - */ -static void give_lock(esp_trace_encoder_t *enc, unsigned int_state) -{ - sysview_encoder_ctx_t *ctx = enc->ctx; - - // Restore interrupt state before releasing lock - ctx->lock.int_state = int_state; - esp_trace_lock_give(&ctx->lock); -} - -/** - * @brief Sysview encoder vtable. - */ -static const esp_trace_encoder_vtable_t s_sysview_vt = { - .init = init, - .panic_handler = panic_handler, - .take_lock = take_lock, - .give_lock = give_lock, -}; - -ESP_TRACE_REGISTER_ENCODER("sysview", &s_sysview_vt); diff --git a/components/esp_trace/include/adapters/adapter_encoder_sysview.h b/components/esp_trace/include/adapters/adapter_encoder_sysview.h deleted file mode 100644 index cd367324cc..0000000000 --- a/components/esp_trace/include/adapters/adapter_encoder_sysview.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#pragma once - -#include "esp_trace_util.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief SystemView encoder configuration - */ -typedef struct { - /** - * @brief CPU to trace (0 or 1) - * - * Determines which CPU's events are captured by SystemView. - * Only relevant when using UART apptrace transport. - * - * - 0: Capture events from CPU0 (Pro CPU) - * - 1: Capture events from CPU1 (App CPU) - * - * @note This parameter is ignored for single-core systems - * @note This parameter is ignored when using JTAG transport - */ - int dest_cpu; -} esp_trace_sysview_config_t; - -/** - * @brief SystemView encoder context structure - * - * This structure is shared between the sysview adapter and the SEGGER RTT layer - * to allow proper access to encoder-specific configuration. - */ -typedef struct { - int dest_cpu; ///< CPU to trace (0 or 1) - esp_trace_lock_t lock; ///< Encoder lock -} sysview_encoder_ctx_t; - -#ifdef __cplusplus -} -#endif diff --git a/components/esp_trace/include/esp_trace_freertos.h b/components/esp_trace/include/esp_trace_freertos.h index fc8d75c89d..41175d9238 100644 --- a/components/esp_trace/include/esp_trace_freertos.h +++ b/components/esp_trace/include/esp_trace_freertos.h @@ -14,14 +14,10 @@ * This header provides a unified interface for FreeRTOS tracing. * It dispatches to the appropriate implementation based on configuration: * - * - CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW: Uses SEGGER SystemView * - CONFIG_ESP_TRACE_LIB_EXTERNAL: Uses external component's implementation * (external component must provide esp_trace_freertos_impl.h see components/esp_trace/README.md for more details) */ -#if CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW -#include "SEGGER_SYSVIEW_FreeRTOS.h" -#undef INLINE /* to avoid redefinition */ -#elif CONFIG_ESP_TRACE_LIB_EXTERNAL +#if CONFIG_ESP_TRACE_LIB_EXTERNAL #include "esp_trace_freertos_impl.h" #endif diff --git a/components/esp_trace/linker.lf b/components/esp_trace/linker.lf index ba230f2034..b2dbeec930 100644 --- a/components/esp_trace/linker.lf +++ b/components/esp_trace/linker.lf @@ -6,8 +6,6 @@ entries: esp_trace_core (noflash) esp_trace_registry (noflash) port_utils (noflash) - if ESP_TRACE_LIB_SEGGER_SYSVIEW: - adapter_encoder_sysview (noflash) if ESP_TRACE_TRANSPORT_APPTRACE: adapter_transport_apptrace (noflash) diff --git a/components/freertos/FreeRTOS-Kernel-SMP/portable/riscv/include/freertos/portmacro.h b/components/freertos/FreeRTOS-Kernel-SMP/portable/riscv/include/freertos/portmacro.h index b017c5105d..5928bc3154 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/portable/riscv/include/freertos/portmacro.h +++ b/components/freertos/FreeRTOS-Kernel-SMP/portable/riscv/include/freertos/portmacro.h @@ -401,7 +401,7 @@ bool xPortcheckValidStackMem(const void *ptr); // --------------------- App-Trace ------------------------- -#if CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW +#if CONFIG_ESP_TRACE_ENABLE extern volatile BaseType_t xPortSwitchFlag; #define os_task_switch_is_pended(_cpu_) (xPortSwitchFlag) #else diff --git a/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/include/freertos/portmacro.h b/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/include/freertos/portmacro.h index a460e179ca..2c59f7b573 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/include/freertos/portmacro.h +++ b/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/include/freertos/portmacro.h @@ -421,7 +421,7 @@ bool xPortcheckValidStackMem(const void *ptr); // --------------------- App-Trace ------------------------- -#if CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW +#if CONFIG_ESP_TRACE_ENABLE extern volatile BaseType_t xPortSwitchFlag; #define os_task_switch_is_pended(_cpu_) (xPortSwitchFlag) #else diff --git a/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro.h b/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro.h index a5b7b1b914..08c7503240 100644 --- a/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro.h +++ b/components/freertos/FreeRTOS-Kernel/portable/riscv/include/freertos/portmacro.h @@ -740,7 +740,7 @@ bool xPortcheckValidStackMem(const void *ptr); // --------------------- App-Trace ------------------------- -#if CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW +#if CONFIG_ESP_TRACE_ENABLE extern volatile UBaseType_t xPortSwitchFlag[portNUM_PROCESSORS]; #define os_task_switch_is_pended(_cpu_) (xPortSwitchFlag[_cpu_]) #else diff --git a/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h b/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h index b820060414..34f387ff25 100644 --- a/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h +++ b/components/freertos/FreeRTOS-Kernel/portable/xtensa/include/freertos/portmacro.h @@ -658,7 +658,7 @@ bool xPortcheckValidStackMem(const void *ptr); // --------------------- App-Trace ------------------------- -#if CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW +#if CONFIG_ESP_TRACE_ENABLE extern volatile uint32_t port_switch_flag[portNUM_PROCESSORS]; #define os_task_switch_is_pended(_cpu_) (port_switch_flag[_cpu_]) #else diff --git a/components/xtensa/xtensa_intr.c b/components/xtensa/xtensa_intr.c index a2f9bfc69b..7279bcdf76 100644 --- a/components/xtensa/xtensa_intr.c +++ b/components/xtensa/xtensa_intr.c @@ -156,7 +156,7 @@ xt_handler xt_set_interrupt_handler(int n, xt_handler f, void * arg) return ((old == &xt_unhandled_interrupt) ? 0 : old); } -#if CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW +#if CONFIG_ESP_TRACE_ENABLE void * xt_get_interrupt_handler_arg(int n) { xt_handler_table_entry * entry; diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index 06ed3a4174..d7dd1d31ec 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -22,7 +22,6 @@ PROJECT_NAME = "IDF Programming Guide" INPUT = \ $(PROJECT_PATH)/components/app_trace/include/esp_app_trace.h \ - $(PROJECT_PATH)/components/app_trace/include/esp_sysview_trace.h \ $(PROJECT_PATH)/components/app_update/include/esp_ota_ops.h \ $(PROJECT_PATH)/components/bootloader_support/include/bootloader_random.h \ $(PROJECT_PATH)/components/bootloader_support/include/esp_app_format.h \ diff --git a/docs/en/api-guides/app_trace.rst b/docs/en/api-guides/app_trace.rst index dcc88f7410..c3d6456b17 100644 --- a/docs/en/api-guides/app_trace.rst +++ b/docs/en/api-guides/app_trace.rst @@ -400,7 +400,20 @@ Another useful ESP-IDF feature built on top of application tracing library is th How To Use It """"""""""""" -Support for this feature is enabled by ``Component config`` > ``ESP Trace Configuration`` > ``Trace library`` > ``SEGGER SystemView`` menuconfig option. There are several other options enabled under the same menu: +SystemView support is provided by the managed component ``espressif/esp_sysview``. The SystemView menu becomes visible only after: + +1. Adding the component dependency in ``idf_component.yml``: + + .. code-block:: yaml + + dependencies: + espressif/esp_sysview: ^1 + +2. Selecting the external library in menuconfig: ``Component config`` > ``ESP Trace Configuration`` > ``Trace library`` > ``External library from component registry``. + +After that, you can configure SystemView in ``Component config`` > ``SEGGER SystemView Configuration``. For full, up-to-date instructions, see the component README: `esp_sysview `_. + +There are several other options enabled under the same menu: 1. {IDF_TARGET_NAME} timer to use as SystemView timestamp source: (:ref:`CONFIG_ESP_TRACE_TIMESTAMP_SOURCE`) selects the source of timestamps for SystemView events. In the single core mode, timestamps are generated using {IDF_TARGET_NAME} internal cycle counter running at maximum frequency. (:ref:`CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ`) In the dual-core mode, external timer is used to generate timestamps. It's frequency is 1/2 of the CPU frequency. @@ -513,7 +526,7 @@ After trace data are collected, users can use a special tool to visualize the re This command will create a single trace file that can be loaded directly into SystemView 3.60+ for multi-core visualization. - **Note:** SystemView versions before 3.60 do not support multi-core tracing. For older versions, when tracing from {IDF_TARGET_NAME} with JTAG interfaces in the dual-core mode, two separate files are generated: one for PRO CPU and another for APP CPU. Users can load each file into separate instances of the tool. For tracing over UART, users can select ``Component config`` > ``ESP Trace Configuration`` > ``SEGGER SystemView`` in menuconfig to choose which CPU (Pro or App) has to be traced. + **Note:** SystemView versions before 3.60 do not support multi-core tracing. For older versions, when tracing from {IDF_TARGET_NAME} with JTAG interfaces in the dual-core mode, two separate files are generated: one for PRO CPU and another for APP CPU. Users can load each file into separate instances of the tool. For tracing over UART, after selecting the external library in menuconfig, users can select ``Component config`` > ``SEGGER SystemView Configuration`` to choose which CPU (Pro or App) has to be traced. For older SystemView versions, analyzing data for every core in separate instances can be awkward. An alternative is to use the Eclipse plugin called *Impulse*, which can load several trace files, making it possible to inspect events from both cores in one view. This plugin also has no limitation of 1,000,000 events as compared to the free version of SystemView. diff --git a/docs/en/api-reference/system/app_trace.rst b/docs/en/api-reference/system/app_trace.rst index 427b4a0629..06d71508df 100644 --- a/docs/en/api-reference/system/app_trace.rst +++ b/docs/en/api-reference/system/app_trace.rst @@ -25,4 +25,3 @@ API Reference ------------- .. include-build-file:: inc/esp_app_trace.inc -.. include-build-file:: inc/esp_sysview_trace.inc diff --git a/docs/en/migration-guides/release-6.x/6.0/system.rst b/docs/en/migration-guides/release-6.x/6.0/system.rst index 97337b3d52..4ed7c7fe15 100644 --- a/docs/en/migration-guides/release-6.x/6.0/system.rst +++ b/docs/en/migration-guides/release-6.x/6.0/system.rst @@ -134,10 +134,26 @@ New configuration: CONFIG_APPTRACE_DEST_UART=y CONFIG_APPTRACE_DEST_UART_NUM=0 # or 1, 2 depending on target -SystemView Configuration -^^^^^^^^^^^^^^^^^^^^^^^^ +SEGGER SystemView +^^^^^^^^^^^^^^^^^ -The SystemView configuration has been moved to a new location in the menuconfig: ``Component config`` > ``ESP Trace Configuration`` > ``Trace library`` > ``SEGGER SystemView``. +The SystemView component has been moved to a separate repository. `esp_sysview `_ is now a managed component. + +Configuration +^^^^^^^^^^^^^^ + +The SystemView configuration has been moved to a new location in the menuconfig. It becomes visible only when the project adds the ``esp_sysview`` component dependency in ``idf_component.yml`` and the external library is selected in menuconfig. + +Add the dependency in your component manifest: + +.. code-block:: yaml + + dependencies: + espressif/esp_sysview: ^1 + +Then, in menuconfig, select: ``Component config`` > ``ESP Trace Configuration`` > ``Trace library`` > ``External library from component registry``. + +After that, the SystemView configuration can be shown by selecting ``Component config`` > ``SEGGER SystemView Configuration``. The SystemView no longer has its own separate destination configuration. It shares the configuration with the application tracing transport (JTAG or UART). diff --git a/docs/zh_CN/api-guides/app_trace.rst b/docs/zh_CN/api-guides/app_trace.rst index 8ea25142c0..8eecd6328c 100644 --- a/docs/zh_CN/api-guides/app_trace.rst +++ b/docs/zh_CN/api-guides/app_trace.rst @@ -400,7 +400,20 @@ ESP-IDF 中另一个基于应用层跟踪库的实用功能是系统级跟踪, 如何使用 """""""" -若需使用这个功能,需要在 menuconfig 中通过 ``Component config`` > ``ESP Trace Configuration`` > ``Trace library`` > ``SEGGER SystemView`` 选项启用此功能。同一菜单栏下还有其它几个选项: +SystemView 支持由托管组件 ``espressif/esp_sysview`` 提供。SystemView 菜单仅在以下步骤完成后才会显示: + +1. 在 ``idf_component.yml`` 中添加组件依赖: + + .. code-block:: yaml + + dependencies: + espressif/esp_sysview: ^1 + +2. 在 menuconfig 中选择外部库:``Component config`` > ``ESP Trace Configuration`` > ``Trace library`` > ``External library from component registry``。 + +之后,您可以在 ``Component config`` > ``SEGGER SystemView Configuration`` 中配置 SystemView。有关完整的最新说明,请参阅组件 README:`esp_sysview `_。 + +同一菜单栏下还有其它几个选项: 1. {IDF_TARGET_NAME} 用作 SystemView 时间戳源的定时器选择:(:ref:`CONFIG_ESP_TRACE_TIMESTAMP_SOURCE`)用于选择 SystemView 事件的时间戳源。在单核模式下,时间戳由以最大频率运行的 {IDF_TARGET_NAME} 内部周期计数器生成。(:ref:`CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ`)在双核模式下,使用外部定时器生成时间戳,其频率为 CPU 频率的 1/2。 @@ -513,7 +526,7 @@ Start 子命令语法: 此命令将创建一个单独的跟踪文件,可以直接加载到 SystemView 3.60+ 中进行多核可视化。 - **注意:** SystemView 3.60 之前的版本不支持多核跟踪。对于旧版本,当使用 JTAG 接口跟踪双核模式下的 {IDF_TARGET_NAME} 时会生成两个文件:一个用于 PRO CPU,另一个用于 APP CPU。用户可将每个文件载入不同的工具实例。使用 UART 进行跟踪时,用户可以在 menuconfig 中选择 ``Component config`` > ``ESP Trace Configuration`` > ``SEGGER SystemView`` 来指定需要跟踪的 CPU(Pro 或 App)。 + **注意:** SystemView 3.60 之前的版本不支持多核跟踪。对于旧版本,当使用 JTAG 接口跟踪双核模式下的 {IDF_TARGET_NAME} 时会生成两个文件:一个用于 PRO CPU,另一个用于 APP CPU。用户可将每个文件载入不同的工具实例。使用 UART 进行跟踪时,在 menuconfig 中选择外部库后,用户可以选择 ``Component config`` > ``SEGGER SystemView Configuration`` 来指定需要跟踪的 CPU(Pro 或 App)。 对于旧版本的 SystemView,在不同的实例中分别分析每个核的数据可能较为不便。另一个选择是使用名为 *Impulse* 的 Eclipse 插件,该插件可同时加载多个跟踪文件,实现在同一视图中检查来自两个核心的事件。与 SystemView 免费版相比,此插件还不受 100 万事件数量的限制。 diff --git a/docs/zh_CN/api-reference/system/app_trace.rst b/docs/zh_CN/api-reference/system/app_trace.rst index 983d8e69f3..f6da0b6bec 100644 --- a/docs/zh_CN/api-reference/system/app_trace.rst +++ b/docs/zh_CN/api-reference/system/app_trace.rst @@ -25,4 +25,3 @@ API 参考 ------------- .. include-build-file:: inc/esp_app_trace.inc -.. include-build-file:: inc/esp_sysview_trace.inc diff --git a/docs/zh_CN/migration-guides/release-6.x/6.0/system.rst b/docs/zh_CN/migration-guides/release-6.x/6.0/system.rst index b9cdd4b055..45a2f340fd 100644 --- a/docs/zh_CN/migration-guides/release-6.x/6.0/system.rst +++ b/docs/zh_CN/migration-guides/release-6.x/6.0/system.rst @@ -134,10 +134,26 @@ UART 目标配置已简化: CONFIG_APPTRACE_DEST_UART=y CONFIG_APPTRACE_DEST_UART_NUM=0 # 或 1、2,具体取决于目标芯片 -SystemView 配置 -^^^^^^^^^^^^^^^^^^^^^^^^ +SEGGER SystemView +^^^^^^^^^^^^^^^^^ -SystemView 配置已移至 menuconfig 中的新位置:``Component config`` > ``ESP Trace Configuration`` > ``Trace library`` > ``SEGGER SystemView``。 +SystemView 组件已移至独立仓库。`esp_sysview `_ 现为托管组件。 + +配置 +^^^^^^^^^^^^^^ + +SystemView 配置已移至 menuconfig。仅当在项目的 ``idf_component.yml`` 中添加 ``esp_sysview`` 组件依赖,并在 menuconfig 中选择外部库后,相关配置菜单才会显示。 + +在组件清单中添加依赖: + +.. code-block:: yaml + + dependencies: + espressif/esp_sysview: ^1 + +随后在 menuconfig 中选择:``Component config`` > ``ESP Trace Configuration`` > ``Trace library`` > ``External library from component registry``。 + +之后,可在 ``Component config`` > ``SEGGER SystemView Configuration`` 中进行 SystemView 配置。 SystemView 不再拥有独立的传输目标配置。它与应用程序跟踪传输方式(JTAG 或 UART)共享配置。 diff --git a/examples/system/sysview_tracing/main/idf_component.yml b/examples/system/sysview_tracing/main/idf_component.yml new file mode 100644 index 0000000000..52aa253449 --- /dev/null +++ b/examples/system/sysview_tracing/main/idf_component.yml @@ -0,0 +1,13 @@ +## IDF Component Manager Manifest File +dependencies: + ## Required IDF version + idf: + version: '>=6.0' + # # Put list of dependencies here + #espressif/esp_sysview: ^1 + esp_sysview: + git: https://github.com/espressif/idf-extra-components.git + path: esp_sysview + version: "refs/pull/600/head" + matches: + - if: "idf_version >=6.0" diff --git a/examples/system/sysview_tracing/main/sysview_tracing.c b/examples/system/sysview_tracing/main/sysview_tracing.c index 498e29fb14..7950596355 100644 --- a/examples/system/sysview_tracing/main/sysview_tracing.c +++ b/examples/system/sysview_tracing/main/sysview_tracing.c @@ -19,11 +19,11 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "driver/gptimer.h" +#include "soc/uart_pins.h" #include "esp_trace.h" static const char *TAG = "example"; -#if CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW #if !CONFIG_USE_CUSTOM_EVENT_ID #define SYSVIEW_EXAMPLE_SEND_EVENT_ID 0 @@ -71,15 +71,6 @@ static void example_sysview_event_send(uint32_t id, uint32_t val) #endif // !CONFIG_USE_CUSTOM_EVENT_ID -#else - -#define SYSVIEW_EXAMPLE_SEND_EVENT_START() -#define SYSVIEW_EXAMPLE_SEND_EVENT_END(_val_) -#define SYSVIEW_EXAMPLE_WAIT_EVENT_START() -#define SYSVIEW_EXAMPLE_WAIT_EVENT_END(_val_) - -#endif // CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW - typedef struct { gptimer_handle_t gptimer; int count; @@ -136,13 +127,32 @@ static void example_task(void *p) } } +esp_trace_open_params_t esp_trace_get_user_params(void) +{ + static esp_apptrace_config_t app_trace_config = APPTRACE_CONFIG_DEFAULT(); +#if CONFIG_APPTRACE_DEST_UART + /* Override default values to use console pins as a uart channel */ + app_trace_config.dest_cfg.uart.tx_pin_num = U0TXD_GPIO_NUM; + app_trace_config.dest_cfg.uart.rx_pin_num = U0RXD_GPIO_NUM; +#endif + + esp_trace_open_params_t trace_params = { + .core_cfg = NULL, + .encoder_name = "sysview", + .encoder_cfg = NULL, + .transport_name = "apptrace", + .transport_cfg = &app_trace_config, + }; + return trace_params; +} + void app_main(void) { ESP_LOGI(TAG, "Hello from sysview_tracing example!"); static example_event_data_t event_data[CONFIG_FREERTOS_NUMBER_OF_CORES]; -#if CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW && CONFIG_USE_CUSTOM_EVENT_ID +#if CONFIG_USE_CUSTOM_EVENT_ID // Currently OpenOCD does not support requesting module info from target. So do the following... // Wait until SystemView module receives START command from host, // after that data can be sent to the host using onboard API, diff --git a/examples/system/sysview_tracing/sdkconfig.ci.sysview_uart b/examples/system/sysview_tracing/sdkconfig.ci.sysview_uart index 9d16ef2ee1..c9de8f194b 100644 --- a/examples/system/sysview_tracing/sdkconfig.ci.sysview_uart +++ b/examples/system/sysview_tracing/sdkconfig.ci.sysview_uart @@ -1,4 +1,3 @@ CONFIG_ESP_CONSOLE_NONE=y CONFIG_APPTRACE_DEST_UART=y -CONFIG_APPTRACE_DEST_UART_NUM=0 CONFIG_USE_CUSTOM_EVENT_ID=y diff --git a/examples/system/sysview_tracing/sdkconfig.ci.sysview_uart_esp32c2_26Mhz b/examples/system/sysview_tracing/sdkconfig.ci.sysview_uart_esp32c2_26Mhz index 1efa43fece..a582e762d8 100644 --- a/examples/system/sysview_tracing/sdkconfig.ci.sysview_uart_esp32c2_26Mhz +++ b/examples/system/sysview_tracing/sdkconfig.ci.sysview_uart_esp32c2_26Mhz @@ -1,6 +1,5 @@ CONFIG_IDF_TARGET="esp32c2" CONFIG_ESP_CONSOLE_NONE=y CONFIG_APPTRACE_DEST_UART=y -CONFIG_APPTRACE_DEST_UART_NUM=0 CONFIG_APPTRACE_UART_BAUDRATE=74880 CONFIG_XTAL_FREQ_26=y diff --git a/examples/system/sysview_tracing/sdkconfig.defaults b/examples/system/sysview_tracing/sdkconfig.defaults index a555ba9727..9a260fdef2 100644 --- a/examples/system/sysview_tracing/sdkconfig.defaults +++ b/examples/system/sysview_tracing/sdkconfig.defaults @@ -2,7 +2,7 @@ CONFIG_FREERTOS_HZ=1000 # Enable FreeRTOS SystemView Tracing by default CONFIG_ESP_TRACE_ENABLE=y -CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW=y +CONFIG_ESP_TRACE_LIB_EXTERNAL=y CONFIG_ESP_TRACE_TRANSPORT_APPTRACE=y CONFIG_ESP_TRACE_TS_SOURCE_ESP_TIMER=y CONFIG_SEGGER_SYSVIEW_EVT_OVERFLOW_ENABLE=y diff --git a/examples/system/sysview_tracing/sdkconfig.defaults.esp32 b/examples/system/sysview_tracing/sdkconfig.defaults.esp32 deleted file mode 100644 index d2b38b3976..0000000000 --- a/examples/system/sysview_tracing/sdkconfig.defaults.esp32 +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_IDF_TARGET="esp32" -CONFIG_APPTRACE_UART_TX_GPIO=1 -CONFIG_APPTRACE_UART_RX_GPIO=3 diff --git a/examples/system/sysview_tracing/sdkconfig.defaults.esp32c2 b/examples/system/sysview_tracing/sdkconfig.defaults.esp32c2 deleted file mode 100644 index f6cfe1f034..0000000000 --- a/examples/system/sysview_tracing/sdkconfig.defaults.esp32c2 +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_IDF_TARGET="esp32c2" -CONFIG_APPTRACE_UART_TX_GPIO=20 -CONFIG_APPTRACE_UART_RX_GPIO=19 diff --git a/examples/system/sysview_tracing/sdkconfig.defaults.esp32c3 b/examples/system/sysview_tracing/sdkconfig.defaults.esp32c3 deleted file mode 100644 index 0b063b705e..0000000000 --- a/examples/system/sysview_tracing/sdkconfig.defaults.esp32c3 +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_IDF_TARGET="esp32c3" -CONFIG_APPTRACE_UART_TX_GPIO=21 -CONFIG_APPTRACE_UART_RX_GPIO=20 diff --git a/examples/system/sysview_tracing/sdkconfig.defaults.esp32c5 b/examples/system/sysview_tracing/sdkconfig.defaults.esp32c5 deleted file mode 100644 index a09b017d7b..0000000000 --- a/examples/system/sysview_tracing/sdkconfig.defaults.esp32c5 +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_IDF_TARGET="esp32c5" -CONFIG_APPTRACE_UART_TX_GPIO=11 -CONFIG_APPTRACE_UART_RX_GPIO=12 diff --git a/examples/system/sysview_tracing/sdkconfig.defaults.esp32c6 b/examples/system/sysview_tracing/sdkconfig.defaults.esp32c6 deleted file mode 100644 index 4b3e4257a0..0000000000 --- a/examples/system/sysview_tracing/sdkconfig.defaults.esp32c6 +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_IDF_TARGET="esp32c6" -CONFIG_APPTRACE_UART_TX_GPIO=16 -CONFIG_APPTRACE_UART_RX_GPIO=17 diff --git a/examples/system/sysview_tracing/sdkconfig.defaults.esp32c61 b/examples/system/sysview_tracing/sdkconfig.defaults.esp32c61 deleted file mode 100644 index 390158a724..0000000000 --- a/examples/system/sysview_tracing/sdkconfig.defaults.esp32c61 +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_IDF_TARGET="esp32c61" -CONFIG_APPTRACE_UART_TX_GPIO=11 -CONFIG_APPTRACE_UART_RX_GPIO=10 diff --git a/examples/system/sysview_tracing/sdkconfig.defaults.esp32h2 b/examples/system/sysview_tracing/sdkconfig.defaults.esp32h2 deleted file mode 100644 index f5d32877b0..0000000000 --- a/examples/system/sysview_tracing/sdkconfig.defaults.esp32h2 +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_IDF_TARGET="esp32h2" -CONFIG_APPTRACE_UART_TX_GPIO=24 -CONFIG_APPTRACE_UART_RX_GPIO=23 diff --git a/examples/system/sysview_tracing/sdkconfig.defaults.esp32p4 b/examples/system/sysview_tracing/sdkconfig.defaults.esp32p4 deleted file mode 100644 index dbd30404c7..0000000000 --- a/examples/system/sysview_tracing/sdkconfig.defaults.esp32p4 +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_IDF_TARGET="esp32p4" -CONFIG_APPTRACE_UART_TX_GPIO=37 -CONFIG_APPTRACE_UART_RX_GPIO=38 diff --git a/examples/system/sysview_tracing/sdkconfig.defaults.esp32s2 b/examples/system/sysview_tracing/sdkconfig.defaults.esp32s2 deleted file mode 100644 index 1ff8e8cb8e..0000000000 --- a/examples/system/sysview_tracing/sdkconfig.defaults.esp32s2 +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_IDF_TARGET="esp32s2" -CONFIG_APPTRACE_UART_TX_GPIO=43 -CONFIG_APPTRACE_UART_RX_GPIO=44 diff --git a/examples/system/sysview_tracing/sdkconfig.defaults.esp32s3 b/examples/system/sysview_tracing/sdkconfig.defaults.esp32s3 deleted file mode 100644 index a4aa377ac0..0000000000 --- a/examples/system/sysview_tracing/sdkconfig.defaults.esp32s3 +++ /dev/null @@ -1,3 +0,0 @@ -CONFIG_IDF_TARGET="esp32s3" -CONFIG_APPTRACE_UART_TX_GPIO=43 -CONFIG_APPTRACE_UART_RX_GPIO=44 diff --git a/examples/system/sysview_tracing_heap_log/main/idf_component.yml b/examples/system/sysview_tracing_heap_log/main/idf_component.yml new file mode 100644 index 0000000000..52aa253449 --- /dev/null +++ b/examples/system/sysview_tracing_heap_log/main/idf_component.yml @@ -0,0 +1,13 @@ +## IDF Component Manager Manifest File +dependencies: + ## Required IDF version + idf: + version: '>=6.0' + # # Put list of dependencies here + #espressif/esp_sysview: ^1 + esp_sysview: + git: https://github.com/espressif/idf-extra-components.git + path: esp_sysview + version: "refs/pull/600/head" + matches: + - if: "idf_version >=6.0" diff --git a/examples/system/sysview_tracing_heap_log/main/sysview_heap_log.c b/examples/system/sysview_tracing_heap_log/main/sysview_heap_log.c index 339083a4b7..9fedde99b9 100644 --- a/examples/system/sysview_tracing_heap_log/main/sysview_heap_log.c +++ b/examples/system/sysview_tracing_heap_log/main/sysview_heap_log.c @@ -11,7 +11,7 @@ #include #include "esp_err.h" #include "esp_app_trace.h" -#include "esp_sysview_trace.h" +#include "esp_sysview_heap_trace_module.h" // from esp_sysview managed component #include "esp_heap_trace.h" #include "esp_log.h" #include "freertos/FreeRTOS.h" @@ -73,6 +73,18 @@ static void alloc_task(void *p) } } +esp_trace_open_params_t esp_trace_get_user_params(void) +{ + esp_trace_open_params_t trace_params = { + .core_cfg = NULL, + .encoder_name = "sysview", + .encoder_cfg = NULL, + .transport_name = "apptrace", + .transport_cfg = NULL, + }; + return trace_params; +} + void app_main(void) { ESP_LOGI(TAG, "Ready for OpenOCD connection"); diff --git a/examples/system/sysview_tracing_heap_log/sdkconfig.ci.app_trace_jtag b/examples/system/sysview_tracing_heap_log/sdkconfig.ci.app_trace_jtag index e69de29bb2..772bddde15 100644 --- a/examples/system/sysview_tracing_heap_log/sdkconfig.ci.app_trace_jtag +++ b/examples/system/sysview_tracing_heap_log/sdkconfig.ci.app_trace_jtag @@ -0,0 +1 @@ +CONFIG_APPTRACE_DEST_JTAG=y diff --git a/examples/system/sysview_tracing_heap_log/sdkconfig.defaults b/examples/system/sysview_tracing_heap_log/sdkconfig.defaults index a709f86cba..68fa9a59f7 100644 --- a/examples/system/sysview_tracing_heap_log/sdkconfig.defaults +++ b/examples/system/sysview_tracing_heap_log/sdkconfig.defaults @@ -2,11 +2,11 @@ CONFIG_FREERTOS_HZ=1000 # Enable application tracing by default CONFIG_ESP_TRACE_ENABLE=y -CONFIG_ESP_TRACE_LIB_SEGGER_SYSVIEW=y +CONFIG_ESP_TRACE_LIB_EXTERNAL=y CONFIG_ESP_TRACE_TRANSPORT_APPTRACE=y CONFIG_ESP_TRACE_TS_SOURCE_GPTIMER=y -CONFIG_APPTRACE_DEST_JTAG=y -# Enable FreeRTOS SystemView Tracing by default + +# FreeRTOS SystemView Tracing Settings CONFIG_SEGGER_SYSVIEW_EVT_OVERFLOW_ENABLE=y CONFIG_SEGGER_SYSVIEW_EVT_ISR_ENTER_ENABLE=y CONFIG_SEGGER_SYSVIEW_EVT_ISR_EXIT_ENABLE=y diff --git a/tools/ci/check_public_headers_exceptions.txt b/tools/ci/check_public_headers_exceptions.txt index eafb64d259..fd36952dbe 100644 --- a/tools/ci/check_public_headers_exceptions.txt +++ b/tools/ci/check_public_headers_exceptions.txt @@ -74,7 +74,6 @@ components/heap/tlsf/tlsf_control_functions.h ### Here are the files that do not compile for some reason # -components/app_trace/include/esp_sysview_trace.h components/esp_gdbstub/include/esp_gdbstub.h components/esp_hw_support/include/esp_memprot.h