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

Go to the source code of this file.

Data Structures

struct  backoff_timer
 
struct  gdb_fileio_info
 
struct  gdb_service
 
struct  target
 
struct  target_event_action
 
struct  target_event_callback
 
struct  target_list
 
struct  target_memory_check_block
 
struct  target_reset_callback
 
struct  target_timer_callback
 
struct  target_trace_callback
 
struct  working_area
 

Macros

#define ERROR_TARGET_ALGO_EXIT   (-313)
 
#define ERROR_TARGET_DATA_ABORT   (-307)
 
#define ERROR_TARGET_DUPLICATE_BREAKPOINT   (-312)
 
#define ERROR_TARGET_FAILURE   (-305)
 
#define ERROR_TARGET_HALTED_DO_RESUME   (-316) /* used to workaround incorrect debug halt */
 
#define ERROR_TARGET_INIT_FAILED   (-301)
 
#define ERROR_TARGET_INVALID   (-300)
 
#define ERROR_TARGET_NOT_EXAMINED   (-311)
 
#define ERROR_TARGET_NOT_HALTED   (-304)
 
#define ERROR_TARGET_NOT_RUNNING   (-310)
 
#define ERROR_TARGET_PACKING_NOT_SUPPORTED   (-315)
 
#define ERROR_TARGET_RESOURCE_NOT_AVAILABLE   (-308)
 
#define ERROR_TARGET_SIZE_NOT_SUPPORTED   (-314)
 
#define ERROR_TARGET_TIMEOUT   (-302)
 
#define ERROR_TARGET_TRANSLATION_FAULT   (-309)
 
#define ERROR_TARGET_UNALIGNED_ACCESS   (-306)
 
#define TARGET_DEFAULT_POLLING_INTERVAL   100
 

Enumerations

enum  target_debug_reason {
  DBG_REASON_DBGRQ = 0 , DBG_REASON_BREAKPOINT = 1 , DBG_REASON_WATCHPOINT = 2 , DBG_REASON_WPTANDBKPT = 3 ,
  DBG_REASON_SINGLESTEP = 4 , DBG_REASON_NOTHALTED = 5 , DBG_REASON_EXIT = 6 , DBG_REASON_EXC_CATCH = 7 ,
  DBG_REASON_UNDEFINED = 8
}
 
enum  target_endianness { TARGET_ENDIAN_UNKNOWN = 0 , TARGET_BIG_ENDIAN = 1 , TARGET_LITTLE_ENDIAN = 2 }
 
enum  target_event {
  TARGET_EVENT_GDB_HALT , TARGET_EVENT_HALTED , TARGET_EVENT_RESUMED , TARGET_EVENT_RESUME_START ,
  TARGET_EVENT_RESUME_END , TARGET_EVENT_STEP_START , TARGET_EVENT_STEP_END , TARGET_EVENT_GDB_START ,
  TARGET_EVENT_GDB_END , TARGET_EVENT_RESET_START , TARGET_EVENT_RESET_ASSERT_PRE , TARGET_EVENT_RESET_ASSERT ,
  TARGET_EVENT_RESET_ASSERT_POST , TARGET_EVENT_RESET_DEASSERT_PRE , TARGET_EVENT_RESET_DEASSERT_POST , TARGET_EVENT_RESET_INIT ,
  TARGET_EVENT_RESET_END , TARGET_EVENT_DEBUG_HALTED , TARGET_EVENT_DEBUG_RESUMED , TARGET_EVENT_EXAMINE_START ,
  TARGET_EVENT_EXAMINE_FAIL , TARGET_EVENT_EXAMINE_END , TARGET_EVENT_GDB_ATTACH , TARGET_EVENT_GDB_DETACH ,
  TARGET_EVENT_GDB_FLASH_ERASE_START , TARGET_EVENT_GDB_FLASH_ERASE_END , TARGET_EVENT_GDB_FLASH_WRITE_START , TARGET_EVENT_GDB_FLASH_WRITE_END ,
  TARGET_EVENT_TRACE_CONFIG , TARGET_EVENT_SEMIHOSTING_USER_CMD_0X100 = 0x100 , TARGET_EVENT_SEMIHOSTING_USER_CMD_0X101 = 0x101 , TARGET_EVENT_SEMIHOSTING_USER_CMD_0X102 = 0x102 ,
  TARGET_EVENT_SEMIHOSTING_USER_CMD_0X103 = 0x103 , TARGET_EVENT_SEMIHOSTING_USER_CMD_0X104 = 0x104 , TARGET_EVENT_SEMIHOSTING_USER_CMD_0X105 = 0x105 , TARGET_EVENT_SEMIHOSTING_USER_CMD_0X106 = 0x106 ,
  TARGET_EVENT_SEMIHOSTING_USER_CMD_0X107 = 0x107
}
 
