From 0206d8442e701d01708cabe3f8accc08d7b17765 Mon Sep 17 00:00:00 2001 From: Erhan Kurubas Date: Thu, 10 Apr 2025 16:22:07 +0200 Subject: [PATCH] fix(apptrace): replace esp32p4 ctrl block into noncache-able TCM memory --- components/app_trace/port/riscv/port.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/components/app_trace/port/riscv/port.c b/components/app_trace/port/riscv/port.c index 3e5ceca966..005550de82 100644 --- a/components/app_trace/port/riscv/port.c +++ b/components/app_trace/port/riscv/port.c @@ -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 */ @@ -57,7 +57,13 @@ static bool esp_apptrace_riscv_host_data_pending(void); const static char *TAG = "esp_apptrace"; -static esp_apptrace_riscv_ctrl_block_t s_tracing_ctrl[CONFIG_FREERTOS_NUMBER_OF_CORES]; +#if SOC_CACHE_INTERNAL_MEM_VIA_L1CACHE +#define APPTRACE_DRAM_ATTR TCM_DRAM_ATTR +#else +#define APPTRACE_DRAM_ATTR +#endif + +static APPTRACE_DRAM_ATTR esp_apptrace_riscv_ctrl_block_t s_tracing_ctrl[CONFIG_FREERTOS_NUMBER_OF_CORES]; esp_apptrace_hw_t *esp_apptrace_jtag_hw_get(void **data) { @@ -92,7 +98,7 @@ esp_apptrace_hw_t *esp_apptrace_jtag_hw_get(void **data) } /* Advertises apptrace control block address to host. - This function can be overriden with custom implementation, + This function can be overridden with custom implementation, e.g. OpenOCD flasher stub use own implementation of it. */ __attribute__((weak)) int esp_apptrace_advertise_ctrl_block(void *ctrl_block_addr) { @@ -103,7 +109,7 @@ __attribute__((weak)) int esp_apptrace_advertise_ctrl_block(void *ctrl_block_add } /* Returns up buffers config. - This function can be overriden with custom implementation, + This function can be overridden with custom implementation, e.g. OpenOCD flasher stub use own implementation of it. */ __attribute__((weak)) void esp_apptrace_get_up_buffers(esp_apptrace_mem_block_t mem_blocks_cfg[2]) { @@ -165,7 +171,7 @@ static esp_err_t esp_apptrace_riscv_init(esp_apptrace_riscv_data_t *hw_data) } // notify host about control block address int res = esp_apptrace_advertise_ctrl_block(&s_tracing_ctrl[core_id]); - assert(res == 0 && "Falied to send config to host!"); + assert(res == 0 && "Failed to send config to host!"); return ESP_OK; }