OpenOCD
arm_semihosting.c File Reference

Hold ARM semihosting support. More...

Include dependency graph for arm_semihosting.c:

Go to the source code of this file.

Functions

int arm_semihosting (struct target *target, int *retval)
 Checks for and processes an ARM semihosting request. More...
 
int arm_semihosting_init (struct target *target)
 Initialize ARM semihosting support. More...
 
static int arm_semihosting_resume (struct target *target, int *retval)
 
static int post_result (struct target *target)
 

Detailed Description

Hold ARM semihosting support.

Semihosting enables code running on an ARM target to use the I/O facilities on the host computer. The target application must be linked against a library that forwards operation requests by using the SVC instruction trapped at the Supervisor Call vector by the debugger. Details can be found in chapter 8 of DUI0203I_rvct_developer_guide.pdf from ARM Ltd.

Definition in file arm_semihosting.c.

Function Documentation

◆ arm_semihosting()

int arm_semihosting ( struct target target,
int *  retval 
)

Checks for and processes an ARM 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 ARM target to process. This target must not represent an ARMv6-M or ARMv7-M processor.
retvalPointer to a location where the return code will be stored
Returns
non-zero value if a request was processed or an error encountered

Definition at line 172 of file arm_semihosting.c.

References armv7a_common::arm, ARM_MODE_SVC, arm_reg_current(), arm_semihosting_resume(), ARM_STATE_AARCH64, ARM_STATE_ARM, ARM_STATE_THUMB, ARMV4_5_MRC, buf_get_u32(), buf_get_u64(), arm::core_cache, arm::core_mode, arm::core_state, DBG_REASON_BREAKPOINT, target::debug_reason, arm::dpm, ERROR_FAIL, ERROR_OK, arm_dpm::finish, semihosting::hit_fileio, arm_dpm::instr_read_data_r0, semihosting::is_active, is_arm7_9(), is_armv7a(), is_armv7m(), is_armv8(), semihosting::is_resumable, LOG_ERROR, semihosting::op, semihosting::param, arm::pc, arm_dpm::prepare, reg_cache::reg_list, target::semihosting, semihosting_common(), arm::spsr, target_buffer_get_u16(), target_buffer_get_u32(), target_read_memory(), target_read_u16(), target_read_u32(), target_to_arm(), target_to_arm7_9(), target_to_armv7a(), target_to_armv7m(), target_to_armv8(), reg::valid, reg::value, and semihosting::word_size_bytes.

Referenced by aarch64_poll(), adapter_poll(), arm7_9_poll(), cortex_a_poll(), and cortex_m_poll().

◆ arm_semihosting_init()

int arm_semihosting_init ( struct target target)

Initialize ARM semihosting support.

Parameters
targetPointer to the ARM target to initialize.
Returns
An error status if there is a problem during initialization.

Definition at line 150 of file arm_semihosting.c.

References ERROR_OK, post_result(), semihosting_common_init(), arm::setup_semihosting, and target_to_arm().

Referenced by aarch64_init_target(), adapter_init_target(), arm7tdmi_init_target(), arm9tdmi_init_target(), cortex_a_init_target(), and cortex_m_init_target().

◆ arm_semihosting_resume()

static int arm_semihosting_resume ( struct target target,
int *  retval 
)
static

◆ post_result()