22 #define ESP_XTENSA_DBGSTUBS_UPDATE_DATA_ENTRY(_e_) \
24 uint32_t __internal_val = (_e_); \
25 if (!xtensa_data_addr_valid(target, __internal_val)) { \
26 LOG_ERROR("No valid stub data entry found (0x%" PRIx32 ")!", __internal_val); \
31 #define ESP_XTENSA_DBGSTUBS_UPDATE_CODE_ENTRY(_e_) \
33 uint32_t __internal_val = (_e_); \
34 if (__internal_val == 0) { \
35 LOG_ERROR("No valid stub code entry found (0x%" PRIx32 ")!", __internal_val); \
53 LOG_ERROR(
"Failed to write trace status (%d)!", res);
124 uint32_t vec_addr = 0;
131 LOG_ERROR(
"Failed to read debug stubs address location (%d)!", res);
138 LOG_ERROR(
"Failed to clear debug stubs address location (%d)!", res);
162 LOG_ERROR(
"Failed to read debug stubs descriptor (%d)!", res);
184 uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds)
193 #define MAX_PASS 1000
198 uint8_t buf[
sizeof(uint32_t) *
MAX_PASS];
206 }
else if (buf[0] == 0 && buf[1] == 0 && buf[2] == 0 && buf[3] == 0) {
223 uint32_t sample_count = 0;
226 uint32_t remaining = max_num_samples - sample_count;
228 this_pass = this_pass > remaining ? remaining : this_pass;
229 for (uint32_t i = 0; i < this_pass; ++i)
237 for (uint32_t i = 0; i < this_pass; ++i) {
238 uint32_t sample32 =
buf_get_u32(buf + i *
sizeof(uint32_t), 0, 32);
239 samples[sample_count++] = sample32;
248 *num_samples = sample_count;
static uint32_t buf_get_u32(const uint8_t *_buffer, unsigned int first, unsigned int num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 32-bit word.
int esp_dbgstubs_table_read(struct target *target, struct esp_dbg_stubs *dbg_stubs)
int esp_common_init(struct esp_common *esp, const struct esp_algorithm_hw *algo_hw)
#define ESP_XTENSA_DBGSTUBS_UPDATE_CODE_ENTRY(_e_)
static void esp_xtensa_dbgstubs_info_update(struct target *target)
static void esp_xtensa_dbgstubs_addr_check(struct target *target)
int esp_xtensa_init_arch_info(struct target *target, struct esp_xtensa_common *esp_xtensa, struct xtensa_debug_module_config *dm_cfg, const struct esp_semihost_ops *semihost_ops)
int esp_xtensa_poll(struct target *target)
#define ESP_XTENSA_DBGSTUBS_UPDATE_DATA_ENTRY(_e_)
int esp_xtensa_arch_state(struct target *target)
void esp_xtensa_target_deinit(struct target *target)
int esp_xtensa_target_init(struct command_context *cmd_ctx, struct target *target)
int esp_xtensa_breakpoint_remove(struct target *target, struct breakpoint *breakpoint)
static int esp_xtensa_dbgstubs_restore(struct target *target)
int esp_xtensa_breakpoint_add(struct target *target, struct breakpoint *breakpoint)
int esp_xtensa_on_halt(struct target *target)
int esp_xtensa_profiling(struct target *target, uint32_t *samples, uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds)
static struct esp_xtensa_common * target_to_esp_xtensa(struct target *target)
const struct esp_algorithm_hw xtensa_algo_hw
int esp_xtensa_apptrace_status_reg_write(struct target *target, uint32_t stat)
int esp_xtensa_apptrace_status_reg_read(struct target *target, uint32_t *stat)
struct esp32_apptrace_hw esp_xtensa_apptrace_hw
#define LOG_TARGET_INFO(target, fmt_str,...)
#define LOG_TARGET_ERROR(target, fmt_str,...)
#define LOG_TARGET_DEBUG(target, fmt_str,...)
#define LOG_ERROR(expr ...)
#define LOG_DEBUG(expr ...)
int gettimeofday(struct timeval *tv, struct timezone *tz)
struct esp_dbg_stubs dbg_stubs
uint32_t min_stack_addr
Pre-compiled target buffer's addr for stack.
uint32_t data_free
Address of free-like function to free buffer allocated with data_alloc.
uint32_t tramp_addr
Address of pre-compiled target buffer for stub trampoline.
uint32_t data_alloc
Address of malloc-like function to allocate buffer on target.
uint32_t entries[ESP_DBG_STUB_ENTRY_MAX]
Table contents.
struct esp_dbg_stubs_desc desc
Debug stubs decsriptor.
uint32_t entries_count
Number of table entries.
struct esp_semihost_ops * ops
Semihost calls handling operations.
const struct esp32_apptrace_hw * hw
struct esp_semihost_data semihost
struct esp_xtensa_apptrace_info apptrace
Represents a generic Xtensa core.
struct xtensa_debug_module dbg_mod
int target_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
int target_profiling_default(struct target *target, uint32_t *samples, uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds)
int target_poll(struct target *target)
int target_resume(struct target *target, int current, target_addr_t address, int handle_breakpoints, int debug_execution)
Make the target (re)start executing using its saved execution context (possibly with some modificatio...
static bool target_was_examined(const struct target *target)
int timeval_compare(const struct timeval *x, const struct timeval *y)
int timeval_add_time(struct timeval *result, long sec, long usec)
int xtensa_breakpoint_add(struct target *target, struct breakpoint *breakpoint)
void xtensa_target_deinit(struct target *target)
int xtensa_poll(struct target *target)
int xtensa_breakpoint_remove(struct target *target, struct breakpoint *breakpoint)
int xtensa_target_init(struct command_context *cmd_ctx, struct target *target)
int xtensa_init_arch_info(struct target *target, struct xtensa *xtensa, const struct xtensa_debug_module_config *dm_cfg)
static struct xtensa * target_to_xtensa(struct target *target)
static bool xtensa_data_addr_valid(struct target *target, uint32_t addr)
static int xtensa_queue_dbg_reg_read(struct xtensa *xtensa, enum xtensa_dm_reg reg, uint8_t *data)
static int xtensa_dm_queue_execute(struct xtensa_debug_module *dm)
static xtensa_pwrstat_t xtensa_dm_power_status_get(struct xtensa_debug_module *dm)
#define PWRSTAT_COREWASRESET(x)