OpenOCD
target_type Struct Reference

This holds methods shared between all instances of a given target type. More...

Collaboration diagram for target_type:

Data Fields

int(* add_breakpoint )(struct target *target, struct breakpoint *breakpoint)
 
int(* add_context_breakpoint )(struct target *target, struct breakpoint *breakpoint)
 
int(* add_hybrid_breakpoint )(struct target *target, struct breakpoint *breakpoint)
 
int(* add_watchpoint )(struct target *target, struct watchpoint *watchpoint)
 
unsigned(* address_bits )(struct target *target)
 
int(* arch_state )(struct target *target)
 
int(* assert_reset )(struct target *target)
 
int(* blank_check_memory )(struct target *target, struct target_memory_check_block *blocks, int num_blocks, uint8_t erased_value)
 
int(* check_reset )(struct target *target)
 
int(* checksum_memory )(struct target *target, target_addr_t address, uint32_t count, uint32_t *checksum)
 
const struct command_registrationcommands
 
unsigned int(* data_bits )(struct target *target)
 
int(* deassert_reset )(struct target *target)
 The implementation is responsible for polling the target such that target->state reflects the state correctly. More...
 
void(* deinit_target )(struct target *target)
 Free all the resources allocated by the target. More...
 
int(* examine )(struct target *target)
 This method is used to perform target setup that requires JTAG access. More...
 
int(* gdb_fileio_end )(struct target *target, int retcode, int fileio_errno, bool ctrl_c)
 
int(* gdb_query_custom )(struct target *target, const char *packet, char **response_p)
 
const char *(* get_gdb_arch )(const struct target *target)
 Target architecture for GDB. More...
 
int(* get_gdb_fileio_info )(struct target *target, struct gdb_fileio_info *fileio_info)
 