enum  target_register_class { REG_CLASS_ALL , REG_CLASS_GENERAL }
 
enum  target_reset_mode { RESET_UNKNOWN = 0 , RESET_RUN = 1 , RESET_HALT = 2 , RESET_INIT = 3 }
 
enum  target_state {
  TARGET_UNKNOWN = 0 , TARGET_RUNNING = 1 , TARGET_HALTED = 2 , TARGET_RESET = 3 ,
  TARGET_DEBUG_RUNNING = 4
}
 
enum  target_timer_type { TARGET_TIMER_TYPE_ONESHOT , TARGET_TIMER_TYPE_PERIODIC }
 

Functions

const char * debug_reason_name (const struct target *t)
 
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)
 
bool get_target_reset_nag (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 int 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)
 
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)
 
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)
 
int target_call_timer_callbacks (void)
 
int target_call_timer_callbacks_now (void)
 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)
 
unsigned int target_data_bits (struct target *target)
 Return the number of data bits this target supports. More...
 
const char * target_debug_reason_str (enum target_debug_reason reason)
 
static const char * target_endianness (const struct target *target)
 Returns a description of the endianness for the specified target. More...
 
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...
 
void target_free_all_working_areas (struct target *target)
 
int target_free_working_area (struct target *target, struct working_area *area)
 Free a working area. More...
 
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...
 
const char * target_get_gdb_arch (const 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...
 
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 *t, enum target_event e)
 
void target_handle_md_output (struct command_invocation *cmd, struct target *target, target_addr_t address, unsigned int size, unsigned int count, const uint8_t *buffer)
 
bool target_has_event_action (const 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 **watchpoint)
 Find out the just hit watchpoint for target. More...
 
static const char * target_name (const struct target *target)
 Returns the instance-specific name of the specified target. More...
 
int target_poll (struct target *target)
 
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)
 
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)
 
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...
 
const char * target_reset_mode_name (enum target_reset_mode reset_mode)
 Return the name of a target reset reason enumeration value. More...
 
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, unsigned int timeout_ms, void *arch_info)
 Run an algorithm on the target given. 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)
 This routine is a wrapper for asynchronous algorithms. 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 void target_set_examined (struct target *target)
 Sets the examined flag for the given target. More...
 
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)
 Starts an algorithm in the background on the target given. More...
 
const char * target_state_name (const struct target *target)
 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...
 
bool target_supports_gdb_connection (const struct target *target)
 Check if target allows GDB connections. More...
 
int64_t target_timer_next_event (void)
 Returns when the next registered event will take place. More...
 
const char * target_type_name (const 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, unsigned int timeout_ms, void *arch_info)
 Wait for an algorithm on the target given. More...
 
int target_wait_state (struct target *target, enum target_state state, unsigned int ms)
 
static bool target_was_examined (const struct target *target)
 
int target_write_buffer (struct target *target, target_addr_t address, uint32_t size, 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)
 

Variables

struct targetall_targets
 

Macro Definition Documentation

◆ ERROR_TARGET_ALGO_EXIT

#define ERROR_TARGET_ALGO_EXIT   (-313)

Definition at line 799 of file target.h.

◆ ERROR_TARGET_DATA_ABORT

#define ERROR_TARGET_DATA_ABORT   (-307)

Definition at line 793 of file target.h.

◆ ERROR_TARGET_DUPLICATE_BREAKPOINT

#define ERROR_TARGET_DUPLICATE_BREAKPOINT   (-312)

Definition at line 798 of file target.h.

◆ ERROR_TARGET_FAILURE

#define ERROR_TARGET_FAILURE   (-305)

Definition at line 791 of file target.h.

◆ ERROR_TARGET_HALTED_DO_RESUME

#define ERROR_TARGET_HALTED_DO_RESUME   (-316) /* used to workaround incorrect debug halt */

Definition at line 802 of file target.h.

◆ ERROR_TARGET_INIT_FAILED

