mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-03 20:54:32 +02:00
Merge branch 'apptrace_breaking_changes' into 'master'
Apptrace breaking changes Closes IDF-9993 and IDF-4316 See merge request espressif/esp-idf!40380
This commit is contained in:
@@ -8,7 +8,7 @@ menu "Application Level Tracing"
|
|||||||
|
|
||||||
config APPTRACE_DEST_JTAG
|
config APPTRACE_DEST_JTAG
|
||||||
bool "JTAG"
|
bool "JTAG"
|
||||||
select APPTRACE_DEST_TRAX if IDF_TARGET_ARCH_XTENSA
|
select APPTRACE_TRAX_ENABLE if IDF_TARGET_ARCH_XTENSA
|
||||||
select APPTRACE_MEMBUFS_APPTRACE_PROTO_ENABLE
|
select APPTRACE_MEMBUFS_APPTRACE_PROTO_ENABLE
|
||||||
select APPTRACE_ENABLE
|
select APPTRACE_ENABLE
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ menu "Application Level Tracing"
|
|||||||
UART task priority. In case of high events rate,
|
UART task priority. In case of high events rate,
|
||||||
this parameter could be changed up to (configMAX_PRIORITIES-1).
|
this parameter could be changed up to (configMAX_PRIORITIES-1).
|
||||||
|
|
||||||
config APPTRACE_DEST_TRAX
|
config APPTRACE_TRAX_ENABLE
|
||||||
bool
|
bool
|
||||||
depends on IDF_TARGET_ARCH_XTENSA && !ESP32_TRAX && !ESP32S2_TRAX && !ESP32S3_TRAX
|
depends on IDF_TARGET_ARCH_XTENSA && !ESP32_TRAX && !ESP32S2_TRAX && !ESP32S3_TRAX
|
||||||
select ESP32_MEMMAP_TRACEMEM
|
select ESP32_MEMMAP_TRACEMEM
|
||||||
@@ -186,7 +186,7 @@ menu "Application Level Tracing"
|
|||||||
|
|
||||||
config APPTRACE_BUF_SIZE
|
config APPTRACE_BUF_SIZE
|
||||||
int "Size of the apptrace buffer"
|
int "Size of the apptrace buffer"
|
||||||
depends on APPTRACE_MEMBUFS_APPTRACE_PROTO_ENABLE && !APPTRACE_DEST_TRAX
|
depends on APPTRACE_MEMBUFS_APPTRACE_PROTO_ENABLE && !APPTRACE_TRAX_ENABLE
|
||||||
default 16384
|
default 16384
|
||||||
help
|
help
|
||||||
Size of the memory buffer for trace data in bytes.
|
Size of the memory buffer for trace data in bytes.
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2017-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
*/
|
*/
|
||||||
@@ -80,31 +80,30 @@ ESP_SYSTEM_INIT_FN(esp_apptrace_init, SECONDARY, ESP_SYSTEM_INIT_ALL_CORES, 115)
|
|||||||
return esp_apptrace_init();
|
return esp_apptrace_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void esp_apptrace_down_buffer_config(uint8_t *buf, uint32_t size)
|
esp_err_t esp_apptrace_down_buffer_config(esp_apptrace_dest_t dest, uint8_t *buf, uint32_t size)
|
||||||
{
|
{
|
||||||
esp_apptrace_channel_t *ch;
|
esp_apptrace_channel_t *ch;
|
||||||
|
|
||||||
|
if (dest >= ESP_APPTRACE_DEST_MAX) {
|
||||||
|
return ESP_ERR_INVALID_ARG;
|
||||||
|
}
|
||||||
|
if (buf == NULL || size == 0) {
|
||||||
|
return ESP_ERR_INVALID_ARG;
|
||||||
|
}
|
||||||
if (!s_inited) {
|
if (!s_inited) {
|
||||||
return;
|
return ESP_ERR_INVALID_STATE;
|
||||||
}
|
}
|
||||||
// currently down buffer is supported for JTAG interface only
|
|
||||||
// TODO: one more argument should be added to this function to specify HW interface: JTAG, UART0 etc
|
ch = &s_trace_channels[dest];
|
||||||
ch = &s_trace_channels[ESP_APPTRACE_DEST_JTAG];
|
if (ch->hw == NULL) {
|
||||||
if (ch->hw != NULL) {
|
ESP_APPTRACE_LOGE("Trace destination %d not supported!", dest);
|
||||||
if (ch->hw->down_buffer_config != NULL) {
|
return ESP_FAIL;
|
||||||
ch->hw->down_buffer_config(ch->hw_data, buf, size);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ESP_APPTRACE_LOGD("Trace destination for JTAG not supported!");
|
|
||||||
}
|
}
|
||||||
ch = &s_trace_channels[ESP_APPTRACE_DEST_UART];
|
if (ch->hw->down_buffer_config != NULL) {
|
||||||
if (ch->hw != NULL) {
|
ch->hw->down_buffer_config(ch->hw_data, buf, size);
|
||||||
if (ch->hw->down_buffer_config != NULL) {
|
|
||||||
ch->hw->down_buffer_config(ch->hw_data, buf, size);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ESP_APPTRACE_LOGD("Trace destination for UART not supported!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *esp_apptrace_down_buffer_get(esp_apptrace_dest_t dest, uint32_t *size, uint32_t user_tmo)
|
uint8_t *esp_apptrace_down_buffer_get(esp_apptrace_dest_t dest, uint32_t *size, uint32_t user_tmo)
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2017-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -46,14 +46,19 @@ void gcov_dump_task(void *pvParameter)
|
|||||||
goto gcov_exit;
|
goto gcov_exit;
|
||||||
}
|
}
|
||||||
ESP_EARLY_LOGV(TAG, "Config apptrace down buf");
|
ESP_EARLY_LOGV(TAG, "Config apptrace down buf");
|
||||||
esp_apptrace_down_buffer_config(down_buf, ESP_GCOV_DOWN_BUF_SIZE);
|
esp_err_t res = esp_apptrace_down_buffer_config(ESP_APPTRACE_DEST_JTAG, down_buf, ESP_GCOV_DOWN_BUF_SIZE);
|
||||||
|
if (res != ESP_OK) {
|
||||||
|
ESP_EARLY_LOGE(TAG, "Failed to config apptrace down buf (%d)!", res);
|
||||||
|
dump_result = res;
|
||||||
|
goto gcov_exit;
|
||||||
|
}
|
||||||
ESP_EARLY_LOGV(TAG, "Dump data...");
|
ESP_EARLY_LOGV(TAG, "Dump data...");
|
||||||
__gcov_dump();
|
__gcov_dump();
|
||||||
// reset dump status to allow incremental data accumulation
|
// reset dump status to allow incremental data accumulation
|
||||||
__gcov_reset();
|
__gcov_reset();
|
||||||
free(down_buf);
|
free(down_buf);
|
||||||
ESP_EARLY_LOGV(TAG, "Finish file transfer session");
|
ESP_EARLY_LOGV(TAG, "Finish file transfer session");
|
||||||
dump_result = esp_apptrace_fstop(ESP_APPTRACE_DEST_TRAX);
|
dump_result = esp_apptrace_fstop(ESP_APPTRACE_DEST_JTAG);
|
||||||
if (dump_result != ESP_OK) {
|
if (dump_result != ESP_OK) {
|
||||||
ESP_EARLY_LOGE(TAG, "Failed to send files transfer stop cmd (%d)!", dump_result);
|
ESP_EARLY_LOGE(TAG, "Failed to send files transfer stop cmd (%d)!", dump_result);
|
||||||
}
|
}
|
||||||
@@ -119,7 +124,7 @@ void esp_gcov_dump(void)
|
|||||||
{
|
{
|
||||||
ESP_EARLY_LOGV(TAG, "%s", __FUNCTION__);
|
ESP_EARLY_LOGV(TAG, "%s", __FUNCTION__);
|
||||||
|
|
||||||
while (!esp_apptrace_host_is_connected(ESP_APPTRACE_DEST_TRAX)) {
|
while (!esp_apptrace_host_is_connected(ESP_APPTRACE_DEST_JTAG)) {
|
||||||
vTaskDelay(pdMS_TO_TICKS(10));
|
vTaskDelay(pdMS_TO_TICKS(10));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +139,7 @@ void esp_gcov_dump(void)
|
|||||||
void *gcov_rtio_fopen(const char *path, const char *mode)
|
void *gcov_rtio_fopen(const char *path, const char *mode)
|
||||||
{
|
{
|
||||||
ESP_EARLY_LOGV(TAG, "%s '%s' '%s'", __FUNCTION__, path, mode);
|
ESP_EARLY_LOGV(TAG, "%s '%s' '%s'", __FUNCTION__, path, mode);
|
||||||
void *f = esp_apptrace_fopen(ESP_APPTRACE_DEST_TRAX, path, mode);
|
void *f = esp_apptrace_fopen(ESP_APPTRACE_DEST_JTAG, path, mode);
|
||||||
ESP_EARLY_LOGV(TAG, "%s ret %p", __FUNCTION__, f);
|
ESP_EARLY_LOGV(TAG, "%s ret %p", __FUNCTION__, f);
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
@@ -142,13 +147,13 @@ void *gcov_rtio_fopen(const char *path, const char *mode)
|
|||||||
int gcov_rtio_fclose(void *stream)
|
int gcov_rtio_fclose(void *stream)
|
||||||
{
|
{
|
||||||
ESP_EARLY_LOGV(TAG, "%s", __FUNCTION__);
|
ESP_EARLY_LOGV(TAG, "%s", __FUNCTION__);
|
||||||
return esp_apptrace_fclose(ESP_APPTRACE_DEST_TRAX, stream);
|
return esp_apptrace_fclose(ESP_APPTRACE_DEST_JTAG, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t gcov_rtio_fread(void *ptr, size_t size, size_t nmemb, void *stream)
|
size_t gcov_rtio_fread(void *ptr, size_t size, size_t nmemb, void *stream)
|
||||||
{
|
{
|
||||||
ESP_EARLY_LOGV(TAG, "%s read %u", __FUNCTION__, size * nmemb);
|
ESP_EARLY_LOGV(TAG, "%s read %u", __FUNCTION__, size * nmemb);
|
||||||
size_t sz = esp_apptrace_fread(ESP_APPTRACE_DEST_TRAX, ptr, size, nmemb, stream);
|
size_t sz = esp_apptrace_fread(ESP_APPTRACE_DEST_JTAG, ptr, size, nmemb, stream);
|
||||||
ESP_EARLY_LOGV(TAG, "%s actually read %u", __FUNCTION__, sz);
|
ESP_EARLY_LOGV(TAG, "%s actually read %u", __FUNCTION__, sz);
|
||||||
return sz;
|
return sz;
|
||||||
}
|
}
|
||||||
@@ -156,26 +161,26 @@ size_t gcov_rtio_fread(void *ptr, size_t size, size_t nmemb, void *stream)
|
|||||||
size_t gcov_rtio_fwrite(const void *ptr, size_t size, size_t nmemb, void *stream)
|
size_t gcov_rtio_fwrite(const void *ptr, size_t size, size_t nmemb, void *stream)
|
||||||
{
|
{
|
||||||
ESP_EARLY_LOGV(TAG, "%s", __FUNCTION__);
|
ESP_EARLY_LOGV(TAG, "%s", __FUNCTION__);
|
||||||
return esp_apptrace_fwrite(ESP_APPTRACE_DEST_TRAX, ptr, size, nmemb, stream);
|
return esp_apptrace_fwrite(ESP_APPTRACE_DEST_JTAG, ptr, size, nmemb, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
int gcov_rtio_fseek(void *stream, long offset, int whence)
|
int gcov_rtio_fseek(void *stream, long offset, int whence)
|
||||||
{
|
{
|
||||||
int ret = esp_apptrace_fseek(ESP_APPTRACE_DEST_TRAX, stream, offset, whence);
|
int ret = esp_apptrace_fseek(ESP_APPTRACE_DEST_JTAG, stream, offset, whence);
|
||||||
ESP_EARLY_LOGV(TAG, "%s(%p %ld %d) = %d", __FUNCTION__, stream, offset, whence, ret);
|
ESP_EARLY_LOGV(TAG, "%s(%p %ld %d) = %d", __FUNCTION__, stream, offset, whence, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
long gcov_rtio_ftell(void *stream)
|
long gcov_rtio_ftell(void *stream)
|
||||||
{
|
{
|
||||||
long ret = esp_apptrace_ftell(ESP_APPTRACE_DEST_TRAX, stream);
|
long ret = esp_apptrace_ftell(ESP_APPTRACE_DEST_JTAG, stream);
|
||||||
ESP_EARLY_LOGV(TAG, "%s(%p) = %ld", __FUNCTION__, stream, ret);
|
ESP_EARLY_LOGV(TAG, "%s(%p) = %ld", __FUNCTION__, stream, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int gcov_rtio_feof(void *stream)
|
int gcov_rtio_feof(void *stream)
|
||||||
{
|
{
|
||||||
int ret = esp_apptrace_feof(ESP_APPTRACE_DEST_TRAX, stream);
|
int ret = esp_apptrace_feof(ESP_APPTRACE_DEST_JTAG, stream);
|
||||||
ESP_EARLY_LOGV(TAG, "%s(%p) = %d", __FUNCTION__, stream, ret);
|
ESP_EARLY_LOGV(TAG, "%s(%p) = %d", __FUNCTION__, stream, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@@ -18,11 +18,9 @@ extern "C" {
|
|||||||
* Application trace data destinations bits.
|
* Application trace data destinations bits.
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ESP_APPTRACE_DEST_JTAG = 1, ///< JTAG destination
|
ESP_APPTRACE_DEST_JTAG, ///< JTAG destination
|
||||||
ESP_APPTRACE_DEST_TRAX = ESP_APPTRACE_DEST_JTAG, ///< xxx_TRAX name is obsolete, use more common xxx_JTAG
|
ESP_APPTRACE_DEST_UART, ///< UART destination
|
||||||
ESP_APPTRACE_DEST_UART, ///< UART destination
|
ESP_APPTRACE_DEST_MAX,
|
||||||
ESP_APPTRACE_DEST_MAX = ESP_APPTRACE_DEST_UART + 1,
|
|
||||||
ESP_APPTRACE_DEST_NUM
|
|
||||||
} esp_apptrace_dest_t;
|
} esp_apptrace_dest_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,10 +37,13 @@ esp_err_t esp_apptrace_init(void);
|
|||||||
* @note Needs to be called before attempting to receive any data using esp_apptrace_down_buffer_get and esp_apptrace_read.
|
* @note Needs to be called before attempting to receive any data using esp_apptrace_down_buffer_get and esp_apptrace_read.
|
||||||
* This function does not protect internal data by lock.
|
* This function does not protect internal data by lock.
|
||||||
*
|
*
|
||||||
|
* @param dest Indicates HW interface to configure.
|
||||||
* @param buf Address of buffer to use for down channel (host to target) data.
|
* @param buf Address of buffer to use for down channel (host to target) data.
|
||||||
* @param size Size of the buffer.
|
* @param size Size of the buffer.
|
||||||
|
*
|
||||||
|
* @return ESP_OK on success, otherwise see esp_err_t
|
||||||
*/
|
*/
|
||||||
void esp_apptrace_down_buffer_config(uint8_t *buf, uint32_t size);
|
esp_err_t esp_apptrace_down_buffer_config(esp_apptrace_dest_t dest, uint8_t *buf, uint32_t size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Allocates buffer for trace data.
|
* @brief Allocates buffer for trace data.
|
||||||
@@ -117,7 +118,7 @@ esp_err_t esp_apptrace_flush(esp_apptrace_dest_t dest, uint32_t tmo);
|
|||||||
* This is a special version of esp_apptrace_flush which should be called from panic handler.
|
* This is a special version of esp_apptrace_flush which should be called from panic handler.
|
||||||
*
|
*
|
||||||
* @param dest Indicates HW interface to flush data on.
|
* @param dest Indicates HW interface to flush data on.
|
||||||
* @param min_sz Threshold for flushing data. If current filling level is above this value, data will be flushed. TRAX destinations only.
|
* @param min_sz Threshold for flushing data. If current filling level is above this value, data will be flushed. JTAG destinations only.
|
||||||
* @param tmo Timeout for operation (in us). Use ESP_APPTRACE_TMO_INFINITE to wait indefinitely.
|
* @param tmo Timeout for operation (in us). Use ESP_APPTRACE_TMO_INFINITE to wait indefinitely.
|
||||||
*
|
*
|
||||||
* @return ESP_OK on success, otherwise see esp_err_t
|
* @return ESP_OK on success, otherwise see esp_err_t
|
||||||
|
@@ -42,7 +42,7 @@ static uint8_t s_down_buf[SYSVIEW_DOWN_BUF_SIZE];
|
|||||||
#endif // CONFIG_APPTRACE_SV_DEST_CPU_0
|
#endif // CONFIG_APPTRACE_SV_DEST_CPU_0
|
||||||
|
|
||||||
#elif CONFIG_APPTRACE_SV_DEST_JTAG || (CONFIG_APPTRACE_ENABLE && CONFIG_APPTRACE_DEST_UART_NONE)
|
#elif CONFIG_APPTRACE_SV_DEST_JTAG || (CONFIG_APPTRACE_ENABLE && CONFIG_APPTRACE_DEST_UART_NONE)
|
||||||
#define ESP_APPTRACE_DEST_SYSVIEW ESP_APPTRACE_DEST_TRAX
|
#define ESP_APPTRACE_DEST_SYSVIEW ESP_APPTRACE_DEST_JTAG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
@@ -60,7 +60,7 @@ static uint8_t s_down_buf[SYSVIEW_DOWN_BUF_SIZE];
|
|||||||
* Flushes buffered events.
|
* Flushes buffered events.
|
||||||
*
|
*
|
||||||
* Parameters
|
* Parameters
|
||||||
* min_sz Threshold for flushing data. If current filling level is above this value, data will be flushed. TRAX destinations only.
|
* 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.
|
* tmo Timeout for operation (in us). Use ESP_APPTRACE_TMO_INFINITE to wait indefinitely.
|
||||||
*
|
*
|
||||||
* Return value
|
* Return value
|
||||||
@@ -91,7 +91,7 @@ void SEGGER_RTT_ESP_FlushNoLock(unsigned long min_sz, unsigned long tmo)
|
|||||||
* Flushes buffered events.
|
* Flushes buffered events.
|
||||||
*
|
*
|
||||||
* Parameters
|
* Parameters
|
||||||
* min_sz Threshold for flushing data. If current filling level is above this value, data will be flushed. TRAX destinations only.
|
* 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.
|
* tmo Timeout for operation (in us). Use ESP_APPTRACE_TMO_INFINITE to wait indefinitely.
|
||||||
*
|
*
|
||||||
* Return value
|
* Return value
|
||||||
@@ -288,8 +288,7 @@ int SEGGER_RTT_ConfigUpBuffer(unsigned BufferIndex, const char* sName, void* pBu
|
|||||||
*/
|
*/
|
||||||
int SEGGER_RTT_ConfigDownBuffer(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)
|
||||||
{
|
{
|
||||||
esp_apptrace_down_buffer_config(s_down_buf, sizeof(s_down_buf));
|
return esp_apptrace_down_buffer_config(ESP_APPTRACE_DEST_SYSVIEW, s_down_buf, sizeof(s_down_buf));
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************** Init hook ****************************
|
/*************************** Init hook ****************************
|
||||||
|
@@ -67,9 +67,9 @@ const static char *TAG = "esp_apptrace_test";
|
|||||||
#define ESP_APPTRACE_TEST_LOGO( format, ... ) ESP_APPTRACE_TEST_LOG_LEVEL(E, ESP_LOG_NONE, format, ##__VA_ARGS__)
|
#define ESP_APPTRACE_TEST_LOGO( format, ... ) ESP_APPTRACE_TEST_LOG_LEVEL(E, ESP_LOG_NONE, format, ##__VA_ARGS__)
|
||||||
|
|
||||||
#if CONFIG_APPTRACE_SV_ENABLE == 0
|
#if CONFIG_APPTRACE_SV_ENABLE == 0
|
||||||
#define ESP_APPTRACE_TEST_WRITE(_b_, _s_) esp_apptrace_write(ESP_APPTRACE_DEST_TRAX, _b_, _s_, ESP_APPTRACE_TMO_INFINITE)
|
#define ESP_APPTRACE_TEST_WRITE(_b_, _s_) esp_apptrace_write(ESP_APPTRACE_DEST_JTAG, _b_, _s_, ESP_APPTRACE_TMO_INFINITE)
|
||||||
#define ESP_APPTRACE_TEST_WRITE_FROM_ISR(_b_, _s_) esp_apptrace_write(ESP_APPTRACE_DEST_TRAX, _b_, _s_, 0UL)
|
#define ESP_APPTRACE_TEST_WRITE_FROM_ISR(_b_, _s_) esp_apptrace_write(ESP_APPTRACE_DEST_JTAG, _b_, _s_, 0UL)
|
||||||
#define ESP_APPTRACE_TEST_WRITE_NOWAIT(_b_, _s_) esp_apptrace_write(ESP_APPTRACE_DEST_TRAX, _b_, _s_, 0)
|
#define ESP_APPTRACE_TEST_WRITE_NOWAIT(_b_, _s_) esp_apptrace_write(ESP_APPTRACE_DEST_JTAG, _b_, _s_, 0)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t *buf;
|
uint8_t *buf;
|
||||||
@@ -625,7 +625,7 @@ static int esp_logtrace_printf(const char *fmt, ...)
|
|||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
|
||||||
int ret = esp_apptrace_vprintf_to(ESP_APPTRACE_DEST_TRAX, ESP_APPTRACE_TMO_INFINITE, fmt, ap);
|
int ret = esp_apptrace_vprintf_to(ESP_APPTRACE_DEST_JTAG, ESP_APPTRACE_TMO_INFINITE, fmt, ap);
|
||||||
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
@@ -657,7 +657,7 @@ static void esp_logtrace_task(void *p)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
esp_err_t ret = esp_apptrace_flush(ESP_APPTRACE_DEST_TRAX, ESP_APPTRACE_TMO_INFINITE);
|
esp_err_t ret = esp_apptrace_flush(ESP_APPTRACE_DEST_JTAG, ESP_APPTRACE_TMO_INFINITE);
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
ESP_APPTRACE_TEST_LOGE("Failed to flush printf buf (%d)!", ret);
|
ESP_APPTRACE_TEST_LOGE("Failed to flush printf buf (%d)!", ret);
|
||||||
}
|
}
|
||||||
|
@@ -361,7 +361,7 @@ void esp_panic_handler(panic_info_t *info)
|
|||||||
#if CONFIG_APPTRACE_SV_ENABLE
|
#if CONFIG_APPTRACE_SV_ENABLE
|
||||||
SEGGER_RTT_ESP_FlushNoLock(CONFIG_APPTRACE_POSTMORTEM_FLUSH_THRESH, APPTRACE_ONPANIC_HOST_FLUSH_TMO);
|
SEGGER_RTT_ESP_FlushNoLock(CONFIG_APPTRACE_POSTMORTEM_FLUSH_THRESH, APPTRACE_ONPANIC_HOST_FLUSH_TMO);
|
||||||
#else
|
#else
|
||||||
esp_apptrace_flush_nolock(ESP_APPTRACE_DEST_TRAX, CONFIG_APPTRACE_POSTMORTEM_FLUSH_THRESH,
|
esp_apptrace_flush_nolock(ESP_APPTRACE_DEST_JTAG, CONFIG_APPTRACE_POSTMORTEM_FLUSH_THRESH,
|
||||||
APPTRACE_ONPANIC_HOST_FLUSH_TMO);
|
APPTRACE_ONPANIC_HOST_FLUSH_TMO);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -401,7 +401,7 @@ void esp_panic_handler(panic_info_t *info)
|
|||||||
#if CONFIG_APPTRACE_SV_ENABLE
|
#if CONFIG_APPTRACE_SV_ENABLE
|
||||||
SEGGER_RTT_ESP_FlushNoLock(CONFIG_APPTRACE_POSTMORTEM_FLUSH_THRESH, APPTRACE_ONPANIC_HOST_FLUSH_TMO);
|
SEGGER_RTT_ESP_FlushNoLock(CONFIG_APPTRACE_POSTMORTEM_FLUSH_THRESH, APPTRACE_ONPANIC_HOST_FLUSH_TMO);
|
||||||
#else
|
#else
|
||||||
esp_apptrace_flush_nolock(ESP_APPTRACE_DEST_TRAX, CONFIG_APPTRACE_POSTMORTEM_FLUSH_THRESH,
|
esp_apptrace_flush_nolock(ESP_APPTRACE_DEST_JTAG, CONFIG_APPTRACE_POSTMORTEM_FLUSH_THRESH,
|
||||||
APPTRACE_ONPANIC_HOST_FLUSH_TMO);
|
APPTRACE_ONPANIC_HOST_FLUSH_TMO);
|
||||||
#endif
|
#endif
|
||||||
#endif // CONFIG_APPTRACE_ENABLE
|
#endif // CONFIG_APPTRACE_ENABLE
|
||||||
@@ -472,7 +472,7 @@ void __attribute__((noreturn, no_sanitize_undefined)) panic_abort(const char *de
|
|||||||
#if CONFIG_APPTRACE_SV_ENABLE
|
#if CONFIG_APPTRACE_SV_ENABLE
|
||||||
SEGGER_RTT_ESP_FlushNoLock(CONFIG_APPTRACE_POSTMORTEM_FLUSH_THRESH, APPTRACE_ONPANIC_HOST_FLUSH_TMO);
|
SEGGER_RTT_ESP_FlushNoLock(CONFIG_APPTRACE_POSTMORTEM_FLUSH_THRESH, APPTRACE_ONPANIC_HOST_FLUSH_TMO);
|
||||||
#else
|
#else
|
||||||
esp_apptrace_flush_nolock(ESP_APPTRACE_DEST_TRAX, CONFIG_APPTRACE_POSTMORTEM_FLUSH_THRESH,
|
esp_apptrace_flush_nolock(ESP_APPTRACE_DEST_JTAG, CONFIG_APPTRACE_POSTMORTEM_FLUSH_THRESH,
|
||||||
APPTRACE_ONPANIC_HOST_FLUSH_TMO);
|
APPTRACE_ONPANIC_HOST_FLUSH_TMO);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@@ -78,7 +78,7 @@ In general, users should decide what type of data should be transferred in every
|
|||||||
#include "esp_app_trace.h"
|
#include "esp_app_trace.h"
|
||||||
...
|
...
|
||||||
char buf[] = "Hello World!";
|
char buf[] = "Hello World!";
|
||||||
esp_err_t res = esp_apptrace_write(ESP_APPTRACE_DEST_TRAX, buf, strlen(buf), ESP_APPTRACE_TMO_INFINITE);
|
esp_err_t res = esp_apptrace_write(ESP_APPTRACE_DEST_JTAG, buf, strlen(buf), ESP_APPTRACE_TMO_INFINITE);
|
||||||
if (res != ESP_OK) {
|
if (res != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to write data to host!");
|
ESP_LOGE(TAG, "Failed to write data to host!");
|
||||||
return res;
|
return res;
|
||||||
@@ -91,13 +91,13 @@ In general, users should decide what type of data should be transferred in every
|
|||||||
#include "esp_app_trace.h"
|
#include "esp_app_trace.h"
|
||||||
...
|
...
|
||||||
int number = 10;
|
int number = 10;
|
||||||
char *ptr = (char *)esp_apptrace_buffer_get(ESP_APPTRACE_DEST_TRAX, 32, 100/*tmo in us*/);
|
char *ptr = (char *)esp_apptrace_buffer_get(ESP_APPTRACE_DEST_JTAG, 32, 100/*tmo in us*/);
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
ESP_LOGE(TAG, "Failed to get buffer!");
|
ESP_LOGE(TAG, "Failed to get buffer!");
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
sprintf(ptr, "Here is the number %d", number);
|
sprintf(ptr, "Here is the number %d", number);
|
||||||
esp_err_t res = esp_apptrace_buffer_put(ESP_APPTRACE_DEST_TRAX, ptr, 100/*tmo in us*/);
|
esp_err_t res = esp_apptrace_buffer_put(ESP_APPTRACE_DEST_JTAG, ptr, 100/*tmo in us*/);
|
||||||
if (res != ESP_OK) {
|
if (res != ESP_OK) {
|
||||||
/* in case of error host tracing tool (e.g., OpenOCD) will report incomplete user buffer */
|
/* in case of error host tracing tool (e.g., OpenOCD) will report incomplete user buffer */
|
||||||
ESP_LOGE(TAG, "Failed to put buffer!");
|
ESP_LOGE(TAG, "Failed to put buffer!");
|
||||||
@@ -115,9 +115,13 @@ In general, users should decide what type of data should be transferred in every
|
|||||||
size_t sz = sizeof(buf);
|
size_t sz = sizeof(buf);
|
||||||
|
|
||||||
/* config down buffer */
|
/* config down buffer */
|
||||||
esp_apptrace_down_buffer_config(down_buf, sizeof(down_buf));
|
esp_err_t res = esp_apptrace_down_buffer_config(ESP_APPTRACE_DEST_JTAG, down_buf, sizeof(down_buf));
|
||||||
|
if (res != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Failed to config down buffer!");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
/* check for incoming data and read them if any */
|
/* check for incoming data and read them if any */
|
||||||
esp_err_t res = esp_apptrace_read(ESP_APPTRACE_DEST_TRAX, buf, &sz, 0/*do not wait*/);
|
res = esp_apptrace_read(ESP_APPTRACE_DEST_JTAG, buf, &sz, 0/*do not wait*/);
|
||||||
if (res != ESP_OK) {
|
if (res != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to read data from host!");
|
ESP_LOGE(TAG, "Failed to read data from host!");
|
||||||
return res;
|
return res;
|
||||||
@@ -138,8 +142,12 @@ In general, users should decide what type of data should be transferred in every
|
|||||||
size_t sz = 32;
|
size_t sz = 32;
|
||||||
|
|
||||||
/* config down buffer */
|
/* config down buffer */
|
||||||
esp_apptrace_down_buffer_config(down_buf, sizeof(down_buf));
|
esp_err_t res = esp_apptrace_down_buffer_config(ESP_APPTRACE_DEST_JTAG, down_buf, sizeof(down_buf));
|
||||||
char *ptr = (char *)esp_apptrace_down_buffer_get(ESP_APPTRACE_DEST_TRAX, &sz, 100/*tmo in us*/);
|
if (res != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Failed to config down buffer!");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
char *ptr = (char *)esp_apptrace_down_buffer_get(ESP_APPTRACE_DEST_JTAG, &sz, 100/*tmo in us*/);
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
ESP_LOGE(TAG, "Failed to get buffer!");
|
ESP_LOGE(TAG, "Failed to get buffer!");
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
@@ -150,7 +158,7 @@ In general, users should decide what type of data should be transferred in every
|
|||||||
} else {
|
} else {
|
||||||
printf("No data");
|
printf("No data");
|
||||||
}
|
}
|
||||||
esp_err_t res = esp_apptrace_down_buffer_put(ESP_APPTRACE_DEST_TRAX, ptr, 100/*tmo in us*/);
|
res = esp_apptrace_down_buffer_put(ESP_APPTRACE_DEST_JTAG, ptr, 100/*tmo in us*/);
|
||||||
if (res != ESP_OK) {
|
if (res != ESP_OK) {
|
||||||
/* in case of error host tracing tool (e.g., OpenOCD) will report incomplete user buffer */
|
/* in case of error host tracing tool (e.g., OpenOCD) will report incomplete user buffer */
|
||||||
ESP_LOGE(TAG, "Failed to put buffer!");
|
ESP_LOGE(TAG, "Failed to put buffer!");
|
||||||
|
@@ -57,9 +57,28 @@ The deprecated ``soc_memory_types.h`` header file has been removed. Please inclu
|
|||||||
|
|
||||||
App Trace
|
App Trace
|
||||||
----------
|
----------
|
||||||
|
|
||||||
Removed extra data buffering option. `CONFIG_APPTRACE_PENDING_DATA_SIZE_MAX` is no longer supported.
|
Removed extra data buffering option. `CONFIG_APPTRACE_PENDING_DATA_SIZE_MAX` is no longer supported.
|
||||||
|
|
||||||
|
Removed deprecated `ESP_APPTRACE_DEST_TRAX` enum value. Use `ESP_APPTRACE_DEST_JTAG` instead.
|
||||||
|
|
||||||
|
The :cpp:func:`esp_apptrace_down_buffer_config` function now requires a destination parameter and returns an error code for proper error handling.
|
||||||
|
|
||||||
|
Old Version:
|
||||||
|
|
||||||
|
.. code-block:: c
|
||||||
|
|
||||||
|
esp_apptrace_down_buffer_config(down_buf, sizeof(down_buf));
|
||||||
|
|
||||||
|
Update to:
|
||||||
|
|
||||||
|
.. code-block:: c
|
||||||
|
|
||||||
|
esp_err_t res = esp_apptrace_down_buffer_config(ESP_APPTRACE_DEST_JTAG, down_buf, sizeof(down_buf));
|
||||||
|
if (res != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Failed to config down buffer!");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
FreeRTOS
|
FreeRTOS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
@@ -78,7 +78,7 @@ ESP-IDF 中提供了应用层跟踪功能,用于分析应用程序的行为。
|
|||||||
#include "esp_app_trace.h"
|
#include "esp_app_trace.h"
|
||||||
...
|
...
|
||||||
char buf[] = "Hello World!";
|
char buf[] = "Hello World!";
|
||||||
esp_err_t res = esp_apptrace_write(ESP_APPTRACE_DEST_TRAX, buf, strlen(buf), ESP_APPTRACE_TMO_INFINITE);
|
esp_err_t res = esp_apptrace_write(ESP_APPTRACE_DEST_JTAG, buf, strlen(buf), ESP_APPTRACE_TMO_INFINITE);
|
||||||
if (res != ESP_OK) {
|
if (res != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to write data to host!");
|
ESP_LOGE(TAG, "Failed to write data to host!");
|
||||||
return res;
|
return res;
|
||||||
@@ -91,13 +91,13 @@ ESP-IDF 中提供了应用层跟踪功能,用于分析应用程序的行为。
|
|||||||
#include "esp_app_trace.h"
|
#include "esp_app_trace.h"
|
||||||
...
|
...
|
||||||
int number = 10;
|
int number = 10;
|
||||||
char *ptr = (char *)esp_apptrace_buffer_get(ESP_APPTRACE_DEST_TRAX, 32, 100/*tmo in us*/);
|
char *ptr = (char *)esp_apptrace_buffer_get(ESP_APPTRACE_DEST_JTAG, 32, 100/*tmo in us*/);
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
ESP_LOGE(TAG, "Failed to get buffer!");
|
ESP_LOGE(TAG, "Failed to get buffer!");
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
}
|
}
|
||||||
sprintf(ptr, "Here is the number %d", number);
|
sprintf(ptr, "Here is the number %d", number);
|
||||||
esp_err_t res = esp_apptrace_buffer_put(ESP_APPTRACE_DEST_TRAX, ptr, 100/*tmo in us*/);
|
esp_err_t res = esp_apptrace_buffer_put(ESP_APPTRACE_DEST_JTAG, ptr, 100/*tmo in us*/);
|
||||||
if (res != ESP_OK) {
|
if (res != ESP_OK) {
|
||||||
/* in case of error host tracing tool (e.g. OpenOCD) will report incomplete user buffer */
|
/* in case of error host tracing tool (e.g. OpenOCD) will report incomplete user buffer */
|
||||||
ESP_LOGE(TAG, "Failed to put buffer!");
|
ESP_LOGE(TAG, "Failed to put buffer!");
|
||||||
@@ -115,9 +115,13 @@ ESP-IDF 中提供了应用层跟踪功能,用于分析应用程序的行为。
|
|||||||
size_t sz = sizeof(buf);
|
size_t sz = sizeof(buf);
|
||||||
|
|
||||||
/* config down buffer */
|
/* config down buffer */
|
||||||
esp_apptrace_down_buffer_config(down_buf, sizeof(down_buf));
|
esp_err_t res = esp_apptrace_down_buffer_config(ESP_APPTRACE_DEST_JTAG, down_buf, sizeof(down_buf));
|
||||||
|
if (res != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Failed to config down buffer!");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
/* check for incoming data and read them if any */
|
/* check for incoming data and read them if any */
|
||||||
esp_err_t res = esp_apptrace_read(ESP_APPTRACE_DEST_TRAX, buf, &sz, 0/*do not wait*/);
|
res = esp_apptrace_read(ESP_APPTRACE_DEST_JTAG, buf, &sz, 0/*do not wait*/);
|
||||||
if (res != ESP_OK) {
|
if (res != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to read data from host!");
|
ESP_LOGE(TAG, "Failed to read data from host!");
|
||||||
return res;
|
return res;
|
||||||
@@ -138,8 +142,12 @@ ESP-IDF 中提供了应用层跟踪功能,用于分析应用程序的行为。
|
|||||||
size_t sz = 32;
|
size_t sz = 32;
|
||||||
|
|
||||||
/* config down buffer */
|
/* config down buffer */
|
||||||
esp_apptrace_down_buffer_config(down_buf, sizeof(down_buf));
|
esp_err_t res = esp_apptrace_down_buffer_config(ESP_APPTRACE_DEST_JTAG, down_buf, sizeof(down_buf));
|
||||||
char *ptr = (char *)esp_apptrace_down_buffer_get(ESP_APPTRACE_DEST_TRAX, &sz, 100/*tmo in us*/);
|
if (res != ESP_OK) {
|
||||||
|
ESP_LOGE(TAG, "Failed to config down buffer!");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
char *ptr = (char *)esp_apptrace_down_buffer_get(ESP_APPTRACE_DEST_JTAG, &sz, 100/*tmo in us*/);
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
ESP_LOGE(TAG, "Failed to get buffer!");
|
ESP_LOGE(TAG, "Failed to get buffer!");
|
||||||
return ESP_FAIL;
|
return ESP_FAIL;
|
||||||
@@ -150,7 +158,7 @@ ESP-IDF 中提供了应用层跟踪功能,用于分析应用程序的行为。
|
|||||||
} else {
|
} else {
|
||||||
printf("No data");
|
printf("No data");
|
||||||
}
|
}
|
||||||
esp_err_t res = esp_apptrace_down_buffer_put(ESP_APPTRACE_DEST_TRAX, ptr, 100/*tmo in us*/);
|
res = esp_apptrace_down_buffer_put(ESP_APPTRACE_DEST_JTAG, ptr, 100/*tmo in us*/);
|
||||||
if (res != ESP_OK) {
|
if (res != ESP_OK) {
|
||||||
/* in case of error host tracing tool (e.g. OpenOCD) will report incomplete user buffer */
|
/* in case of error host tracing tool (e.g. OpenOCD) will report incomplete user buffer */
|
||||||
ESP_LOGE(TAG, "Failed to put buffer!");
|
ESP_LOGE(TAG, "Failed to put buffer!");
|
||||||
|
@@ -21,7 +21,7 @@ menu "Example Configuration"
|
|||||||
Store pcap file to SD card.
|
Store pcap file to SD card.
|
||||||
config SNIFFER_PCAP_DESTINATION_JTAG
|
config SNIFFER_PCAP_DESTINATION_JTAG
|
||||||
bool "JTAG (App Trace)"
|
bool "JTAG (App Trace)"
|
||||||
depends on APPTRACE_DEST_TRAX
|
depends on APPTRACE_DEST_JTAG
|
||||||
help
|
help
|
||||||
Store pcap file to host via JTAG interface.
|
Store pcap file to host via JTAG interface.
|
||||||
config SNIFFER_PCAP_DESTINATION_MEMORY
|
config SNIFFER_PCAP_DESTINATION_MEMORY
|
||||||
|
@@ -1,3 +1,8 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
|
*/
|
||||||
/* cmd_pcap example.
|
/* cmd_pcap example.
|
||||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||||
|
|
||||||
@@ -68,18 +73,18 @@ static pcap_cmd_runtime_t pcap_cmd_rt = {0};
|
|||||||
#if CONFIG_SNIFFER_PCAP_DESTINATION_JTAG
|
#if CONFIG_SNIFFER_PCAP_DESTINATION_JTAG
|
||||||
static int trace_writefun(void *cookie, const char *buf, int len)
|
static int trace_writefun(void *cookie, const char *buf, int len)
|
||||||
{
|
{
|
||||||
return esp_apptrace_write(ESP_APPTRACE_DEST_TRAX, buf, len, SNIFFER_PROCESS_APPTRACE_TIMEOUT_US) ==
|
return esp_apptrace_write(ESP_APPTRACE_DEST_JTAG, buf, len, SNIFFER_PROCESS_APPTRACE_TIMEOUT_US) ==
|
||||||
ESP_OK ? len : -1;
|
ESP_OK ? len : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int trace_closefun(void *cookie)
|
static int trace_closefun(void *cookie)
|
||||||
{
|
{
|
||||||
return esp_apptrace_flush(ESP_APPTRACE_DEST_TRAX, ESP_APPTRACE_TMO_INFINITE) == ESP_OK ? 0 : -1;
|
return esp_apptrace_flush(ESP_APPTRACE_DEST_JTAG, ESP_APPTRACE_TMO_INFINITE) == ESP_OK ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pcap_flush_apptrace_timer_cb(TimerHandle_t pxTimer)
|
void pcap_flush_apptrace_timer_cb(TimerHandle_t pxTimer)
|
||||||
{
|
{
|
||||||
esp_apptrace_flush(ESP_APPTRACE_DEST_TRAX, pdMS_TO_TICKS(10));
|
esp_apptrace_flush(ESP_APPTRACE_DEST_JTAG, pdMS_TO_TICKS(10));
|
||||||
}
|
}
|
||||||
#endif // CONFIG_SNIFFER_PCAP_DESTINATION_JTAG
|
#endif // CONFIG_SNIFFER_PCAP_DESTINATION_JTAG
|
||||||
|
|
||||||
@@ -151,7 +156,7 @@ esp_err_t sniff_packet_start(pcap_link_type_t link_type)
|
|||||||
#if CONFIG_SNIFFER_PCAP_DESTINATION_JTAG
|
#if CONFIG_SNIFFER_PCAP_DESTINATION_JTAG
|
||||||
uint32_t retry = 0;
|
uint32_t retry = 0;
|
||||||
/* wait until apptrace communication established or timeout */
|
/* wait until apptrace communication established or timeout */
|
||||||
while (!esp_apptrace_host_is_connected(ESP_APPTRACE_DEST_TRAX) && (retry < SNIFFER_APPTRACE_RETRY)) {
|
while (!esp_apptrace_host_is_connected(ESP_APPTRACE_DEST_JTAG) && (retry < SNIFFER_APPTRACE_RETRY)) {
|
||||||
retry++;
|
retry++;
|
||||||
ESP_LOGW(CMD_PCAP_TAG, "waiting for apptrace established");
|
ESP_LOGW(CMD_PCAP_TAG, "waiting for apptrace established");
|
||||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||||
|
Reference in New Issue
Block a user