27 #define ESP32_DRAM_LOW            0x3ffae000 
   28 #define ESP32_DRAM_HIGH           0x40000000 
   29 #define ESP32_IROM_MASK_LOW       0x40000000 
   30 #define ESP32_IROM_MASK_HIGH      0x40064f00 
   31 #define ESP32_IRAM_LOW            0x40070000 
   32 #define ESP32_IRAM_HIGH           0x400a0000 
   33 #define ESP32_RTC_IRAM_LOW        0x400c0000 
   34 #define ESP32_RTC_IRAM_HIGH       0x400c2000 
   35 #define ESP32_RTC_DRAM_LOW        0x3ff80000 
   36 #define ESP32_RTC_DRAM_HIGH       0x3ff82000 
   37 #define ESP32_RTC_DATA_LOW        0x50000000 
   38 #define ESP32_RTC_DATA_HIGH       0x50002000 
   39 #define ESP32_EXTRAM_DATA_LOW     0x3f800000 
   40 #define ESP32_EXTRAM_DATA_HIGH    0x3fc00000 
   41 #define ESP32_DR_REG_LOW          0x3ff00000 
   42 #define ESP32_DR_REG_HIGH         0x3ff71000 
   43 #define ESP32_SYS_RAM_LOW         0x60000000UL 
   44 #define ESP32_SYS_RAM_HIGH        (ESP32_SYS_RAM_LOW + 0x20000000UL) 
   45 #define ESP32_RTC_SLOW_MEM_BASE   ESP32_RTC_DATA_LOW 
   48 #define ESP32_WDT_WKEY_VALUE       0x50d83aa1 
   49 #define ESP32_TIMG0_BASE           0x3ff5f000 
   50 #define ESP32_TIMG1_BASE           0x3ff60000 
   51 #define ESP32_TIMGWDT_CFG0_OFF     0x48 
   52 #define ESP32_TIMGWDT_PROTECT_OFF  0x64 
   53 #define ESP32_TIMG0WDT_CFG0        (ESP32_TIMG0_BASE + ESP32_TIMGWDT_CFG0_OFF) 
   54 #define ESP32_TIMG1WDT_CFG0        (ESP32_TIMG1_BASE + ESP32_TIMGWDT_CFG0_OFF) 
   55 #define ESP32_TIMG0WDT_PROTECT     (ESP32_TIMG0_BASE + ESP32_TIMGWDT_PROTECT_OFF) 
   56 #define ESP32_TIMG1WDT_PROTECT     (ESP32_TIMG1_BASE + ESP32_TIMGWDT_PROTECT_OFF) 
   57 #define ESP32_RTCCNTL_BASE         0x3ff48000 
   58 #define ESP32_RTCWDT_CFG_OFF       0x8C 
   59 #define ESP32_RTCWDT_PROTECT_OFF   0xA4 
   60 #define ESP32_RTCWDT_CFG           (ESP32_RTCCNTL_BASE + ESP32_RTCWDT_CFG_OFF) 
   61 #define ESP32_RTCWDT_PROTECT       (ESP32_RTCCNTL_BASE + ESP32_RTCWDT_PROTECT_OFF) 
   63 #define ESP32_TRACEMEM_BLOCK_SZ    0x4000 
   66 #define ESP32_DR_REG_DPORT_BASE         ESP32_DR_REG_LOW 
   67 #define ESP32_DPORT_APPCPU_CTRL_B_REG   (ESP32_DR_REG_DPORT_BASE + 0x030) 
   68 #define ESP32_DPORT_APPCPU_CLKGATE_EN   BIT(0) 
   70 #define ESP32_RTC_CNTL_SW_CPU_STALL_REG (ESP32_RTCCNTL_BASE + 0xac) 
   71 #define ESP32_RTC_CNTL_SW_CPU_STALL_DEF 0x0 
  105 #include "../../../contrib/loaders/reset/espressif/esp32/cpu_reset_handler_code.inc" 
  117         LOG_DEBUG(
"Target not halted before SoC reset, trying to halt it first");
 
  121             LOG_DEBUG(
"Couldn't halt target before SoC reset, trying to do reset-halt");
 
  125                     "Couldn't halt target before SoC reset! (xtensa_assert_reset returned %d)",
 
  137                     "Couldn't halt target before SoC reset! (xtensa_deassert_reset returned %d)",
 
  146                 LOG_ERROR(
"Couldn't halt target before SoC reset");
 
  170     LOG_DEBUG(
"Loading stub code into RTC RAM");
 
  176         LOG_ERROR(
"Failed to save contents of RTC_SLOW_MEM (%d)!", res);
 
  183         LOG_ERROR(
"Failed to write stub (%d)!", res);
 
  193         LOG_ERROR(
"Failed to run stub (%d)!", res);
 
  196     LOG_DEBUG(
"resume done, waiting for the target to come alive");
 
  201     bool get_timeout = 