#define ERROR_TARGET_INIT_FAILED   (-301)

Definition at line 788 of file target.h.

◆ ERROR_TARGET_INVALID

#define ERROR_TARGET_INVALID   (-300)

Definition at line 787 of file target.h.

◆ ERROR_TARGET_NOT_EXAMINED

#define ERROR_TARGET_NOT_EXAMINED   (-311)

Definition at line 797 of file target.h.

◆ ERROR_TARGET_NOT_HALTED

#define ERROR_TARGET_NOT_HALTED   (-304)

Definition at line 790 of file target.h.

◆ ERROR_TARGET_NOT_RUNNING

#define ERROR_TARGET_NOT_RUNNING   (-310)

Definition at line 796 of file target.h.

◆ ERROR_TARGET_PACKING_NOT_SUPPORTED

#define ERROR_TARGET_PACKING_NOT_SUPPORTED   (-315)

Definition at line 801 of file target.h.

◆ ERROR_TARGET_RESOURCE_NOT_AVAILABLE

#define ERROR_TARGET_RESOURCE_NOT_AVAILABLE   (-308)

Definition at line 794 of file target.h.

◆ ERROR_TARGET_SIZE_NOT_SUPPORTED

#define ERROR_TARGET_SIZE_NOT_SUPPORTED   (-314)

Definition at line 800 of file target.h.

◆ ERROR_TARGET_TIMEOUT

#define ERROR_TARGET_TIMEOUT   (-302)

Definition at line 789 of file target.h.

◆ ERROR_TARGET_TRANSLATION_FAULT

#define ERROR_TARGET_TRANSLATION_FAULT   (-309)

Definition at line 795 of file target.h.

◆ ERROR_TARGET_UNALIGNED_ACCESS

#define ERROR_TARGET_UNALIGNED_ACCESS   (-306)

Definition at line 792 of file target.h.

◆ TARGET_DEFAULT_POLLING_INTERVAL

#define TARGET_DEFAULT_POLLING_INTERVAL   100

Definition at line 806 of file target.h.

Enumeration Type Documentation

◆ target_debug_reason

Enumerator
DBG_REASON_DBGRQ 
DBG_REASON_BREAKPOINT 
DBG_REASON_WATCHPOINT 
DBG_REASON_WPTANDBKPT 
DBG_REASON_SINGLESTEP 
DBG_REASON_NOTHALTED 
DBG_REASON_EXIT 
DBG_REASON_EXC_CATCH 
DBG_REASON_UNDEFINED 

Definition at line 68 of file target.h.

◆ target_endianness

Enumerator
TARGET_ENDIAN_UNKNOWN 
TARGET_BIG_ENDIAN 
TARGET_LITTLE_ENDIAN 

Definition at line 80 of file target.h.

◆ target_event

Enumerator
TARGET_EVENT_GDB_HALT 
TARGET_EVENT_HALTED 
TARGET_EVENT_RESUMED 
TARGET_EVENT_RESUME_START 
TARGET_EVENT_RESUME_END 
TARGET_EVENT_STEP_START 
TARGET_EVENT_STEP_END 
TARGET_EVENT_GDB_START 
TARGET_EVENT_GDB_END 
TARGET_EVENT_RESET_START 
TARGET_EVENT_RESET_ASSERT_PRE 
TARGET_EVENT_RESET_ASSERT 
TARGET_EVENT_RESET_ASSERT_POST 
TARGET_EVENT_RESET_DEASSERT_PRE 
TARGET_EVENT_RESET_DEASSERT_POST 
TARGET_EVENT_RESET_INIT 
TARGET_EVENT_RESET_END 
TARGET_EVENT_DEBUG_HALTED 
TARGET_EVENT_DEBUG_RESUMED 
TARGET_EVENT_EXAMINE_START 
TARGET_EVENT_EXAMINE_FAIL 
TARGET_EVENT_EXAMINE_END 
TARGET_EVENT_GDB_ATTACH 
TARGET_EVENT_GDB_DETACH 
TARGET_EVENT_GDB_FLASH_ERASE_START 
TARGET_EVENT_GDB_FLASH_ERASE_END 
TARGET_EVENT_GDB_FLASH_WRITE_START 
TARGET_EVENT_GDB_FLASH_WRITE_END 
TARGET_EVENT_TRACE_CONFIG 
TARGET_EVENT_SEMIHOSTING_USER_CMD_0X100 
TARGET_EVENT_SEMIHOSTING_USER_CMD_0X101 
TARGET_EVENT_SEMIHOSTING_USER_CMD_0X102 
TARGET_EVENT_SEMIHOSTING_USER_CMD_0X103 
TARGET_EVENT_SEMIHOSTING_USER_CMD_0X104 
TARGET_EVENT_SEMIHOSTING_USER_CMD_0X105 
TARGET_EVENT_SEMIHOSTING_USER_CMD_0X106 
TARGET_EVENT_SEMIHOSTING_USER_CMD_0X107 