int(* get_gdb_reg_list )(struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
 Target register access for GDB. More...
 
int(* get_gdb_reg_list_noread )(struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
 Same as get_gdb_reg_list, but doesn't read the register values. More...
 
int(* halt )(struct target *target)
 
int(* hit_watchpoint )(struct target *target, struct watchpoint **hit_watchpoint)
 
int(* init_target )(struct command_context *cmd_ctx, struct target *target)
 
int(* mmu )(struct target *target, int *enabled)
 
const char * name
 Name of this type of target. More...
 
int(* poll )(struct target *target)
 
int(* profiling )(struct target *target, uint32_t *samples, uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds)
 
int(* read_buffer )(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
 
int(* read_memory )(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
 Target memory read callback. More...
 
int(* read_phys_memory )(struct target *target, target_addr_t phys_address, uint32_t size, uint32_t count, uint8_t *buffer)
 
int(* remove_breakpoint )(struct target *target, struct breakpoint *breakpoint)
 
int(* remove_watchpoint )(struct target *target, struct watchpoint *watchpoint)
 
int(* resume )(struct target *target, int current, target_addr_t address, int handle_breakpoints, int debug_execution)
 
int(* 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, unsigned int timeout_ms, void *arch_info)
 Target algorithm support. More...
 
int(* soft_reset_halt )(struct target *target)
 
int(* start_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, void *arch_info)
 
int(* step )(struct target *target, int current, target_addr_t address, int handle_breakpoints)
 
int(* target_create )(struct target *target, Jim_Interp *interp)
 
int(* target_jim_commands )(struct target *target, struct jim_getopt_info *goi)
 
int(* target_jim_configure )(struct target *target, struct jim_getopt_info *goi)
 
int(* target_request_data )(struct target *target, uint32_t size, uint8_t *buffer)
 
int(* virt2phys )(struct target *target, target_addr_t address, target_addr_t *physical)
 
int(* wait_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 exit_point, unsigned int timeout_ms, void *arch_info)
 
int(* write_buffer )(struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)
 
int(* write_memory )(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
 Target memory write callback. More...
 
int(* write_phys_memory )(struct target *target, target_addr_t phys_address, uint32_t size, uint32_t count, const uint8_t *buffer)
 

Detailed Description

This holds methods shared between all instances of a given target type.

For example, all Cortex-M3 targets on a scan chain share the same method table.

Definition at line 26 of file target_type.h.

Field Documentation

◆ add_breakpoint

int(* target_type::add_breakpoint) (struct target *target, struct breakpoint *breakpoint)

◆ add_context_breakpoint

int(* target_type::add_context_breakpoint) (struct target *target, struct breakpoint *breakpoint)

Definition at line 154 of file target_type.h.

Referenced by handle_bp_command_set(), and target_add_context_breakpoint().

◆ add_hybrid_breakpoint

int(* target_type::add_hybrid_breakpoint) (struct target *target, struct breakpoint *breakpoint)

Definition at line 155 of file target_type.h.

Referenced by handle_bp_command_set(), and target_add_hybrid_breakpoint().

◆ add_watchpoint

int(* target_type::add_watchpoint) (struct target *target, struct watchpoint *watchpoint)

Definition at line 164 of file target_type.h.

Referenced by arm_dpm_setup(), armv8_dpm_setup(), and target_add_watchpoint().

◆ address_bits

unsigned(* target_type::address_bits) (struct target *target)

Definition at line 306 of file target_type.h.

Referenced by target_address_bits().

◆ arch_state

int(* target_type::arch_state) (struct target *target)

Definition at line 37 of file target_type.h.

Referenced by riscv_arch_state(), and target_arch_state().

◆ assert_reset

int(* target_type::assert_reset) (struct target *target)

Definition at line 64 of file target_type.h.

Referenced by COMMAND_HANDLER(), and riscv_assert_reset().

◆ blank_check_memory

int(* target_type::blank_check_memory) (struct target *target, struct target_memory_check_block *blocks, int num_blocks, uint8_t erased_value)

Definition at line 137 of file target_type.h.

Referenced by target_blank_check_memory().

◆ check_reset

int(* target_type::check_reset) (struct target *target)

Definition at line 279 of file target_type.h.

Referenced by target_process_reset().

◆ checksum_memory

int(* target_type::checksum_memory) (struct target *target, target_addr_t address, uint32_t count, uint32_t *checksum)

Definition at line 135 of file target_type.h.

Referenced by target_checksum_memory().

◆ commands

const struct command_registration* target_type::commands

Definition at line 194 of file target_type.h.

Referenced by target_create().

◆ data_bits

unsigned int(* target_type::data_bits) (struct target *target)

Definition at line 311 of file target_type.h.

Referenced by target_data_bits().

◆ deassert_reset

int(* target_type::deassert_reset) (struct target *target)

The implementation is responsible for polling the target such that target->state reflects the state correctly.

Otherwise the following would fail, as there will not be any "poll" invoked between the "reset run" and "halt".

reset run; halt

Definition at line 76 of file target_type.h.

Referenced by COMMAND_HANDLER(), and riscv_deassert_reset().

◆ deinit_target

void(* target_type::deinit_target) (struct target *target)

Free all the resources allocated by the target.

WARNING: deinit_target is called unconditionally regardless the target has ever been examined/initialised or not. If a problem has prevented establishing JTAG/SWD/... communication or if the target was created with -defer-examine flag and has never been examined then it is not possible to communicate with the target.

If you need to talk to the target during deinit, first check if target_was_examined()!

Parameters
targetThe target to deinit

Definition at line 247 of file target_type.h.

Referenced by riscv_deinit_target(), target_create(), and target_destroy().

◆ examine

int(* target_type::examine) (struct target *target)

This method is used to perform target setup that requires JTAG access.

This may be called multiple times. It is called after the scan chain is initially validated, or later after the target is enabled by a JRC. It may also be called during some parts of the reset sequence.

For one-time initialization tasks, use target_was_examined() and target_set_examined(). For example, probe the hardware before setting up chip-specific state, and then set that flag so you don't do that again.

Definition at line 222 of file target_type.h.

Referenced by COMMAND_HANDLER(), riscv_examine(), and target_examine_one().

◆ gdb_fileio_end

int(* target_type::gdb_fileio_end) (struct target *target, int retcode, int fileio_errno, bool ctrl_c)

Definition at line 287 of file target_type.h.

Referenced by semihosting_common_init(), target_gdb_fileio_end(), and target_init_one().

◆ gdb_query_custom

int(* target_type::gdb_query_custom) (struct target *target, const char *packet, char **response_p)

Definition at line 296 of file target_type.h.

Referenced by gdb_query_packet().

◆ get_gdb_arch

const char*(* target_type::get_gdb_arch) (const struct target *target)

Target architecture for GDB.

The string returned by this function will not be automatically freed; if dynamic allocation is used for this value, it must be managed by the target, ideally by caching the result for subsequent calls.

Definition at line 86 of file target_type.h.

Referenced by target_get_gdb_arch().

◆ get_gdb_fileio_info

int(* target_type::get_gdb_fileio_info) (struct target *target, struct gdb_fileio_info *fileio_info)

◆ get_gdb_reg_list

int(* target_type::get_gdb_reg_list) (struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)

Target register access for GDB.

Do not call this function directly, use target_get_gdb_reg_list() instead.

Danger! this function will succeed even if the target is running and return a register list with dummy values.

The reason is that GDB connection will fail without a valid register list, however it is after GDB is connected that monitor commands can be run to properly initialize the target

Definition at line 99 of file target_type.h.

Referenced by target_get_gdb_reg_list(), and target_supports_gdb_connection().

◆ get_gdb_reg_list_noread

int(* target_type::get_gdb_reg_list_noread) (struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)

Same as get_gdb_reg_list, but doesn't read the register values.

Definition at line 105 of file target_type.h.

Referenced by target_get_gdb_reg_list_noread().

◆ halt

int(* target_type::halt) (struct target *target)

Definition at line 43 of file target_type.h.

Referenced by COMMAND_HANDLER(), halt_go(), riscv_halt(), and target_halt().

◆ hit_watchpoint

int(* target_type::hit_watchpoint) (struct target *target, struct watchpoint **hit_watchpoint)

Definition at line 175 of file target_type.h.

Referenced by target_hit_watchpoint().

◆ init_target

int(* target_type::init_target) (struct command_context *cmd_ctx, struct target *target)

Definition at line 229 of file target_type.h.

Referenced by riscv_examine().

◆ mmu

int(* target_type::mmu) (struct target *target, int *enabled)

Definition at line 271 of file target_type.h.

Referenced by target_alloc_working_area_try().

◆ name

const char* target_type::name

◆ poll

int(* target_type::poll) (struct target *target)

Definition at line 34 of file target_type.h.

Referenced by COMMAND_HANDLER(), oldriscv_poll(), and target_poll().

◆ profiling

int(* target_type::profiling) (struct target *target, uint32_t *samples, uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds)

Definition at line 300 of file target_type.h.

Referenced by target_init_one(), and target_profiling().

◆ read_buffer

int(* target_type::read_buffer) (struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)

Definition at line 128 of file target_type.h.

Referenced by target_init_one(), and target_read_buffer().

◆ read_memory

int(* target_type::read_memory) (struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)

Target memory read callback.

Do not call this function directly, use target_read_memory() instead.

Definition at line 118 of file target_type.h.

Referenced by target_read_memory().

◆ read_phys_memory

int(* target_type::read_phys_memory) (struct target *target, target_addr_t phys_address, uint32_t size, uint32_t count, uint8_t *buffer)

Definition at line 262 of file target_type.h.

Referenced by target_read_phys_memory().

◆ remove_breakpoint

int(* target_type::remove_breakpoint) (struct target *target, struct breakpoint *breakpoint)

Definition at line 161 of file target_type.h.

Referenced by arm_dpm_setup(), armv8_dpm_setup(), and target_remove_breakpoint().

◆ remove_watchpoint

int(* target_type::remove_watchpoint) (struct target *target, struct watchpoint *watchpoint)

Definition at line 170 of file target_type.h.

Referenced by arm_dpm_setup(), armv8_dpm_setup(), and target_remove_watchpoint().

◆ resume

int(* target_type::resume) (struct target *target, int current, target_addr_t address, int handle_breakpoints, int debug_execution)

Definition at line 45 of file target_type.h.

Referenced by resume_go(), and target_resume().

◆ run_algorithm

int(* target_type::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, unsigned int timeout_ms, void *arch_info)

Target algorithm support.

Do not call this method directly, use target_run_algorithm() instead.

Definition at line 181 of file target_type.h.

Referenced by target_run_algorithm().

◆ soft_reset_halt

int(* target_type::soft_reset_halt) (struct target *target)

Definition at line 77 of file target_type.h.

Referenced by target_soft_reset_halt().

◆ start_algorithm

int(* target_type::start_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, void *arch_info)

Definition at line 185 of file target_type.h.

Referenced by target_start_algorithm().

◆ step

int(* target_type::step) (struct target *target, int current, target_addr_t address, int handle_breakpoints)

Definition at line 47 of file target_type.h.

Referenced by gdb_handle_vcont_packet(), oldriscv_step(), and target_step().

◆ target_create

int(* target_type::target_create) (struct target *target, Jim_Interp *interp)

Definition at line 197 of file target_type.h.

Referenced by target_create().

◆ target_jim_commands

int(* target_type::target_jim_commands) (struct target *target, struct jim_getopt_info *goi)

Definition at line 206 of file target_type.h.

◆ target_jim_configure

int(* target_type::target_jim_configure) (struct target *target, struct jim_getopt_info *goi)

Definition at line 202 of file target_type.h.

Referenced by target_configure().

◆ target_request_data

int(* target_type::target_request_data) (struct target *target, uint32_t size, uint8_t *buffer)

Definition at line 40 of file target_type.h.

Referenced by COMMAND_HANDLER(), target_asciimsg(), target_hexmsg(), and target_request().

◆ virt2phys

◆ wait_algorithm

int(* target_type::wait_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 exit_point, unsigned int timeout_ms, void *arch_info)

Definition at line 189 of file target_type.h.

Referenced by target_wait_algorithm().

◆ write_buffer

int(* target_type::write_buffer) (struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)

Definition at line 132 of file target_type.h.

Referenced by target_init_one(), and target_write_buffer().

◆ write_memory

int(* target_type::write_memory) (struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)

Target memory write callback.

Do not call this function directly, use target_write_memory() instead.

Definition at line 124 of file target_type.h.

Referenced by riscv_write_memory(), riscv_write_phys_memory(), and target_write_memory().

◆ write_phys_memory

int(* target_type::write_phys_memory) (struct target *target, target_addr_t phys_address, uint32_t size, uint32_t count, const uint8_t *buffer)

Definition at line 268 of file target_type.h.

Referenced by target_write_phys_memory().


The documentation for this struct was generated from the following file: