From 1a40148be0f5aa8366ddf437931d64bafafddab3 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_esp32c3_family | 1 + .../include/esp_private/dbg_stubs.h | 29 +++++++++++++++---- components/esp_common/src/dbg_stubs.c | 12 ++++++++ components/tinyusb/tinyusb | 1 + .../components/esp-cryptoauthlib | 1 + 6 files changed, 42 insertions(+), 8 deletions(-) create mode 160000 components/bt/controller/lib_esp32c3_family create mode 160000 components/tinyusb/tinyusb create mode 160000 examples/peripherals/secure_element/atecc608_ecdsa/components/esp-cryptoauthlib diff --git a/components/app_trace/gcov/gcov_rtio.c b/components/app_trace/gcov/gcov_rtio.c index 72c194be4a..6508e68b0e 100644 --- a/components/app_trace/gcov/gcov_rtio.c +++ b/components/app_trace/gcov/gcov_rtio.c @@ -106,7 +106,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)??? * @@ -114,11 +114,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_esp32c3_family b/components/bt/controller/lib_esp32c3_family new file mode 160000 index 0000000000..32f15e826a --- /dev/null +++ b/components/bt/controller/lib_esp32c3_family @@ -0,0 +1 @@ +Subproject commit 32f15e826a102d2d64e612620468122ea2234a2e diff --git a/components/esp_common/include/esp_private/dbg_stubs.h b/components/esp_common/include/esp_private/dbg_stubs.h index 899dfa56ed..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); -#endif //ESP_DBG_STUBS_H_ \ No newline at end of file +/** + * @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/tinyusb/tinyusb b/components/tinyusb/tinyusb new file mode 160000 index 0000000000..68f6ef6790 --- /dev/null +++ b/components/tinyusb/tinyusb @@ -0,0 +1 @@ +Subproject commit 68f6ef679000f9cd22b20af7473d7f0480d2862e diff --git a/examples/peripherals/secure_element/atecc608_ecdsa/components/esp-cryptoauthlib b/examples/peripherals/secure_element/atecc608_ecdsa/components/esp-cryptoauthlib new file mode 160000 index 0000000000..36d0642e66 --- /dev/null +++ b/examples/peripherals/secure_element/atecc608_ecdsa/components/esp-cryptoauthlib @@ -0,0 +1 @@ +Subproject commit 36d0642e66ff5b1c7a291873f24c498ca6ffedef