Definition at line 240 of file target.h.

◆ target_register_class

Enumerator
REG_CLASS_ALL 
REG_CLASS_GENERAL 

Definition at line 110 of file target.h.

◆ target_reset_mode

Enumerator
RESET_UNKNOWN 
RESET_RUN 
RESET_HALT 
RESET_INIT 

Definition at line 61 of file target.h.

◆ target_state

Enumerator
TARGET_UNKNOWN 
TARGET_RUNNING 
TARGET_HALTED 
TARGET_RESET 
TARGET_DEBUG_RUNNING 

Definition at line 53 of file target.h.

◆ target_timer_type

Enumerator
TARGET_TIMER_TYPE_ONESHOT 
TARGET_TIMER_TYPE_PERIODIC 

Definition at line 325 of file target.h.

Function Documentation

◆ debug_reason_name()

◆ get_current_target()

◆ get_current_target_or_null()

struct target* get_current_target_or_null ( struct command_context cmd_ctx)

◆ get_target()

struct target* get_target ( const char *  id)

◆ get_target_reset_nag()

bool get_target_reset_nag ( void  )

Definition at line 6288 of file target.c.

References target_reset_nag.

Referenced by arm7_9_check_reset().

◆ 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 1293 of file target.c.

References target_type::add_breakpoint, BKPT_HARD, ERROR_TARGET_NOT_HALTED, LOG_TARGET_ERROR, target::state, TARGET_HALTED, breakpoint::type, and target::type.

Referenced by breakpoint_add_internal().

◆ 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 1303 of file target.c.

References target_type::add_context_breakpoint, ERROR_TARGET_NOT_HALTED, LOG_TARGET_ERROR, target::state, TARGET_HALTED, 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 1313 of file target.c.

References target_type::add_hybrid_breakpoint, ERROR_TARGET_NOT_HALTED, LOG_TARGET_ERROR, target::state, TARGET_HALTED, 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 1329 of file target.c.

References target_type::add_watchpoint, ERROR_TARGET_NOT_HALTED, LOG_TARGET_ERROR, target::state, TARGET_HALTED, and target::type.

Referenced by watchpoint_add_internal().

◆ target_address_bits()

unsigned int 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 1453 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 1444 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 2060 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(), esp_algorithm_load_func_image(), esp_algorithm_run_image(), 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_read_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_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 401 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 325 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 385 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 425 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 361 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 409 of file target.c.

References buffer, count, and target_buffer_set_u64().

Referenced by mips_mips64_read_memory().

◆ target_call_event_callbacks()

int target_call_event_callbacks ( struct target target,
enum target_event  event 
)

Definition at line 1764 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_exit_debug(), 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(), COMMAND_HANDLER(), cortex_a_poll(), cortex_a_resume(), cortex_m_poll_one(), cortex_m_poll_smp(), cortex_m_restart_one(), 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(), 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(), 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_callbacks()

int target_call_timer_callbacks ( void  )

◆ 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 1884 of file target.c.

References target_call_timer_callbacks_check_time().

Referenced by gdb_query_packet(), 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_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 1460 of file target.c.

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

Referenced by target_read_buffer_default(), and target_write_buffer_default().

◆ target_debug_reason_str()

◆ target_endianness()

static const char* target_endianness ( const struct target target)
inlinestatic

Returns a description of the endianness for the specified target.

Definition at line 226 of file target.h.

References target::endianness, TARGET_BIG_ENDIAN, and TARGET_ENDIAN_UNKNOWN.

◆ target_event_name()

const char* target_event_name ( enum target_event  event)

Return the name of a target event enumeration value.

Definition at line 275 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)

◆ target_free_all_working_areas()

◆ 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 2118 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(), esp_algorithm_run_image(), 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_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 1435 of file target.c.

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

