From 81956c63c85030f211f63ab60cdb7bd48f242c9f Mon Sep 17 00:00:00 2001 From: Erhan Kurubas Date: Sun, 16 May 2021 18:51:28 +0300 Subject: [PATCH] gcov: added dbg stub capabilites and magic number entry to keep backward compatible --- components/app_trace/gcov/gcov_rtio.c | 6 +++-- components/bt/controller/lib_esp32 | 2 +- components/bt/controller/lib_esp32c3_family | 2 +- components/cbor/tinycbor | 2 +- components/coap/libcoap | 2 +- .../include/esp_private/dbg_stubs.h | 27 +++++++++++++++---- components/esp_common/src/dbg_stubs.c | 12 +++++++++ components/esp_wifi/lib | 2 +- components/tinyusb/tinyusb | 2 +- 9 files changed, 44 insertions(+), 13 deletions(-) diff --git a/components/app_trace/gcov/gcov_rtio.c b/components/app_trace/gcov/gcov_rtio.c index 6744354563..684eed1466 100644 --- a/components/app_trace/gcov/gcov_rtio.c +++ b/components/app_trace/gcov/gcov_rtio.c @@ -115,7 +115,7 @@ static int esp_dbg_stub_gcov_dump_do(void) } /** - * @brief Triggers gcov info dump. + * @brief Triggers gcov info dump task * This function is to be called by OpenOCD, not by normal user code. * TODO: what about interrupted flash access (when cache disabled)??? * @@ -123,11 +123,13 @@ static int esp_dbg_stub_gcov_dump_do(void) */ static int esp_dbg_stub_gcov_entry(void) { - return esp_dbg_stub_gcov_dump_do(); + s_do_dump = true; + return ESP_OK; } int gcov_rtio_atexit(void (*function)(void) __attribute__ ((unused))) { + uint32_t capabilities = 0; ESP_EARLY_LOGV(TAG, "%s", __FUNCTION__); esp_dbg_stub_entry_set(ESP_DBG_STUB_ENTRY_GCOV, (uint32_t)&esp_dbg_stub_gcov_entry); return 0; diff --git a/components/bt/controller/lib_esp32 b/components/bt/controller/lib_esp32 index fb49791b7c..cfbb0571fb 160000 --- a/components/bt/controller/lib_esp32 +++ b/components/bt/controller/lib_esp32 @@ -1 +1 @@ -Subproject commit fb49791b7c1a8a35f06e68124c90022667b4cff1 +Subproject commit cfbb0571fb424ca4a68a0c172cbff1fdc79fd91b diff --git a/components/bt/controller/lib_esp32c3_family b/components/bt/controller/lib_esp32c3_family index 7ad49c38b8..9ca8afd50a 160000 --- a/components/bt/controller/lib_esp32c3_family +++ b/components/bt/controller/lib_esp32c3_family @@ -1 +1 @@ -Subproject commit 7ad49c38b893952bbed155ede2c7684f0307f6d3 +Subproject commit 9ca8afd50afde57958a67fca65847edc52f7d91c diff --git a/components/cbor/tinycbor b/components/cbor/tinycbor index 085ca40781..7c349dbb6b 160000 --- a/components/cbor/tinycbor +++ b/components/cbor/tinycbor @@ -1 +1 @@ -Subproject commit 085ca40781f7c39febe6d14fb7e5cba342e1804b +Subproject commit 7c349dbb6b8d76db39383b226d3ebdf59b8ab37d diff --git a/components/coap/libcoap b/components/coap/libcoap index 98954eb30a..9b6451c365 160000 --- a/components/coap/libcoap +++ b/components/coap/libcoap @@ -1 +1 @@ -Subproject commit 98954eb30a2e728e172a6cd29430ae5bc999b585 +Subproject commit 9b6451c3654bc1f625e36c87f018c2da34bea5e6 diff --git a/components/esp_common/include/esp_private/dbg_stubs.h b/components/esp_common/include/esp_private/dbg_stubs.h index c784de9845..454c3418f9 100644 --- a/components/esp_common/include/esp_private/dbg_stubs.h +++ b/components/esp_common/include/esp_private/dbg_stubs.h @@ -20,13 +20,18 @@ * Debug stubs entries IDs */ typedef enum { - ESP_DBG_STUB_CONTROL_DATA, ///< stubs descriptor entry + ESP_DBG_STUB_MAGIC_NUM, + ESP_DBG_STUB_CONTROL_DATA, ///< stubs descriptor entry ESP_DBG_STUB_ENTRY_FIRST, - ESP_DBG_STUB_ENTRY_GCOV ///< GCOV entry - = ESP_DBG_STUB_ENTRY_FIRST, + ESP_DBG_STUB_ENTRY_GCOV ///< GCOV entry + = ESP_DBG_STUB_ENTRY_FIRST, + ESP_DBG_STUB_CAPABILITIES, ESP_DBG_STUB_ENTRY_MAX } esp_dbg_stub_id_t; +#define ESP_DBG_STUB_MAGIC_NUM_VAL 0xFEEDBEEF +#define ESP_DBG_STUB_CAP_GCOV_TASK (1 << 0) + /** * @brief Initializes debug stubs. * @@ -41,10 +46,22 @@ void esp_dbg_stubs_init(void); * * @param id Stub ID. * @param entry Stub entry. Usually it is stub entry function address, - * but can be any value meaningfull for OpenOCD command/code. - * + * but can be any value meaningfull for OpenOCD command/code + * such as capabilities * @return ESP_OK on success, otherwise see esp_err_t */ esp_err_t esp_dbg_stub_entry_set(esp_dbg_stub_id_t id, uint32_t entry); +/** + * @brief Retrives the corresponding stub entry + * + * @param id Stub ID. + * @param entry Stub entry. Usually it is stub entry function address, + * but can be any value meaningfull for OpenOCD command/code + * such as capabilities + * + * @return ESP_OK on success, otherwise see esp_err_t + */ +esp_err_t esp_dbg_stub_entry_get(esp_dbg_stub_id_t id, uint32_t *entry); + #endif //ESP_DBG_STUBS_H_ diff --git a/components/esp_common/src/dbg_stubs.c b/components/esp_common/src/dbg_stubs.c index 1ee9124897..e4c65c22e2 100644 --- a/components/esp_common/src/dbg_stubs.c +++ b/components/esp_common/src/dbg_stubs.c @@ -76,6 +76,7 @@ void esp_dbg_stubs_init(void) s_dbg_stubs_ctl_data.data_alloc = (uint32_t)esp_dbg_stubs_data_alloc; s_dbg_stubs_ctl_data.data_free = (uint32_t)esp_dbg_stubs_data_free; + s_stub_entry[ESP_DBG_STUB_MAGIC_NUM] = ESP_DBG_STUB_MAGIC_NUM_VAL; s_stub_entry[ESP_DBG_STUB_CONTROL_DATA] = (uint32_t)&s_dbg_stubs_ctl_data; eri_write(ESP_DBG_STUBS_TRAX_REG, (uint32_t)s_stub_entry); ESP_LOGV(TAG, "%s stubs %x", __func__, eri_read(ESP_DBG_STUBS_TRAX_REG)); @@ -92,4 +93,15 @@ esp_err_t esp_dbg_stub_entry_set(esp_dbg_stub_id_t id, uint32_t entry) return ESP_OK; } +esp_err_t esp_dbg_stub_entry_get(esp_dbg_stub_id_t id, uint32_t *entry) +{ + if (id < ESP_DBG_STUB_ENTRY_FIRST || id >= ESP_DBG_STUB_ENTRY_MAX) { + ESP_LOGE(TAG, "Invalid stub id %d!", id); + return ESP_ERR_INVALID_ARG; + } + *entry = s_stub_entry[id]; + + return ESP_OK; +} + #endif diff --git a/components/esp_wifi/lib b/components/esp_wifi/lib index e6945e61f7..045b526641 160000 --- a/components/esp_wifi/lib +++ b/components/esp_wifi/lib @@ -1 +1 @@ -Subproject commit e6945e61f7c63545a77b0575c3770a85b4de948e +Subproject commit 045b526641b7dbe7a6be3d9039be93a2c1b56f10 diff --git a/components/tinyusb/tinyusb b/components/tinyusb/tinyusb index 334e95fac5..c4badd394e 160000 --- a/components/tinyusb/tinyusb +++ b/components/tinyusb/tinyusb @@ -1 +1 @@ -Subproject commit 334e95fac52a607150157ae5199a19e11f843982 +Subproject commit c4badd394eda18199c0196ed0be1e2d635f0a5f6