dbg_stubs.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Copyright 2017 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #ifndef ESP_DBG_STUBS_H_
  14. #define ESP_DBG_STUBS_H_
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #include "esp_err.h"
  19. /**
  20. * Debug stubs entries IDs
  21. */
  22. typedef enum {
  23. ESP_DBG_STUB_MAGIC_NUM,
  24. ESP_DBG_STUB_TABLE_SIZE,
  25. ESP_DBG_STUB_CONTROL_DATA, ///< stubs descriptor entry
  26. ESP_DBG_STUB_ENTRY_FIRST,
  27. ESP_DBG_STUB_ENTRY_GCOV ///< GCOV entry
  28. = ESP_DBG_STUB_ENTRY_FIRST,
  29. ESP_DBG_STUB_ENTRY_CAPABILITIES,
  30. ESP_DBG_STUB_ENTRY_MAX
  31. } esp_dbg_stub_id_t;
  32. #define ESP_DBG_STUB_MAGIC_NUM_VAL 0xFEEDBEEF
  33. #define ESP_DBG_STUB_CAP_GCOV_TASK (1 << 0)
  34. /**
  35. * @brief Initializes debug stubs.
  36. *
  37. * @note Must be called after esp_apptrace_init() if app tracing is enabled.
  38. */
  39. void esp_dbg_stubs_init(void);
  40. /**
  41. * @brief Initializes application tracing module.
  42. *
  43. * @note Should be called before any esp_apptrace_xxx call.
  44. *
  45. * @param id Stub ID.
  46. * @param entry Stub entry. Usually it is stub entry function address,
  47. * but can be any value meaningfull for OpenOCD command/code
  48. * such as capabilities
  49. * @return ESP_OK on success, otherwise see esp_err_t
  50. */
  51. esp_err_t esp_dbg_stub_entry_set(esp_dbg_stub_id_t id, uint32_t entry);
  52. /**
  53. * @brief Retrives the corresponding stub entry
  54. *
  55. * @param id Stub ID.
  56. * @param entry Stub entry. Usually it is stub entry function address,
  57. * but can be any value meaningfull for OpenOCD command/code
  58. * such as capabilities
  59. *
  60. * @return ESP_OK on success, otherwise see esp_err_t
  61. */
  62. esp_err_t esp_dbg_stub_entry_get(esp_dbg_stub_id_t id, uint32_t *entry);
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66. #endif //ESP_DBG_STUBS_H_