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

Go to the source code of this file.

Data Structures

struct  fast_load
 

Macros

#define DEFAULT_HALT_TIMEOUT   5000
 

Typedefs

typedef int(* target_write_fn) (struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
 
typedef unsigned char UNIT[2]
 

Enumerations

enum  target_cfg_param {
  TCFG_TYPE , TCFG_EVENT , TCFG_WORK_AREA_VIRT , TCFG_WORK_AREA_PHYS ,
  TCFG_WORK_AREA_SIZE , TCFG_WORK_AREA_BACKUP , TCFG_ENDIAN , TCFG_COREID ,
  TCFG_CHAIN_POSITION , TCFG_DBGBASE , TCFG_RTOS , TCFG_DEFER_EXAMINE ,
  TCFG_GDB_PORT , TCFG_GDB_MAX_CONNECTIONS
}
 
enum  verify_mode { IMAGE_TEST = 0 , IMAGE_VERIFY = 1 , IMAGE_CHECKSUM_ONLY = 2 }
 

Functions

static struct target_list__attribute__ ((warn_unused_result))
 
static void append_to_list_all_targets (struct target *target)
 
static void binprint (struct command_invocation *cmd, const char *text, const uint8_t *buf, int size)
 
 COMMAND_HANDLER (handle_bp_command)
 
 COMMAND_HANDLER (handle_dump_image_command)
 
 COMMAND_HANDLER (handle_fast_load_command)
 
 COMMAND_HANDLER (handle_fast_load_image_command)
 
 COMMAND_HANDLER (handle_halt_command)
 
 COMMAND_HANDLER (handle_load_image_command)
 
 COMMAND_HANDLER (handle_md_command)
 
 COMMAND_HANDLER (handle_mw_command)
 
 COMMAND_HANDLER (handle_poll_command)
 
 COMMAND_HANDLER (handle_profile_command)
 
 COMMAND_HANDLER (handle_ps_command)
 
 COMMAND_HANDLER (handle_rbp_command)
 
 COMMAND_HANDLER (handle_reg_command)
 
 COMMAND_HANDLER (handle_reset_command)
 
 COMMAND_HANDLER (handle_resume_command)
 
 COMMAND_HANDLER (handle_rwp_command)
 
 COMMAND_HANDLER (handle_soft_reset_halt_command)
 
 COMMAND_HANDLER (handle_step_command)
 
 COMMAND_HANDLER (handle_target_event_list)
 
 COMMAND_HANDLER (handle_target_init_command)
 
 COMMAND_HANDLER (handle_target_reset_nag)
 
 COMMAND_HANDLER (handle_targets_command)
 
 COMMAND_HANDLER (handle_test_image_command)
 
 COMMAND_HANDLER (handle_test_mem_access_command)
 
 COMMAND_HANDLER (handle_verify_image_checksum_command)
 
 COMMAND_HANDLER (handle_verify_image_command)
 
 COMMAND_HANDLER (handle_virt2phys_command)
 Translate a virtual address to a physical address. More...
 
 COMMAND_HANDLER (handle_wait_halt_command)
 
 COMMAND_HANDLER (handle_wp_command)
 
static COMMAND_HELPER (handle_verify_image_command_internal, enum verify_mode verify)
 
static COMMAND_HELPER (parse_load_image_command, struct image *image, target_addr_t *min_address, target_addr_t *max_address)
 
const char * debug_reason_name (struct target *t)
 
static int default_check_reset (struct target *target)
 
static int default_examine (struct target *target)
 
static int find_target (struct command_invocation *cmd, const char *name)
 
static void free_fastload (void)
 
struct targetget_current_target (struct command_context *cmd_ctx)
 
struct targetget_current_target_or_null (struct command_context *cmd_ctx)
 
struct targetget_target (const char *id)
 
struct targetget_target_by_num (int num)
 
bool get_target_reset_nag (void)
 
static int get_target_with_common_rtos_type (struct list_head *lh, struct target **result)
 
static int get_u64_array_element (Jim_Interp *interp, const char *varname, size_t idx, uint64_t *val)
 
static int handle_bp_command_list (struct command_invocation *cmd)
 
static int handle_bp_command_set (struct command_invocation *cmd, target_addr_t addr, uint32_t asid, uint32_t length, int hw)
 
static int handle_target (void *priv)
 
static int identity_virt2phys (struct target *target, target_addr_t virtual, target_addr_t *physical)
 
static int jim_target_array2mem (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_target_configure (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_target_create (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_target_current (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_target_current_state (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_target_examine (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_target_examine_deferred (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_target_halt (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_target_halt_gdb (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_target_invoke_event (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_target_mem2array (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_target_names (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_target_poll (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_target_reset (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_target_smp (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_target_tap_disabled (Jim_Interp *interp)
 
static int jim_target_types (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_target_wait_state (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jim_target_was_examined (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int jtag_enable_callback (enum jtag_event event, void *priv)
 
static LIST_HEAD (empty_smp_targets)
 
static LIST_HEAD (target_reset_callback_list)
 
static LIST_HEAD (target_trace_callback_list)
 
static int new_target_number (void)
 
static int new_u64_array_element (Jim_Interp *interp, const char *varname, int idx, uint64_t val)
 
static int no_mmu (struct target *target, int *enabled)
 
static void print_wa_layout (struct target *target)
 
static int sense_handler (void)
 
int target_add_breakpoint (struct target *target, struct breakpoint *breakpoint)
 Add the breakpoint for target. More...
 
int target_add_context_breakpoint (struct target *target, struct breakpoint *breakpoint)
 Add the ContextID breakpoint for target. More...
 
int target_add_hybrid_breakpoint (struct target *target, struct breakpoint *breakpoint)
 Add the ContextID & IVA breakpoint for target. More...
 
int target_add_watchpoint (struct target *target, struct watchpoint *watchpoint)
 Add the watchpoint for target. More...
 
unsigned target_address_bits (struct target *target)
 Return the number of address bits this target supports. More...
 
target_addr_t target_address_max (struct target *target)
 Return the highest accessible address for this target. More...
 
int target_alloc_working_area (struct target *target, uint32_t size, struct working_area **area)
 
int target_alloc_working_area_try (struct target *target, uint32_t size, struct working_area **area)
 
int target_arch_state (struct target *target)
 
static int target_array2mem (Jim_Interp *interp, struct target *target, int argc, Jim_Obj *const *argv)
 
int target_blank_check_memory (struct target *target, struct target_memory_check_block *blocks, int num_blocks, uint8_t erased_value)
 
uint16_t target_buffer_get_u16 (struct target *target, const uint8_t *buffer)
 
void target_buffer_get_u16_array (struct target *target, const uint8_t *buffer, uint32_t count, uint16_t *dstbuf)
 
uint32_t target_buffer_get_u24 (struct target *target, const uint8_t *buffer)
 
uint32_t target_buffer_get_u32 (struct target *target, const uint8_t *buffer)
 
void target_buffer_get_u32_array (struct target *target, const uint8_t *buffer, uint32_t count, uint32_t *dstbuf)
 
uint64_t target_buffer_get_u64 (struct target *target, const uint8_t *buffer)
 
void target_buffer_get_u64_array (struct target *target, const uint8_t *buffer, uint32_t count, uint64_t *dstbuf)
 
void target_buffer_set_u16 (struct target *target, uint8_t *buffer, uint16_t value)
 
void target_buffer_set_u16_array (struct target *target, uint8_t *buffer, uint32_t count, const uint16_t *srcbuf)
 
void target_buffer_set_u24 (struct target *target, uint8_t *buffer, uint32_t value)
 
void target_buffer_set_u32 (struct target *target, uint8_t *buffer, uint32_t value)
 
void target_buffer_set_u32_array (struct target *target, uint8_t *buffer, uint32_t count, const uint32_t *srcbuf)
 
void target_buffer_set_u64 (struct target *target, uint8_t *buffer, uint64_t value)
 
void target_buffer_set_u64_array (struct target *target, uint8_t *buffer, uint32_t count, const uint64_t *srcbuf)
 
static void target_buffer_set_u8 (struct target *target, uint8_t *buffer, uint8_t value)
 
int target_call_event_callbacks (struct target *target, enum target_event event)
 
int target_call_reset_callbacks (struct target *target, enum target_reset_mode reset_mode)
 
static int target_call_timer_callback (struct target_timer_callback *cb, int64_t *now)
 
int target_call_timer_callbacks ()
 
static int target_call_timer_callbacks_check_time (int checktime)
 
int target_call_timer_callbacks_now ()
 Invoke this to ensure that e.g. More...
 
int target_call_trace_callbacks (struct target *target, size_t len, uint8_t *data)
 
int target_checksum_memory (struct target *target, target_addr_t address, uint32_t size, uint32_t *crc)
 
static int target_configure (struct jim_getopt_info *goi, struct target *target)
 
static int target_create (struct jim_getopt_info *goi)
 
unsigned int target_data_bits (struct target *target)
 Return the number of data bits this target supports. More...
 
static void target_destroy (struct target *target)
 
const char * target_event_name (enum target_event event)
 Return the name of a target event enumeration value. More...
 
int target_examine (void)
 
int target_examine_one (struct target *target)
 Examine the specified target, letting it perform any Initialisation that requires JTAG access. More...
 
static int target_fill_mem (struct target *target, target_addr_t address, target_write_fn fn, unsigned data_size, uint64_t b, unsigned c)
 
void target_free_all_working_areas (struct target *target)
 
static void target_free_all_working_areas_restore (struct target *target, int restore)
 
int target_free_working_area (struct target *target, struct working_area *area)
 Free a working area. More...
 
static int target_free_working_area_restore (struct target *target, struct working_area *area, int restore)
 
int target_gdb_fileio_end (struct target *target, int retcode, int fileio_errno, bool ctrl_c)
 Pass GDB file-I/O response to target after finishing host syscall. More...
 
static int target_gdb_fileio_end_default (struct target *target, int retcode, int fileio_errno, bool ctrl_c)
 
const char * target_get_gdb_arch (struct target *target)
 Obtain the architecture for GDB. More...
 
int target_get_gdb_fileio_info (struct target *target, struct gdb_fileio_info *fileio_info)
 Obtain file-I/O information from target for GDB to do syscall. More...
 
static int target_get_gdb_fileio_info_default (struct target *target, struct gdb_fileio_info *fileio_info)
 
int target_get_gdb_reg_list (struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
 Obtain the registers for GDB. More...
 
int target_get_gdb_reg_list_noread (struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
 Obtain the registers for GDB, but don't read register values from the target. More...
 
uint32_t target_get_working_area_avail (struct target *target)
 
int target_halt (struct target *target)
 
void target_handle_event (struct target *target, enum target_event e)
 
void target_handle_md_output (struct command_invocation *cmd, struct target *target, target_addr_t address, unsigned size, unsigned count, const uint8_t *buffer)
 
bool target_has_event_action (struct target *target, enum target_event event)
 Returns true only if the target has a handler for the specified event. More...
 
int target_hit_watchpoint (struct target *target, struct watchpoint **hit_watchpoint)
 Find out the just hit watchpoint for target. More...
 
static int target_init (struct command_context *cmd_ctx)
 
static int target_init_one (struct command_context *cmd_ctx, struct target *target)
 
static int target_jim_get_reg (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int target_jim_read_memory (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int target_jim_set_reg (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int target_jim_write_memory (Jim_Interp *interp, int argc, Jim_Obj *const *argv)
 
static int target_mem2array (Jim_Interp *interp, struct target *target, int argc, Jim_Obj *const *argv)
 
static void target_merge_working_areas (struct target *target)
 
int target_poll (struct target *target)
 
static int target_process_reset (struct command_invocation *cmd, enum target_reset_mode reset_mode)
 
static int target_profiling (struct target *target, uint32_t *samples, uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds)
 
int target_profiling_default (struct target *target, uint32_t *samples, uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds)
 
void target_quit (void)
 Free all the resources allocated by targets and the target layer. More...
 
int target_read_buffer (struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
 
static int target_read_buffer_default (struct target *target, target_addr_t address, uint32_t count, uint8_t *buffer)
 
int target_read_memory (struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
 Read count items of size bytes from the memory of target at the address given. More...
 
int target_read_phys_memory (struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
 
int target_read_u16 (struct target *target, target_addr_t address, uint16_t *value)
 
int target_read_u32 (struct target *target, target_addr_t address, uint32_t *value)
 
int target_read_u64 (struct target *target, target_addr_t address, uint64_t *value)
 
int target_read_u8 (struct target *target, target_addr_t address, uint8_t *value)
 
int target_register_commands (struct command_context *cmd_ctx)
 
int target_register_event_callback (int(*callback)(struct target *target, enum target_event event, void *priv), void *priv)
 
int target_register_reset_callback (int(*callback)(struct target *target, enum target_reset_mode reset_mode, void *priv), void *priv)
 
int target_register_timer_callback (int(*callback)(void *priv), unsigned int time_ms, enum target_timer_type type, void *priv)
 The period is very approximate, the callback can happen much more often or much more rarely than specified. More...
 
int target_register_trace_callback (int(*callback)(struct target *target, size_t len, uint8_t *data, void *priv), void *priv)
 
static int target_register_user_commands (struct command_context *cmd_ctx)
 
int target_remove_breakpoint (struct target *target, struct breakpoint *breakpoint)
 Remove the breakpoint for target. More...
 
int target_remove_watchpoint (struct target *target, struct watchpoint *watchpoint)
 Remove the watchpoint for target. More...
 
static void target_reset_examined (struct target *target)
 Reset the examined flag for the given target. More...
 
const char * target_reset_mode_name (enum target_reset_mode reset_mode)
 Return the name of a target reset reason enumeration value. More...
 
static int target_restore_working_area (struct target *target, struct working_area *area)
 
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 modifications). More...
 
int target_run_algorithm (struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_param, target_addr_t entry_point, target_addr_t exit_point, int timeout_ms, void *arch_info)
 Downloads a target-specific native code algorithm to the target, and executes it. More...
 
int target_run_flash_async_algorithm (struct target *target, const uint8_t *buffer, uint32_t count, int block_size, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, uint32_t buffer_start, uint32_t buffer_size, uint32_t entry_point, uint32_t exit_point, void *arch_info)
 Streams data to a circular buffer on target intended for consumption by code running asynchronously on target. More...
 
int target_run_read_async_algorithm (struct target *target, uint8_t *buffer, uint32_t count, int block_size, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, uint32_t buffer_start, uint32_t buffer_size, uint32_t entry_point, uint32_t exit_point, void *arch_info)
 This routine is a wrapper for asynchronous algorithms. More...
 
static int target_soft_reset_halt (struct target *target)
 
static void target_split_working_area (struct working_area *area, uint32_t size)
 
int target_start_algorithm (struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, target_addr_t entry_point, target_addr_t exit_point, void *arch_info)
 Executes a target-specific native code algorithm and leaves it running. More...
 
const char * target_state_name (struct target *t)
 Return the name of this targets current state. More...
 
int target_step (struct target *target, int current, target_addr_t address, int handle_breakpoints)
 Step the target. More...
 
static const char * target_strerror_safe (int err)
 
bool target_supports_gdb_connection (struct target *target)
 Check if target allows GDB connections. More...
 
static int target_timer_callback_periodic_restart (struct target_timer_callback *cb, int64_t *now)
 
int64_t target_timer_next_event (void)
 Returns when the next registered event will take place. More...
 
const char * target_type_name (struct target *target)
 Get the target type name. More...
 
int target_unregister_event_callback (int(*callback)(struct target *target, enum target_event event, void *priv), void *priv)
 
int target_unregister_reset_callback (int(*callback)(struct target *target, enum target_reset_mode reset_mode, void *priv), void *priv)
 
int target_unregister_timer_callback (int(*callback)(void *priv), void *priv)
 
int target_unregister_trace_callback (int(*callback)(struct target *target, size_t len, uint8_t *data, void *priv), void *priv)
 
int target_wait_algorithm (struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, target_addr_t exit_point, int timeout_ms, void *arch_info)
 Waits for an algorithm started with target_start_algorithm() to complete. More...
 
int target_wait_state (struct target *target, enum target_state state, int ms)
 
int target_write_buffer (struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)
 
static int target_write_buffer_default (struct target *target, target_addr_t address, uint32_t count, const uint8_t *buffer)
 
int target_write_memory (struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
 Write count items of size bytes to the memory of target at the address given. More...
 
int target_write_phys_memory (struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
 
int target_write_phys_u16 (struct target *target, target_addr_t address, uint16_t value)
 
int target_write_phys_u32 (struct target *target, target_addr_t address, uint32_t value)
 
int target_write_phys_u64 (struct target *target, target_addr_t address, uint64_t value)
 
int target_write_phys_u8 (struct target *target, target_addr_t address, uint8_t value)
 
int target_write_u16 (struct target *target, target_addr_t address, uint16_t value)
 
int target_write_u32 (struct target *target, target_addr_t address, uint32_t value)
 
int target_write_u64 (struct target *target, target_addr_t address, uint64_t value)
 
int target_write_u8 (struct target *target, target_addr_t address, uint8_t value)
 
static void write_data (FILE *f, const void *data, size_t len)
 
static void write_gmon (uint32_t *samples, uint32_t sample_num, const char *filename, bool with_range, uint32_t start_address, uint32_t end_address, struct target *target, uint32_t duration_ms)
 
static void write_long (FILE *f, int l, struct target *target)
 
static void write_string (FILE *f, char *s)
 

Variables

struct target_type aarch64_target
 
struct targetall_targets
 
struct target_type arcv2_target
 
struct target_type arm11_target
 Holds methods for ARM11xx targets. More...
 
struct target_type arm720t_target
 Holds methods for ARM720 targets. More...
 
struct target_type arm7tdmi_target
 Holds methods for ARM7TDMI targets. More...
 
struct target_type arm920t_target
 Holds methods for ARM920 targets. More...
 
struct target_type arm926ejs_target
 Holds methods for ARM926 targets. More...
 
struct target_type arm946e_target
 Holds methods for ARM946 targets. More...
 
struct target_type arm966e_target
 Holds methods for ARM966 targets. More...
 
struct target_type arm9tdmi_target
 Holds methods for ARM9TDMI targets. More...
 
struct target_type avr32_ap7k_target
 
struct target_type avr_target
 
struct target_type cortexa_target
 
struct target_type cortexm_target
 
struct target_type cortexr4_target
 
struct target_type dragonite_target
 
struct target_type dsp563xx_target
 Holds methods for DSP563XX targets. More...
 
struct target_type dsp5680xx_target
 Holds methods for dsp5680xx targets. More...
 
struct target_type esirisc_target
 
struct target_type esp32_target
 Holds methods for Xtensa targets. More...
 
struct target_type esp32s2_target
 
struct target_type esp32s3_target
 Holds methods for Xtensa targets. More...
 
struct target_type fa526_target
 Holds methods for FA526 targets. More...
 
static struct fast_loadfastload
 
static int fastload_num
 
struct target_type feroceon_target
 
struct target_type hla_target
 
struct target_type ls1_sap_target
 
struct target_type mem_ap_target
 
struct target_type mips_m4k_target
 
struct target_type mips_mips64_target
 
struct target_type nds32_v2_target
 Holds methods for V2 targets. More...
 
struct target_type nds32_v3_target
 Holds methods for Andes1337 targets. More...
 
struct target_type nds32_v3m_target
 Holds methods for NDS32 V3m targets. More...
 
static const struct jim_nvp nvp_assert []
 
static struct jim_nvp nvp_config_opts []
 
static const struct jim_nvp nvp_error_target []
 
static const struct jim_nvp nvp_reset_modes []
 
static const struct jim_nvp nvp_target_debug_reason []
 
static const struct jim_nvp nvp_target_endian []
 
static const struct jim_nvp nvp_target_event []
 
static const struct jim_nvp nvp_target_state []
 
struct target_type or1k_target
 
static const int polling_interval = TARGET_DEFAULT_POLLING_INTERVAL
 
static int power_dropout
 
struct target_type quark_d20xx_target
 
struct target_type quark_x10xx_target
 
struct target_type riscv_target
 
static int run_power_dropout
 
static int run_power_restore
 
static int run_srst_asserted
 
static int run_srst_deasserted
 
static int srst_asserted
 
struct target_type stm8_target
 
static const struct command_registration target_command_handlers []
 
static struct target_event_callbacktarget_event_callbacks
 
static const struct command_registration target_exec_command_handlers []
 
static const struct command_registration target_instance_command_handlers []
 
static bool target_reset_nag = true
 
static const struct command_registration target_subcommand_handlers []
 
static struct target_timer_callbacktarget_timer_callbacks
 
static int64_t target_timer_next_event_value
 
static struct target_typetarget_types []
 
struct target_type testee_target
 
struct target_type xscale_target
 
struct target_type xtensa_chip_target
 Methods for generic example of Xtensa-based chip-level targets. More...
 

Macro Definition Documentation

◆ DEFAULT_HALT_TIMEOUT

#define DEFAULT_HALT_TIMEOUT   5000

Definition at line 52 of file target.c.

Typedef Documentation

◆ target_write_fn

typedef int(* target_write_fn) (struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)

Definition at line 3521 of file target.c.

◆ UNIT

typedef unsigned char UNIT[2]

Definition at line 4217 of file target.c.

Enumeration Type Documentation

◆ target_cfg_param

Enumerator
TCFG_TYPE 
TCFG_EVENT 
TCFG_WORK_AREA_VIRT 
TCFG_WORK_AREA_PHYS 
TCFG_WORK_AREA_SIZE 
TCFG_WORK_AREA_BACKUP 
TCFG_ENDIAN 
TCFG_COREID 
TCFG_CHAIN_POSITION 
TCFG_DBGBASE 
TCFG_RTOS 
TCFG_DEFER_EXAMINE 
TCFG_GDB_PORT 
TCFG_GDB_MAX_CONNECTIONS 

Definition at line 5298 of file target.c.

◆ verify_mode

Enumerator
IMAGE_TEST 
IMAGE_VERIFY 
IMAGE_CHECKSUM_ONLY 

Definition at line 3805 of file target.c.

Function Documentation

◆ __attribute__()

static struct target_list* __attribute__ ( (warn_unused_result)  )
static

Definition at line 6449 of file target.c.

References get_target(), LOG_DEBUG, LOG_ERROR, name, NULL, and target.

◆ append_to_list_all_targets()

static void append_to_list_all_targets ( struct target target)
static

Definition at line 356 of file target.c.

References all_targets, and target.

Referenced by target_create().

◆ binprint()

static void binprint ( struct command_invocation cmd,
const char *  text,
const uint8_t *  buf,
int  size 
)
static

Definition at line 6797 of file target.c.

References cmd, command_print(), command_print_sameline(), and size.

Referenced by COMMAND_HANDLER().

◆ COMMAND_HANDLER() [1/29]

◆ COMMAND_HANDLER() [2/29]

◆ COMMAND_HANDLER() [3/29]

◆ COMMAND_HANDLER() [4/29]

◆ COMMAND_HANDLER() [5/29]

COMMAND_HANDLER ( handle_halt_command  )

◆ COMMAND_HANDLER() [6/29]

◆ COMMAND_HANDLER() [7/29]

◆ COMMAND_HANDLER() [8/29]

◆ COMMAND_HANDLER() [9/29]

◆ COMMAND_HANDLER() [10/29]

COMMAND_HANDLER ( handle_profile_command  )

Some cores let us sample the PC without the annoying halt/resume step; for example, ARMv7 PCSR. Provide a way to use that more efficient mechanism.

Definition at line 4327 of file target.c.

References CMD, CMD_ARGC, CMD_ARGV, CMD_CTX, COMMAND_PARSE_NUMBER, command_print(), ERROR_COMMAND_ARGUMENT_INVALID, ERROR_COMMAND_SYNTAX_ERROR, ERROR_FAIL, ERROR_OK, get_current_target(), LOG_ERROR, offset, target::state, target_halt(), TARGET_HALTED, target_poll(), target_profiling(), target_resume(), TARGET_RUNNING, timeval_ms(), and write_gmon().

◆ COMMAND_HANDLER() [11/29]

COMMAND_HANDLER ( handle_ps_command  )

◆ COMMAND_HANDLER() [12/29]

COMMAND_HANDLER ( handle_rbp_command  )

◆ COMMAND_HANDLER() [13/29]

◆ COMMAND_HANDLER() [14/29]

◆ COMMAND_HANDLER() [15/29]

COMMAND_HANDLER ( handle_resume_command  )

◆ COMMAND_HANDLER() [16/29]

COMMAND_HANDLER ( handle_rwp_command  )

◆ COMMAND_HANDLER() [17/29]

COMMAND_HANDLER ( handle_soft_reset_halt_command  )

◆ COMMAND_HANDLER() [18/29]

COMMAND_HANDLER ( handle_step_command  )

◆ COMMAND_HANDLER() [19/29]

◆ COMMAND_HANDLER() [20/29]

COMMAND_HANDLER ( handle_target_init_command  )

◆ COMMAND_HANDLER() [21/29]

COMMAND_HANDLER ( handle_target_reset_nag  )

Definition at line 6769 of file target.c.

References CALL_COMMAND_HANDLER, and target_reset_nag.

◆ COMMAND_HANDLER() [22/29]

◆ COMMAND_HANDLER() [23/29]

COMMAND_HANDLER ( handle_test_image_command  )

Definition at line 3954 of file target.c.

References CALL_COMMAND_HANDLER, and IMAGE_TEST.

◆ COMMAND_HANDLER() [24/29]

◆ COMMAND_HANDLER() [25/29]

COMMAND_HANDLER ( handle_verify_image_checksum_command  )

Definition at line 3944 of file target.c.

References CALL_COMMAND_HANDLER, and IMAGE_CHECKSUM_ONLY.

◆ COMMAND_HANDLER() [26/29]

COMMAND_HANDLER ( handle_verify_image_command  )

Definition at line 3949 of file target.c.

References CALL_COMMAND_HANDLER, and IMAGE_VERIFY.

◆ COMMAND_HANDLER() [27/29]

COMMAND_HANDLER ( handle_virt2phys_command  )

Translate a virtual address to a physical address.

The low-level target implementation must have logged a detailed error which is forwarded to telnet/GDB session.

Definition at line 4180 of file target.c.

References CMD, CMD_ARGC, CMD_ARGV, CMD_CTX, COMMAND_PARSE_ADDRESS, command_print(), ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, get_current_target(), TARGET_ADDR_FMT, target::type, and target_type::virt2phys.

◆ COMMAND_HANDLER() [28/29]

COMMAND_HANDLER ( handle_wait_halt_command  )

◆ COMMAND_HANDLER() [29/29]

◆ COMMAND_HELPER() [1/2]

◆ COMMAND_HELPER() [2/2]

static COMMAND_HELPER ( parse_load_image_command  ,
struct image image,
target_addr_t min_address,
target_addr_t max_address 
)
static

◆ debug_reason_name()

◆ default_check_reset()

static int default_check_reset ( struct target target)
static

Definition at line 743 of file target.c.

References ERROR_OK.

Referenced by target_init_one().

◆ default_examine()

static int default_examine ( struct target target)
static

Definition at line 736 of file target.c.

References ERROR_OK, and target_set_examined().

Referenced by target_init_one().

◆ find_target()

static int find_target ( struct command_invocation cmd,
const char *  name 
)
static

◆ free_fastload()

static void free_fastload ( void  )
static

Definition at line 6597 of file target.c.

References fast_load::data, fastload, fastload_num, and NULL.

Referenced by COMMAND_HANDLER().

◆ get_current_target()

◆ get_current_target_or_null()

struct target* get_current_target_or_null ( struct command_context cmd_ctx)

◆ get_target()

◆ get_target_by_num()

struct target* get_target_by_num ( int  num)

Definition at line 523 of file target.c.

References all_targets, target::next, NULL, target, and target::target_number.

◆ get_target_reset_nag()

bool get_target_reset_nag ( void  )

Definition at line 6764 of file target.c.

References target_reset_nag.

Referenced by arm7_9_check_reset().

◆ get_target_with_common_rtos_type()

static int get_target_with_common_rtos_type ( struct list_head lh,
struct target **  result 
)
static

Definition at line 6468 of file target.c.

References foreach_smp_target, lh(), LOG_ERROR, NULL, target::rtos, target, target_list::target, and rtos::type.

Referenced by jim_target_smp().

◆ get_u64_array_element()

static int get_u64_array_element ( Jim_Interp *  interp,
const char *  varname,
size_t  idx,
uint64_t *  val 
)
static

Definition at line 4756 of file target.c.

References alloc_printf().

Referenced by target_array2mem().

◆ handle_bp_command_list()

◆ handle_bp_command_set()

◆ handle_target()

◆ identity_virt2phys()

static int identity_virt2phys ( struct target target,
target_addr_t  virtual,
target_addr_t physical 
)
static

Definition at line 714 of file target.c.

References ERROR_OK.

Referenced by target_init_one().

◆ jim_target_array2mem()

static int jim_target_array2mem ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ jim_target_configure()

static int jim_target_configure ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ jim_target_create()

static int jim_target_create ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ jim_target_current()

static int jim_target_current ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ jim_target_current_state()

static int jim_target_current_state ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ jim_target_examine()

◆ jim_target_examine_deferred()

static int jim_target_examine_deferred ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ jim_target_halt()

static int jim_target_halt ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ jim_target_halt_gdb()

static int jim_target_halt_gdb ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ jim_target_invoke_event()

static int jim_target_invoke_event ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ jim_target_mem2array()

static int jim_target_mem2array ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ jim_target_names()

static int jim_target_names ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

Definition at line 6432 of file target.c.

References all_targets, target::next, NULL, and target_name().

◆ jim_target_poll()

static int jim_target_poll ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ jim_target_reset()

◆ jim_target_smp()

static int jim_target_smp ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ jim_target_tap_disabled()

static int jim_target_tap_disabled ( Jim_Interp *  interp)
static

◆ jim_target_types()

static int jim_target_types ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

Definition at line 6418 of file target.c.

References name, NULL, and target_types.

◆ jim_target_wait_state()

◆ jim_target_was_examined()

static int jim_target_was_examined ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ jtag_enable_callback()

static int jtag_enable_callback ( enum jtag_event  event,
void *  priv 
)
static

◆ LIST_HEAD() [1/3]

static LIST_HEAD ( empty_smp_targets  )
static

◆ LIST_HEAD() [2/3]

static LIST_HEAD ( target_reset_callback_list  )
static

◆ LIST_HEAD() [3/3]

static LIST_HEAD ( target_trace_callback_list  )
static

◆ new_target_number()

static int new_target_number ( void  )
static

Definition at line 340 of file target.c.

References all_targets, target::next, and target::target_number.

Referenced by target_create().

◆ new_u64_array_element()

static int new_u64_array_element ( Jim_Interp *  interp,
const char *  varname,
int  idx,
uint64_t  val 
)
static

Definition at line 4415 of file target.c.

References alloc_printf().

Referenced by target_mem2array().

◆ no_mmu()

static int no_mmu ( struct target target,
int *  enabled 
)
static

Definition at line 721 of file target.c.

References ERROR_OK.

Referenced by target_init_one().

◆ print_wa_layout()

◆ sense_handler()

static int sense_handler ( void  )
static

◆ target_add_breakpoint()

int target_add_breakpoint ( struct target target,
struct breakpoint breakpoint 
)

Add the breakpoint for target.

This routine is a wrapper for target->type->add_breakpoint.

Definition at line 1362 of file target.c.

References target_type::add_breakpoint, BKPT_HARD, ERROR_TARGET_NOT_HALTED, LOG_WARNING, target::state, TARGET_HALTED, target_name(), breakpoint::type, and target::type.

Referenced by breakpoint_add_internal(), and nds32_v3_leave_debug_state().

◆ target_add_context_breakpoint()

int target_add_context_breakpoint ( struct target target,
struct breakpoint breakpoint 
)

Add the ContextID breakpoint for target.

This routine is a wrapper for target->type->add_context_breakpoint.

Definition at line 1372 of file target.c.

References target_type::add_context_breakpoint, ERROR_TARGET_NOT_HALTED, LOG_WARNING, target::state, TARGET_HALTED, target_name(), and target::type.

Referenced by context_breakpoint_add_internal().

◆ target_add_hybrid_breakpoint()

int target_add_hybrid_breakpoint ( struct target target,
struct breakpoint breakpoint 
)

Add the ContextID & IVA breakpoint for target.

This routine is a wrapper for target->type->add_hybrid_breakpoint.

Definition at line 1382 of file target.c.

References target_type::add_hybrid_breakpoint, ERROR_TARGET_NOT_HALTED, LOG_WARNING, target::state, TARGET_HALTED, target_name(), and target::type.

Referenced by hybrid_breakpoint_add_internal().

◆ target_add_watchpoint()

int target_add_watchpoint ( struct target target,
struct watchpoint watchpoint 
)

Add the watchpoint for target.

This routine is a wrapper for target->type->add_watchpoint.

Definition at line 1398 of file target.c.

References target_type::add_watchpoint, ERROR_TARGET_NOT_HALTED, LOG_WARNING, target::state, TARGET_HALTED, target_name(), and target::type.

Referenced by watchpoint_add_internal().

◆ target_address_bits()

unsigned target_address_bits ( struct target target)

Return the number of address bits this target supports.

This routine is a wrapper for target->type->address_bits.

Definition at line 1522 of file target.c.

References target_type::address_bits, and target::type.

Referenced by stm32x_get_property_addr(), and target_address_max().

◆ target_address_max()

target_addr_t target_address_max ( struct target target)

Return the highest accessible address for this target.

Definition at line 1513 of file target.c.

References bits, and target_address_bits().

Referenced by gdb_memory_map().

◆ target_alloc_working_area()

int target_alloc_working_area ( struct target target,
uint32_t  size,
struct working_area **  area 
)

Definition at line 2129 of file target.c.

References ERROR_TARGET_RESOURCE_NOT_AVAILABLE, LOG_WARNING, size, and target_alloc_working_area_try().

Referenced by aduc702x_write_block(), aducm360_write_block_async(), aducm360_write_block_sync(), arm7_9_bulk_write_memory(), arm_blank_check_memory(), arm_checksum_memory(), arm_code_to_working_area(), armv7m_blank_check_memory(), armv7m_checksum_memory(), bluenrgx_write(), cc26xx_init(), cc3220sf_write(), cfi_intel_write_block(), cfi_spansion_write_block(), cfi_spansion_write_block_mips(), COMMAND_HANDLER(), efm32x_write_block(), em357_write_block(), feroceon_bulk_write_memory(), fespi_write(), fm3_chip_erase(), fm3_erase(), fm3_write_block(), fm4_flash_erase(), fm4_flash_write(), kinetis_disable_wdog_algo(), kinetis_ke_stop_watchdog(), kinetis_ke_write_words(), kinetis_write_block(), lpc2000_iap_working_area_init(), lpc2000_write(), lpc3180_read_page(), lpc3180_write_page(), lpc32xx_read_page(), lpc32xx_write_page(), lpcspifi_erase(), lpcspifi_set_hw_mode(), lpcspifi_write(), max32xxx_write_block(), mdr_write_block(), mips32_blank_check_memory(), mips32_checksum_memory(), mips_m4k_bulk_write_memory(), mips_mips64_bulk_write_memory(), mrvlqspi_flash_write(), msp432_init(), niietcm4_write_block(), npcx_init(), nrf5_ll_flash_write(), numicro_writeblock(), pic32mx_write_block(), psoc4_sysreq(), psoc5lp_write(), psoc6_erase(), psoc6_program_row(), riscv_checksum_memory(), rp2040_flash_write(), rp2040_stack_grab_and_prep(), rsl10_ll_flash_erase(), rsl10_ll_flash_write(), rsl10_mass_erase(), scratch_reserve(), sh_qspi_upload_helper(), sim3x_write_block(), sromalgo_prepare(), stellaris_write_block(), stm32l4_write_block(), stm32lx_write_half_pages(), stm32x_write_block(), stm32x_write_block_async(), stm32x_write_block_riscv(), stm8_blank_check_memory(), str9x_write_block(), xmc1xxx_erase(), xmc1xxx_erase_check(), and xmc1xxx_write().

◆ target_alloc_working_area_try()

◆ target_arch_state()

int target_arch_state ( struct target target)

◆ target_array2mem()

static int target_array2mem ( Jim_Interp *  interp,
struct target target,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ target_blank_check_memory()

int target_blank_check_memory ( struct target target,
struct target_memory_check_block blocks,
int  num_blocks,
uint8_t  erased_value 
)

◆ target_buffer_get_u16()

◆ target_buffer_get_u16_array()

void target_buffer_get_u16_array ( struct target target,
const uint8_t *  buffer,
uint32_t  count,
uint16_t *  dstbuf 
)

Definition at line 460 of file target.c.

References buffer, count, and target_buffer_get_u16().

Referenced by arc_mem_write(), mips_m4k_write_memory(), and mips_mips64_write_memory().

◆ target_buffer_get_u24()

uint32_t target_buffer_get_u24 ( struct target target,
const uint8_t *  buffer 
)

Definition at line 384 of file target.c.

References be_to_h_u24(), buffer, target::endianness, le_to_h_u24(), and TARGET_LITTLE_ENDIAN.

◆ target_buffer_get_u32()

◆ target_buffer_get_u32_array()

void target_buffer_get_u32_array ( struct target target,
const uint8_t *  buffer,
uint32_t  count,
uint32_t *  dstbuf 
)

◆ target_buffer_get_u64()

◆ target_buffer_get_u64_array()

void target_buffer_get_u64_array ( struct target target,
const uint8_t *  buffer,
uint32_t  count,
uint64_t *  dstbuf 
)

Definition at line 444 of file target.c.

References buffer, count, and target_buffer_get_u64().

Referenced by mips_mips64_bulk_write_memory(), and mips_mips64_write_memory().

◆ target_buffer_set_u16()

◆ target_buffer_set_u16_array()

void target_buffer_set_u16_array ( struct target target,
uint8_t *  buffer,
uint32_t  count,
const uint16_t *  srcbuf 
)

Definition at line 484 of file target.c.

References buffer, count, and target_buffer_set_u16().

Referenced by mips_m4k_read_memory(), and mips_mips64_read_memory().

◆ target_buffer_set_u24()

void target_buffer_set_u24 ( struct target target,
uint8_t *  buffer,
uint32_t  value 
)

Definition at line 420 of file target.c.

References buffer, target::endianness, h_u24_to_be(), h_u24_to_le(), and TARGET_LITTLE_ENDIAN.

◆ target_buffer_set_u32()

◆ target_buffer_set_u32_array()

◆ target_buffer_set_u64()

◆ target_buffer_set_u64_array()

void target_buffer_set_u64_array ( struct target target,
uint8_t *  buffer,
uint32_t  count,
const uint64_t *  srcbuf 
)

Definition at line 468 of file target.c.

References buffer, count, and target_buffer_set_u64().

Referenced by mips_mips64_read_memory().

◆ target_buffer_set_u8()

static void target_buffer_set_u8 ( struct target target,
uint8_t *  buffer,
uint8_t  value 
)
static

Definition at line 438 of file target.c.

References buffer.

Referenced by target_fill_mem().

◆ target_call_event_callbacks()

int target_call_event_callbacks ( struct target target,
enum target_event  event 
)

Definition at line 1833 of file target.c.

References target_event_callback::callback, ERROR_OK, LOG_DEBUG, target_event_callbacks, TARGET_EVENT_GDB_HALT, TARGET_EVENT_HALTED, target_event_name(), target_handle_event(), and target_name().

Referenced by aarch64_poll(), aarch64_resume(), aarch64_step(), aarch64_step_restart_smp(), adapter_poll(), adapter_resume(), adapter_step(), arc_halt(), arc_poll(), arc_resume(), arc_step(), arm11_halt(), arm11_poll(), arm11_resume(), arm11_step(), arm720t_soft_reset_halt(), arm7_9_poll(), arm7_9_resume(), arm7_9_soft_reset_halt(), arm7_9_step(), arm920t_soft_reset_halt(), arm926ejs_soft_reset_halt(), avr32_ap7k_poll(), avr32_ap7k_resume(), cortex_a_poll(), cortex_a_resume(), cortex_m_poll(), cortex_m_resume(), cortex_m_step(), do_resume(), dsp563xx_poll(), dsp563xx_resume(), dsp563xx_step(), esirisc_poll(), esirisc_resume_or_step(), esp32s2_poll(), esp32s2_step(), esp_xtensa_smp_poll(), esp_xtensa_smp_resume(), esp_xtensa_smp_step(), gdb_connection_closed(), gdb_handle_vcont_packet(), gdb_input_inner(), gdb_new_connection(), gdb_target_callback_event_handler(), gdb_v_packet(), halt_finish(), handle_halt(), handle_target(), jim_target_halt_gdb(), lakemont_poll(), lakemont_step(), lakemont_update_after_probemode_entry(), mem_ap_deassert_reset(), mem_ap_halt(), mem_ap_step(), mips_m4k_internal_restore(), mips_m4k_poll(), mips_m4k_resume(), mips_m4k_step(), mips_mips64_poll(), mips_mips64_resume(), mips_mips64_step(), nds32_halt(), nds32_poll(), nds32_resume(), nds32_step(), or1k_poll(), or1k_resume_or_step(), resume_finish(), riscv_openocd_poll(), riscv_openocd_step(), semihosting_common(), stm8_poll(), stm8_resume(), stm8_step(), target_examine_one(), target_poll(), target_resume(), target_step(), xscale_poll(), xscale_resume(), xscale_step(), xscale_step_inner(), xtensa_chip_poll(), xtensa_resume(), and xtensa_step().

◆ target_call_reset_callbacks()

int target_call_reset_callbacks ( struct target target,
enum target_reset_mode  reset_mode 
)

◆ target_call_timer_callback()

◆ target_call_timer_callbacks()

int target_call_timer_callbacks ( void  )

Definition at line 1947 of file target.c.

References target_call_timer_callbacks_check_time().

Referenced by server_loop().

◆ target_call_timer_callbacks_check_time()

◆ target_call_timer_callbacks_now()

int target_call_timer_callbacks_now ( void  )

Invoke this to ensure that e.g.

polling timer callbacks happen before a synchronous command completes.

Definition at line 1953 of file target.c.

References target_call_timer_callbacks_check_time().

Referenced by gdb_query_packet(), jim_command_dispatch(), and target_process_reset().

◆ target_call_trace_callbacks()

int target_call_trace_callbacks ( struct target target,
size_t  len,
uint8_t *  data 
)

◆ target_checksum_memory()

◆ target_configure()

static int target_configure ( struct jim_getopt_info goi,
struct target target 
)
static

Definition at line 5333 of file target.c.

References jim_getopt_info::argc, jim_getopt_info::argv, target::backup_working_area, target_event_action::body, COMMAND_CONFIG, CONNECTION_LIMIT_UNLIMITED, target::coreid, current_command_context(), target::dbgbase, target::dbgbase_set, target::defer_examine, jtag_tap::dotted_name, target::endianness, target_event_action::event, target::event_action, target::gdb_max_connections, target::gdb_port_override, target::has_dap, jim_getopt_info::interp, target_event_action::interp, jim_getopt_info::isconfigure, jim_getopt_nvp(), jim_getopt_nvp_unknown(), jim_getopt_obj(), jim_getopt_string(), jim_getopt_wide(), jim_nvp_value2name_simple(), jtag_tap_by_jim_obj(), LOG_INFO, command_context::mode, jim_nvp::name, target_event_action::next, NULL, nvp_config_opts, nvp_target_endian, nvp_target_event, rtos_create(), target::tap, target::tap_configured, target, TARGET_EVENT_TRACE_CONFIG, target_free_all_working_areas(), target_type::target_jim_configure, TARGET_LITTLE_ENDIAN, target_type_name(), TCFG_CHAIN_POSITION, TCFG_COREID, TCFG_DBGBASE, TCFG_DEFER_EXAMINE, TCFG_ENDIAN, TCFG_EVENT, TCFG_GDB_MAX_CONNECTIONS, TCFG_GDB_PORT, TCFG_RTOS, TCFG_TYPE, TCFG_WORK_AREA_BACKUP, TCFG_WORK_AREA_PHYS, TCFG_WORK_AREA_SIZE, TCFG_WORK_AREA_VIRT, target::type, jim_nvp::value, target::working_area_phys, target::working_area_phys_spec, target::working_area_size, target::working_area_virt, and target::working_area_virt_spec.

Referenced by jim_target_configure(), and target_create().

◆ target_create()

static int target_create ( struct jim_getopt_info goi)
static

Definition at line 6166 of file target.c.

References append_to_list_all_targets(), target::arch_info, jim_getopt_info::argc, jim_getopt_info::argv, target::backup_working_area, target::breakpoints, command_registration::chain, cmd, target::cmd_name, COMMAND_ANY, COMMAND_REGISTRATION_DONE, target_type::commands, target::coreid, current_command_context(), command_context::current_target, target::dap_configured, target::dbg_msg_enabled, DBG_REASON_UNDEFINED, target::dbgmsg, target::debug_reason, target_type::deinit_target, target::endianness, ERROR_OK, target::gdb_max_connections, target::gdb_port_override, get_current_transport(), target::halt_issued, target::has_dap, jim_getopt_info::interp, jim_getopt_info::isconfigure, jim_getopt_obj(), jim_getopt_string(), LOG_DEBUG, LOG_ERROR, LOG_INFO, command_registration::name, name, target_type::name, new_target_number(), target::next, NULL, transport::override_target, target::reg_cache, register_commands(), register_commands_override_target(), target::rtos, target::rtos_auto_detect, rtos_destroy(), target::smp_targets, target::state, target::tap, target::tap_configured, target, target_configure(), target_type::target_create, TARGET_ENDIAN_UNKNOWN, target_instance_command_handlers, TARGET_LITTLE_ENDIAN, target::target_number, target_types, TARGET_UNKNOWN, target::trace_info, target::type, target::verbose_halt_msg, target::watchpoints, target::working_area, target::working_area_size, and target::working_areas.

Referenced by jim_target_create().

◆ target_data_bits()

unsigned int target_data_bits ( struct target target)

Return the number of data bits this target supports.

This routine is a wrapper for target->type->data_bits.

Definition at line 1529 of file target.c.

References target_type::data_bits, and target::type.

Referenced by target_read_buffer_default(), and target_write_buffer_default().

◆ target_destroy()

◆ target_event_name()

const char* target_event_name ( enum target_event  event)

Return the name of a target event enumeration value.

Definition at line 317 of file target.c.

References jim_nvp_value2name_simple(), LOG_ERROR, jim_nvp::name, and nvp_target_event.

Referenced by COMMAND_HANDLER(), target_call_event_callbacks(), target_handle_event(), and tcl_target_callback_event_handler().

◆ target_examine()

◆ target_examine_one()

int target_examine_one ( struct target target)

Examine the specified target, letting it perform any Initialisation that requires JTAG access.

This routine is a wrapper for target->type->examine.

Definition at line 750 of file target.c.

References ERROR_OK, target_type::examine, target_call_event_callbacks(), TARGET_EVENT_EXAMINE_END, TARGET_EVENT_EXAMINE_FAIL, TARGET_EVENT_EXAMINE_START, target_reset_examined(), target_set_examined(), and target::type.

Referenced by arm7_9_deassert_reset(), cortex_m_assert_reset(), esp_xtensa_smp_poll(), handle_target(), hl_assert_reset(), jtag_enable_callback(), and target_examine().

◆ target_fill_mem()

static int target_fill_mem ( struct target target,
target_addr_t  address,
target_write_fn  fn,
unsigned  data_size,
uint64_t  b,
unsigned  c 
)
static

◆ target_free_all_working_areas()

◆ target_free_all_working_areas_restore()

static void target_free_all_working_areas_restore ( struct target target,
int  restore 
)
static

◆ target_free_working_area()

int target_free_working_area ( struct target target,
struct working_area area 
)

Free a working area.

Restore target data if area backup is configured.

Parameters
target
areaPointer to the area to be freed or NULL
Returns
ERROR_OK if successful; error code if restore failed

Definition at line 2187 of file target.c.

References target_free_working_area_restore().

Referenced by aduc702x_write_block(), aducm360_write_block_async(), aducm360_write_block_sync(), arm_blank_check_memory(), arm_checksum_memory(), armv7m_blank_check_memory(), armv7m_checksum_memory(), bluenrgx_write(), cc26xx_init(), cc26xx_quit(), cc3220sf_write(), cfi_intel_write_block(), cfi_spansion_write_block(), cfi_spansion_write_block_mips(), COMMAND_HANDLER(), efm32x_write_block(), em357_write_block(), fespi_write(), fm3_chip_erase(), fm3_erase(), fm3_write_block(), fm4_flash_erase(), fm4_flash_write(), get_lpc2000_part_id(), kinetis_disable_wdog_algo(), kinetis_ke_stop_watchdog(), kinetis_ke_write_words(), kinetis_write_block(), lpc2000_erase(), lpc2000_iap_blank_check(), lpc2000_iap_working_area_init(), lpc2000_write(), lpc3180_read_page(), lpc3180_write_page(), lpc32xx_read_page(), lpc32xx_write_page(), lpcspifi_erase(), lpcspifi_set_hw_mode(), lpcspifi_write(), max32xxx_write_block(), mdr_write_block(), mips32_blank_check_memory(), mips32_checksum_memory(), mrvlqspi_flash_write(), msp432_init(), msp432_quit(), niietcm4_write_block(), npcx_init(), npcx_quit(), nrf5_ll_flash_write(), numicro_writeblock(), pic32mx_write_block(), psoc4_sysreq(), psoc5lp_write(), psoc6_erase(), psoc6_program_row(), qspi_read_write_block(), qspi_verify(), riscv_checksum_memory(), rp2040_finalize_stack_free(), rp2040_flash_write(), rsl10_ll_flash_erase(), rsl10_ll_flash_write(), rsl10_mass_erase(), scratch_release(), sh_qspi_upload_helper(), sim3x_write_block(), sromalgo_prepare(), sromalgo_release(), stellaris_write_block(), stm32l4_write_block(), stm32lx_write_half_pages(), stm32x_write_block(), stm32x_write_block_async(), stm32x_write_block_riscv(), stm8_blank_check_memory(), stmqspi_blank_check(), str7x_write_block(), str9x_write_block(), xmc1xxx_erase(), xmc1xxx_erase_check(), and xmc1xxx_write().

◆ target_free_working_area_restore()

static int target_free_working_area_restore ( struct target target,
struct working_area area,
int  restore 
)
static

◆ target_gdb_fileio_end()

int target_gdb_fileio_end ( struct target target,
int  retcode,
int  fileio_errno,
bool  ctrl_c 
)

Pass GDB file-I/O response to target after finishing host syscall.

This routine is a wrapper for target->type->gdb_fileio_end.

Definition at line 1504 of file target.c.

References target::cmd_name, ERROR_TARGET_NOT_HALTED, target_type::gdb_fileio_end, LOG_WARNING, target::state, TARGET_HALTED, and target::type.

Referenced by gdb_fileio_response_packet().

◆ target_gdb_fileio_end_default()

static int target_gdb_fileio_end_default ( struct target target,
int  retcode,
int  fileio_errno,
bool  ctrl_c 
)
static

Definition at line 2350 of file target.c.

References ERROR_OK.

Referenced by target_init_one().

◆ target_get_gdb_arch()

const char* target_get_gdb_arch ( struct target target)

Obtain the architecture for GDB.

This routine is a wrapper for target->type->get_gdb_arch.

Definition at line 1430 of file target.c.

References target_type::get_gdb_arch, NULL, and target::type.

Referenced by __attribute__(), gdb_generate_target_description(), and gdb_target_description_supported().

◆ target_get_gdb_fileio_info()

int target_get_gdb_fileio_info ( struct target target,
struct gdb_fileio_info fileio_info 
)

Obtain file-I/O information from target for GDB to do syscall.

This routine is a wrapper for target->type->get_gdb_fileio_info.

Definition at line 1495 of file target.c.

References target::cmd_name, ERROR_TARGET_NOT_HALTED, target::fileio_info, target_type::get_gdb_fileio_info, LOG_WARNING, target::state, TARGET_HALTED, and target::type.

Referenced by gdb_frontend_halted().

◆ target_get_gdb_fileio_info_default()

static int target_get_gdb_fileio_info_default ( struct target target,
struct gdb_fileio_info fileio_info 
)
static

Definition at line 2340 of file target.c.

References ERROR_FAIL.

Referenced by target_init_one().

◆ target_get_gdb_reg_list()

int target_get_gdb_reg_list ( struct target target,
struct reg **  reg_list[],
int *  reg_list_size,
enum target_register_class  reg_class 
)

Obtain the registers for GDB.

This routine is a wrapper for target->type->get_gdb_reg_list.

Definition at line 1437 of file target.c.

References ERROR_FAIL, ERROR_OK, target_type::get_gdb_reg_list, LOG_ERROR, NULL, target_was_examined(), and target::type.

Referenced by gdb_get_registers_packet(), gdb_set_registers_packet(), get_current(), hwthread_get_thread_reg_list(), and target_get_gdb_reg_list_noread().

◆ target_get_gdb_reg_list_noread()

int target_get_gdb_reg_list_noread ( struct target target,
struct reg **  reg_list[],
int *  reg_list_size,
enum target_register_class  reg_class 
)

Obtain the registers for GDB, but don't read register values from the target.

This routine is a wrapper for target->type->get_gdb_reg_list_noread.

Definition at line 1459 of file target.c.

References ERROR_OK, target_type::get_gdb_reg_list_noread, target_get_gdb_reg_list(), and target::type.

Referenced by gdb_get_register_packet(), gdb_set_register_packet(), gdb_target_description_supported(), and smp_reg_list_noread().

◆ target_get_working_area_avail()

◆ target_halt()

◆ target_handle_event()

◆ target_handle_md_output()

void target_handle_md_output ( struct command_invocation cmd,
struct target target,
target_addr_t  address,
unsigned  size,
unsigned  count,
const uint8_t *  buffer 
)

◆ target_has_event_action()

bool target_has_event_action ( struct target target,
enum target_event  event 
)

Returns true only if the target has a handler for the specified event.

Definition at line 5287 of file target.c.

Referenced by aarch64_assert_reset(), arc_assert_reset(), arm11_assert_reset(), arm7_9_assert_reset(), assert_reset(), cortex_a_assert_reset(), cortex_m_assert_reset(), and mips_m4k_assert_reset().

◆ target_hit_watchpoint()

int target_hit_watchpoint ( struct target target,
struct watchpoint **  watchpoint 
)

Find out the just hit watchpoint for target.

This routine is a wrapper for target->type->hit_watchpoint.

Definition at line 1412 of file target.c.

References target::cmd_name, ERROR_FAIL, ERROR_TARGET_NOT_HALTED, target_type::hit_watchpoint, LOG_WARNING, target::state, TARGET_HALTED, and target::type.

Referenced by watchpoint_hit().

◆ target_init()

◆ target_init_one()

◆ target_jim_get_reg()

static int target_jim_get_reg ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ target_jim_read_memory()

static int target_jim_read_memory ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ target_jim_set_reg()

static int target_jim_set_reg ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ target_jim_write_memory()

static int target_jim_write_memory ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ target_mem2array()

static int target_mem2array ( Jim_Interp *  interp,
struct target target,
int  argc,
Jim_Obj *const *  argv 
)
static

◆ target_merge_working_areas()

static void target_merge_working_areas ( struct target target)
static

◆ target_poll()

◆ target_process_reset()

◆ target_profiling()

static int target_profiling ( struct target target,
uint32_t *  samples,
uint32_t  max_num_samples,
uint32_t *  num_samples,
uint32_t  seconds 
)
static

Definition at line 1536 of file target.c.

References target_type::profiling, and target::type.

Referenced by COMMAND_HANDLER().

◆ target_profiling_default()

int target_profiling_default ( struct target target,
uint32_t *  samples,
uint32_t  max_num_samples,
uint32_t *  num_samples,
uint32_t  seconds 
)

◆ target_quit()

void target_quit ( void  )

Free all the resources allocated by targets and the target layer.

Definition at line 2296 of file target.c.

References all_targets, target::next, target_event_callback::next, target_timer_callback::next, NULL, target, target_destroy(), target_event_callbacks, and target_timer_callbacks.

Referenced by server_quit().

◆ target_read_buffer()

int target_read_buffer ( struct target target,
target_addr_t  address,
uint32_t  size,
uint8_t *  buffer 
)

Definition at line 2473 of file target.c.

References buffer, ERROR_FAIL, ERROR_OK, LOG_DEBUG, LOG_ERROR, target_type::read_buffer, size, TARGET_ADDR_FMT, target_was_examined(), and target::type.

Referenced by arc_read_instruction_u32(), arc_set_breakpoint(), arm_nandread(), armv4_5_run_algorithm_inner(), armv7m_blank_check_memory(), armv7m_wait_algorithm(), cc3220sf_write(), chibios_update_memory_signature(), chibios_update_threads(), chromium_ec_detect_rtos(), chromium_ec_update_threads(), COMMAND_HANDLER(), COMMAND_HELPER(), default_flash_read(), dsp563xx_run_algorithm(), ecos_get_thread_reg_list(), ecos_update_threads(), efm32x_write_lock_data(), embkernel_get_tasks_details(), embkernel_get_thread_reg_list(), embkernel_update_threads(), esp32_soc_reset(), esp32s3_soc_reset(), freertos_update_threads(), gdb_read_memory_packet(), get_stacking_info_arm926ejs(), hwthread_read_buffer(), image_read_section(), imx31_read_page(), jim_nds32_bulk_read(), mips32_run_algorithm(), mqx_target_read_buffer(), mxc_read_page(), nds32_read_opcode(), nuttx_update_threads(), read_channel_name(), read_from_channel(), read_rtt_channel(), riot_update_threads(), riscv_hit_watchpoint(), rtos_generic_stack_read(), semihosting_common(), sh_qspi_read(), stm8_run_algorithm(), stmqspi_blank_check(), target_checksum_memory(), target_rtt_find_control_block(), target_rtt_read_control_block(), target_run_read_async_algorithm(), threadx_get_thread_reg_list(), threadx_update_threads(), tms470_erase_check(), ucos_iii_update_threads(), xtensa_sw_breakpoint_add(), and zephyr_fetch_thread().

◆ target_read_buffer_default()

static int target_read_buffer_default ( struct target target,
target_addr_t  address,
uint32_t  count,
uint8_t *  buffer 
)
static

Definition at line 2497 of file target.c.

References buffer, count, ERROR_OK, size, target_data_bits(), and target_read_memory().

Referenced by target_init_one().

◆ target_read_memory()

int target_read_memory ( struct target target,
target_addr_t  address,
uint32_t  size,
uint32_t  count,
uint8_t *  buffer 
)

Read count items of size bytes from the memory of target at the address given.

This routine is a wrapper for target->type->read_memory.

Definition at line 1306 of file target.c.

References buffer, count, ERROR_FAIL, LOG_ERROR, target_type::read_memory, size, target_name(), target_was_examined(), and target::type.

Referenced by aarch64_set_breakpoint(), arm7_9_set_breakpoint(), arm7_9_unset_breakpoint(), arm920t_write_memory(), arm_semihosting(), cfi_target_read_memory(), COMMAND_HANDLER(), cortex_a_read_buffer(), cortex_a_set_breakpoint(), cortex_m_set_breakpoint(), default_flash_mem_blank_check(), esirisc_trace_read_memory(), esp_xtensa_semihosting(), kinetis_write(), linux_read_memory(), lpc2900_read_security_status(), lpc2900_run_bist128(), lpc3180_read_page(), lpc32xx_read_page_mlc(), lpc32xx_read_page_slc(), lpc32xx_write_page_slc(), mips_m4k_set_breakpoint(), mips_m4k_unset_breakpoint(), mips_mips16_set_sdbbp(), mips_mips16_unset_sdbbp(), mips_mips64_set_sdbbp(), mips_mips64_unset_sdbbp(), psoc4_get_family(), psoc4_protect_check(), read_by_given_size(), read_userrow(), sam3_page_read(), sam4_page_read(), sam4l_write_page_partial(), samd_modify_user_row_masked(), same5_modify_user_row_masked(), samv_page_read(), semihosting_common(), semihosting_read_fields(), stm8_unset_breakpoint(), target_alloc_working_area_try(), target_jim_read_memory(), target_mem2array(), target_read_buffer_default(), target_read_u16(), target_read_u32(), target_read_u64(), target_read_u8(), ucos_iii_find_last_thread_address(), ucos_iii_get_thread_reg_list(), ucos_iii_update_thread_offsets(), ucos_iii_update_threads(), write_by_given_size(), and xscale_set_breakpoint().

◆ target_read_phys_memory()

int target_read_phys_memory ( struct target target,
target_addr_t  address,
uint32_t  size,
uint32_t  count,
uint8_t *  buffer 
)

◆ target_read_u16()

◆ target_read_u32()

int target_read_u32 ( struct target target,
target_addr_t  address,
uint32_t *  value 
)

Definition at line 2616 of file target.c.

References ERROR_FAIL, ERROR_OK, LOG_DEBUG, LOG_ERROR, TARGET_ADDR_FMT, target_buffer_get_u32(), target_read_memory(), target_was_examined(), and reg::value.

Referenced by adapter_debug_entry(), aducm360_check_flash_completion(), aducm360_mass_erase(), aducm360_page_erase(), aducm360_set_write_enable(), aducm360_write_modified(), ambiqmicro_read_part_info(), arm7_9_resume(), arm7_9_set_breakpoint(), arm7_9_step(), arm_semihosting(), arm_simulate_step_core(), armv7m_trace_itm_config(), at91sam7_get_flash_status(), at91sam7_read_clock_info(), at91sam7_read_part_info(), at91sam9_nand_ready(), at91sam9_read_page(), at91sam9_write_page(), bluenrgx_probe(), bluenrgx_read_flash_reg(), bluenrgx_write(), call_sromapi(), cc26xx_probe(), cc26xx_wait_algo_done(), cc3220sf_erase(), cc3220sf_mass_erase(), check_flash_status(), chibios_get_thread_reg_list(), chibios_update_stacking(), chibios_update_threads(), chromium_ec_get_current_task_ptr(), chromium_ec_get_num_tasks(), chromium_ec_get_thread_reg_list(), chromium_ec_update_threads(), clrsetbits_u32(), COMMAND_HANDLER(), cortex_m_dwt_get_reg(), cortex_m_dwt_setup(), cortex_m_enable_fpb(), cortex_m_examine(), cortex_m_has_tz(), cortex_m_hit_watchpoint(), cortex_m_profiling(), davinci_init(), davinci_nand_ready(), davinci_read_block_data(), davinci_write_page_ecc1(), davinci_write_page_ecc4(), davinci_write_page_ecc4infix(), efc_get_result(), efc_get_status(), efm32x_read_lock_data(), efm32x_read_reg_u32(), em357_get_flash_status(), em357_protect(), em357_protect_check(), em357_read_options(), esirisc_flash_check_status(), esirisc_flash_disable_protect(), esirisc_flash_enable_protect(), esirisc_flash_wait(), esp32s2_disable_wdts(), esp32s2_set_peri_reg_mask(), esp32s3_disable_wdts(), fespi_read_reg(), flashd_read_uid(), fm3_chip_erase(), fm3_erase(), fm4_enter_flash_cpu_programming_mode(), fm4_enter_flash_cpu_rom_mode(), freertos_get_thread_reg_list(), freertos_update_threads(), handle_reset_halt(), imx31_init(), ipc_acquire(), ipc_poll_lock_stat(), kinetis_disable_wdog32(), kinetis_ke_probe(), kinetis_probe_chip(), kinetis_protect_check(), kinetis_read_pmstat(), lpc2000_iap_call(), lpc2900_probe(), lpc2900_wait_status(), lpc3180_controller_ready(), lpc3180_cycle_time(), lpc3180_nand_ready(), lpc3180_read_data(), lpc3180_read_page(), lpc3180_tc_ready(), lpc32xx_controller_ready(), lpc32xx_cycle_time(), lpc32xx_dma_ready(), lpc32xx_nand_ready(), lpc32xx_read_data(), lpc32xx_read_page_mlc(), lpc32xx_tc_ready(), max32xxx_erase(), max32xxx_flash_op_post(), max32xxx_flash_op_pre(), max32xxx_mass_erase(), max32xxx_probe(), max32xxx_protect(), max32xxx_protect_check(), max32xxx_write(), mdr_erase(), mdr_mass_erase(), mdr_read(), mdr_write(), mips32_configure_break_unit(), mips32_configure_dbs(), mips32_configure_ibs(), mips32_enable_interrupts(), mips_m4k_examine_debug_reason(), mips_m4k_set_breakpoint(), mips_mips64_set_sdbbp(), mrvlqspi_fifo_flush(), mrvlqspi_read_byte(), mrvlqspi_set_conf(), mrvlqspi_set_ss_state(), mrvlqspi_start_transfer(), mrvlqspi_stop_transfer(), msp432_probe(), msp432_wait_inactive(), msp432_wait_return_code(), mxc_init(), niietcm4_dump_uflash_page(), niietcm4_opstatus_check(), niietcm4_probe(), niietcm4_probe_k1921vk01t(), niietcm4_protect_check(), niietcm4_uopstatus_check(), npcx_get_flash_id(), nrf5_erase_page(), nrf5_get_ram_size(), nrf5_probe(), nrf5_protect_check_bprot(), nrf5_protect_check_clenr0(), nrf5_protect_clenr0(), nrf5_read_ficr_info(), nrf5_wait_for_nvmc(), nuc910_nand_ready(), numicro_erase(), numicro_fmc_cmd(), numicro_get_cpu_type(), numicro_init_isp(), numicro_reg_unlock(), numicro_write(), nuttx_get_thread_reg_list(), nuttx_update_threads(), pic32mx_get_flash_status(), pic32mx_probe(), pic32mx_protect_check(), poll_busy(), psoc4_get_silicon_id(), psoc4_probe(), psoc4_sysreq(), psoc4_test_flash_wounding(), psoc5lp_eeprom_probe(), psoc5lp_get_device_id(), psoc6_probe(), read_flash_id(), read_sfdp_block(), read_status_reg(), riot_get_thread_reg_list(), riot_update_threads(), rp2040_lookup_symbol(), rp2040_spi_read_flash_id(), rp2040_ssel_active(), rpc_hf_mode(), rpc_hf_wait_tend(), rpc_hf_xfer(), rsl10_check_device(), rsl10_ll_flash_erase(), rsl10_ll_flash_write(), rsl10_mass_erase(), rsl10_protect(), rsl10_protect_check(), s3c2440_read_block_data(), s6e2cc_probe(), sam3_page_write(), sam3_read_this_reg(), sam4_read_this_reg(), sam4_set_wait(), sam4l_check_page_erased(), sam4l_flash_check_error(), sam4l_flash_command(), sam4l_flash_wait_until_ready(), sam4l_probe(), sam4l_protect_check(), samd_get_flash_page_info(), samd_get_reservedmask(), samd_modify_user_row_masked(), samd_probe(), samd_write(), same5_pre_write_check(), same5_probe(), same5_protect_check(), samv_efc_get_result(), samv_efc_get_status(), samv_get_device_id(), sim3x_erase_page(), sim3x_flash_erase(), sim3x_flash_lock_check(), sim3x_read_deviceid(), sim3x_read_info(), ssp_read_reg(), stellaris_erase(), stellaris_mass_erase(), stellaris_protect(), stellaris_protect_check(), stellaris_read_clock_info(), stellaris_read_part_info(), stellaris_write(), stm32l4_read_flash_reg(), stm32l4_read_idcode(), stm32lx_enable_write_half_page(), stm32lx_get_flash_status(), stm32lx_lock_program_memory(), stm32lx_mass_erase(), stm32lx_protect_check(), stm32lx_read_id_code(), stm32lx_unlock_options_bytes(), stm32lx_unlock_program_memory(), stm32x_get_device_id(), stm32x_get_flash_status(), stm32x_probe(), stm32x_protect_check(), stm32x_read_flash_reg(), stm32x_read_id_code(), stm32x_read_options(), stm32x_unlock_option_reg(), stm32x_unlock_reg(), stmqspi_abort(), stmqspi_probe(), str7x_protect_check(), str7x_result(), str7x_waitbusy(), str9x_protect_check(), target_run_flash_async_algorithm(), target_run_read_async_algorithm(), test_iomux_settings(), tms470_check_flash_unlocked(), tms470_erase_check(), tms470_flash_initialize_internal_state_machine(), tms470_flash_status(), tms470_protect(), tms470_protect_check(), tms470_read_part_info(), tms470_try_flash_keys(), tms470_write(), w600_get_flash_id(), w600_start_do(), xmc1xxx_get_info_command(), xmc1xxx_probe(), xmc1xxx_protect_check(), xmc4xxx_erase_sector(), xmc4xxx_get_flash_status(), xmc4xxx_get_info_command(), xmc4xxx_probe(), xmc4xxx_protect_check(), xscale_resume(), xscale_step_inner(), xscale_update_vectors(), zephyr_fetch_thread(), zephyr_fetch_thread_list(), zephyr_get_arc_state(), and zephyr_update_threads().

◆ target_read_u64()

◆ target_read_u8()

int target_read_u8 ( struct target target,
target_addr_t  address,
uint8_t *  value 
)

Definition at line 2664 of file target.c.

References ERROR_FAIL, ERROR_OK, LOG_DEBUG, LOG_ERROR, TARGET_ADDR_FMT, target_read_memory(), target_was_examined(), and reg::value.

Referenced by aduc702x_check_flash_completion(), aduc702x_write_single(), at91sam9_read_data(), chibios_update_threads(), COMMAND_HANDLER(), davinci_read_block_data(), davinci_read_data(), efm32x_get_part_family(), efm32x_get_prod_rev(), efm32x_read_info(), find_sfdp_dummy(), fm3_busy_wait(), kinetis_disable_wdog(), kinetis_ftfx_command(), kinetis_ftfx_prepare(), kinetis_ke_ftmrx_command(), kinetis_ke_prepare_flash(), kinetis_ke_protect_check(), kinetis_ke_stop_watchdog(), kinetis_make_ram_ready(), kinetis_protect_check(), kinetis_read_pmstat(), kinetis_write_block(), lpc3180_controller_ready(), lpc3180_nand_ready(), lpc3180_read_data(), lpc32xx_controller_ready(), lpc32xx_nand_ready(), lpc32xx_read_data(), nuc910_nand_read(), orion_nand_read(), psoc5lp_nvl_write(), psoc5lp_spc_busy_wait_data(), psoc5lp_spc_busy_wait_idle(), psoc5lp_spc_enable_clock(), psoc5lp_spc_get_temp(), psoc5lp_spc_read_byte(), psoc5lp_spc_read_hidden_row(), psoc5lp_spc_read_volatile_byte(), read_flash_id(), read_sfdp_block(), read_status_reg(), riot_update_threads(), s3c2410_read_data(), s3c2440_nand_ready(), s3c2440_read_block_data(), s3c24xx_read_data(), samd_check_error(), sh_qspi_cs_activate(), sh_qspi_cs_deactivate(), sh_qspi_init(), sh_qspi_wait_for_bit(), sh_qspi_xfer_common(), stm32x_otp_protect(), stm32x_otp_read_protect(), stm8_set_breakpoint(), str9x_erase(), str9x_protect(), str9x_write(), ucos_iii_update_threads(), zephyr_fetch_thread(), and zephyr_update_threads().

◆ target_register_commands()

int target_register_commands ( struct command_context cmd_ctx)

Definition at line 6757 of file target.c.

References NULL, register_commands(), and target_command_handlers.

Referenced by setup_command_handler().

◆ target_register_event_callback()

int target_register_event_callback ( int(*)(struct target *target, enum target_event event, void *priv callback,
void *  priv 
)

◆ target_register_reset_callback()

int target_register_reset_callback ( int(*)(struct target *target, enum target_reset_mode reset_mode, void *priv callback,
void *  priv 
)

◆ target_register_timer_callback()

int target_register_timer_callback ( int(*)(void *priv callback,
unsigned int  time_ms,
enum target_timer_type  type,
void *  priv 
)

◆ target_register_trace_callback()

int target_register_trace_callback ( int(*)(struct target *target, size_t len, uint8_t *data, void *priv callback,
void *  priv 
)

◆ target_register_user_commands()

static int target_register_user_commands ( struct command_context cmd_ctx)
static

◆ target_remove_breakpoint()

int target_remove_breakpoint ( struct target target,
struct breakpoint breakpoint 
)

Remove the breakpoint for target.

This routine is a wrapper for target->type->remove_breakpoint.

Definition at line 1392 of file target.c.

References target_type::remove_breakpoint, and target::type.

Referenced by breakpoint_free(), and nds32_v3_debug_entry().

◆ target_remove_watchpoint()

int target_remove_watchpoint ( struct target target,
struct watchpoint watchpoint 
)

Remove the watchpoint for target.

This routine is a wrapper for target->type->remove_watchpoint.

Definition at line 1407 of file target.c.

References target_type::remove_watchpoint, and target::type.

Referenced by watchpoint_free().

◆ target_reset_examined()

static void target_reset_examined ( struct target target)
inlinestatic

Reset the examined flag for the given target.

Pure paranoia – targets are zeroed on allocation.

Definition at line 731 of file target.c.

References target::examined.

Referenced by handle_target(), jim_target_examine(), jim_target_reset(), target_examine_one(), and target_init_one().

◆ target_reset_mode_name()

const char* target_reset_mode_name ( enum target_reset_mode  reset_mode)

Return the name of a target reset reason enumeration value.

Definition at line 328 of file target.c.

References jim_nvp_value2name_simple(), LOG_ERROR, jim_nvp::name, and nvp_reset_modes.

Referenced by tcl_target_callback_reset_handler().

◆ target_restore_working_area()

static int target_restore_working_area ( struct target target,
struct working_area area 
)
static

◆ target_resume()

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 modifications).

Parameters
targetWhich target should start executing.
currentTrue to use the target's saved program counter instead of the address parameter
addressOptionally used as the program counter.
handle_breakpointsTrue iff breakpoints at the resumption PC should be skipped. (For example, maybe execution was stopped by such a breakpoint, in which case it would be counterproductive to let it re-trigger.
debug_executionFalse if all working areas allocated by OpenOCD should be released and/or restored to their original contents. (This would for example be true to run some downloaded "helper" algorithm code, which resides in one such working buffer and uses another for data storage.)
Todo:
Resolve the ambiguity about what the "debug_execution" flag signifies. For example, Target implementations don't agree on how it relates to invalidation of the register cache, or to whether breakpoints and watchpoints should be enabled. (It would seem wrong to enable breakpoints when running downloaded "helper" algorithms (debug_execution true), since the breakpoints would be set to match target firmware being debugged, not the helper algorithm.... and enabling them could cause such helpers to malfunction (for example, by overwriting data with a breakpoint instruction. On the other hand the infrastructure for running such helpers might use this procedure but rely on hardware breakpoint to detect termination.)

Definition at line 634 of file target.c.

References ERROR_FAIL, ERROR_OK, jtag_poll_mask(), jtag_poll_unmask(), LOG_ERROR, target_type::resume, target_call_event_callbacks(), TARGET_EVENT_RESUME_END, TARGET_EVENT_RESUME_START, target_was_examined(), and target::type.

Referenced by ambiqmicro_exec_command(), arc_assert_reset(), arm_semihosting_resume(), armv4_5_run_algorithm_inner(), armv7m_start_algorithm(), COMMAND_HANDLER(), cortex_m_profiling(), dsp563xx_run_algorithm(), esp32s2_poll(), esp_xtensa_smp_poll(), gdb_fileio_reply(), gdb_fileio_response_packet(), gdb_handle_vcont_packet(), gdb_step_continue_packet(), hl_deassert_reset(), mips32_run_and_wait(), nds32_gdb_detach(), or1k_profiling(), stm8_run_and_wait(), and target_profiling_default().

◆ target_run_algorithm()

int target_run_algorithm ( struct target target,
int  num_mem_params,
struct mem_param mem_params,
int  num_reg_params,
struct reg_param reg_param,
target_addr_t  entry_point,
target_addr_t  exit_point,
int  timeout_ms,
void *  arch_info 
)

Downloads a target-specific native code algorithm to the target, and executes it.

Run an algorithm on the target given.

  • Note that some targets may need to set up, enable, and tear down a breakpoint (hard or * soft) to detect algorithm termination, while others may support lower overhead schemes where soft breakpoints embedded in the algorithm automatically terminate the algorithm.
Parameters
targetused to run the algorithm
num_mem_params
mem_params
num_reg_params
reg_param
entry_point
exit_point
timeout_ms
arch_infotarget-specific description of the algorithm.

Definition at line 846 of file target.c.

References target::arch_info, ERROR_FAIL, LOG_ERROR, target_type::run_algorithm, target::running_alg, target_type_name(), target_was_examined(), and target::type.

Referenced by aduc702x_write_block(), aducm360_write_block_sync(), arm_blank_check_memory(), arm_checksum_memory(), arm_nandread(), arm_nandwrite(), armv7m_blank_check_memory(), armv7m_checksum_memory(), cc3220sf_write(), cfi_intel_write_block(), cfi_spansion_write_block(), cfi_spansion_write_block_mips(), em357_write_block(), fespi_write(), fm3_chip_erase(), fm3_erase(), fm3_write_block(), fm4_flash_erase(), fm4_flash_write(), kinetis_disable_wdog_algo(), kinetis_ke_stop_watchdog(), lpc2000_iap_call(), lpc2900_write(), lpcspifi_erase(), lpcspifi_set_hw_mode(), mips32_blank_check_memory(), mips32_checksum_memory(), numicro_writeblock(), pic32mx_write_block(), psoc4_sysreq(), qspi_verify(), riscv_checksum_memory(), rp2040_call_rom_func(), rsl10_ll_flash_erase(), rsl10_ll_flash_write(), rsl10_mass_erase(), sh_qspi_read(), sh_qspi_write(), stm32lx_write_half_pages(), stm32x_write_block_riscv(), stm8_blank_check_memory(), stmqspi_blank_check(), str7x_write_block(), str9x_write_block(), xmc1xxx_erase(), xmc1xxx_erase_check(), and xmc1xxx_write().

◆ target_run_flash_async_algorithm()

int target_run_flash_async_algorithm ( struct target target,
const uint8_t *  buffer,
uint32_t  count,
int  block_size,
int  num_mem_params,
struct mem_param mem_params,
int  num_reg_params,
struct reg_param reg_params,
uint32_t  buffer_start,
uint32_t  buffer_size,
uint32_t  entry_point,
uint32_t  exit_point,
void *  arch_info 
)

Streams data to a circular buffer on target intended for consumption by code running asynchronously on target.

This routine is a wrapper for asynchronous algorithms.

This is intended for applications where target-specific native code runs on the target, receives data from the circular buffer, does something with it (most likely writing it to a flash memory), and advances the circular buffer pointer.

This assumes that the helper algorithm has already been loaded to the target, but has not been started yet. Given memory and register parameters are passed to the algorithm.

The buffer is defined by (buffer_start, buffer_size) arguments and has the following format:

[buffer_start + 0, buffer_start + 4):
    Write Pointer address (aka head). Written and updated by this
    routine when new data is written to the circular buffer.
[buffer_start + 4, buffer_start + 8):
    Read Pointer address (aka tail). Updated by code running on the
    target after it consumes data.
[buffer_start + 8, buffer_start + buffer_size):
    Circular buffer contents.

See contrib/loaders/flash/stm32f1x.S for an example.

Parameters
targetused to run the algorithm
bufferaddress on the host where data to be sent is located
countnumber of blocks to send
block_sizesize in bytes of each block
num_mem_paramscount of memory-based params to pass to algorithm
mem_paramsmemory-based params to pass to algorithm
num_reg_paramscount of register-based params to pass to algorithm
reg_paramsmemory-based params to pass to algorithm
buffer_startaddress on the target of the circular buffer structure
buffer_sizesize of the circular buffer structure
entry_pointaddress on the target to execute to start the algorithm
exit_pointaddress at which to set a breakpoint to catch the end of the algorithm; can be 0 if target triggers a breakpoint itself
arch_info

Definition at line 1003 of file target.c.

References alive_sleep(), target::arch_info, buffer, count, ERROR_FLASH_OPERATION_FAILED, ERROR_OK, IS_ALIGNED, IS_PWR_OF_2, keep_alive(), LOG_DEBUG, LOG_ERROR, target_read_u32(), target_start_algorithm(), target_wait_algorithm(), target_write_buffer(), and target_write_u32().

Referenced by aducm360_write_block_async(), bluenrgx_write(), efm32x_write_block(), kinetis_ke_write_words(), kinetis_write_block(), lpcspifi_write(), max32xxx_write_block(), mdr_write_block(), mrvlqspi_flash_write(), niietcm4_write_block(), nrf5_ll_flash_write(), qspi_read_write_block(), sim3x_write_block(), stellaris_write_block(), stm32l4_write_block(), stm32x_write_block(), and stm32x_write_block_async().

◆ target_run_read_async_algorithm()

int target_run_read_async_algorithm ( struct target target,
uint8_t *  buffer,
uint32_t  count,
int  block_size,
int  num_mem_params,
struct mem_param mem_params,
int  num_reg_params,
struct reg_param reg_params,
uint32_t  buffer_start,
uint32_t  buffer_size,
uint32_t  entry_point,
uint32_t  exit_point,
void *  arch_info 
)

◆ target_soft_reset_halt()

static int target_soft_reset_halt ( struct target target)
static

◆ target_split_working_area()

static void target_split_working_area ( struct working_area area,
uint32_t  size 
)
static

◆ target_start_algorithm()

int target_start_algorithm ( struct target target,
int  num_mem_params,
struct mem_param mem_params,
int  num_reg_params,
struct reg_param reg_params,
target_addr_t  entry_point,
target_addr_t  exit_point,
void *  arch_info 
)

Executes a target-specific native code algorithm and leaves it running.

Starts an algorithm in the background on the target given.

Parameters
targetused to run the algorithm
num_mem_params
mem_params
num_reg_params
reg_params
entry_point
exit_point
arch_infotarget-specific description of the algorithm.

Definition at line 887 of file target.c.

References target::arch_info, ERROR_FAIL, LOG_ERROR, target::running_alg, target_type::start_algorithm, target_type_name(), target_was_examined(), and target::type.

Referenced by cc26xx_init(), msp432_init(), npcx_init(), sromalgo_prepare(), target_run_flash_async_algorithm(), and target_run_read_async_algorithm().

◆ target_state_name()

◆ target_step()

int target_step ( struct target target,
int  current,
target_addr_t  address,
int  handle_breakpoints 
)

Step the target.

This routine is a wrapper for target->type->step.

Definition at line 1479 of file target.c.

References ERROR_OK, target_type::step, target_call_event_callbacks(), TARGET_EVENT_STEP_END, TARGET_EVENT_STEP_START, and target::type.

Referenced by COMMAND_HANDLER(), gdb_fileio_response_packet(), gdb_handle_vcont_packet(), and gdb_step_continue_packet().

◆ target_strerror_safe()

static const char* target_strerror_safe ( int  err)
static

Definition at line 188 of file target.c.

Referenced by jim_target_wait_state().

◆ target_supports_gdb_connection()

bool target_supports_gdb_connection ( struct target target)

Check if target allows GDB connections.

Some target do not implement the necessary code required by GDB.

Definition at line 1470 of file target.c.

References target::gdb_max_connections, target_type::get_gdb_reg_list, and target::type.

Referenced by gdb_target_add_one().

◆ target_timer_callback_periodic_restart()

static int target_timer_callback_periodic_restart ( struct target_timer_callback cb,
int64_t *  now 
)
static

◆ target_timer_next_event()

int64_t target_timer_next_event ( void  )

Returns when the next registered event will take place.

Callers can use this to go to sleep until that time occurs.

Definition at line 1958 of file target.c.

References target_timer_next_event_value.

Referenced by server_loop().

◆ target_type_name()

const char* target_type_name ( struct target target)

Get the target type name.

This routine is a wrapper for the target->type->name field. Note that this is not an instance-specific name for his target.

Definition at line 809 of file target.c.

References target_type::name, and target::type.

Referenced by arm_default_mcr(), arm_default_mrc(), cfi_spansion_write_block(), COMMAND_HANDLER(), embeddedice_build_reg_cache(), stm32x_get_property_addr(), target_configure(), target_handle_event(), target_run_algorithm(), target_start_algorithm(), target_wait_algorithm(), and zephyr_create().

◆ target_unregister_event_callback()

int target_unregister_event_callback ( int(*)(struct target *target, enum target_event event, void *priv callback,
void *  priv 
)

◆ target_unregister_reset_callback()

int target_unregister_reset_callback ( int(*)(struct target *target, enum target_reset_mode reset_mode, void *priv callback,
void *  priv 
)

◆ target_unregister_timer_callback()

◆ target_unregister_trace_callback()

int target_unregister_trace_callback ( int(*)(struct target *target, size_t len, uint8_t *data, void *priv callback,
void *  priv 
)

◆ target_wait_algorithm()

int target_wait_algorithm ( struct target target,
int  num_mem_params,
struct mem_param mem_params,
int  num_reg_params,
struct reg_param reg_params,
target_addr_t  exit_point,
int  timeout_ms,
void *  arch_info 
)

Waits for an algorithm started with target_start_algorithm() to complete.

Wait for an algorithm on the target given.

Parameters
targetused to run the algorithm
num_mem_params
mem_params
num_reg_params
reg_params
exit_point
timeout_ms
arch_infotarget-specific description of the algorithm.

Definition at line 931 of file target.c.

References target::arch_info, ERROR_FAIL, ERROR_TARGET_TIMEOUT, LOG_ERROR, target::running_alg, target_type_name(), target::type, and target_type::wait_algorithm.

Referenced by cc26xx_quit(), msp432_quit(), npcx_quit(), sromalgo_release(), target_run_flash_async_algorithm(), and target_run_read_async_algorithm().

◆ target_wait_state()

◆ target_write_buffer()

int target_write_buffer ( struct target target,
target_addr_t  address,
uint32_t  size,
const uint8_t *  buffer 
)

Definition at line 2408 of file target.c.

References buffer, ERROR_FAIL, ERROR_OK, LOG_DEBUG, LOG_ERROR, size, TARGET_ADDR_FMT, target_was_examined(), target::type, and target_type::write_buffer.

Referenced by aduc702x_write_block(), aducm360_write_block_async(), aducm360_write_block_sync(), ambiqmicro_write_block(), arc_unset_breakpoint(), arc_write_instruction_u32(), arm_nandwrite(), armv4_5_run_algorithm_inner(), armv7m_blank_check_memory(), armv7m_checksum_memory(), armv7m_start_algorithm(), bluenrgx_write(), cc26xx_erase(), cc26xx_init(), cc26xx_mass_erase(), cc26xx_write(), cc3220sf_write(), cfi_intel_write_block(), cfi_spansion_write_block(), cfi_spansion_write_block_mips(), COMMAND_HANDLER(), dsp563xx_run_algorithm(), efm32x_write_block(), em357_write_block(), esirisc_flash_fill_pb(), esp32_soc_reset(), esp32s3_soc_reset(), fespi_write(), fm3_chip_erase(), fm3_erase(), fm3_write_block(), fm4_flash_erase(), fm4_flash_write(), gdb_write_memory_binary_packet(), gdb_write_memory_packet(), hwthread_write_buffer(), imx31_write_page(), jim_nds32_bulk_write(), jim_nds32_multi_write(), kinetis_disable_wdog_algo(), kinetis_ke_stop_watchdog(), kinetis_ke_write_words(), kinetis_write_block(), lpc2000_write(), lpc2900_write(), lpcspifi_erase(), lpcspifi_set_hw_mode(), lpcspifi_write(), max32xxx_write(), max32xxx_write_block(), mdr_write_block(), mips32_blank_check_memory(), mips32_checksum_memory(), mips32_run_algorithm(), mrvlqspi_flash_write(), msp432_exec_cmd(), msp432_init(), msp432_write(), mxc_write_page(), niietcm4_write_block(), npcx_chip_erase(), npcx_erase(), npcx_init(), npcx_write(), nrf5_ll_flash_write(), numicro_writeblock(), pic32mx_write_block(), psoc4_sysreq(), psoc5lp_write(), psoc6_program_row(), qspi_read_write_block(), qspi_verify(), riscv_checksum_memory(), rp2040_flash_write(), rsl10_ll_flash_erase(), rsl10_ll_flash_write(), rsl10_mass_erase(), semihosting_common(), sh_qspi_upload_helper(), sh_qspi_write(), sim3x_write_block(), smi_write_buffer(), stellaris_write(), stellaris_write_block(), stm32l4_write_block(), stm32lx_write(), stm32lx_write_half_pages(), stm32x_write(), stm32x_write_block(), stm32x_write_block_async(), stm32x_write_block_riscv(), stm8_blank_check_memory(), stm8_run_algorithm(), stmqspi_blank_check(), str7x_write_block(), str9x_write_block(), target_run_flash_async_algorithm(), w600_write(), write_to_channel(), xmc1xxx_erase(), xmc1xxx_erase_check(), xmc1xxx_write(), and xtensa_update_instruction().

◆ target_write_buffer_default()

static int target_write_buffer_default ( struct target target,
target_addr_t  address,
uint32_t  count,
const uint8_t *  buffer 
)
static

Definition at line 2432 of file target.c.

References buffer, count, ERROR_OK, size, target_data_bits(), and target_write_memory().

Referenced by target_init_one().

◆ target_write_memory()

int target_write_memory ( struct target target,
target_addr_t  address,
uint32_t  size,
uint32_t  count,
const uint8_t *  buffer 
)

Write count items of size bytes to the memory of target at the address given.

address must be aligned to size in target memory.

The endianness is the same in the host and target memory for this function.

Todo:
TODO: Really buffer should have been defined as "const void *" and buffer should have been aligned to size in the host memory.

This is not enforced via e.g. assert's today and e.g. the target_write_buffer fn breaks this assumption.

This routine is wrapper for target->type->write_memory.

Definition at line 1334 of file target.c.

References buffer, count, ERROR_FAIL, LOG_ERROR, size, target_name(), target_was_examined(), target::type, and target_type::write_memory.

Referenced by aarch64_set_breakpoint(), aarch64_unset_breakpoint(), arm7_9_unset_breakpoint(), arm_code_to_working_area(), at91sam7_write(), cfi_target_write_memory(), COMMAND_HANDLER(), cortex_a_set_breakpoint(), cortex_a_unset_breakpoint(), cortex_a_write_buffer(), cortex_m_set_breakpoint(), cortex_m_unset_breakpoint(), kinetis_ftfx_command(), kinetis_write_sections(), lpc2000_iap_working_area_init(), lpc2900_write(), lpc2900_write_index_page(), lpc3180_write_page(), lpc32xx_read_page_slc(), lpc32xx_write_page_mlc(), lpc32xx_write_page_slc(), mips_m4k_set_breakpoint(), mips_m4k_unset_breakpoint(), mips_mips16_unset_sdbbp(), mips_mips64_unset_sdbbp(), nrf5_ll_flash_write(), numicro_write(), rpc_hf_xfer(), sam3_page_write(), sam4_page_write(), sam4l_write_page(), samd_modify_user_row_masked(), samd_write(), same5_modify_user_row_masked(), same5_write(), samv_page_write(), semihosting_common(), semihosting_write_fields(), stm32l4_write_block_without_loader(), stm32x_write(), stm32x_write_block(), stm8_unset_breakpoint(), str7x_write(), str9x_write(), swm050_write(), target_array2mem(), target_jim_write_memory(), target_restore_working_area(), target_write_buffer_default(), target_write_u16(), target_write_u32(), target_write_u64(), target_write_u8(), write_by_given_size(), xmc1xxx_write(), and xscale_unset_breakpoint().

◆ target_write_phys_memory()

int target_write_phys_memory ( struct target target,
target_addr_t  address,
uint32_t  size,
uint32_t  count,
const uint8_t *  buffer 
)

◆ target_write_phys_u16()

int target_write_phys_u16 ( struct target target,
target_addr_t  address,
uint16_t  value 
)

◆ target_write_phys_u32()

◆ target_write_phys_u64()

int target_write_phys_u64 ( struct target target,
target_addr_t  address,
uint64_t  value 
)

◆ target_write_phys_u8()

int target_write_phys_u8 ( struct target target,
target_addr_t  address,
uint8_t  value 
)

◆ target_write_u16()

◆ target_write_u32()

int target_write_u32 ( struct target target,
target_addr_t  address,
uint32_t  value 
)

Definition at line 2707 of file target.c.

References ERROR_FAIL, ERROR_OK, LOG_DEBUG, LOG_ERROR, TARGET_ADDR_FMT, target_buffer_set_u32(), target_was_examined(), target_write_memory(), and reg::value.

Referenced by adapter_resume(), adapter_step(), aducm360_mass_erase(), aducm360_page_erase(), aducm360_set_write_enable(), aducm360_write_modified(), ambiqmicro_erase(), ambiqmicro_mass_erase(), ambiqmicro_otp_program(), ambiqmicro_write_block(), arm7_9_set_breakpoint(), arm_blank_check_memory(), arm_checksum_memory(), arm_simulate_step_core(), armv7m_trace_itm_config(), at91sam7_flash_command(), at91sam7_set_flash_mode(), at91sam9_disable(), at91sam9_ecc_init(), at91sam9_enable(), bluenrgx_erase(), bluenrgx_write_flash_reg(), call_sromapi(), cc3220sf_erase(), cc3220sf_mass_erase(), clrsetbits_u32(), COMMAND_HANDLER(), cortex_m_dwt_set_reg(), cortex_m_dwt_setup(), cortex_m_enable_fpb(), cortex_m_endreset_event(), cortex_m_examine(), cortex_m_set_breakpoint(), cortex_m_set_watchpoint(), cortex_m_unset_breakpoint(), cortex_m_unset_watchpoint(), davinci_write_block_data(), davinci_write_page_ecc1(), davinci_write_page_ecc4(), davinci_write_page_ecc4infix(), efc_start_command(), efm32x_write_reg_u32(), em357_erase(), em357_erase_options(), em357_mass_erase(), em357_probe(), em357_wait_status_busy(), em357_write(), em357_write_block(), em357_write_options(), esirisc_flash_clear_status(), esirisc_flash_control(), esirisc_flash_disable_protect(), esirisc_flash_enable_protect(), esirisc_flash_erase(), esirisc_flash_fill_pb(), esirisc_flash_init(), esirisc_flash_mass_erase(), esirisc_flash_unlock(), esirisc_flash_write(), esp32_disable_wdts(), esp32_soc_reset(), esp32s2_disable_wdts(), esp32s2_set_peri_reg_mask(), esp32s2_soc_reset(), esp32s3_disable_wdts(), esp32s3_soc_reset(), fespi_write_reg(), find_sfdp_dummy(), fm3_chip_erase(), fm3_erase(), fm3_write_block(), fm4_disable_hw_watchdog(), fm4_enter_flash_cpu_programming_mode(), fm4_enter_flash_cpu_rom_mode(), imx31_init(), io_write_reg(), ioconfig_write_reg(), ipc_acquire(), kinetis_check_run_mode(), kinetis_invalidate_flash_cache(), kinetis_ke_prepare_flash(), lpc288x_load_timer(), lpc288x_set_flash_clk(), lpc2900_erase(), lpc2900_read_security_status(), lpc2900_run_bist128(), lpc2900_setup(), lpc2900_write(), lpc2900_write_index_page(), lpc3180_address(), lpc3180_command(), lpc3180_init(), lpc3180_read_page(), lpc3180_reset(), lpc3180_write_data(), lpc3180_write_page(), lpc32xx_address(), lpc32xx_command(), lpc32xx_init(), lpc32xx_read_page_mlc(), lpc32xx_read_page_slc(), lpc32xx_reset(), lpc32xx_start_slc_dma(), lpc32xx_write_data(), lpc32xx_write_page_mlc(), lpc32xx_write_page_slc(), max32xxx_erase(), max32xxx_flash_op_post(), max32xxx_flash_op_pre(), max32xxx_mass_erase(), max32xxx_protect(), max32xxx_write(), mdr_erase(), mdr_mass_erase(), mdr_read(), mdr_write(), mips32_configure_dbs(), mips32_configure_ibs(), mips32_enable_interrupts(), mips_m4k_examine_debug_reason(), mips_m4k_set_breakpoint(), mips_m4k_set_watchpoint(), mips_m4k_unset_breakpoint(), mips_m4k_unset_watchpoint(), mips_mips64_set_sdbbp(), mrvlqspi_fifo_flush(), mrvlqspi_set_addr(), mrvlqspi_set_conf(), mrvlqspi_set_din_cnt(), mrvlqspi_set_hdr_cnt(), mrvlqspi_set_instr(), mrvlqspi_set_ss_state(), mrvlqspi_start_transfer(), mrvlqspi_stop_transfer(), msp432_exec_cmd(), msp432_write(), mxc_init(), niietcm4_dump_uflash_page(), niietcm4_erase(), niietcm4_load_uflash_page(), niietcm4_mass_erase(), niietcm4_opstatus_check(), niietcm4_probe_k1921vk01t(), niietcm4_protect_check(), niietcm4_uflash_page_erase(), niietcm4_uopstatus_check(), niietcm4_write(), nrf5_nvmc_erase_enable(), nrf5_nvmc_generic_erase(), nrf5_nvmc_read_only(), nrf5_nvmc_write_enable(), nrf5_protect_clenr0(), nuc910_nand_address(), numicro_erase(), numicro_fmc_cmd(), numicro_init_isp(), numicro_reg_unlock(), numicro_write(), octospi_cmd(), pic32mx_erase(), pic32mx_nvm_exec(), pic32mx_write_word(), poll_busy(), psoc4_sysreq(), psoc5lp_eeprom_probe(), psoc5lp_write(), psoc6_erase_row(), psoc6_erase_sector(), psoc6_program_row(), qspi_erase_sector(), qspi_write_enable(), read_flash_id(), read_from_channel(), read_sfdp_block(), read_status_reg(), rp2040_spi_read_flash_id(), rp2040_ssel_active(), rpc_hf_mode(), rpc_hf_xfer(), rsl10_protect(), s3c2410_init(), s3c2410_write_data(), s3c2412_init(), s3c2440_init(), s3c2443_init(), s3c24xx_reset(), s3c6400_init(), sam3_page_write(), sam4_set_wait(), sam4l_flash_command(), samd_erase_row(), samd_issue_nvmctrl_command(), samd_protect(), same5_erase_block(), same5_issue_nvmctrl_command(), same5_protect(), samv_efc_start_command(), set_mm_mode(), sh_qspi_xfer_common(), sim3x_erase_page(), sim3x_flash_erase(), sim3x_init(), sromalgo_prepare(), ssp_write_reg(), stellaris_erase(), stellaris_mass_erase(), stellaris_protect(), stellaris_set_flash_timing(), stellaris_write(), stm32l4_write_flash_reg(), stm32lx_enable_write_half_page(), stm32lx_erase_sector(), stm32lx_lock(), stm32lx_lock_program_memory(), stm32lx_mass_erase(), stm32lx_obl_launch(), stm32lx_unlock(), stm32lx_unlock_options_bytes(), stm32lx_unlock_program_memory(), stm32lx_wait_until_bsy_clear_timeout(), stm32x_erase(), stm32x_erase_options(), stm32x_mass_erase(), stm32x_unlock_option_reg(), stm32x_unlock_reg(), stm32x_wait_status_busy(), stm32x_write(), stm32x_write_block(), stm32x_write_flash_reg(), stm32x_write_options(), stmqspi_abort(), stmqspi_probe(), str7x_erase(), str7x_protect(), str7x_write(), swm050_erase(), swm050_mass_erase(), swm050_write(), target_run_flash_async_algorithm(), target_run_read_async_algorithm(), tms470_erase_check(), tms470_flash_initialize_internal_state_machine(), tms470_protect(), tms470_protect_check(), tms470_read_part_info(), tms470_try_flash_keys(), tms470_write(), w600_start_do(), wrap_write_u32(), write_to_channel(), xmc4xxx_clear_flash_status(), xmc4xxx_enter_page_mode(), xmc4xxx_write_command_sequence(), xmc4xxx_write_page(), and xscale_set_breakpoint().

◆ target_write_u64()

◆ target_write_u8()

◆ write_data()

static void write_data ( FILE *  f,
const void *  data,
size_t  len 
)
static

Definition at line 4197 of file target.c.

References LOG_ERROR.

Referenced by nand_write_data_page(), write_gmon(), write_long(), write_memory_sba_simple(), and write_string().

◆ write_gmon()

static void write_gmon ( uint32_t *  samples,
uint32_t  sample_num,
const char *  filename,
bool  with_range,
uint32_t  start_address,
uint32_t  end_address,
struct target target,
uint32_t  duration_ms 
)
static

Definition at line 4220 of file target.c.

References write_data(), write_long(), and write_string().

Referenced by COMMAND_HANDLER().

◆ write_long()

static void write_long ( FILE *  f,
int  l,
struct target target 
)
static

Definition at line 4204 of file target.c.

References target_buffer_set_u32(), and write_data().

Referenced by write_gmon().

◆ write_string()

static void write_string ( FILE *  f,
char *  s 
)
static

Definition at line 4212 of file target.c.

References write_data().

Referenced by write_gmon().

Variable Documentation

◆ aarch64_target

struct target_type aarch64_target
extern

Definition at line 2955 of file aarch64.c.

◆ all_targets

◆ arcv2_target

struct target_type arcv2_target
extern

Definition at line 2231 of file arc.c.

◆ arm11_target

struct target_type arm11_target
extern

Holds methods for ARM11xx targets.

Definition at line 1254 of file arm11.c.

◆ arm720t_target

struct target_type arm720t_target
extern

Holds methods for ARM720 targets.

Definition at line 440 of file arm720t.c.

◆ arm7tdmi_target

struct target_type arm7tdmi_target
extern

Holds methods for ARM7TDMI targets.

Definition at line 672 of file arm7tdmi.c.

◆ arm920t_target

struct target_type arm920t_target
extern

Holds methods for ARM920 targets.

Definition at line 1534 of file arm920t.c.

◆ arm926ejs_target

struct target_type arm926ejs_target
extern

Holds methods for ARM926 targets.

Definition at line 752 of file arm926ejs.c.

◆ arm946e_target

struct target_type arm946e_target
extern

Holds methods for ARM946 targets.

Definition at line 613 of file arm946e.c.

◆ arm966e_target

struct target_type arm966e_target
extern

Holds methods for ARM966 targets.

Definition at line 166 of file arm966e.c.

◆ arm9tdmi_target

struct target_type arm9tdmi_target
extern

Holds methods for ARM9TDMI targets.

Definition at line 788 of file arm9tdmi.c.

◆ avr32_ap7k_target

struct target_type avr32_ap7k_target
extern

Definition at line 557 of file avr32_ap7k.c.

◆ avr_target

struct target_type avr_target
extern

Definition at line 37 of file avrt.c.

◆ cortexa_target

struct target_type cortexa_target
extern

Definition at line 3272 of file cortex_a.c.

◆ cortexm_target

struct target_type cortexm_target
extern

Definition at line 2786 of file cortex_m.c.

◆ cortexr4_target

struct target_type cortexr4_target
extern

Definition at line 3272 of file cortex_a.c.

◆ dragonite_target

struct target_type dragonite_target
extern

Definition at line 657 of file feroceon.c.

◆ dsp563xx_target

struct target_type dsp563xx_target
extern

Holds methods for DSP563XX targets.

Definition at line 2088 of file dsp563xx.c.

◆ dsp5680xx_target

struct target_type dsp5680xx_target
extern

Holds methods for dsp5680xx targets.

Definition at line 2237 of file dsp5680xx.c.

◆ esirisc_target

struct target_type esirisc_target
extern

Definition at line 1716 of file esirisc.c.

◆ esp32_target

struct target_type esp32_target
extern

Holds methods for Xtensa targets.

Definition at line 407 of file esp32.c.

◆ esp32s2_target

struct target_type esp32s2_target
extern

Definition at line 465 of file esp32s2.c.

◆ esp32s3_target

struct target_type esp32s3_target
extern

Holds methods for Xtensa targets.

Definition at line 329 of file esp32s3.c.

◆ fa526_target

struct target_type fa526_target
extern

Holds methods for FA526 targets.

Definition at line 339 of file fa526.c.

◆ fastload

struct fast_load* fastload
static

Definition at line 6595 of file target.c.

Referenced by COMMAND_HANDLER(), and free_fastload().

◆ fastload_num

int fastload_num
static

Definition at line 6594 of file target.c.

Referenced by COMMAND_HANDLER(), and free_fastload().

◆ feroceon_target

struct target_type feroceon_target
extern

Definition at line 657 of file feroceon.c.

◆ hla_target

struct target_type hla_target
extern

Definition at line 607 of file hla_target.c.

◆ ls1_sap_target

struct target_type ls1_sap_target
extern

Definition at line 193 of file ls1_sap.c.

◆ mem_ap_target

struct target_type mem_ap_target
extern

Definition at line 250 of file mem_ap.c.

◆ mips_m4k_target

struct target_type mips_m4k_target
extern

Definition at line 1316 of file mips_m4k.c.

◆ mips_mips64_target

struct target_type mips_mips64_target
extern

Definition at line 1123 of file mips_mips64.c.

◆ nds32_v2_target

struct target_type nds32_v2_target
extern

Holds methods for V2 targets.

Definition at line 708 of file nds32_v2.c.

◆ nds32_v3_target

struct target_type nds32_v3_target
extern

Holds methods for Andes1337 targets.

Definition at line 420 of file nds32_v3.c.

◆ nds32_v3m_target

struct target_type nds32_v3m_target
extern

Holds methods for NDS32 V3m targets.

Definition at line 395 of file nds32_v3m.c.

◆ nvp_assert

const struct jim_nvp nvp_assert[]
static
Initial value:
= {
{ .name = "assert", NVP_ASSERT },
{ .name = "deassert", NVP_DEASSERT },
{ .name = "T", NVP_ASSERT },
{ .name = "F", NVP_DEASSERT },
{ .name = "t", NVP_ASSERT },
{ .name = "f", NVP_DEASSERT },
{ .name = NULL, .value = -1 }
}
@ NVP_ASSERT
Definition: target.h:62
@ NVP_DEASSERT
Definition: target.h:61
#define NULL
Definition: usb.h:16

Definition at line 161 of file target.c.

◆ nvp_config_opts

struct jim_nvp nvp_config_opts[]
static
Initial value:
= {
{ .name = "-type", .value = TCFG_TYPE },
{ .name = "-event", .value = TCFG_EVENT },
{ .name = "-work-area-virt", .value = TCFG_WORK_AREA_VIRT },
{ .name = "-work-area-phys", .value = TCFG_WORK_AREA_PHYS },
{ .name = "-work-area-size", .value = TCFG_WORK_AREA_SIZE },
{ .name = "-work-area-backup", .value = TCFG_WORK_AREA_BACKUP },
{ .name = "-endian", .value = TCFG_ENDIAN },
{ .name = "-coreid", .value = TCFG_COREID },
{ .name = "-chain-position", .value = TCFG_CHAIN_POSITION },
{ .name = "-dbgbase", .value = TCFG_DBGBASE },
{ .name = "-rtos", .value = TCFG_RTOS },
{ .name = "-defer-examine", .value = TCFG_DEFER_EXAMINE },
{ .name = "-gdb-port", .value = TCFG_GDB_PORT },
{ .name = "-gdb-max-connections", .value = TCFG_GDB_MAX_CONNECTIONS },
{ .name = NULL, .value = -1 }
}
@ TCFG_GDB_MAX_CONNECTIONS
Definition: target.c:5312
@ TCFG_CHAIN_POSITION
Definition: target.c:5307
@ TCFG_GDB_PORT
Definition: target.c:5311
@ TCFG_WORK_AREA_VIRT
Definition: target.c:5301
@ TCFG_TYPE
Definition: target.c:5299
@ TCFG_WORK_AREA_BACKUP
Definition: target.c:5304
@ TCFG_RTOS
Definition: target.c:5309
@ TCFG_DBGBASE
Definition: target.c:5308
@ TCFG_WORK_AREA_PHYS
Definition: target.c:5302
@ TCFG_ENDIAN
Definition: target.c:5305
@ TCFG_WORK_AREA_SIZE
Definition: target.c:5303
@ TCFG_EVENT
Definition: target.c:5300
@ TCFG_DEFER_EXAMINE
Definition: target.c:5310
@ TCFG_COREID
Definition: target.c:5306

Definition at line 5287 of file target.c.

Referenced by target_configure().

◆ nvp_error_target

const struct jim_nvp nvp_error_target[]
static
Initial value:
= {
{ .value = ERROR_TARGET_INVALID, .name = "err-invalid" },
{ .value = ERROR_TARGET_INIT_FAILED, .name = "err-init-failed" },
{ .value = ERROR_TARGET_TIMEOUT, .name = "err-timeout" },
{ .value = ERROR_TARGET_NOT_HALTED, .name = "err-not-halted" },
{ .value = ERROR_TARGET_FAILURE, .name = "err-failure" },
{ .value = ERROR_TARGET_UNALIGNED_ACCESS, .name = "err-unaligned-access" },
{ .value = ERROR_TARGET_DATA_ABORT, .name = "err-data-abort" },
{ .value = ERROR_TARGET_RESOURCE_NOT_AVAILABLE, .name = "err-resource-not-available" },
{ .value = ERROR_TARGET_TRANSLATION_FAULT, .name = "err-translation-fault" },
{ .value = ERROR_TARGET_NOT_RUNNING, .name = "err-not-running" },
{ .value = ERROR_TARGET_NOT_EXAMINED, .name = "err-not-examined" },
{ .value = -1, .name = NULL }
}
#define ERROR_TARGET_NOT_HALTED
Definition: target.h:792
#define ERROR_TARGET_INIT_FAILED
Definition: target.h:790
#define ERROR_TARGET_UNALIGNED_ACCESS
Definition: target.h:794
#define ERROR_TARGET_INVALID
Definition: target.h:789
#define ERROR_TARGET_NOT_EXAMINED
Definition: target.h:799
#define ERROR_TARGET_TIMEOUT
Definition: target.h:791
#define ERROR_TARGET_RESOURCE_NOT_AVAILABLE
Definition: target.h:796
#define ERROR_TARGET_NOT_RUNNING
Definition: target.h:798
#define ERROR_TARGET_DATA_ABORT
Definition: target.h:795
#define ERROR_TARGET_FAILURE
Definition: target.h:793
#define ERROR_TARGET_TRANSLATION_FAULT
Definition: target.h:797

Definition at line 161 of file target.c.

◆ nvp_reset_modes

const struct jim_nvp nvp_reset_modes[]
static
Initial value:
= {
{ .name = "unknown", .value = RESET_UNKNOWN },
{ .name = "run", .value = RESET_RUN },
{ .name = "halt", .value = RESET_HALT },
{ .name = "init", .value = RESET_INIT },
{ .name = NULL, .value = -1 },
}
@ RESET_RUN
Definition: target.h:67
@ RESET_HALT
Definition: target.h:68
@ RESET_UNKNOWN
Definition: target.h:66
@ RESET_INIT
Definition: target.h:69

Definition at line 188 of file target.c.

Referenced by COMMAND_HANDLER(), target_call_reset_callbacks(), target_process_reset(), and target_reset_mode_name().

◆ nvp_target_debug_reason

const struct jim_nvp nvp_target_debug_reason[]
static
Initial value:
= {
{ .name = "debug-request", .value = DBG_REASON_DBGRQ },
{ .name = "breakpoint", .value = DBG_REASON_BREAKPOINT },
{ .name = "watchpoint", .value = DBG_REASON_WATCHPOINT },
{ .name = "watchpoint-and-breakpoint", .value = DBG_REASON_WPTANDBKPT },
{ .name = "single-step", .value = DBG_REASON_SINGLESTEP },
{ .name = "target-not-halted", .value = DBG_REASON_NOTHALTED },
{ .name = "program-exit", .value = DBG_REASON_EXIT },
{ .name = "exception-catch", .value = DBG_REASON_EXC_CATCH },
{ .name = "undefined", .value = DBG_REASON_UNDEFINED },
{ .name = NULL, .value = -1 },
}
@ DBG_REASON_WPTANDBKPT
Definition: target.h:76
@ DBG_REASON_UNDEFINED
Definition: target.h:81
@ DBG_REASON_EXIT
Definition: target.h:79
@ DBG_REASON_NOTHALTED
Definition: target.h:78
@ DBG_REASON_DBGRQ
Definition: target.h:73
@ DBG_REASON_SINGLESTEP
Definition: target.h:77
@ DBG_REASON_WATCHPOINT
Definition: target.h:75
@ DBG_REASON_EXC_CATCH
Definition: target.h:80
@ DBG_REASON_BREAKPOINT
Definition: target.h:74

Definition at line 188 of file target.c.

Referenced by debug_reason_name().

◆ nvp_target_endian

const struct jim_nvp nvp_target_endian[]
static
Initial value:
= {
{ .name = "big", .value = TARGET_BIG_ENDIAN },
{ .name = "little", .value = TARGET_LITTLE_ENDIAN },
{ .name = "be", .value = TARGET_BIG_ENDIAN },
{ .name = "le", .value = TARGET_LITTLE_ENDIAN },
{ .name = NULL, .value = -1 },
}
@ TARGET_BIG_ENDIAN
Definition: target.h:86
@ TARGET_LITTLE_ENDIAN
Definition: target.h:86

Definition at line 188 of file target.c.

Referenced by COMMAND_HANDLER(), and target_configure().

◆ nvp_target_event

const struct jim_nvp nvp_target_event[]
static

Definition at line 188 of file target.c.

Referenced by jim_target_invoke_event(), target_configure(), and target_event_name().

◆ nvp_target_state

const struct jim_nvp nvp_target_state[]
static
Initial value:
= {
{ .name = "unknown", .value = TARGET_UNKNOWN },
{ .name = "running", .value = TARGET_RUNNING },
{ .name = "halted", .value = TARGET_HALTED },
{ .name = "reset", .value = TARGET_RESET },
{ .name = "debug-running", .value = TARGET_DEBUG_RUNNING },
{ .name = NULL, .value = -1 },
}
@ TARGET_RESET
Definition: target.h:56
@ TARGET_DEBUG_RUNNING
Definition: target.h:57
@ TARGET_UNKNOWN
Definition: target.h:53
@ TARGET_HALTED
Definition: target.h:55
@ TARGET_RUNNING
Definition: target.h:54

Definition at line 188 of file target.c.

Referenced by jim_target_wait_state(), target_state_name(), and target_wait_state().

◆ or1k_target

struct target_type or1k_target
extern

Definition at line 1336 of file or1k.c.

◆ polling_interval

const int polling_interval = TARGET_DEFAULT_POLLING_INTERVAL
static

Definition at line 160 of file target.c.

Referenced by handle_target(), and target_init().

◆ power_dropout

int power_dropout
static

Definition at line 2915 of file target.c.

Referenced by handle_target(), and sense_handler().

◆ quark_d20xx_target

struct target_type quark_d20xx_target
extern

Definition at line 53 of file quark_d20xx.c.

◆ quark_x10xx_target

struct target_type quark_x10xx_target
extern

Definition at line 43 of file quark_x10xx.c.

◆ riscv_target

struct target_type riscv_target
extern

Definition at line 3146 of file riscv.c.

◆ run_power_dropout

int run_power_dropout
static

Definition at line 2919 of file target.c.

Referenced by handle_target(), and sense_handler().

◆ run_power_restore

int run_power_restore
static

Definition at line 2918 of file target.c.

Referenced by handle_target(), and sense_handler().

◆ run_srst_asserted

int run_srst_asserted
static

Definition at line 2920 of file target.c.

Referenced by handle_target(), and sense_handler().

◆ run_srst_deasserted

int run_srst_deasserted
static

Definition at line 2921 of file target.c.

Referenced by handle_target(), and sense_handler().

◆ srst_asserted

◆ stm8_target

struct target_type stm8_target
extern

Definition at line 2114 of file stm8.c.

Referenced by stm8_get_core_reg().

◆ target_command_handlers

const struct command_registration target_command_handlers[]
static
Initial value:
= {
{
.name = "targets",
.handler = handle_targets_command,
.mode = COMMAND_ANY,
.help = "change current default target (one parameter) "
"or prints table of all targets (no parameters)",
.usage = "[target]",
},
{
.name = "target",
.mode = COMMAND_CONFIG,
.help = "configure target",
.usage = "",
},
}
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:247
@ COMMAND_CONFIG
Definition: command.h:41
@ COMMAND_ANY
Definition: command.h:42
const char * usage
a string listing the options and arguments, required or optional
Definition: command.h:235
static const struct command_registration target_subcommand_handlers[]
Definition: target.c:6542

Definition at line 6709 of file target.c.

Referenced by target_register_commands().

◆ target_event_callbacks

struct target_event_callback* target_event_callbacks
static

◆ target_exec_command_handlers

const struct command_registration target_exec_command_handlers[]
static

Definition at line 6806 of file target.c.

Referenced by target_register_user_commands().

◆ target_instance_command_handlers

const struct command_registration target_instance_command_handlers[]
static

Definition at line 5957 of file target.c.

Referenced by target_create().

◆ target_reset_nag

bool target_reset_nag = true
static

Definition at line 6762 of file target.c.

Referenced by COMMAND_HANDLER(), and get_target_reset_nag().

◆ target_subcommand_handlers

const struct command_registration target_subcommand_handlers[]
static

Definition at line 6530 of file target.c.

◆ target_timer_callbacks

◆ target_timer_next_event_value

int64_t target_timer_next_event_value
static

◆ target_types

struct target_type* target_types[]
static

Definition at line 110 of file target.c.

Referenced by jim_target_types(), and target_create().

◆ testee_target

struct target_type testee_target
extern

Definition at line 48 of file testee.c.

◆ xscale_target

struct target_type xscale_target
extern

Definition at line 3506 of file xscale.c.

◆ xtensa_chip_target

struct target_type xtensa_chip_target
extern

Methods for generic example of Xtensa-based chip-level targets.

Definition at line 139 of file xtensa_chip.c.