gcov: ipc component name changei

This commit is contained in:
Erhan Kurubas 2021-11-12 00:59:02 +03:00
parent 3830ac21e2
commit 3277ff6856
3 changed files with 26 additions and 11 deletions

View File

@ -30,7 +30,7 @@ endif()
idf_component_register(SRCS "${srcs}" idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}" INCLUDE_DIRS "${include_dirs}"
PRIV_REQUIRES soc esp_ipc PRIV_REQUIRES soc esp_common
LDFRAGMENTS linker.lf) LDFRAGMENTS linker.lf)

View File

@ -25,7 +25,6 @@
#include "esp_freertos_hooks.h" #include "esp_freertos_hooks.h"
#include "esp_private/dbg_stubs.h" #include "esp_private/dbg_stubs.h"
#include "esp_ipc.h" #include "esp_ipc.h"
#include "hal/wdt_hal.h"
#if CONFIG_IDF_TARGET_ESP32 #if CONFIG_IDF_TARGET_ESP32
#include "esp32/rom/libc_stubs.h" #include "esp32/rom/libc_stubs.h"
#elif CONFIG_IDF_TARGET_ESP32S2BETA #elif CONFIG_IDF_TARGET_ESP32S2BETA
@ -61,18 +60,11 @@ void gcov_dump_task(void *pvParameter)
} }
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_apptrace_down_buffer_config(down_buf, ESP_GCOV_DOWN_BUF_SIZE);
/* we are directing the std outputs to the fake ones in order to reduce stack usage */
FILE *old_stderr = stderr;
FILE *old_stdout = stdout;
stderr = (FILE *) &__sf_fake_stderr;
stdout = (FILE *) &__sf_fake_stdout;
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);
stderr = old_stderr;
stdout = old_stdout;
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_TRAX);
if (dump_result != ESP_OK) { if (dump_result != ESP_OK) {

View File

@ -62,6 +62,8 @@ static void IRAM_ATTR ipc_task(void* arg)
if (s_gcov_func) { if (s_gcov_func) {
(*s_gcov_func)(s_gcov_func_arg); (*s_gcov_func)(s_gcov_func_arg);
s_gcov_func = NULL; s_gcov_func = NULL;
/* we can not interfer with IPC calls so no need for further processing */
continue;
} }
#endif #endif
if (s_func[cpuid]) { if (s_func[cpuid]) {
@ -164,13 +166,34 @@ esp_err_t esp_ipc_call_blocking(uint32_t cpu_id, esp_ipc_func_t func, void* arg)
#if CONFIG_APPTRACE_GCOV_ENABLE #if CONFIG_APPTRACE_GCOV_ENABLE
esp_err_t esp_ipc_start_gcov_from_isr(uint32_t cpu_id, esp_ipc_func_t func, void* arg) esp_err_t esp_ipc_start_gcov_from_isr(uint32_t cpu_id, esp_ipc_func_t func, void* arg)
{ {
portBASE_TYPE ret = pdFALSE;
if (xTaskGetSchedulerState() != taskSCHEDULER_RUNNING) { if (xTaskGetSchedulerState() != taskSCHEDULER_RUNNING) {
return ESP_ERR_INVALID_STATE; return ESP_ERR_INVALID_STATE;
} }
/* Lock IPC to avoid interferring with normal IPC calls, e.g.
avoid situation when esp_ipc_start_gcov_from_isr() is called from IRQ
in the middle of IPC call between `s_func` and `s_func_arg` modification. See esp_ipc_call_and_wait() */
#ifdef CONFIG_ESP_IPC_USES_CALLERS_PRIORITY
ret = xSemaphoreTakeFromISR(s_ipc_mutex[cpu_id], NULL);
#else
ret = xSemaphoreTakeFromISR(s_ipc_mutex[0], NULL);
#endif
if (ret != pdTRUE) {
return ESP_ERR_TIMEOUT;
}
s_gcov_func = func; s_gcov_func = func;
s_gcov_func_arg = arg; s_gcov_func_arg = arg;
xSemaphoreGiveFromISR(s_ipc_sem[cpu_id], NULL); ret = xSemaphoreGiveFromISR(s_ipc_sem[cpu_id], NULL);
return ESP_OK; #ifdef CONFIG_ESP_IPC_USES_CALLERS_PRIORITY
xSemaphoreGiveFromISR(s_ipc_mutex[cpu_id], NULL);
#else
xSemaphoreGiveFromISR(s_ipc_mutex[0], NULL);
#endif
return ret == pdTRUE ? ESP_OK : ESP_FAIL;
} }
#endif #endif