Referenced by gdb_fileio_response_packet().

◆ target_get_gdb_arch()

const char* target_get_gdb_arch ( const struct target target)

Obtain the architecture for GDB.

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

Definition at line 1361 of file target.c.

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

Referenced by 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 1426 of file target.c.

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

Referenced by gdb_frontend_halted().

◆ 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 1368 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(), nuttx_getreg_current_thread(), 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 1390 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 int  size,
unsigned int  count,
const uint8_t *  buffer 
)

◆ target_has_event_action()

bool target_has_event_action ( const struct target target,
enum target_event  event 
)

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

Definition at line 4860 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 1343 of file target.c.

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

Referenced by watchpoint_hit().

◆ target_name()

static const char* target_name ( const struct target target)
inlinestatic

Returns the instance-specific name of the specified target.

Definition at line 233 of file target.h.

References target::cmd_name.

Referenced by aarch64_assert_reset(), aarch64_deassert_reset(), aarch64_debug_entry(), aarch64_do_restart_one(), aarch64_examine_first(), aarch64_halt_one(), aarch64_init_debug_access(), aarch64_poll(), aarch64_prep_restart_smp(), aarch64_prepare_halt_smp(), aarch64_prepare_restart_one(), aarch64_restart_one(), aarch64_restore_context(), aarch64_restore_one(), aarch64_resume(), aarch64_step(), aarch64_step_restart_smp(), aarch64_wait_halt_one(), arc_set_actionpoints_num(), arm11_assert_reset(), arm11_deassert_reset(), arm7_9_assert_reset(), arm_dpm_initialize(), arm_dpm_setup(), armv7a_read_mpidr(), armv7m_arch_state(), armv8_aarch64_state(), armv8_dpm_initialize(), armv8_dpm_setup(), armv8_get_gdb_reg_list(), armv8_read_mpidr(), chibios_create(), chromium_ec_create(), COMMAND_HANDLER(), COMMAND_HELPER(), cortex_a_assert_reset(), cortex_a_deassert_reset(), cortex_a_examine_first(), discover_vlenb(), dpm_maybe_update_bpwp(), dpmv8_maybe_update_bpwp(), embeddedice_build_reg_cache(), embkernel_create(), esirisc_add_breakpoint(), esirisc_add_watchpoint(), esirisc_assert_reset(), esirisc_deassert_reset(), esirisc_debug_enable(), esirisc_debug_reset(), esirisc_debug_step(), esirisc_disable_interrupts(), esirisc_disable_step(), esirisc_enable_step(), esirisc_examine(), esirisc_flush_caches(), esirisc_halt(), esirisc_identify(), esirisc_poll(), esirisc_read_csr(), esirisc_read_memory(), esirisc_read_reg(), esirisc_remove_breakpoint(), esirisc_remove_breakpoints(), esirisc_remove_watchpoint(), esirisc_remove_watchpoints(), esirisc_reset_entry(), esirisc_restore_hwdc(), esirisc_restore_interrupts(), esirisc_resume_or_step(), esirisc_save_interrupts(), esirisc_target_create(), esirisc_trace_clear_status(), esirisc_trace_get_status(), esirisc_trace_init(), esirisc_trace_read_buffer(), esirisc_trace_read_memory(), esirisc_trace_start(), esirisc_trace_stop(), esirisc_write_csr(), esirisc_write_memory(), esirisc_write_reg(), esp32_apptrace_get_data_info(), esp32_apptrace_safe_halt_targets(), esp32_cmd_apptrace_generic(), esp32_sysview_stop(), esp_dbgstubs_table_read(), esp_xtensa_apptrace_buffs_write(), esp_xtensa_apptrace_data_read(), esp_xtensa_smp_poll(), esp_xtensa_smp_update_halt_gdb(), freertos_create(), gdb_breakpoint_watchpoint_packet(), gdb_new_connection(), gdb_restart_inferior(), get_target(), halt_prep(), hwthread_fill_thread(), kinetis_create_missing_banks(), lakemont_reset_deassert(), max32xxx_write_block(), mqx_create(), read_memory(), register_get(), register_set(), riot_create(), riscv013_get_register(), riscv_enumerate_triggers(), riscv_get_gdb_reg_list_internal(), riscv_get_register(), riscv_halt_go_all_harts(), riscv_resume_go_all_harts(), riscv_resume_prep_all_harts(), riscv_semihosting_setup(), riscv_set_register(), riscv_step_rtos_hart(), rtkernel_create(), set_debug_reason(), stellaris_write_block(), stm32x_probe(), target_call_event_callbacks(), target_checksum_memory(), target_examine(), target_handle_event(), target_init_one(), target_read_memory(), target_read_phys_memory(), target_soft_reset_halt(), target_write_memory(), target_write_phys_memory(), threadx_create(), ucos_iii_create(), write_memory(), xscale_init_arch_info(), xscale_read_phys_memory(), xscale_write_phys_memory(), and xtensa_core_status_check().

