esp32: Fixes double initialization of apptrace down ring buffer in dual core mode
Additional minor fixes: - Host file I/O code warnings - Initialization of down buffer for GCOV
This commit is contained in:
parent
3d7ec475d1
commit
fe3b557fa8
|
@ -864,6 +864,8 @@ esp_err_t esp_apptrace_init()
|
||||||
|
|
||||||
if (!s_trace_buf.inited) {
|
if (!s_trace_buf.inited) {
|
||||||
memset(&s_trace_buf, 0, sizeof(s_trace_buf));
|
memset(&s_trace_buf, 0, sizeof(s_trace_buf));
|
||||||
|
// disabled by default
|
||||||
|
esp_apptrace_rb_init(&s_trace_buf.rb_down, NULL, 0);
|
||||||
res = esp_apptrace_lock_initialize(&s_trace_buf.lock);
|
res = esp_apptrace_lock_initialize(&s_trace_buf.lock);
|
||||||
if (res != ESP_OK) {
|
if (res != ESP_OK) {
|
||||||
ESP_APPTRACE_LOGE("Failed to init log lock (%d)!", res);
|
ESP_APPTRACE_LOGE("Failed to init log lock (%d)!", res);
|
||||||
|
@ -884,9 +886,6 @@ esp_err_t esp_apptrace_init()
|
||||||
esp_apptrace_trax_init();
|
esp_apptrace_trax_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// disabled by default
|
|
||||||
esp_apptrace_rb_init(&s_trace_buf.rb_down, NULL, 0);
|
|
||||||
|
|
||||||
s_trace_buf.inited |= 1 << xPortGetCoreID(); // global and this CPU-specific data are inited
|
s_trace_buf.inited |= 1 << xPortGetCoreID(); // global and this CPU-specific data are inited
|
||||||
|
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
|
|
|
@ -49,6 +49,7 @@ void esp_gcov_dump()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_gcov_exit) {
|
if (s_gcov_exit) {
|
||||||
|
esp_apptrace_down_buffer_config(s_gcov_down_buf, sizeof(s_gcov_down_buf));
|
||||||
s_gcov_exit();
|
s_gcov_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +62,6 @@ void esp_gcov_dump()
|
||||||
int gcov_rtio_atexit(void (*function)(void))
|
int gcov_rtio_atexit(void (*function)(void))
|
||||||
{
|
{
|
||||||
s_gcov_exit = function;
|
s_gcov_exit = function;
|
||||||
esp_apptrace_down_buffer_config(s_gcov_down_buf, sizeof(s_gcov_down_buf));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,14 +155,14 @@ void *esp_apptrace_fopen(esp_apptrace_dest_t dest, const char *path, const char
|
||||||
}
|
}
|
||||||
|
|
||||||
// now read the answer
|
// now read the answer
|
||||||
uint8_t resp[sizeof(void *)];
|
void *resp;
|
||||||
ret = esp_apptrace_file_rsp_recv(dest, resp, sizeof(resp));
|
ret = esp_apptrace_file_rsp_recv(dest, (uint8_t *)&resp, sizeof(resp));
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to read response (%d)!", ret);
|
ESP_LOGE(TAG, "Failed to read response (%d)!", ret);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return *((void **)resp);
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void esp_apptrace_fclose_args_prepare(uint8_t *buf, void *priv)
|
static void esp_apptrace_fclose_args_prepare(uint8_t *buf, void *priv)
|
||||||
|
@ -185,14 +185,14 @@ int esp_apptrace_fclose(esp_apptrace_dest_t dest, void *stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
// now read the answer
|
// now read the answer
|
||||||
uint8_t resp[sizeof(int)];
|
int resp;
|
||||||
ret = esp_apptrace_file_rsp_recv(dest, resp, sizeof(resp));
|
ret = esp_apptrace_file_rsp_recv(dest, (uint8_t *)&resp, sizeof(resp));
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to read response (%d)!", ret);
|
ESP_LOGE(TAG, "Failed to read response (%d)!", ret);
|
||||||
return EOF;
|
return EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
return *((int *)resp);
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void esp_apptrace_fwrite_args_prepare(uint8_t *buf, void *priv)
|
static void esp_apptrace_fwrite_args_prepare(uint8_t *buf, void *priv)
|
||||||
|
@ -218,14 +218,14 @@ size_t esp_apptrace_fwrite(esp_apptrace_dest_t dest, const void *ptr, size_t siz
|
||||||
}
|
}
|
||||||
|
|
||||||
// now read the answer
|
// now read the answer
|
||||||
uint8_t resp[sizeof(size_t)];
|
size_t resp;
|
||||||
ret = esp_apptrace_file_rsp_recv(dest, resp, sizeof(resp));
|
ret = esp_apptrace_file_rsp_recv(dest, (uint8_t *)&resp, sizeof(resp));
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to read response (%d)!", ret);
|
ESP_LOGE(TAG, "Failed to read response (%d)!", ret);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return *((size_t *)resp);
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void esp_apptrace_fread_args_prepare(uint8_t *buf, void *priv)
|
static void esp_apptrace_fread_args_prepare(uint8_t *buf, void *priv)
|
||||||
|
@ -250,20 +250,20 @@ size_t esp_apptrace_fread(esp_apptrace_dest_t dest, void *ptr, size_t size, size
|
||||||
}
|
}
|
||||||
|
|
||||||
// now read the answer
|
// now read the answer
|
||||||
uint8_t resp[sizeof(size_t)];
|
size_t resp;
|
||||||
ret = esp_apptrace_file_rsp_recv(dest, resp, sizeof(resp));
|
ret = esp_apptrace_file_rsp_recv(dest, (uint8_t *)&resp, sizeof(resp));
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to read response (%d)!", ret);
|
ESP_LOGE(TAG, "Failed to read response (%d)!", ret);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (*((size_t *)resp) > 0) {
|
if (resp > 0) {
|
||||||
ret = esp_apptrace_file_rsp_recv(dest, ptr, *((size_t *)resp));
|
ret = esp_apptrace_file_rsp_recv(dest, ptr, resp);
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to read file data (%d)!", ret);
|
ESP_LOGE(TAG, "Failed to read file data (%d)!", ret);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return *((size_t *)resp);
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void esp_apptrace_fseek_args_prepare(uint8_t *buf, void *priv)
|
static void esp_apptrace_fseek_args_prepare(uint8_t *buf, void *priv)
|
||||||
|
@ -288,14 +288,14 @@ int esp_apptrace_fseek(esp_apptrace_dest_t dest, void *stream, long offset, int
|
||||||
}
|
}
|
||||||
|
|
||||||
// now read the answer
|
// now read the answer
|
||||||
uint8_t resp[sizeof(int)];
|
int resp;
|
||||||
ret = esp_apptrace_file_rsp_recv(dest, resp, sizeof(resp));
|
ret = esp_apptrace_file_rsp_recv(dest, (uint8_t *)&resp, sizeof(resp));
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to read response (%d)!", ret);
|
ESP_LOGE(TAG, "Failed to read response (%d)!", ret);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return *((int *)resp);
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void esp_apptrace_ftell_args_prepare(uint8_t *buf, void *priv)
|
static void esp_apptrace_ftell_args_prepare(uint8_t *buf, void *priv)
|
||||||
|
@ -318,14 +318,14 @@ int esp_apptrace_ftell(esp_apptrace_dest_t dest, void *stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
// now read the answer
|
// now read the answer
|
||||||
uint8_t resp[sizeof(int)];
|
int resp;
|
||||||
ret = esp_apptrace_file_rsp_recv(dest, resp, sizeof(resp));
|
ret = esp_apptrace_file_rsp_recv(dest, (uint8_t *)&resp, sizeof(resp));
|
||||||
if (ret != ESP_OK) {
|
if (ret != ESP_OK) {
|
||||||
ESP_LOGE(TAG, "Failed to read response (%d)!", ret);
|
ESP_LOGE(TAG, "Failed to read response (%d)!", ret);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return *((int *)resp);
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int esp_apptrace_fstop(esp_apptrace_dest_t dest)
|
int esp_apptrace_fstop(esp_apptrace_dest_t dest)
|
||||||
|
|
Loading…
Reference in a new issue