false;
 
  234         LOG_ERROR(
"Failed to write ESP32_TIMG0WDT_PROTECT (%d)!", res);
 
  239         LOG_ERROR(
"Failed to write ESP32_TIMG0WDT_CFG0 (%d)!", res);
 
  245         LOG_ERROR(
"Failed to write ESP32_TIMG1WDT_PROTECT (%d)!", res);
 
  250         LOG_ERROR(
"Failed to write ESP32_TIMG1WDT_CFG0 (%d)!", res);
 
  256         LOG_ERROR(
"Failed to write ESP32_RTCWDT_PROTECT (%d)!", res);
 
  261         LOG_ERROR(
"Failed to write ESP32_RTCWDT_CFG (%d)!", res);
 
  295     static uint32_t value;
 
  296     uint8_t t[4] = { 0, 0, 0, 0 };
 
  344         .queue_tdi_idle_arg = 
target 
  349         LOG_ERROR(
"Failed to alloc memory for arch info!");
 
  387     if (!strcasecmp(
CMD_ARGV[0], 
"none"))
 
  389     else if (!strcasecmp(
CMD_ARGV[0], 
"1.8"))
 
  391     else if (!strcasecmp(
CMD_ARGV[0], 
"3.3"))
 
  393     else if (!strcasecmp(
CMD_ARGV[0], 
"high"))
 
  395     else if (!strcasecmp(
CMD_ARGV[0], 
"low"))
 
  400             "Argument unknown. Please pick one of none, high, low, 1.8 or 3.3");
 
  429         .
name = 
"flashbootstrap",
 
  430         .handler = esp32_cmd_flashbootstrap,
 
  433             "Set the idle state of the TMS pin, which at reset also is the voltage selector for the flash chip.",
 
  434         .usage = 
"none|1.8|3.3|high|low",
 
  456         .help = 
"ARM Command Group",
 