◆ target_poll()

◆ 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 2230 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 2407 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(), eneispif_read_flash_id(), esp32_soc_reset(), esp32s3_soc_reset(), esp_dbgstubs_table_read(), esp_xtensa_dbgstubs_info_update(), freertos_update_threads(), gdb_read_memory_packet(), get_stacking_info_arm926ejs(), hwthread_read_buffer(), image_read_section(), imx31_read_page(), mips32_run_algorithm(), mqx_target_read_buffer(), mxc_read_page(), nuttx_cortex_m_tcbinfo_stack_read(), nuttx_update_threads(), read_channel_name(), read_from_channel(), read_rtt_channel(), riot_update_threads(), riscv_hit_watchpoint(), rtkernel_add_task(), 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(), xtensa_wait_algorithm(), and zephyr_fetch_thread().

◆ 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 1237 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_algorithm_read_stub_logs(), 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(), qn908x_get_info(), qn908x_probe(), qn908x_read_page_lock(), 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_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(), xscale_set_breakpoint(), and xtensa_fileio_detect_proc().

◆ 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 2550 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(), eneispif_read_reg(), 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(), esp_algorithm_read_stub_logs(), 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(), is_flash_protected(), kinetis_disable_wdog32(), kinetis_ke_probe(), kinetis_probe_chip(), kinetis_probe_chip_s32k(), 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(), mips32_read_config_regs(), 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(), nrf51_get_ram_size(), nrf51_protect_check_clenr0(), nrf51_protect_clenr0(), nrf52_protect_check_bprot(), nrf5_erase_page(), nrf5_nvmc_read_u32(), nrf5_probe_chip(), nrf5_read_ficr_info_part(), nrf5_read_ficr_more_info(), nuc910_nand_ready(), numicro_erase(), numicro_fmc_cmd(), numicro_get_cpu_type(), numicro_init_isp(), numicro_reg_unlock(), numicro_write(), nuttx_getregs_fromstack(), 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(), qn908x_busy_check(), qn908x_get_info(), qn908x_init_flash(), qn908x_load_lock_stat(), qn908x_probe(), qn908x_status_check(), qn908x_update_reg(), 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(), rtkernel_add_task(), rtkernel_get_thread_reg_list(), rtkernel_update_threads(), rtkernel_verify_task(), 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 2598 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(), nuttx_update_threads(), 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 6281 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_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 1323 of file target.c.

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

Referenced by breakpoint_free().

◆ 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 1338 of file target.c.

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

Referenced by watchpoint_free().

◆ 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 286 of file target.c.

References LOG_ERROR, nvp::name, nvp_reset_modes, and nvp_value2name().

Referenced by tcl_target_callback_reset_handler().

◆ 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 556 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(), esp32_apptrace_connect_targets(), esp32_apptrace_safe_halt_targets(), esp32_sysview_stop(), esp32s2_poll(), esp_xtensa_profiling(), 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(), 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,
unsigned int  timeout_ms,
void *  arch_info 
)

Run an algorithm on the target given.

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

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 773 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 
)

This routine is a wrapper for asynchronous algorithms.

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 930 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_set_examined()

static void target_set_examined ( struct target target)
inlinestatic

◆ 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 
)

Starts an algorithm in the background on the target given.

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

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 814 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(), esp_algorithm_run_debug_stub(), esp_algorithm_run_image(), 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 1410 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_supports_gdb_connection()

bool target_supports_gdb_connection ( const struct target target)

Check if target allows GDB connections.

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

Definition at line 1401 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_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 1889 of file target.c.

References target_timer_next_event_value.

Referenced by server_loop().

◆ target_type_name()

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

