OpenOCD
esp_xtensa_semihosting.c File Reference
Include dependency graph for esp_xtensa_semihosting.c:

Go to the source code of this file.

Macros

#define ESP_XTENSA_SYSCALL   0x41E0 /* XT_INS_BREAK(1, 14) */
 
#define ESP_XTENSA_SYSCALL_SZ   3
 
#define XTENSA_SYSCALL_ERRNO_REG   XT_REG_IDX_A3
 
#define XTENSA_SYSCALL_OP_REG   XT_REG_IDX_A2
 
#define XTENSA_SYSCALL_RETVAL_REG   XT_REG_IDX_A2
 

Functions

int esp_xtensa_semihosting (struct target *target, int *retval)
 Checks and processes an ESP Xtensa semihosting request. More...
 
int esp_xtensa_semihosting_init (struct target *target)
 
static int esp_xtensa_semihosting_post_result (struct target *target)
 
static int esp_xtensa_semihosting_setup (struct target *target, int enable)
 
static int xtensa_semihosting_init (struct target *target)
 

Macro Definition Documentation

◆ ESP_XTENSA_SYSCALL

#define ESP_XTENSA_SYSCALL   0x41E0 /* XT_INS_BREAK(1, 14) */

Definition at line 17 of file esp_xtensa_semihosting.c.

◆ ESP_XTENSA_SYSCALL_SZ

#define ESP_XTENSA_SYSCALL_SZ   3

Definition at line 18 of file esp_xtensa_semihosting.c.

◆ XTENSA_SYSCALL_ERRNO_REG

#define XTENSA_SYSCALL_ERRNO_REG   XT_REG_IDX_A3

Definition at line 22 of file esp_xtensa_semihosting.c.

◆ XTENSA_SYSCALL_OP_REG

#define XTENSA_SYSCALL_OP_REG   XT_REG_IDX_A2

Definition at line 20 of file esp_xtensa_semihosting.c.

◆ XTENSA_SYSCALL_RETVAL_REG

#define XTENSA_SYSCALL_RETVAL_REG   XT_REG_IDX_A2

Definition at line 21 of file esp_xtensa_semihosting.c.

Function Documentation

◆ esp_xtensa_semihosting()

int esp_xtensa_semihosting ( struct target target,
int *  retval 
)

Checks and processes an ESP Xtensa semihosting request.

This is meant to be called when the target is stopped due to a debug mode entry. If the value 0 is returned then there was nothing to process. A non-zero return value signifies that a request was processed and the target resumed, or an error was encountered, in which case the caller must return immediately.

Parameters
targetPointer to the ESP Xtensa target to process.
retvalPointer to a location where the return code will be stored
Returns
SEMIHOSTING_HANDLED if a request was processed or SEMIHOSTING_NONE with the proper retval

Definition at line 50 of file esp_xtensa_semihosting.c.

References a2, a3, semihosting::basedir, buf_get_u32(), DEBUGCAUSE_BI, DEBUGCAUSE_BN, ERROR_OK, ESP_XTENSA_SYSCALL, ESP_XTENSA_SYSCALL_SZ, semihosting::hit_fileio, semihosting::is_resumable, LOG_TARGET_DEBUG, LOG_TARGET_ERROR, esp_semihost_data::need_resume, semihosting::op, esp_semihost_data::ops, semihosting::param, esp_semihost_ops::prepare, esp_xtensa_common::semihost, target::semihosting, semihosting_common(), SEMIHOSTING_HANDLED, SEMIHOSTING_NONE, target_read_memory(), target_to_esp_xtensa(), XT_REG_IDX_A2, XT_REG_IDX_A3, XT_REG_IDX_DEBUGCAUSE, XT_REG_IDX_PC, and xtensa_reg_get().

Referenced by esp32s2_poll(), and esp_xtensa_smp_poll().

◆ esp_xtensa_semihosting_init()

◆ esp_xtensa_semihosting_post_result()

static int esp_xtensa_semihosting_post_result ( struct target target)
static

◆ esp_xtensa_semihosting_setup()

static int esp_xtensa_semihosting_setup ( struct target target,
int  enable 
)
static

Definition at line 24 of file esp_xtensa_semihosting.c.

References ERROR_OK, and LOG_TARGET_DEBUG.

Referenced by xtensa_semihosting_init().

◆ xtensa_semihosting_init()

static int xtensa_semihosting_init ( struct target target)
static