static void buf_set_u32(uint8_t *_buffer, unsigned first, unsigned num, uint32_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
 
void command_print(struct command_invocation *cmd, const char *format,...)
 
#define CMD
Use this macro to access the command being handled, rather than accessing the variable directly.
 
#define CALL_COMMAND_HANDLER(name, extra ...)
Use this to macro to call a command helper (or a nested handler).
 
#define CMD_ARGV
Use this macro to access the arguments for the command being handled, rather than accessing the varia...
 
#define CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
 
#define CMD_CTX
Use this macro to access the context of the command being handled, rather than accessing the variable...
 
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
 
static const struct esp_xtensa_smp_chip_ops esp32_chip_ops
 
#define ESP32_TIMG0WDT_PROTECT
 
#define ESP32_TIMG0WDT_CFG0
 
static void esp32_queue_tdi_idle(struct target *target)
 
#define ESP32_TIMG1WDT_PROTECT
 
static const struct xtensa_debug_ops esp32_dbg_ops
 
static COMMAND_HELPER(esp32_cmd_flashbootstrap_do, struct esp32_common *esp32)
 
static const struct command_registration esp32_any_command_handlers[]
 
static int esp32_virt2phys(struct target *target, target_addr_t virtual, target_addr_t *physical)
 
static int esp32_target_init(struct command_context *cmd_ctx, struct target *target)
 
static const struct command_registration esp32_command_handlers[]
 
static const struct esp_semihost_ops esp32_semihost_ops
 
#define ESP32_RTC_CNTL_SW_CPU_STALL_DEF
 
static const uint8_t esp32_reset_stub_code[]
 
#define ESP32_TIMG1WDT_CFG0
 
struct target_type esp32_target
Holds methods for Xtensa targets.
 
static int esp32_arch_state(struct target *target)
 
#define ESP32_WDT_WKEY_VALUE
 
static const struct xtensa_power_ops esp32_pwr_ops
 
static struct esp32_common * target_to_esp32(struct target *target)
 
static int esp32_on_halt(struct target *target)
 
#define ESP32_RTCWDT_PROTECT
 
static int esp32_disable_wdts(struct target *target)
 
static int esp32_soc_reset(struct target *target)
 
static int esp32_target_create(struct target *target, Jim_Interp *interp)
 
#define ESP32_RTC_SLOW_MEM_BASE
 
COMMAND_HANDLER(esp32_cmd_flashbootstrap)
 
#define ESP32_RTC_CNTL_SW_CPU_STALL_REG
 
void esp_xtensa_target_deinit(struct target *target)
 
int esp_xtensa_breakpoint_remove(struct target *target, struct breakpoint *breakpoint)
 
int esp_xtensa_breakpoint_add(struct target *target, struct breakpoint *breakpoint)
 
int esp_xtensa_smp_init_arch_info(struct target *target, struct esp_xtensa_smp_common *esp_xtensa_smp, struct xtensa_debug_module_config *dm_cfg, const struct esp_xtensa_smp_chip_ops *chip_ops, const struct esp_semihost_ops *semihost_ops)
 
const struct command_registration esp_xtensa_smp_command_handlers[]
 
int esp_xtensa_smp_soft_reset_halt(struct target *target)
 
int esp_xtensa_smp_deassert_reset(struct target *target)
 
int esp_xtensa_smp_step(struct target *target, int current, target_addr_t address, int handle_breakpoints)
 
int esp_xtensa_smp_watchpoint_remove(struct target *target, struct watchpoint *watchpoint)
 
int esp_xtensa_smp_target_init(struct command_context *cmd_ctx, struct target *target)
 
int esp_xtensa_smp_watchpoint_add(struct target *target, struct watchpoint *watchpoint)
 
int esp_xtensa_smp_assert_reset(struct target *target)
 
int esp_xtensa_smp_poll(struct target *target)
 
int esp_xtensa_smp_resume(struct target *target, int current, target_addr_t address, int handle_breakpoints, int debug_execution)
 
void jtag_add_plain_ir_scan(int num_bits, const uint8_t *out_bits, uint8_t *in_bits, tap_state_t state)
Scan out the bits in ir scan mode.
 
void alive_sleep(uint64_t ms)
 
#define LOG_TARGET_ERROR(target, fmt_str,...)
 
#define LOG_TARGET_DEBUG(target, fmt_str,...)
 
#define LOG_ERROR(expr ...)
 
#define LOG_DEBUG(expr ...)
 
const struct command_registration semihosting_common_handlers[]
 
const struct command_registration smp_command_handlers[]
 
#define foreach_smp_target(pos, head)
 
const struct command_registration * chain
If non-NULL, the commands in chain will be registered in the same context and scope of this registrat...
 
struct esp_xtensa_smp_common esp_xtensa_smp
 
enum esp32_flash_bootstrap flash_bootstrap
 
Semihost calls handling operations.
 
int(* prepare)(struct target *target)
Callback called before handling semihost call.
 
int(* reset)(struct target *target)
 
This holds methods shared between all instances of a given target type.
 
const char * name
Name of this type of target.
 
enum target_debug_reason debug_reason
 
struct list_head * smp_targets
 
const struct xtensa_debug_ops * dbg_ops
 
int(* queue_enable)(struct xtensa_debug_module *dm)
enable operation
 
int(* queue_reg_read)(struct xtensa_debug_module *dm, enum xtensa_dm_pwr_reg reg, uint8_t *data, uint32_t clear)
register read.
 
Represents a generic Xtensa core.
 
struct xtensa_debug_module dbg_mod
 
int target_write_buffer(struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)
 
int target_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
 
int target_write_u32(struct target *target, target_addr_t address, uint32_t value)
 
struct target * get_current_target(struct command_context *cmd_ctx)
 
int target_wait_state(struct target *target, enum target_state state, int ms)
 
#define ERROR_TARGET_TIMEOUT
 
#define container_of(ptr, type, member)
Cast a member of a structure out to the containing structure.
 
const char * xtensa_get_gdb_arch(struct target *target)
 
int xtensa_poll(struct target *target)
 
int xtensa_halt(struct target *target)
 
int xtensa_read_buffer(struct target *target, target_addr_t address, uint32_t count, uint8_t *buffer)
 
int xtensa_get_gdb_reg_list(struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
 
int xtensa_checksum_memory(struct target *target, target_addr_t address, uint32_t count, uint32_t *checksum)
 
int xtensa_examine(struct target *target)
 
int xtensa_resume(struct target *target, int current, target_addr_t address, int handle_breakpoints, int debug_execution)
 
int xtensa_write_buffer(struct target *target, target_addr_t address, uint32_t count, const uint8_t *buffer)
 
int xtensa_write_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
 
int xtensa_mmu_is_enabled(struct target *target, int *enabled)
 
int xtensa_deassert_reset(struct target *target)
 
int xtensa_read_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
 
int xtensa_assert_reset(struct target *target)
 
static struct xtensa * target_to_xtensa(struct target *target)
 
int xtensa_dm_queue_reg_read(struct xtensa_debug_module *dm, enum xtensa_dm_reg reg, uint8_t *value)
 
int xtensa_dm_queue_pwr_reg_write(struct xtensa_debug_module *dm, enum xtensa_dm_pwr_reg reg, uint32_t data)
 
int xtensa_dm_queue_pwr_reg_read(struct xtensa_debug_module *dm, enum xtensa_dm_pwr_reg reg, uint8_t *data, uint32_t clear)
 
int xtensa_dm_queue_reg_write(struct xtensa_debug_module *dm, enum xtensa_dm_reg reg, uint32_t value)
 
int xtensa_dm_queue_enable(struct xtensa_debug_module *dm)
 
static bool xtensa_dm_core_is_stalled(struct xtensa_debug_module *dm)