mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-05 13:44:32 +02:00
refactor(apptrace): format apptrace component with astyle
This commit is contained in:
@@ -52,7 +52,6 @@ const static char *TAG = "esp_apptrace";
|
|||||||
|
|
||||||
static uint32_t esp_apptrace_membufs_down_buffer_write_nolock(esp_apptrace_membufs_proto_data_t *proto, uint8_t *data, uint32_t size);
|
static uint32_t esp_apptrace_membufs_down_buffer_write_nolock(esp_apptrace_membufs_proto_data_t *proto, uint8_t *data, uint32_t size);
|
||||||
|
|
||||||
|
|
||||||
esp_err_t esp_apptrace_membufs_init(esp_apptrace_membufs_proto_data_t *proto, const esp_apptrace_mem_block_t blocks_cfg[2])
|
esp_err_t esp_apptrace_membufs_init(esp_apptrace_membufs_proto_data_t *proto, const esp_apptrace_mem_block_t blocks_cfg[2])
|
||||||
{
|
{
|
||||||
// disabled by default
|
// disabled by default
|
||||||
@@ -102,12 +101,12 @@ static esp_err_t esp_apptrace_membufs_swap(esp_apptrace_membufs_proto_data_t *pr
|
|||||||
uint8_t *p = proto->blocks[new_block_num].start + proto->blocks[new_block_num].sz;
|
uint8_t *p = proto->blocks[new_block_num].start + proto->blocks[new_block_num].sz;
|
||||||
ESP_APPTRACE_LOGD("Recvd %" PRIu16 " bytes from host (@ %p) [%x %x %x %x %x %x %x %x .. %x %x %x %x %x %x %x %x]",
|
ESP_APPTRACE_LOGD("Recvd %" PRIu16 " bytes from host (@ %p) [%x %x %x %x %x %x %x %x .. %x %x %x %x %x %x %x %x]",
|
||||||
hdr->block_sz, proto->blocks[new_block_num].start,
|
hdr->block_sz, proto->blocks[new_block_num].start,
|
||||||
*(proto->blocks[new_block_num].start+0), *(proto->blocks[new_block_num].start+1),
|
*(proto->blocks[new_block_num].start + 0), *(proto->blocks[new_block_num].start + 1),
|
||||||
*(proto->blocks[new_block_num].start+2), *(proto->blocks[new_block_num].start+3),
|
*(proto->blocks[new_block_num].start + 2), *(proto->blocks[new_block_num].start + 3),
|
||||||
*(proto->blocks[new_block_num].start+4), *(proto->blocks[new_block_num].start+5),
|
*(proto->blocks[new_block_num].start + 4), *(proto->blocks[new_block_num].start + 5),
|
||||||
*(proto->blocks[new_block_num].start+6), *(proto->blocks[new_block_num].start+7),
|
*(proto->blocks[new_block_num].start + 6), *(proto->blocks[new_block_num].start + 7),
|
||||||
*(p-8), *(p-7), *(p-6), *(p-5), *(p-4), *(p-3), *(p-2), *(p-1));
|
*(p - 8), *(p - 7), *(p - 6), *(p - 5), *(p - 4), *(p - 3), *(p - 2), *(p - 1));
|
||||||
uint32_t sz = esp_apptrace_membufs_down_buffer_write_nolock(proto, (uint8_t *)(hdr+1), hdr->block_sz);
|
uint32_t sz = esp_apptrace_membufs_down_buffer_write_nolock(proto, (uint8_t *)(hdr + 1), hdr->block_sz);
|
||||||
if (sz != hdr->block_sz) {
|
if (sz != hdr->block_sz) {
|
||||||
ESP_APPTRACE_LOGE("Failed to write %" PRIu32 " bytes to down buffer (%" PRIu16 " %" PRIu32 ")!", hdr->block_sz - sz, hdr->block_sz, sz);
|
ESP_APPTRACE_LOGE("Failed to write %" PRIu32 " bytes to down buffer (%" PRIu16 " %" PRIu32 ")!", hdr->block_sz - sz, hdr->block_sz, sz);
|
||||||
}
|
}
|
||||||
@@ -129,8 +128,8 @@ static esp_err_t esp_apptrace_membufs_swap(esp_apptrace_membufs_proto_data_t *pr
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ESP_APPTRACE_LOGD("Pump %d pend bytes [%x %x %x %x : %x %x %x %x : %x %x %x %x : %x %x...%x %x]",
|
ESP_APPTRACE_LOGD("Pump %d pend bytes [%x %x %x %x : %x %x %x %x : %x %x %x %x : %x %x...%x %x]",
|
||||||
read_sz, *(ptr+0), *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4),
|
read_sz, *(ptr + 0), *(ptr + 1), *(ptr + 2), *(ptr + 3), *(ptr + 4),
|
||||||
*(ptr+5), *(ptr+6), *(ptr+7), *(ptr+8), *(ptr+9), *(ptr+10), *(ptr+11), *(ptr+12), *(ptr+13), *(ptr+read_sz-2), *(ptr+read_sz-1));
|
*(ptr + 5), *(ptr + 6), *(ptr + 7), *(ptr + 8), *(ptr + 9), *(ptr + 10), *(ptr + 11), *(ptr + 12), *(ptr + 13), *(ptr + read_sz - 2), *(ptr + read_sz - 1));
|
||||||
memcpy(proto->blocks[new_block_num].start + proto->state.markers[new_block_num], ptr, read_sz);
|
memcpy(proto->blocks[new_block_num].start + proto->state.markers[new_block_num], ptr, read_sz);
|
||||||
proto->state.markers[new_block_num] += read_sz;
|
proto->state.markers[new_block_num] += read_sz;
|
||||||
}
|
}
|
||||||
@@ -319,10 +318,10 @@ uint8_t *esp_apptrace_membufs_up_buffer_get(esp_apptrace_membufs_proto_data_t *p
|
|||||||
if (1) {
|
if (1) {
|
||||||
#endif
|
#endif
|
||||||
if (ESP_APPTRACE_INBLOCK_MARKER(proto) + ESP_APPTRACE_USR_BLOCK_RAW_SZ(size) > ESP_APPTRACE_INBLOCK(proto)->sz) {
|
if (ESP_APPTRACE_INBLOCK_MARKER(proto) + ESP_APPTRACE_USR_BLOCK_RAW_SZ(size) > ESP_APPTRACE_INBLOCK(proto)->sz) {
|
||||||
#if CONFIG_APPTRACE_PENDING_DATA_SIZE_MAX > 0
|
#if CONFIG_APPTRACE_PENDING_DATA_SIZE_MAX > 0
|
||||||
ESP_APPTRACE_LOGD("Block full. Get %" PRIu32 " bytes from PEND buffer", size);
|
ESP_APPTRACE_LOGD("Block full. Get %" PRIu32 " bytes from PEND buffer", size);
|
||||||
buf_ptr = esp_apptrace_rb_produce(&proto->rb_pend, ESP_APPTRACE_USR_BLOCK_RAW_SZ(size));
|
buf_ptr = esp_apptrace_rb_produce(&proto->rb_pend, ESP_APPTRACE_USR_BLOCK_RAW_SZ(size));
|
||||||
#endif
|
#endif
|
||||||
if (buf_ptr == NULL) {
|
if (buf_ptr == NULL) {
|
||||||
int pended_buf;
|
int pended_buf;
|
||||||
ESP_APPTRACE_LOGD(" full. Get %" PRIu32 " bytes from pend buffer", size);
|
ESP_APPTRACE_LOGD(" full. Get %" PRIu32 " bytes from pend buffer", size);
|
||||||
@@ -372,10 +371,11 @@ esp_err_t esp_apptrace_membufs_flush_nolock(esp_apptrace_membufs_proto_data_t *p
|
|||||||
ESP_APPTRACE_LOGD("Try to flush %" PRIu32 " bytes", ESP_APPTRACE_INBLOCK_MARKER(proto));
|
ESP_APPTRACE_LOGD("Try to flush %" PRIu32 " bytes", ESP_APPTRACE_INBLOCK_MARKER(proto));
|
||||||
res = esp_apptrace_membufs_swap_waitus(proto, tmo);
|
res = esp_apptrace_membufs_swap_waitus(proto, tmo);
|
||||||
if (res != ESP_OK) {
|
if (res != ESP_OK) {
|
||||||
if (res == ESP_ERR_TIMEOUT)
|
if (res == ESP_ERR_TIMEOUT) {
|
||||||
ESP_APPTRACE_LOGW("Failed to switch to another block in %" PRIi32 " us!", (int32_t)tmo->elapsed);
|
ESP_APPTRACE_LOGW("Failed to switch to another block in %" PRIi32 " us!", (int32_t)tmo->elapsed);
|
||||||
else
|
} else {
|
||||||
ESP_APPTRACE_LOGE("Failed to switch to another block, res: %d", res);
|
ESP_APPTRACE_LOGE("Failed to switch to another block, res: %d", res);
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -44,7 +44,7 @@ void esp_apptrace_log_unlock(void)
|
|||||||
|
|
||||||
esp_err_t esp_apptrace_tmo_check(esp_apptrace_tmo_t *tmo)
|
esp_err_t esp_apptrace_tmo_check(esp_apptrace_tmo_t *tmo)
|
||||||
{
|
{
|
||||||
if (tmo->tmo != (int64_t)-1) {
|
if (tmo->tmo != (int64_t) -1) {
|
||||||
tmo->elapsed = esp_timer_get_time() - tmo->start;
|
tmo->elapsed = esp_timer_get_time() - tmo->start;
|
||||||
if (tmo->elapsed >= tmo->tmo) {
|
if (tmo->elapsed >= tmo->tmo) {
|
||||||
return ESP_ERR_TIMEOUT;
|
return ESP_ERR_TIMEOUT;
|
||||||
|
@@ -180,7 +180,7 @@ int gcov_rtio_feof(void *stream)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gcov_rtio_setbuf(void *arg1 __attribute__ ((unused)), void *arg2 __attribute__ ((unused)))
|
void gcov_rtio_setbuf(void *arg1 __attribute__((unused)), void *arg2 __attribute__((unused)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@ esp_err_t heap_trace_init_tohost(void)
|
|||||||
esp_err_t heap_trace_start(heap_trace_mode_t mode_param)
|
esp_err_t heap_trace_start(heap_trace_mode_t mode_param)
|
||||||
{
|
{
|
||||||
#if CONFIG_APPTRACE_SV_ENABLE
|
#if CONFIG_APPTRACE_SV_ENABLE
|
||||||
esp_err_t ret = esp_sysview_heap_trace_start((uint32_t)-1);
|
esp_err_t ret = esp_sysview_heap_trace_start((uint32_t) -1);
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2017-2023 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
|
||||||
*/
|
*/
|
||||||
@@ -152,7 +152,7 @@ void *esp_apptrace_fopen(esp_apptrace_dest_t dest, const char *path, const char
|
|||||||
cmd_args.mode_len = strlen(mode) + 1;
|
cmd_args.mode_len = strlen(mode) + 1;
|
||||||
|
|
||||||
esp_err_t ret = esp_apptrace_file_cmd_send(dest, ESP_APPTRACE_FILE_CMD_FOPEN, esp_apptrace_fopen_args_prepare,
|
esp_err_t ret = esp_apptrace_file_cmd_send(dest, ESP_APPTRACE_FILE_CMD_FOPEN, esp_apptrace_fopen_args_prepare,
|
||||||
&cmd_args, cmd_args.path_len+cmd_args.mode_len);
|
&cmd_args, cmd_args.path_len + cmd_args.mode_len);
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
ESP_EARLY_LOGE(TAG, "Failed to send file cmd (%d)!", ret);
|
ESP_EARLY_LOGE(TAG, "Failed to send file cmd (%d)!", ret);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -211,7 +211,7 @@ size_t esp_apptrace_fwrite(esp_apptrace_dest_t dest, const void *ptr, size_t siz
|
|||||||
{
|
{
|
||||||
esp_apptrace_fwrite_args_t cmd_args;
|
esp_apptrace_fwrite_args_t cmd_args;
|
||||||
|
|
||||||
ESP_EARLY_LOGV(TAG, "esp_apptrace_fwrite f %p l %d", stream, size*nmemb);
|
ESP_EARLY_LOGV(TAG, "esp_apptrace_fwrite f %p l %d", stream, size * nmemb);
|
||||||
|
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -221,7 +221,7 @@ size_t esp_apptrace_fwrite(esp_apptrace_dest_t dest, const void *ptr, size_t siz
|
|||||||
cmd_args.size = size * nmemb;
|
cmd_args.size = size * nmemb;
|
||||||
cmd_args.file = stream;
|
cmd_args.file = stream;
|
||||||
esp_err_t ret = esp_apptrace_file_cmd_send(dest, ESP_APPTRACE_FILE_CMD_FWRITE, esp_apptrace_fwrite_args_prepare,
|
esp_err_t ret = esp_apptrace_file_cmd_send(dest, ESP_APPTRACE_FILE_CMD_FWRITE, esp_apptrace_fwrite_args_prepare,
|
||||||
&cmd_args, sizeof(cmd_args.file)+cmd_args.size);
|
&cmd_args, sizeof(cmd_args.file) + cmd_args.size);
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
ESP_EARLY_LOGE(TAG, "Failed to send file cmd (%d)!", ret);
|
ESP_EARLY_LOGE(TAG, "Failed to send file cmd (%d)!", ret);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -253,7 +253,7 @@ size_t esp_apptrace_fread(esp_apptrace_dest_t dest, void *ptr, size_t size, size
|
|||||||
{
|
{
|
||||||
esp_apptrace_fread_args_t cmd_args;
|
esp_apptrace_fread_args_t cmd_args;
|
||||||
|
|
||||||
ESP_EARLY_LOGV(TAG, "esp_apptrace_fread f %p l %d", stream, size*nmemb);
|
ESP_EARLY_LOGV(TAG, "esp_apptrace_fread f %p l %d", stream, size * nmemb);
|
||||||
|
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -288,7 +288,7 @@ size_t esp_apptrace_fread(esp_apptrace_dest_t dest, void *ptr, size_t size, size
|
|||||||
* fread(buf, 1 ,size, file);
|
* fread(buf, 1 ,size, file);
|
||||||
* So, total read bytes count returns
|
* So, total read bytes count returns
|
||||||
*/
|
*/
|
||||||
return resp/size; // return the number of items read
|
return resp / size; // return the number of items read
|
||||||
}
|
}
|
||||||
|
|
||||||
static void esp_apptrace_fseek_args_prepare(uint8_t *buf, void *priv)
|
static void esp_apptrace_fseek_args_prepare(uint8_t *buf, void *priv)
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2017-2023 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
|
||||||
*/
|
*/
|
||||||
@@ -21,7 +21,7 @@ typedef enum {
|
|||||||
ESP_APPTRACE_DEST_JTAG = 1, ///< JTAG destination
|
ESP_APPTRACE_DEST_JTAG = 1, ///< JTAG destination
|
||||||
ESP_APPTRACE_DEST_TRAX = ESP_APPTRACE_DEST_JTAG, ///< xxx_TRAX name is obsolete, use more common xxx_JTAG
|
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_UART+1,
|
ESP_APPTRACE_DEST_MAX = ESP_APPTRACE_DEST_UART + 1,
|
||||||
ESP_APPTRACE_DEST_NUM
|
ESP_APPTRACE_DEST_NUM
|
||||||
} esp_apptrace_dest_t;
|
} esp_apptrace_dest_t;
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2017-2021 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
|
||||||
*/
|
*/
|
||||||
@@ -32,12 +32,12 @@ typedef struct {
|
|||||||
* @brief Initializes timeout structure.
|
* @brief Initializes timeout structure.
|
||||||
*
|
*
|
||||||
* @param tmo Pointer to timeout structure to be initialized.
|
* @param tmo Pointer to timeout structure to be initialized.
|
||||||
* @param user_tmo Timeout value (in us). Use ESP_APPTRACE_TMO_INFINITE to wait indefinetly.
|
* @param user_tmo Timeout value (in us). Use ESP_APPTRACE_TMO_INFINITE to wait indefinitely.
|
||||||
*/
|
*/
|
||||||
static inline void esp_apptrace_tmo_init(esp_apptrace_tmo_t *tmo, uint32_t user_tmo)
|
static inline void esp_apptrace_tmo_init(esp_apptrace_tmo_t *tmo, uint32_t user_tmo)
|
||||||
{
|
{
|
||||||
tmo->start = esp_timer_get_time();
|
tmo->start = esp_timer_get_time();
|
||||||
tmo->tmo = user_tmo == ESP_APPTRACE_TMO_INFINITE ? (int64_t)-1 : (int64_t)user_tmo;
|
tmo->tmo = user_tmo == ESP_APPTRACE_TMO_INFINITE ? (int64_t) -1 : (int64_t)user_tmo;
|
||||||
tmo->elapsed = 0;
|
tmo->elapsed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ esp_err_t esp_apptrace_tmo_check(esp_apptrace_tmo_t *tmo);
|
|||||||
|
|
||||||
static inline uint32_t esp_apptrace_tmo_remaining_us(esp_apptrace_tmo_t *tmo)
|
static inline uint32_t esp_apptrace_tmo_remaining_us(esp_apptrace_tmo_t *tmo)
|
||||||
{
|
{
|
||||||
return tmo->tmo != (int64_t)-1 ? (tmo->elapsed - tmo->tmo) : ESP_APPTRACE_TMO_INFINITE;
|
return tmo->tmo != (int64_t) -1 ? (tmo->elapsed - tmo->tmo) : ESP_APPTRACE_TMO_INFINITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Tracing module synchronization lock */
|
/** Tracing module synchronization lock */
|
||||||
@@ -94,7 +94,7 @@ esp_err_t esp_apptrace_lock_give(esp_apptrace_lock_t *lock);
|
|||||||
/** Ring buffer control structure.
|
/** Ring buffer control structure.
|
||||||
*
|
*
|
||||||
* @note For purposes of application tracing module if there is no enough space for user data and write pointer can be wrapped
|
* @note For purposes of application tracing module if there is no enough space for user data and write pointer can be wrapped
|
||||||
* current ring buffer size can be temporarily shrinked in order to provide buffer with requested size.
|
* current ring buffer size can be temporarily shrunk in order to provide buffer with requested size.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t *data; ///< pointer to data storage
|
uint8_t *data; ///< pointer to data storage
|
||||||
|
@@ -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
|
||||||
*/
|
*/
|
||||||
@@ -14,7 +14,6 @@
|
|||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
|
|
||||||
|
|
||||||
#define APPTRACE_DEST_UART (CONFIG_APPTRACE_DEST_UART0 | CONFIG_APPTRACE_DEST_UART1 | CONFIG_APPTRACE_DEST_UART2)
|
#define APPTRACE_DEST_UART (CONFIG_APPTRACE_DEST_UART0 | CONFIG_APPTRACE_DEST_UART1 | CONFIG_APPTRACE_DEST_UART2)
|
||||||
|
|
||||||
#define APP_TRACE_MAX_TX_BUFF_UART CONFIG_APPTRACE_UART_TX_BUFF_SIZE
|
#define APP_TRACE_MAX_TX_BUFF_UART CONFIG_APPTRACE_UART_TX_BUFF_SIZE
|
||||||
@@ -59,7 +58,7 @@ const static char *TAG = "esp_apptrace_uart";
|
|||||||
|
|
||||||
esp_apptrace_hw_t *esp_apptrace_uart_hw_get(int num, void **data)
|
esp_apptrace_hw_t *esp_apptrace_uart_hw_get(int num, void **data)
|
||||||
{
|
{
|
||||||
ESP_LOGD(TAG,"esp_apptrace_uart_hw_get - %i", num);
|
ESP_LOGD(TAG, "esp_apptrace_uart_hw_get - %i", num);
|
||||||
#if APPTRACE_DEST_UART
|
#if APPTRACE_DEST_UART
|
||||||
static esp_apptrace_uart_data_t s_uart_hw_data = {
|
static esp_apptrace_uart_data_t s_uart_hw_data = {
|
||||||
};
|
};
|
||||||
@@ -69,7 +68,7 @@ esp_apptrace_hw_t *esp_apptrace_uart_hw_get(int num, void **data)
|
|||||||
.put_up_buffer = (esp_err_t (*)(void *, uint8_t *, esp_apptrace_tmo_t *))esp_apptrace_uart_up_buffer_put,
|
.put_up_buffer = (esp_err_t (*)(void *, uint8_t *, esp_apptrace_tmo_t *))esp_apptrace_uart_up_buffer_put,
|
||||||
.flush_up_buffer_nolock = (esp_err_t (*)(void *, uint32_t, esp_apptrace_tmo_t *))esp_apptrace_uart_flush_nolock,
|
.flush_up_buffer_nolock = (esp_err_t (*)(void *, uint32_t, esp_apptrace_tmo_t *))esp_apptrace_uart_flush_nolock,
|
||||||
.flush_up_buffer = (esp_err_t (*)(void *, esp_apptrace_tmo_t *))esp_apptrace_uart_flush,
|
.flush_up_buffer = (esp_err_t (*)(void *, esp_apptrace_tmo_t *))esp_apptrace_uart_flush,
|
||||||
.down_buffer_config = (void (*)(void *, uint8_t *, uint32_t ))esp_apptrace_uart_down_buffer_config,
|
.down_buffer_config = (void (*)(void *, uint8_t *, uint32_t))esp_apptrace_uart_down_buffer_config,
|
||||||
.get_down_buffer = (uint8_t *(*)(void *, uint32_t *, esp_apptrace_tmo_t *))esp_apptrace_uart_down_buffer_get,
|
.get_down_buffer = (uint8_t *(*)(void *, uint32_t *, esp_apptrace_tmo_t *))esp_apptrace_uart_down_buffer_get,
|
||||||
.put_down_buffer = (esp_err_t (*)(void *, uint8_t *, esp_apptrace_tmo_t *))esp_apptrace_uart_down_buffer_put,
|
.put_down_buffer = (esp_err_t (*)(void *, uint8_t *, esp_apptrace_tmo_t *))esp_apptrace_uart_down_buffer_put,
|
||||||
.host_is_connected = (bool (*)(void *))esp_apptrace_uart_host_is_connected,
|
.host_is_connected = (bool (*)(void *))esp_apptrace_uart_host_is_connected,
|
||||||
@@ -109,7 +108,6 @@ static inline void esp_apptrace_uart_hw_init(void)
|
|||||||
ESP_APPTRACE_LOGI("Initialized UART on CPU%d", esp_cpu_get_core_id());
|
ESP_APPTRACE_LOGI("Initialized UART on CPU%d", esp_cpu_get_core_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
/***************************** Apptrace HW iface *****************************************/
|
/***************************** Apptrace HW iface *****************************************/
|
||||||
/*****************************************************************************************/
|
/*****************************************************************************************/
|
||||||
@@ -128,9 +126,8 @@ static esp_err_t esp_apptrace_send_uart_data(esp_apptrace_uart_data_t *hw_data,
|
|||||||
len_free = out_position - hw_data->tx_data_buff_in;
|
len_free = out_position - hw_data->tx_data_buff_in;
|
||||||
}
|
}
|
||||||
int check_len = APP_TRACE_MAX_TX_BUFF_UART - hw_data->tx_data_buff_in;
|
int check_len = APP_TRACE_MAX_TX_BUFF_UART - hw_data->tx_data_buff_in;
|
||||||
if (size <= len_free)
|
if (size <= len_free) {
|
||||||
{
|
if (check_len >= size) {
|
||||||
if ( check_len >= size) {
|
|
||||||
memcpy(&hw_data->tx_data_buff[hw_data->tx_data_buff_in], data, size);
|
memcpy(&hw_data->tx_data_buff[hw_data->tx_data_buff_in], data, size);
|
||||||
hw_data->tx_data_buff_in += size;
|
hw_data->tx_data_buff_in += size;
|
||||||
} else {
|
} else {
|
||||||
@@ -183,13 +180,11 @@ static void esp_apptrace_send_uart_tx_task(void *arg)
|
|||||||
while (1) {
|
while (1) {
|
||||||
send_buff_data(hw_data, &tmo);
|
send_buff_data(hw_data, &tmo);
|
||||||
vTaskDelay(10);
|
vTaskDelay(10);
|
||||||
if (hw_data->circular_buff_overflow == true)
|
if (hw_data->circular_buff_overflow == true) {
|
||||||
{
|
|
||||||
hw_data->circular_buff_overflow = false;
|
hw_data->circular_buff_overflow = false;
|
||||||
ESP_LOGE(TAG, "Buffer overflow. Please increase UART baudrate, or increase UART TX ring buffer size in menuconfig.");
|
ESP_LOGE(TAG, "Buffer overflow. Please increase UART baudrate, or increase UART TX ring buffer size in menuconfig.");
|
||||||
}
|
}
|
||||||
if (hw_data->message_buff_overflow == true)
|
if (hw_data->message_buff_overflow == true) {
|
||||||
{
|
|
||||||
hw_data->message_buff_overflow = false;
|
hw_data->message_buff_overflow = false;
|
||||||
ESP_LOGE(TAG, "Message size more then message buffer!");
|
ESP_LOGE(TAG, "Message size more then message buffer!");
|
||||||
}
|
}
|
||||||
@@ -202,15 +197,14 @@ static esp_err_t esp_apptrace_uart_init(esp_apptrace_uart_data_t *hw_data)
|
|||||||
{
|
{
|
||||||
int core_id = esp_cpu_get_core_id();
|
int core_id = esp_cpu_get_core_id();
|
||||||
if (core_id == 0) {
|
if (core_id == 0) {
|
||||||
hw_data->tx_data_buff = (uint8_t *)heap_caps_malloc(APP_TRACE_MAX_TX_BUFF_UART, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
|
hw_data->tx_data_buff = (uint8_t *)heap_caps_malloc(APP_TRACE_MAX_TX_BUFF_UART, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
||||||
if (hw_data->tx_data_buff == NULL){
|
if (hw_data->tx_data_buff == NULL) {
|
||||||
return ESP_ERR_NO_MEM;
|
return ESP_ERR_NO_MEM;
|
||||||
}
|
}
|
||||||
hw_data->tx_data_buff_in = 0;
|
hw_data->tx_data_buff_in = 0;
|
||||||
hw_data->tx_data_buff_out = 0;
|
hw_data->tx_data_buff_out = 0;
|
||||||
hw_data->tx_msg_buff = (uint8_t *)heap_caps_malloc(APP_TRACE_MAX_TX_MSG_UART, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
|
hw_data->tx_msg_buff = (uint8_t *)heap_caps_malloc(APP_TRACE_MAX_TX_MSG_UART, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
|
||||||
if (hw_data->tx_msg_buff == NULL)
|
if (hw_data->tx_msg_buff == NULL) {
|
||||||
{
|
|
||||||
return ESP_ERR_NO_MEM;
|
return ESP_ERR_NO_MEM;
|
||||||
}
|
}
|
||||||
hw_data->tx_msg_buff_size = 0;
|
hw_data->tx_msg_buff_size = 0;
|
||||||
@@ -222,8 +216,9 @@ static esp_err_t esp_apptrace_uart_init(esp_apptrace_uart_data_t *hw_data)
|
|||||||
|
|
||||||
int source_clk = UART_SCLK_DEFAULT;
|
int source_clk = UART_SCLK_DEFAULT;
|
||||||
#if SOC_UART_LP_NUM > 0
|
#if SOC_UART_LP_NUM > 0
|
||||||
if (hw_data->port_num >= SOC_UART_HP_NUM)
|
if (hw_data->port_num >= SOC_UART_HP_NUM) {
|
||||||
source_clk = LP_UART_SCLK_DEFAULT;
|
source_clk = LP_UART_SCLK_DEFAULT;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const uart_config_t uart_config = {
|
const uart_config_t uart_config = {
|
||||||
@@ -244,7 +239,9 @@ static esp_err_t esp_apptrace_uart_init(esp_apptrace_uart_data_t *hw_data)
|
|||||||
assert((err == ESP_OK) && "Not possible to configure UART RX/TX pins. Please check and change menuconfig parameters!");
|
assert((err == ESP_OK) && "Not possible to configure UART RX/TX pins. Please check and change menuconfig parameters!");
|
||||||
|
|
||||||
int uart_prio = CONFIG_APPTRACE_UART_TASK_PRIO;
|
int uart_prio = CONFIG_APPTRACE_UART_TASK_PRIO;
|
||||||
if (uart_prio >= (configMAX_PRIORITIES-1)) uart_prio = configMAX_PRIORITIES - 1;
|
if (uart_prio >= (configMAX_PRIORITIES - 1)) {
|
||||||
|
uart_prio = configMAX_PRIORITIES - 1;
|
||||||
|
}
|
||||||
err = xTaskCreate(esp_apptrace_send_uart_tx_task, "app_trace_uart_tx_task", 2500, hw_data, uart_prio, NULL);
|
err = xTaskCreate(esp_apptrace_send_uart_tx_task, "app_trace_uart_tx_task", 2500, hw_data, uart_prio, NULL);
|
||||||
assert((err == pdPASS) && "Not possible to configure UART. Not possible to create task!");
|
assert((err == pdPASS) && "Not possible to configure UART. Not possible to create task!");
|
||||||
|
|
||||||
@@ -266,8 +263,7 @@ static uint8_t *esp_apptrace_uart_up_buffer_get(esp_apptrace_uart_data_t *hw_dat
|
|||||||
hw_data->message_buff_overflow = true;
|
hw_data->message_buff_overflow = true;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (hw_data->tx_msg_buff_size != 0)
|
if (hw_data->tx_msg_buff_size != 0) {
|
||||||
{
|
|
||||||
// A previous message was not sent.
|
// A previous message was not sent.
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -296,7 +292,7 @@ static esp_err_t esp_apptrace_uart_up_buffer_put(esp_apptrace_uart_data_t *hw_da
|
|||||||
static void esp_apptrace_uart_down_buffer_config(esp_apptrace_uart_data_t *hw_data, uint8_t *buf, uint32_t size)
|
static void esp_apptrace_uart_down_buffer_config(esp_apptrace_uart_data_t *hw_data, uint8_t *buf, uint32_t size)
|
||||||
{
|
{
|
||||||
hw_data->down_buffer = (uint8_t *)malloc(size);
|
hw_data->down_buffer = (uint8_t *)malloc(size);
|
||||||
if (hw_data->down_buffer == NULL){
|
if (hw_data->down_buffer == NULL) {
|
||||||
assert(false && "Failed to allocate apptrace uart down buffer!");
|
assert(false && "Failed to allocate apptrace uart down buffer!");
|
||||||
}
|
}
|
||||||
hw_data->down_buffer_size = size;
|
hw_data->down_buffer_size = size;
|
||||||
@@ -323,7 +319,7 @@ static uint8_t *esp_apptrace_uart_down_buffer_get(esp_apptrace_uart_data_t *hw_d
|
|||||||
}
|
}
|
||||||
*size = uart_fifolen;
|
*size = uart_fifolen;
|
||||||
ptr = hw_data->down_buffer;
|
ptr = hw_data->down_buffer;
|
||||||
*size =uart_read_bytes(hw_data->port_num, ptr, uart_fifolen, 0);
|
*size = uart_read_bytes(hw_data->port_num, ptr, uart_fifolen, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (esp_apptrace_uart_unlock(hw_data) != ESP_OK) {
|
if (esp_apptrace_uart_unlock(hw_data) != ESP_OK) {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||||
*/
|
*/
|
||||||
@@ -54,7 +54,6 @@ static esp_err_t esp_apptrace_riscv_buffer_swap(uint32_t new_block_id, uint32_t
|
|||||||
static esp_err_t esp_apptrace_riscv_buffer_swap_end(uint32_t new_block_id, uint32_t prev_block_len);
|
static esp_err_t esp_apptrace_riscv_buffer_swap_end(uint32_t new_block_id, uint32_t prev_block_len);
|
||||||
static bool esp_apptrace_riscv_host_data_pending(void);
|
static bool esp_apptrace_riscv_host_data_pending(void);
|
||||||
|
|
||||||
|
|
||||||
const static char *TAG = "esp_apptrace";
|
const static char *TAG = "esp_apptrace";
|
||||||
|
|
||||||
#if SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE
|
#if SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE
|
||||||
@@ -85,7 +84,7 @@ esp_apptrace_hw_t *esp_apptrace_jtag_hw_get(void **data)
|
|||||||
.put_up_buffer = (esp_err_t (*)(void *, uint8_t *, esp_apptrace_tmo_t *))esp_apptrace_riscv_up_buffer_put,
|
.put_up_buffer = (esp_err_t (*)(void *, uint8_t *, esp_apptrace_tmo_t *))esp_apptrace_riscv_up_buffer_put,
|
||||||
.flush_up_buffer_nolock = (esp_err_t (*)(void *, uint32_t, esp_apptrace_tmo_t *))esp_apptrace_riscv_flush_nolock,
|
.flush_up_buffer_nolock = (esp_err_t (*)(void *, uint32_t, esp_apptrace_tmo_t *))esp_apptrace_riscv_flush_nolock,
|
||||||
.flush_up_buffer = (esp_err_t (*)(void *, esp_apptrace_tmo_t *))esp_apptrace_riscv_flush,
|
.flush_up_buffer = (esp_err_t (*)(void *, esp_apptrace_tmo_t *))esp_apptrace_riscv_flush,
|
||||||
.down_buffer_config = (void (*)(void *, uint8_t *, uint32_t ))esp_apptrace_riscv_down_buffer_config,
|
.down_buffer_config = (void (*)(void *, uint8_t *, uint32_t))esp_apptrace_riscv_down_buffer_config,
|
||||||
.get_down_buffer = (uint8_t *(*)(void *, uint32_t *, esp_apptrace_tmo_t *))esp_apptrace_riscv_down_buffer_get,
|
.get_down_buffer = (uint8_t *(*)(void *, uint32_t *, esp_apptrace_tmo_t *))esp_apptrace_riscv_down_buffer_get,
|
||||||
.put_down_buffer = (esp_err_t (*)(void *, uint8_t *, esp_apptrace_tmo_t *))esp_apptrace_riscv_down_buffer_put,
|
.put_down_buffer = (esp_err_t (*)(void *, uint8_t *, esp_apptrace_tmo_t *))esp_apptrace_riscv_down_buffer_put,
|
||||||
.host_is_connected = (bool (*)(void *))esp_apptrace_riscv_host_is_connected,
|
.host_is_connected = (bool (*)(void *))esp_apptrace_riscv_host_is_connected,
|
||||||
@@ -314,7 +313,7 @@ static __attribute__((noinline)) void esp_apptrace_riscv_buffer_swap_unlock(void
|
|||||||
s_tracing_ctrl[esp_cpu_get_core_id()].stat = 0;
|
s_tracing_ctrl[esp_cpu_get_core_id()].stat = 0;
|
||||||
// TODO: currently host sets breakpoint, use break instruction to stop;
|
// TODO: currently host sets breakpoint, use break instruction to stop;
|
||||||
// it will allow to use ESP_APPTRACE_RISCV_STAT_REG for other purposes
|
// it will allow to use ESP_APPTRACE_RISCV_STAT_REG for other purposes
|
||||||
asm volatile (
|
asm volatile(
|
||||||
" .global __esp_apptrace_riscv_updated\n"
|
" .global __esp_apptrace_riscv_updated\n"
|
||||||
"__esp_apptrace_riscv_updated:\n"); // host will set bp here to resolve collision at streaming start
|
"__esp_apptrace_riscv_updated:\n"); // host will set bp here to resolve collision at streaming start
|
||||||
}
|
}
|
||||||
|
@@ -197,7 +197,6 @@ typedef struct {
|
|||||||
esp_apptrace_membufs_proto_data_t membufs;
|
esp_apptrace_membufs_proto_data_t membufs;
|
||||||
} esp_apptrace_trax_data_t;
|
} esp_apptrace_trax_data_t;
|
||||||
|
|
||||||
|
|
||||||
static esp_err_t esp_apptrace_trax_init(esp_apptrace_trax_data_t *hw_data);
|
static esp_err_t esp_apptrace_trax_init(esp_apptrace_trax_data_t *hw_data);
|
||||||
static esp_err_t esp_apptrace_trax_flush(esp_apptrace_trax_data_t *hw_data, esp_apptrace_tmo_t *tmo);
|
static esp_err_t esp_apptrace_trax_flush(esp_apptrace_trax_data_t *hw_data, esp_apptrace_tmo_t *tmo);
|
||||||
static esp_err_t esp_apptrace_trax_flush_nolock(esp_apptrace_trax_data_t *hw_data, uint32_t min_sz, esp_apptrace_tmo_t *tmo);
|
static esp_err_t esp_apptrace_trax_flush_nolock(esp_apptrace_trax_data_t *hw_data, uint32_t min_sz, esp_apptrace_tmo_t *tmo);
|
||||||
@@ -212,7 +211,6 @@ static esp_err_t esp_apptrace_trax_buffer_swap(uint32_t new_block_id, uint32_t p
|
|||||||
static esp_err_t esp_apptrace_trax_buffer_swap_end(uint32_t new_block_id, uint32_t prev_block_len);
|
static esp_err_t esp_apptrace_trax_buffer_swap_end(uint32_t new_block_id, uint32_t prev_block_len);
|
||||||
static bool esp_apptrace_trax_host_data_pending(void);
|
static bool esp_apptrace_trax_host_data_pending(void);
|
||||||
|
|
||||||
|
|
||||||
const static char *TAG = "esp_apptrace";
|
const static char *TAG = "esp_apptrace";
|
||||||
|
|
||||||
static uint8_t * const s_trax_blocks[] = {
|
static uint8_t * const s_trax_blocks[] = {
|
||||||
@@ -240,7 +238,7 @@ esp_apptrace_hw_t *esp_apptrace_jtag_hw_get(void **data)
|
|||||||
.put_up_buffer = (esp_err_t (*)(void *, uint8_t *, esp_apptrace_tmo_t *))esp_apptrace_trax_up_buffer_put,
|
.put_up_buffer = (esp_err_t (*)(void *, uint8_t *, esp_apptrace_tmo_t *))esp_apptrace_trax_up_buffer_put,
|
||||||
.flush_up_buffer_nolock = (esp_err_t (*)(void *, uint32_t, esp_apptrace_tmo_t *))esp_apptrace_trax_flush_nolock,
|
.flush_up_buffer_nolock = (esp_err_t (*)(void *, uint32_t, esp_apptrace_tmo_t *))esp_apptrace_trax_flush_nolock,
|
||||||
.flush_up_buffer = (esp_err_t (*)(void *, esp_apptrace_tmo_t *))esp_apptrace_trax_flush,
|
.flush_up_buffer = (esp_err_t (*)(void *, esp_apptrace_tmo_t *))esp_apptrace_trax_flush,
|
||||||
.down_buffer_config = (void (*)(void *, uint8_t *, uint32_t ))esp_apptrace_trax_down_buffer_config,
|
.down_buffer_config = (void (*)(void *, uint8_t *, uint32_t))esp_apptrace_trax_down_buffer_config,
|
||||||
.get_down_buffer = (uint8_t *(*)(void *, uint32_t *, esp_apptrace_tmo_t *))esp_apptrace_trax_down_buffer_get,
|
.get_down_buffer = (uint8_t *(*)(void *, uint32_t *, esp_apptrace_tmo_t *))esp_apptrace_trax_down_buffer_get,
|
||||||
.put_down_buffer = (esp_err_t (*)(void *, uint8_t *, esp_apptrace_tmo_t *))esp_apptrace_trax_down_buffer_put,
|
.put_down_buffer = (esp_err_t (*)(void *, uint8_t *, esp_apptrace_tmo_t *))esp_apptrace_trax_down_buffer_put,
|
||||||
.host_is_connected = (bool (*)(void *))esp_apptrace_trax_host_is_connected,
|
.host_is_connected = (bool (*)(void *))esp_apptrace_trax_host_is_connected,
|
||||||
@@ -291,7 +289,7 @@ static inline void esp_apptrace_trax_select_memory_block(int block_num)
|
|||||||
#if CONFIG_IDF_TARGET_ESP32
|
#if CONFIG_IDF_TARGET_ESP32
|
||||||
DPORT_WRITE_PERI_REG(DPORT_TRACEMEM_MUX_MODE_REG, block_num ? TRACEMEM_MUX_BLK0_ONLY : TRACEMEM_MUX_BLK1_ONLY);
|
DPORT_WRITE_PERI_REG(DPORT_TRACEMEM_MUX_MODE_REG, block_num ? TRACEMEM_MUX_BLK0_ONLY : TRACEMEM_MUX_BLK1_ONLY);
|
||||||
#elif CONFIG_IDF_TARGET_ESP32S2
|
#elif CONFIG_IDF_TARGET_ESP32S2
|
||||||
WRITE_PERI_REG(DPORT_PMS_OCCUPY_3_REG, block_num ? BIT(TRACEMEM_MUX_BLK0_NUM-4) : BIT(TRACEMEM_MUX_BLK1_NUM-4));
|
WRITE_PERI_REG(DPORT_PMS_OCCUPY_3_REG, block_num ? BIT(TRACEMEM_MUX_BLK0_NUM - 4) : BIT(TRACEMEM_MUX_BLK1_NUM - 4));
|
||||||
#elif CONFIG_IDF_TARGET_ESP32S3
|
#elif CONFIG_IDF_TARGET_ESP32S3
|
||||||
// select memory block to be exposed to the TRAX module (accessed by host)
|
// select memory block to be exposed to the TRAX module (accessed by host)
|
||||||
uint32_t block_bits = block_num ? TRACEMEM_CORE0_MUX_BLK_BITS(TRACEMEM_MUX_BLK0_NUM)
|
uint32_t block_bits = block_num ? TRACEMEM_CORE0_MUX_BLK_BITS(TRACEMEM_MUX_BLK0_NUM)
|
||||||
@@ -491,7 +489,7 @@ static __attribute__((noinline)) void esp_apptrace_trax_buffer_swap_unlock(void)
|
|||||||
eri_write(ESP_APPTRACE_TRAX_STAT_REG, 0x0);
|
eri_write(ESP_APPTRACE_TRAX_STAT_REG, 0x0);
|
||||||
// TODO: currently host sets breakpoint, use break instruction to stop;
|
// TODO: currently host sets breakpoint, use break instruction to stop;
|
||||||
// it will allow to use ESP_APPTRACE_TRAX_STAT_REG for other purposes
|
// it will allow to use ESP_APPTRACE_TRAX_STAT_REG for other purposes
|
||||||
asm volatile (
|
asm volatile(
|
||||||
" .global __esp_apptrace_trax_eri_updated\n"
|
" .global __esp_apptrace_trax_eri_updated\n"
|
||||||
"__esp_apptrace_trax_eri_updated:\n"); // host will set bp here to resolve collision at streaming start
|
"__esp_apptrace_trax_eri_updated:\n"); // host will set bp here to resolve collision at streaming start
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2017-2021 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
|
||||||
*/
|
*/
|
||||||
@@ -61,7 +61,7 @@ static uint8_t s_down_buf[SYSVIEW_DOWN_BUF_SIZE];
|
|||||||
*
|
*
|
||||||
* 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. TRAX destinations only.
|
||||||
* tmo Timeout for operation (in us). Use ESP_APPTRACE_TMO_INFINITE to wait indefinetly.
|
* tmo Timeout for operation (in us). Use ESP_APPTRACE_TMO_INFINITE to wait indefinitely.
|
||||||
*
|
*
|
||||||
* Return value
|
* Return value
|
||||||
* None.
|
* None.
|
||||||
@@ -92,7 +92,7 @@ void SEGGER_RTT_ESP_FlushNoLock(unsigned long min_sz, unsigned long tmo)
|
|||||||
*
|
*
|
||||||
* 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. TRAX destinations only.
|
||||||
* tmo Timeout for operation (in us). Use ESP_APPTRACE_TMO_INFINITE to wait indefinetly.
|
* tmo Timeout for operation (in us). Use ESP_APPTRACE_TMO_INFINITE to wait indefinitely.
|
||||||
*
|
*
|
||||||
* Return value
|
* Return value
|
||||||
* None.
|
* None.
|
||||||
@@ -121,7 +121,8 @@ void SEGGER_RTT_ESP_Flush(unsigned long min_sz, unsigned long tmo)
|
|||||||
* Return value
|
* Return value
|
||||||
* Number of bytes that have been read.
|
* Number of bytes that have been read.
|
||||||
*/
|
*/
|
||||||
unsigned SEGGER_RTT_ReadNoLock(unsigned BufferIndex, void* pData, unsigned BufferSize) {
|
unsigned SEGGER_RTT_ReadNoLock(unsigned BufferIndex, void* pData, unsigned BufferSize)
|
||||||
|
{
|
||||||
uint32_t size = BufferSize;
|
uint32_t size = BufferSize;
|
||||||
esp_err_t res = esp_apptrace_read(ESP_APPTRACE_DEST_SYSVIEW, pData, &size, 0);
|
esp_err_t res = esp_apptrace_read(ESP_APPTRACE_DEST_SYSVIEW, pData, &size, 0);
|
||||||
if (res != ESP_OK) {
|
if (res != ESP_OK) {
|
||||||
@@ -154,7 +155,8 @@ unsigned SEGGER_RTT_ReadNoLock(unsigned BufferIndex, void* pData, unsigned Buffe
|
|||||||
* and may only be called after RTT has been initialized.
|
* and may only be called after RTT has been initialized.
|
||||||
* Either by calling SEGGER_RTT_Init() or calling another RTT API function first.
|
* Either by calling SEGGER_RTT_Init() or calling another RTT API function first.
|
||||||
*/
|
*/
|
||||||
unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes) {
|
unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes)
|
||||||
|
{
|
||||||
uint8_t *pbuf = (uint8_t *)pBuffer;
|
uint8_t *pbuf = (uint8_t *)pBuffer;
|
||||||
uint8_t event_id = *pbuf;
|
uint8_t event_id = *pbuf;
|
||||||
#if CONFIG_APPTRACE_SV_DEST_UART
|
#if CONFIG_APPTRACE_SV_DEST_UART
|
||||||
@@ -174,13 +176,13 @@ unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pBuffer, u
|
|||||||
(event_id == SYSVIEW_EVTID_STACK_INFO) ||
|
(event_id == SYSVIEW_EVTID_STACK_INFO) ||
|
||||||
(event_id == SYSVIEW_EVTID_MODULEDESC)
|
(event_id == SYSVIEW_EVTID_MODULEDESC)
|
||||||
)
|
)
|
||||||
){
|
) {
|
||||||
return NumBytes;
|
return NumBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is workaround for SystemView!
|
// This is workaround for SystemView!
|
||||||
// Without this line SystemView will hangs on when heap tracing enabled.
|
// Without this line SystemView will hangs on when heap tracing enabled.
|
||||||
if(event_id == SYSVIEW_EVTID_MODULEDESC){
|
if (event_id == SYSVIEW_EVTID_MODULEDESC) {
|
||||||
return NumBytes;
|
return NumBytes;
|
||||||
}
|
}
|
||||||
#endif // CONFIG_APPTRACE_SV_DEST_UART
|
#endif // CONFIG_APPTRACE_SV_DEST_UART
|
||||||
@@ -216,15 +218,13 @@ unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pBuffer, u
|
|||||||
|
|
||||||
#if CONFIG_APPTRACE_SV_DEST_UART
|
#if CONFIG_APPTRACE_SV_DEST_UART
|
||||||
esp_err_t res = esp_apptrace_write(ESP_APPTRACE_DEST_SYSVIEW, pBuffer, NumBytes, SEGGER_HOST_WAIT_TMO);
|
esp_err_t res = esp_apptrace_write(ESP_APPTRACE_DEST_SYSVIEW, pBuffer, NumBytes, SEGGER_HOST_WAIT_TMO);
|
||||||
if (res != ESP_OK)
|
if (res != ESP_OK) {
|
||||||
{
|
|
||||||
return 0; // skip current data buffer only, accumulated events are kept
|
return 0; // skip current data buffer only, accumulated events are kept
|
||||||
}
|
}
|
||||||
s_events_buf_filled = 0;
|
s_events_buf_filled = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (event_id == SYSVIEW_EVTID_TRACE_STOP)
|
if (event_id == SYSVIEW_EVTID_TRACE_STOP) {
|
||||||
{
|
|
||||||
SEGGER_RTT_ESP_FlushNoLock(0, SEGGER_STOP_WAIT_TMO);
|
SEGGER_RTT_ESP_FlushNoLock(0, SEGGER_STOP_WAIT_TMO);
|
||||||
}
|
}
|
||||||
return NumBytes;
|
return NumBytes;
|
||||||
@@ -255,7 +255,8 @@ unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pBuffer, u
|
|||||||
* May only be called once per buffer.
|
* May only be called once per buffer.
|
||||||
* Buffer name and flags can be reconfigured using the appropriate functions.
|
* 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) {
|
int SEGGER_RTT_ConfigUpBuffer(unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags)
|
||||||
|
{
|
||||||
s_events_buf_filled = 0;
|
s_events_buf_filled = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -285,7 +286,8 @@ int SEGGER_RTT_ConfigUpBuffer(unsigned BufferIndex, const char* sName, void* pBu
|
|||||||
* May only be called once per buffer.
|
* May only be called once per buffer.
|
||||||
* Buffer name and flags can be reconfigured using the appropriate functions.
|
* 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) {
|
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));
|
esp_apptrace_down_buffer_config(s_down_buf, sizeof(s_down_buf));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -302,5 +304,4 @@ ESP_SYSTEM_INIT_FN(sysview_init, SECONDARY, BIT(0), 120)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************** End of file ****************************/
|
/*************************** End of file ****************************/
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2018-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -27,14 +27,13 @@ static SEGGER_SYSVIEW_MODULE s_esp_sysview_heap_module = {
|
|||||||
|
|
||||||
static bool s_mod_registered;
|
static bool s_mod_registered;
|
||||||
|
|
||||||
|
|
||||||
esp_err_t esp_sysview_heap_trace_start(uint32_t tmo)
|
esp_err_t esp_sysview_heap_trace_start(uint32_t tmo)
|
||||||
{
|
{
|
||||||
uint32_t tmo_ticks = tmo/(1000*portTICK_PERIOD_MS);
|
uint32_t tmo_ticks = tmo / (1000 * portTICK_PERIOD_MS);
|
||||||
|
|
||||||
ESP_EARLY_LOGV(TAG, "%s", __func__);
|
ESP_EARLY_LOGV(TAG, "%s", __func__);
|
||||||
do {
|
do {
|
||||||
if (tmo != (uint32_t)-1) {
|
if (tmo != (uint32_t) -1) {
|
||||||
// Currently timeout implementation is simple and has granularity of 1 OS tick,
|
// Currently timeout implementation is simple and has granularity of 1 OS tick,
|
||||||
// so just count down the number of times to call vTaskDelay
|
// so just count down the number of times to call vTaskDelay
|
||||||
if (tmo_ticks-- == 0) {
|
if (tmo_ticks-- == 0) {
|
||||||
@@ -42,7 +41,7 @@ esp_err_t esp_sysview_heap_trace_start(uint32_t tmo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
vTaskDelay(1);
|
vTaskDelay(1);
|
||||||
} while(!SEGGER_SYSVIEW_Started());
|
} while (!SEGGER_SYSVIEW_Started());
|
||||||
|
|
||||||
SEGGER_SYSVIEW_RegisterModule(&s_esp_sysview_heap_module);
|
SEGGER_SYSVIEW_RegisterModule(&s_esp_sysview_heap_module);
|
||||||
s_mod_registered = true;
|
s_mod_registered = true;
|
||||||
@@ -58,7 +57,7 @@ esp_err_t esp_sysview_heap_trace_stop(void)
|
|||||||
|
|
||||||
void esp_sysview_heap_trace_alloc(const void *addr, uint32_t size, const void *callers)
|
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 aPacket[SEGGER_SYSVIEW_INFO_SIZE + (2 + CALLSTACK_SIZE)*SEGGER_SYSVIEW_QUANTA_U32];
|
||||||
U8* pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket);
|
U8* pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket);
|
||||||
U32 *calls = (U32 *)callers;
|
U32 *calls = (U32 *)callers;
|
||||||
|
|
||||||
@@ -76,7 +75,7 @@ void esp_sysview_heap_trace_alloc(const void *addr, uint32_t size, const void *c
|
|||||||
|
|
||||||
void esp_sysview_heap_trace_free(const void *addr, const void *callers)
|
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 aPacket[SEGGER_SYSVIEW_INFO_SIZE + (1 + CALLSTACK_SIZE)*SEGGER_SYSVIEW_QUANTA_U32];
|
||||||
U8* pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket);
|
U8* pPayload = SEGGER_SYSVIEW_PREPARE_PACKET(aPacket);
|
||||||
U32 *calls = (U32 *)callers;
|
U32 *calls = (U32 *)callers;
|
||||||
|
|
||||||
|
@@ -43,7 +43,6 @@ components_not_formatted_temporary:
|
|||||||
# 2. If no, move it to 'components_not_formatted_permanent' section below.
|
# 2. If no, move it to 'components_not_formatted_permanent' section below.
|
||||||
check: false
|
check: false
|
||||||
include:
|
include:
|
||||||
- "/components/app_trace/"
|
|
||||||
- "/components/app_update/"
|
- "/components/app_update/"
|
||||||
- "/components/bootloader_support/"
|
- "/components/bootloader_support/"
|
||||||
- "/components/bootloader/"
|
- "/components/bootloader/"
|
||||||
|
Reference in New Issue
Block a user