Wait for an algorithm on the target given.

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

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 858 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(), esp_algorithm_run_debug_stub(), esp_algorithm_run_image(), msp432_quit(), npcx_quit(), sromalgo_release(), target_run_flash_async_algorithm(), and target_run_read_async_algorithm().

◆ target_wait_state()

◆ target_was_examined()

static bool target_was_examined ( const struct target target)
inlinestatic
Returns
true if target_set_examined() has been called.

Definition at line 436 of file target.h.

References target::examined.

Referenced by aarch64_assert_reset(), aarch64_deassert_reset(), aarch64_examine(), aarch64_halt_smp(), aarch64_handle_target_request(), aarch64_prep_restart_smp(), aarch64_prepare_halt_smp(), aarch64_resume(), aarch64_step_restart_smp(), arc_examine(), arc_read_instruction_u32(), arc_write_instruction_u32(), arm11_assert_reset(), arm11_examine(), arm7_9_assert_reset(), arm7_9_deinit(), arm7_9_examine(), arm7_9_handle_target_request(), avr32_ap7k_examine(), COMMAND_HANDLER(), cortex_a_deassert_reset(), cortex_a_deinit_target(), cortex_a_examine_first(), cortex_a_halt_smp(), cortex_a_handle_target_request(), cortex_a_restore_smp(), cortex_m_assert_reset(), cortex_m_deassert_reset(), cortex_m_examine(), cortex_m_halt_one(), cortex_m_handle_target_request(), cortex_m_restore_smp(), cortex_m_smp_halt_all(), cortex_m_smp_post_halt_poll(), dsp563xx_examine(), esirisc_deinit_target(), esirisc_examine(), esirisc_get_gdb_arch(), esp32_apptrace_cmd_ctx_init(), esp32_apptrace_safe_halt_targets(), esp32_cmd_apptrace_generic(), esp_xtensa_smp_deassert_reset(), esp_xtensa_smp_poll(), esp_xtensa_smp_resume_cores(), esp_xtensa_smp_run_func_image(), esp_xtensa_smp_run_onboard_func(), esp_xtensa_smp_update_halt_gdb(), esp_xtensa_smp_watchpoint_add(), esp_xtensa_target_deinit(), feroceon_assert_reset(), gdb_new_connection(), handle_target(), hl_assert_reset(), hl_handle_target_request(), hwthread_get_thread_reg(), hwthread_get_thread_reg_list(), hwthread_update_threads(), lakemont_reset_deassert(), mem_ap_examine(), mips32_examine(), mips64_examine(), mips_m4k_assert_reset(), mips_m4k_examine(), or1k_examine(), riscv_examine(), smp_reg_list_noread(), stm32l4_probe(), stm32x_get_property_addr(), stm32x_probe(), stm8_examine(), target_blank_check_memory(), target_checksum_memory(), target_get_gdb_reg_list(), target_halt(), target_poll(), target_read_buffer(), target_read_memory(), target_read_phys_memory(), target_read_u16(), target_read_u32(), target_read_u64(), target_read_u8(), target_resume(), target_run_algorithm(), target_soft_reset_halt(), target_start_algorithm(), target_state_name(), target_write_buffer(), target_write_memory(), target_write_phys_memory(), target_write_phys_u16(), target_write_phys_u32(), target_write_phys_u64(), target_write_phys_u8(), target_write_u16(), target_write_u32(), target_write_u64(), target_write_u8(), update_halt_gdb(), xscale_assert_reset(), xtensa_smpbreak_set(), and xtensa_target_deinit().

◆ target_write_buffer()

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

Definition at line 2342 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(), eneispif_write(), esirisc_flash_fill_pb(), esp32_soc_reset(), esp32s3_soc_reset(), esp_algorithm_load_func_image(), esp_algorithm_load_onboard_func(), 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(), kinetis_disable_wdog_algo(), kinetis_ke_stop_watchdog(), kinetis_ke_write_words(), kinetis_write_block(), load_section_from_image(), 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(), qn908x_write(), 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(), xtensa_start_algorithm(), and xtensa_update_instruction().

◆ 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 1265 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_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 2641 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(), eneispif_write_reg(), 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(), nrf51_protect_clenr0(), nrf5_erase_page(), nrf5_nvmc_write_u32(), 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(), qn908x_erase(), qn908x_init_flash(), qn908x_load_lock_stat(), qn908x_setup_erase(), qn908x_update_reg(), qn908x_write(), 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()

Variable Documentation

◆ all_targets