OpenOCD
target.h File Reference
Include dependency graph for target.h:
This graph shows which files directly or indirectly include this file:

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_reset_callback
 
struct  target_timer_callback
 
struct  target_trace_callback
 
struct  working_area
 

Macros

#define ERROR_TARGET_DATA_ABORT   (-307)
 
#define ERROR_TARGET_FAILURE   (-305)
 
#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_RESOURCE_NOT_AVAILABLE   (-308)
 
#define ERROR_TARGET_TIMEOUT   (-302)
 
#define ERROR_TARGET_TRANSLATION_FAULT   (-309)
 
#define ERROR_TARGET_UNALIGNED_ACCESS   (-306)
 

Enumerations

enum  nvp_assert { NVP_DEASSERT, NVP_ASSERT }
 
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_UNDEFINED = 7
}
 
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_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_HALT_PRE, TARGET_EVENT_RESET_HALT_POST, TARGET_EVENT_RESET_WAIT_PRE,
  TARGET_EVENT_RESET_WAIT_POST, TARGET_EVENT_RESET_INIT, TARGET_EVENT_RESET_END, TARGET_EVENT_DEBUG_HALTED,
  TARGET_EVENT_DEBUG_RESUMED, TARGET_EVENT_EXAMINE_START, 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
}
 
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
}
 

Functions

const char * debug_reason_name (struct target *t)
 
struct targetget_current_target (struct command_context *cmd_ctx)
 
struct targetget_target (const char *id)
 
struct targetget_target_by_num (int num)
 
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...
 
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, target_addr_t address, uint32_t size, uint32_t *blank, 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)
 
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)
 
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...
 
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...
 
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)
 
bool target_has_event_action (struct target *target, enum target_event event)
 Returns true only if the target has a handler for the specified event. More...
 
int target_hit_watchpoint (struct target *target, struct watchpoint **watchpoint)
 Find out the just hit watchpoint for target. More...
 
static const char * target_name (struct target *target)
 Returns the instance-specific name of the specified target. More...
 
int target_poll (struct target *target)
 
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), int time_ms, int periodic, 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, uint32_t entry_point, uint32_t exit_point, 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...
 
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, uint32_t entry_point, uint32_t exit_point, void *arch_info)
 Starts an algorithm in the background on the target given. More...
 
const char * target_state_name (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...
 
const char * target_type_name (struct target *target)
 Get the target type name. More...
 
int target_unregister_event_callback (int(*callback)(struct target *target, enum target_event event, void *priv), void *priv)
 
int target_unregister_reset_callback (int(*callback)(struct target *target, enum target_reset_mode reset_mode, void *priv), void *priv)
 
int target_unregister_timer_callback (int(*callback)(void *priv), void *priv)
 
int target_unregister_trace_callback (int(*callback)(struct target *target, size_t len, uint8_t *data, void *priv), void *priv)
 
int target_wait_algorithm (struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, uint32_t exit_point, 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, int ms)
 
static bool target_was_examined (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

#define ERROR_TARGET_INIT_FAILED   (-301)

Definition at line 687 of file target.h.

Referenced by cortex_a_examine_first(), and rtos_smp_init().

#define ERROR_TARGET_NOT_EXAMINED   (-311)
#define ERROR_TARGET_NOT_HALTED   (-304)

Definition at line 689 of file target.h.

Referenced by _sam3_probe(), _sam4_probe(), aarch64_read_apb_ap_memory(), aarch64_remove_breakpoint(), aarch64_resume(), aarch64_step(), aarch64_write_apb_ap_memory(), adapter_resume(), adapter_step(), ambiqmicro_erase(), ambiqmicro_mass_erase(), ambiqmicro_otp_program(), ambiqmicro_protect(), arm11_read_memory_inner(), arm11_resume(), arm11_step(), arm11_write_memory_inner(), arm7_9_debug_entry(), arm7_9_full_context(), arm7_9_read_memory(), arm7_9_restore_context(), arm7_9_resume(), arm7_9_set_breakpoint(), arm7_9_set_watchpoint(), arm7_9_step(), arm7_9_unset_watchpoint(), arm7_9_write_memory(), arm7a_l2x_sanity_check(), armv4_5_get_core_reg(), armv4_5_mmu_read_physical(), armv4_5_mmu_write_physical(), armv4_5_run_algorithm_inner(), armv4_5_set_core_reg(), armv7a_l1_d_cache_sanity_check(), armv7a_l1_i_cache_sanity_check(), armv7m_get_core_reg(), armv7m_set_core_reg(), armv7m_start_algorithm(), armv8_get_core_reg(), armv8_set_core_reg(), at91sam7_erase(), at91sam7_erase_check(), at91sam7_probe(), at91sam7_protect(), at91sam7_protect_check(), at91sam7_write(), ath79_erase(), ath79_read(), ath79_write(), avr32_ap7k_read_memory(), avr32_ap7k_resume(), avr32_ap7k_write_memory(), avr32_get_core_reg(), avr32_set_core_reg(), avrf_erase(), avrf_info(), avrf_mass_erase(), avrf_probe(), avrf_write(), breakpoint_add_internal(), cfi_erase(), cfi_probe(), cfi_protect(), cfi_protect_check(), cfi_read(), cfi_write(), COMMAND_HANDLER(), cortex_a_read_cpu_memory(), cortex_a_remove_breakpoint(), cortex_a_step(), cortex_a_write_cpu_memory(), cortex_m_remove_breakpoint(), cortex_m_remove_watchpoint(), cortex_m_resume(), cortex_m_step(), default_flash_blank_check(), default_flash_mem_blank_check(), dsp563xx_get_core_reg(), dsp563xx_get_gdb_reg_list(), dsp563xx_read_memory_core(), dsp563xx_run_algorithm(), dsp563xx_set_core_reg(), dsp563xx_step(), dsp563xx_write_memory_core(), efm32x_erase(), efm32x_protect(), efm32x_protect_check(), efm32x_write(), em357_erase(), em357_mass_erase(), em357_protect(), em357_protect_check(), em357_write(), fm3_chip_erase(), fm3_erase(), fm3_probe(), fm4_flash_erase(), fm4_flash_write(), fm4_get_info_command(), fm4_probe(), get_lpc2000_part_id(), kinetis_check_run_mode(), kinetis_disable_wdog_algo(), kinetis_ke_blank_check(), kinetis_ke_erase(), kinetis_ke_protect(), kinetis_ke_protect_check(), kinetis_ke_stop_watchdog(), kinetis_ke_write(), lakemont_get_core_reg(), lakemont_resume(), lakemont_set_core_reg(), lakemont_step(), lpc2000_auto_probe_flash(), lpc2000_erase(), lpc2000_erase_check(), lpc2000_write(), lpc288x_probe(), lpc288x_system_ready(), lpc2900_is_ready(), lpc2900_probe(), lpc2900_write_index_page(), lpcspifi_erase(), lpcspifi_read_flash_id(), lpcspifi_write(), mdr_erase(), mdr_read(), mdr_write(), mips32_get_core_reg(), mips32_run_algorithm(), mips32_set_core_reg(), mips_m4k_internal_restore(), mips_m4k_read_memory(), mips_m4k_remove_breakpoint(), mips_m4k_remove_watchpoint(), mips_m4k_step(), mips_m4k_write_memory(), mrvlqspi_flash_erase(), mrvlqspi_flash_read(), mrvlqspi_flash_write(), mrvlqspi_probe(), nds32_get_core_reg(), nds32_get_core_reg_64(), nds32_read_buffer(), nds32_restore_context(), nds32_resume(), nds32_set_core_reg(), nds32_set_core_reg_64(), nds32_step(), nds32_step_without_watchpoint(), nds32_v2_read_buffer(), nds32_v2_read_memory(), nds32_v2_write_buffer(), nds32_v2_write_memory(), nds32_v3_read_buffer(), nds32_v3_read_memory(), nds32_v3_write_buffer(), nds32_v3_write_memory(), nds32_write_buffer(), niietcm4_erase(), niietcm4_protect(), niietcm4_write(), nrf5_get_probed_chip_if_halted(), numicro_erase(), numicro_init_isp(), numicro_protect_check(), numicro_write(), or1k_get_core_reg(), or1k_read_memory(), or1k_resume_or_step(), or1k_set_core_reg(), or1k_write_memory(), pic32mx_erase(), pic32mx_protect(), pic32mx_protect_check(), pic32mx_write(), psoc4_mass_erase(), psoc4_probe(), psoc4_protect(), psoc4_write(), read_flash_id(), read_hw_reg_to_cache(), read_phys_mem(), sam3_erase(), sam3_erase_check(), sam3_protect(), sam3_protect_check(), sam3_write(), sam4_erase(), sam4_protect(), sam4_protect_check(), sam4_write(), sam4l_erase(), sam4l_protect(), sam4l_protect_check(), sam4l_write(), samd_erase(), samd_issue_nvmctrl_command(), samd_protect(), samd_write(), samv_erase(), samv_protect(), samv_write(), sim3x_flash_erase(), sim3x_flash_protect(), sim3x_flash_protect_check(), sim3x_flash_write(), stellaris_erase(), stellaris_mass_erase(), stellaris_protect(), stellaris_write(), stm32l4_erase(), stm32l4_mass_erase(), stm32l4_protect(), stm32l4_write(), stm32lx_erase(), stm32lx_lock(), stm32lx_mass_erase(), stm32lx_unlock(), stm32lx_write(), stm32x_erase(), stm32x_mass_erase(), stm32x_protect(), stm32x_write(), stm8_get_core_reg(), stm8_remove_breakpoint(), stm8_remove_watchpoint(), stm8_resume(), stm8_run_algorithm(), stm8_set_core_reg(), stm8_step(), stmsmi_erase(), stmsmi_write(), str7x_erase(), str7x_protect(), str7x_protect_check(), str7x_write(), str9x_erase(), str9x_protect(), str9x_protect_check(), str9x_write(), target_add_breakpoint(), target_add_context_breakpoint(), target_add_hybrid_breakpoint(), target_add_watchpoint(), target_gdb_fileio_end(), target_get_gdb_fileio_info(), target_hit_watchpoint(), target_profiling(), tms470_erase(), tms470_erase_check(), tms470_probe(), tms470_protect(), tms470_protect_check(), tms470_write(), watchpoint_add(), write_hw_reg_from_cache(), x86_32_common_add_breakpoint(), x86_32_common_remove_breakpoint(), x86_32_common_remove_watchpoint(), xmc1xxx_erase(), xmc1xxx_erase_check(), xmc1xxx_get_info_command(), xmc1xxx_probe(), xmc1xxx_protect_check(), xmc1xxx_write(), xmc4xxx_erase(), xmc4xxx_get_info_command(), xmc4xxx_probe(), xmc4xxx_write(), xscale_full_context(), xscale_read_memory(), xscale_read_trace(), xscale_remove_breakpoint(), xscale_remove_watchpoint(), xscale_restore_banked(), xscale_resume(), xscale_set_breakpoint(), xscale_set_watchpoint(), xscale_step(), xscale_unset_breakpoint(), xscale_unset_watchpoint(), and xscale_write_memory().

#define ERROR_TARGET_NOT_RUNNING   (-310)

Definition at line 695 of file target.h.

Referenced by ocl_erase(), and ocl_write().

#define ERROR_TARGET_RESOURCE_NOT_AVAILABLE   (-308)

Definition at line 693 of file target.h.

Referenced by aarch64_add_breakpoint(), aarch64_add_context_breakpoint(), aarch64_add_hybrid_breakpoint(), aarch64_set_breakpoint(), aduc702x_write(), aduc702x_write_block(), aducm360_write(), aducm360_write_block(), aducm360_write_block_async(), aducm360_write_block_sync(), arm11_add_breakpoint(), arm7_9_add_breakpoint(), arm7_9_add_watchpoint(), arm7_9_bulk_write_memory(), arm7_9_set_software_breakpoints(), arm946e_invalidate_whole_dcache(), arm946e_invalidate_whole_icache(), armv7m_blank_check_memory(), breakpoint_add_internal(), cfi_intel_write_block(), cfi_spansion_write_block(), cfi_spansion_write_block_mips(), cfi_write(), COMMAND_HANDLER(), cortex_a_add_breakpoint(), cortex_a_add_context_breakpoint(), cortex_a_add_hybrid_breakpoint(), cortex_a_set_breakpoint(), cortex_m_add_breakpoint(), cortex_m_add_watchpoint(), dap_lookup_cs_component(), dpm_add_breakpoint(), dpm_add_watchpoint(), dpm_watchpoint_setup(), dpmv8_add_breakpoint(), dpmv8_add_watchpoint(), dpmv8_watchpoint_setup(), dsp563xx_add_custom_watchpoint(), dsp563xx_add_watchpoint(), dsp563xx_remove_watchpoint(), efm32x_write(), efm32x_write_block(), em357_write(), em357_write_block(), feroceon_bulk_write_memory(), fm3_chip_erase(), fm3_erase(), fm3_write_block(), fm4_flash_erase(), fm4_flash_write(), kinetis_ke_stop_watchdog(), kinetis_ke_write_words(), kinetis_write_block(), kinetis_write_inner(), lpcspifi_write(), mdr_write(), mdr_write_block(), mips32_blank_check_memory(), mips32_checksum_memory(), mips32_pracc_fastdata_xfer(), mips_m4k_add_breakpoint(), mips_m4k_add_watchpoint(), mips_m4k_set_breakpoint(), mrvlqspi_flash_write(), nds32_v2_add_breakpoint(), nds32_v2_add_watchpoint(), nds32_v3_add_breakpoint(), nds32_v3_add_watchpoint(), nds32_v3m_add_breakpoint(), nds32_v3m_add_watchpoint(), niietcm4_write(), niietcm4_write_block(), nrf5_ll_flash_write(), numicro_write(), numicro_writeblock(), pic32mx_write(), pic32mx_write_block(), psoc4_sysreq(), set_debug_regs(), set_hwbp(), set_watchpoint(), sim3x_write_block(), stellaris_write(), stellaris_write_block(), stm32l4_write_block(), stm32lx_write(), stm32lx_write_half_pages(), stm32x_write(), stm32x_write_block(), stm32x_write_options(), stm8_add_breakpoint(), stm8_add_watchpoint(), stm8_blank_check_memory(), stm8_checksum_memory(), stm8_set_breakpoint(), stm8_set_hwbreak(), stm8_set_watchpoint(), str7x_write(), str7x_write_block(), str9x_write(), str9x_write_block(), target_alloc_working_area(), target_alloc_working_area_try(), target_blank_check_memory(), unset_debug_regs(), watchpoint_add(), xmc1xxx_erase(), xmc1xxx_erase_check(), xmc1xxx_write(), xscale_add_breakpoint(), xscale_add_watchpoint(), xscale_poll(), xscale_read_tx(), xscale_set_breakpoint(), and xscale_set_watchpoint().

#define ERROR_TARGET_TRANSLATION_FAULT   (-309)

Enumeration Type Documentation

enum nvp_assert
Enumerator
NVP_DEASSERT 
NVP_ASSERT 

Definition at line 67 of file target.h.

Enumerator
DBG_REASON_DBGRQ 
DBG_REASON_BREAKPOINT 
DBG_REASON_WATCHPOINT 
DBG_REASON_WPTANDBKPT 
DBG_REASON_SINGLESTEP 
DBG_REASON_NOTHALTED 
DBG_REASON_EXIT 
DBG_REASON_UNDEFINED 

Definition at line 79 of file target.h.

Enumerator
TARGET_ENDIAN_UNKNOWN 
TARGET_BIG_ENDIAN 
TARGET_LITTLE_ENDIAN 

Definition at line 90 of file target.h.

Enumerator
TARGET_EVENT_GDB_HALT 
TARGET_EVENT_HALTED 
TARGET_EVENT_RESUMED 
TARGET_EVENT_RESUME_START 
TARGET_EVENT_RESUME_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_HALT_PRE 
TARGET_EVENT_RESET_HALT_POST 
TARGET_EVENT_RESET_WAIT_PRE 
TARGET_EVENT_RESET_WAIT_POST 
TARGET_EVENT_RESET_INIT 
TARGET_EVENT_RESET_END 
TARGET_EVENT_DEBUG_HALTED 
TARGET_EVENT_DEBUG_RESUMED 
TARGET_EVENT_EXAMINE_START 
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 

Definition at line 230 of file target.h.

Enumerator
REG_CLASS_ALL 
REG_CLASS_GENERAL 

Definition at line 120 of file target.h.

Enumerator
RESET_UNKNOWN 
RESET_RUN 
RESET_HALT 
RESET_INIT 

Definition at line 72 of file target.h.

Enumerator
TARGET_UNKNOWN 
TARGET_RUNNING 
TARGET_HALTED 
TARGET_RESET 
TARGET_DEBUG_RUNNING 

Definition at line 59 of file target.h.

Function Documentation

struct target* get_target_by_num ( int  num)

Definition at line 502 of file target/target.c.

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

Referenced by get_current_target(), and tcl_new_connection().

bool get_target_reset_nag ( void  )

Definition at line 5959 of file target/target.c.

References target_reset_nag.

Referenced by arm7_9_check_reset().

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 1099 of file target/target.c.

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

Referenced by breakpoint_add_internal(), and nds32_v3_leave_debug_state().

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 1109 of file target/target.c.

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

Referenced by context_breakpoint_add_internal().

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 1119 of file target/target.c.

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

Referenced by hybrid_breakpoint_add_internal().

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 1135 of file target/target.c.

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

Referenced by watchpoint_add().

int target_alloc_working_area ( 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,
target_addr_t  address,
uint32_t  size,
uint32_t *  blank,
uint8_t  erased_value 
)
void target_buffer_get_u16_array ( struct target target,
const uint8_t *  buffer,
uint32_t  count,
uint16_t *  dstbuf 
)

Definition at line 439 of file target/target.c.

References count, and target_buffer_get_u16().

Referenced by mips_m4k_write_memory().

uint32_t target_buffer_get_u24 ( 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 
)

Definition at line 423 of file target/target.c.

References count, and target_buffer_get_u64().

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

Definition at line 463 of file target/target.c.

References count, and target_buffer_set_u16().

Referenced by mips_m4k_read_memory().

void target_buffer_set_u24 ( struct target target,
uint8_t *  buffer,
uint32_t  value 
)
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 
)

Definition at line 447 of file target/target.c.

References count, and target_buffer_set_u64().

int target_call_event_callbacks ( struct target target,
enum target_event  event 
)

Definition at line 1513 of file target/target.c.

References target_event_callback::callback, ERROR_OK, Jim_Nvp_value2name_simple(), LOG_DEBUG, name, target_event_callback::next, target_event_callback::priv, target_call_event_callbacks(), target_event_callbacks, TARGET_EVENT_GDB_HALT, TARGET_EVENT_HALTED, and target_handle_event().

Referenced by aarch64_poll(), aarch64_resume(), aarch64_step(), aarch64_step_restart_smp(), adapter_poll(), adapter_resume(), adapter_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(), armv7m_trace_tpiu_config(), avr32_ap7k_poll(), avr32_ap7k_resume(), cortex_a_poll(), cortex_a_resume(), cortex_m_poll(), cortex_m_resume(), cortex_m_step(), do_resume(), do_semihosting(), dsp563xx_poll(), dsp563xx_resume(), dsp563xx_step(), gdb_connection_closed(), gdb_detach(), gdb_input_inner(), gdb_new_connection(), gdb_target_callback_event_handler(), gdb_v_packet(), handle_target(), jim_target_halt_gdb(), lakemont_poll(), lakemont_step(), lakemont_update_after_probemode_entry(), mips_m4k_internal_restore(), mips_m4k_poll(), mips_m4k_resume(), mips_m4k_step(), nds32_halt(), nds32_poll(), nds32_resume(), nds32_step(), or1k_poll(), or1k_resume_or_step(), stm8_poll(), stm8_resume(), stm8_step(), target_call_event_callbacks(), target_examine_one(), target_poll(), target_resume(), xscale_poll(), xscale_resume(), xscale_step(), and xscale_step_inner().

int target_call_reset_callbacks ( struct target target,
enum target_reset_mode  reset_mode 
)
int target_call_timer_callbacks ( void  )

Definition at line 1628 of file target/target.c.

References target_call_timer_callbacks_check_time().

Referenced by server_loop().

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 1634 of file target/target.c.

References target_call_timer_callbacks_check_time().

Referenced by COMMAND_HANDLER(), gdb_query_packet(), script_command_run(), and target_process_reset().

int target_call_trace_callbacks ( struct target target,
size_t  len,
uint8_t *  data 
)
const char* target_event_name ( enum target_event  event)

Return the name of a target event enumeration value.

Definition at line 299 of file target/target.c.

References Jim_Nvp_value2name_simple(), LOG_ERROR, and Jim_Nvp::name.

Referenced by tcl_target_callback_event_handler().

int target_examine_one ( struct target target)

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

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

Definition at line 702 of file target/target.c.

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

Referenced by arm7_9_deassert_reset(), COMMAND_HANDLER(), handle_target(), jtag_enable_callback(), and target_examine().

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 1188 of file target/target.c.

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

Referenced by gdb_fileio_response_packet().

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 1179 of file target/target.c.

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

Referenced by gdb_frontend_halted().

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 1167 of file target/target.c.

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

Referenced by gdb_generate_target_description(), gdb_get_register_packet(), gdb_get_registers_packet(), gdb_set_register_packet(), gdb_set_registers_packet(), gdb_target_description_supported(), and get_current().

uint32_t target_get_working_area_avail ( struct target target)
bool target_has_event_action ( struct target target,
enum target_event  event 
)

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

Definition at line 4443 of file target/target.c.

References target_event_action::event, target::event_action, target_event_action::next, and NULL.

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

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 1149 of file target/target.c.

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

Referenced by watchpoint_hit().

static const char* target_name ( struct target target)
inlinestatic

Returns the instance-specific name of the specified target.

Definition at line 223 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_mmu(), 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(), arm11_assert_reset(), arm11_deassert_reset(), arm7_9_assert_reset(), arm_dpm_initialize(), arm_dpm_setup(), armv7a_read_mpidr(), armv8_dpm_initialize(), armv8_dpm_setup(), armv8_get_gdb_reg_list(), armv8_read_mpidr(), breakpoint_clear_target_internal(), ChibiOS_create(), COMMAND_HANDLER(), cortex_a_assert_reset(), cortex_a_deassert_reset(), cortex_m_examine(), cortex_m_poll(), dpm_maybe_update_bpwp(), dpmv8_maybe_update_bpwp(), eCos_create(), embeddedice_build_reg_cache(), embKernel_create(), FreeRTOS_create(), gdb_connection_closed(), gdb_input_inner(), gdb_new_connection(), get_target(), handle_target(), jim_arm946e_cp15(), jim_mcrmrc(), jim_target_current(), jim_target_event_list(), jim_target_examine(), jim_target_names(), jim_target_reset(), jim_target_wait_state(), kinetis_create_missing_banks(), mqx_create(), nds32_v2_deassert_reset(), nds32_v2_examine(), nds32_v3_deassert_reset(), nds32_v3_examine(), nds32_v3m_deassert_reset(), nds32_v3m_examine(), stellaris_write_block(), target_add_breakpoint(), target_add_context_breakpoint(), target_add_hybrid_breakpoint(), target_add_watchpoint(), 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(), watchpoint_clear_target(), xscale_init_arch_info(), xscale_read_phys_memory(), and xscale_write_phys_memory().

void target_quit ( void  )

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

Definition at line 1886 of file target/target.c.

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

Referenced by server_quit().

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 1043 of file target/target.c.

References ERROR_FAIL, LOG_ERROR, target_type::read_memory, 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(), at91sam7_erase_check(), cfi_get_u8(), cfi_probe(), cfi_query_u16(), cfi_query_u32(), cfi_query_u8(), cfi_read(), cfi_write(), COMMAND_HANDLER(), COMMAND_HELPER(), cortex_a_read_memory_ahb(), cortex_a_set_breakpoint(), cortex_m_set_breakpoint(), default_flash_mem_blank_check(), do_semihosting(), jim_target_md(), 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(), mg_dsk_drv_info(), mg_mflash_do_read_sects(), mg_verify_interface(), mips_m4k_set_breakpoint(), mips_m4k_unset_breakpoint(), nrf5_code_flash_write(), nrf5_uicr_flash_write(), sam3_page_read(), sam4_page_read(), sam4l_write_page_partial(), samd_modify_user_row(), samv_page_read(), stm8_unset_breakpoint(), target_alloc_working_area_try(), target_mem2array(), target_read_buffer_default(), target_read_u16(), target_read_u32(), target_read_u64(), target_read_u8(), uCOS_III_find_last_thread_address(), uCOS_III_get_thread_reg_list(), uCOS_III_update_thread_offsets(), uCOS_III_update_threads(), and xscale_set_breakpoint().

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

Definition at line 2250 of file target/target.c.

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

Referenced by adapter_debug_entry(), adapter_load_core_reg_u32(), 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_simulate_step_core(), armv7m_trace_tpiu_config(), at91sam7_get_flash_status(), at91sam7_read_clock_info(), at91sam7_read_part_info(), at91sam9_nand_ready(), at91sam9_read_page(), at91sam9_write_page(), check_flash_status(), ChibiOS_get_thread_reg_list(), ChibiOS_update_stacking(), ChibiOS_update_threads(), COMMAND_HANDLER(), cortex_m_dwt_get_reg(), cortex_m_dwt_setup(), cortex_m_enable_fpb(), cortex_m_examine(), cortex_m_load_core_reg_u32(), davinci_init(), davinci_nand_ready(), davinci_read_block_data(), davinci_write_page_ecc1(), davinci_write_page_ecc4(), davinci_write_page_ecc4infix(), EFC_GetResult(), EFC_GetStatus(), efm32x_read_info(), efm32x_read_lock_data(), efm32x_read_reg_u32(), em357_get_flash_status(), em357_protect(), em357_protect_check(), em357_read_options(), FLASHD_ReadUniqueID(), fm3_chip_erase(), fm3_erase(), fm4_enter_flash_cpu_programming_mode(), fm4_enter_flash_cpu_rom_mode(), FreeRTOS_get_thread_reg_list(), get_stm32l4_info(), imx31_init(), kinetis_disable_wdog32(), kinetis_ke_probe(), kinetis_probe_chip(), kinetis_protect_check(), kinetis_read_pmstat(), lpc2000_iap_call(), lpc288x_read_part_info(), lpc288x_wait_status_busy(), 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(), mdr_erase(), mdr_mass_erase(), mdr_read(), mdr_write(), mips32_configure_break_unit(), mips32_configure_dbs(), mips32_configure_ibs(), mips32_enable_interrupts(), mips_m4k_examine_debug_reason(), mips_m4k_set_breakpoint(), mrvlqspi_fifo_flush(), mrvlqspi_read_byte(), mrvlqspi_set_conf(), mrvlqspi_set_ss_state(), mrvlqspi_start_transfer(), mrvlqspi_stop_transfer(), mxc_init(), niietcm4_dump_uflash_page(), niietcm4_opstatus_check(), niietcm4_probe(), niietcm4_probe_k1921vk01t(), niietcm4_protect_check(), niietcm4_uopstatus_check(), nrf5_erase_page(), nrf5_info(), nrf5_probe(), nrf5_protect(), nrf5_protect_check(), nrf5_wait_for_nvmc(), nuc910_nand_ready(), numicro_erase(), numicro_fmc_cmd(), numicro_get_cpu_type(), numicro_init_isp(), numicro_reg_unlock(), numicro_write(), pic32mx_get_flash_status(), pic32mx_probe(), pic32mx_protect_check(), psoc4_get_silicon_id(), psoc4_probe(), psoc4_protect_check(), pxa270_set_gpio_output_val(), pxa270_set_gpio_to_output(), s3c2440_read_block_data(), s3c2440_set_gpio_output_val(), s3c2440_set_gpio_to_output(), s6e2cc_probe(), sam3_page_write(), sam3_ReadThisReg(), sam4_page_write(), sam4_ReadThisReg(), 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_modify_user_row(), samd_probe(), samd_write(), 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_get_flash_status(), stm32l4_probe(), stm32l4_read_options(), stm32l4_unlock_option_reg(), stm32l4_unlock_reg(), 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_size(), stm32x_get_flash_status(), stm32x_probe(), stm32x_protect(), stm32x_protect_check(), stm32x_read_id_code(), stm32x_read_options(), stm32x_unlock_option_reg(), stm32x_unlock_reg(), stm32x_write_options(), str7x_protect_check(), str7x_result(), str7x_waitbusy(), str9x_protect_check(), target_run_flash_async_algorithm(), test_iomux_settings(), tms470_check_flash_unlocked(), tms470_erase_check(), tms470_erase_sector(), tms470_flash_initialize_internal_state_machine(), tms470_flash_status(), tms470_protect(), tms470_protect_check(), tms470_read_part_info(), tms470_try_flash_keys(), tms470_write(), 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(), and xscale_update_vectors().

int target_read_u64 ( struct target target,
target_addr_t  address,
uint64_t *  value 
)
int target_register_commands ( struct command_context cmd_ctx)

Definition at line 5952 of file target/target.c.

References NULL, and register_commands().

Referenced by setup_command_handler().

int target_register_event_callback ( int(*)(struct target *target, enum target_event event, void *priv)  callback,
void *  priv 
)
int target_register_reset_callback ( int(*)(struct target *target, enum target_reset_mode reset_mode, void *priv)  callback,
void *  priv 
)
int target_register_timer_callback ( int(*)(void *priv)  callback,
int  time_ms,
int  periodic,
void *  priv 
)
int target_register_trace_callback ( int(*)(struct target *target, size_t len, uint8_t *data, void *priv)  callback,
void *  priv 
)
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 1129 of file target/target.c.

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

Referenced by breakpoint_free(), and nds32_v3_debug_entry().

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 1144 of file target/target.c.

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

Referenced by watchpoint_free().

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 310 of file target/target.c.

References Jim_Nvp_value2name_simple(), LOG_ERROR, and Jim_Nvp::name.

Referenced by tcl_target_callback_reset_handler().

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 counterprodutive 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 606 of file target/target.c.

References ERROR_FAIL, ERROR_OK, 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 adapter_deassert_reset(), ambiqmicro_exec_command(), arm_semihosting(), armv4_5_run_algorithm_inner(), armv7m_start_algorithm(), COMMAND_HANDLER(), dsp563xx_run_algorithm(), gdb_fileio_reply(), gdb_fileio_response_packet(), gdb_step_continue_packet(), mips32_run_and_wait(), nds32_gdb_detach(), or1k_profiling(), stm8_run_and_wait(), and target_profiling_default().

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,
uint32_t  entry_point,
uint32_t  exit_point,
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
arch_infotarget-specific description of the algorithm.

Definition at line 785 of file target/target.c.

References 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(), cfi_intel_write_block(), cfi_spansion_write_block(), cfi_spansion_write_block_mips(), em357_write_block(), 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(), stm32lx_write_half_pages(), stm8_blank_check_memory(), str7x_write_block(), str9x_write_block(), xmc1xxx_erase(), xmc1xxx_erase_check(), and xmc1xxx_write().

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.

It differs from target_run_algorithm in that the algorithm is asynchronous. Because of this it requires an compliant algorithm: see contrib/loaders/flash/stm32f1x.S for example.

Parameters
targetused to run the algorithm

Definition at line 897 of file target/target.c.

References alive_sleep(), buffer, ERROR_FLASH_OPERATION_FAILED, ERROR_OK, 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(), efm32x_write_block(), kinetis_ke_write_words(), kinetis_write_block(), lpcspifi_write(), mdr_write_block(), mrvlqspi_flash_write(), niietcm4_write_block(), nrf5_ll_flash_write(), sim3x_write_block(), stellaris_write_block(), stm32l4_write_block(), and stm32x_write_block().

static void target_set_examined ( struct target target)
inlinestatic

Sets the examined flag for the given target.

Use in target->type->examine() after one-time setup is done.

Definition at line 410 of file target.h.

References target::examined.

Referenced by aarch64_examine_first(), arm11_examine(), arm7_9_examine(), avr32_ap7k_examine(), cortex_a_examine_first(), cortex_m_examine(), default_examine(), dsp563xx_examine(), mips32_examine(), nds32_v2_examine(), nds32_v3_examine(), nds32_v3m_examine(), or1k_examine(), and stm8_examine().

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,
uint32_t  entry_point,
uint32_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
arch_infotarget-specific description of the algorithm.

Definition at line 821 of file target/target.c.

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

Referenced by target_run_flash_async_algorithm().

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 1173 of file target/target.c.

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

Referenced by gdb_fileio_response_packet(), and gdb_step_continue_packet().

const char* target_type_name ( struct target target)

Get the target type name.

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

Definition at line 755 of file target/target.c.

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

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

int target_unregister_event_callback ( int(*)(struct target *target, enum target_event event, void *priv)  callback,
void *  priv 
)
int target_unregister_reset_callback ( int(*)(struct target *target, enum target_reset_mode reset_mode, void *priv)  callback,
void *  priv 
)
int target_unregister_timer_callback ( int(*)(void *priv)  callback,
void *  priv 
)
int target_unregister_trace_callback ( int(*)(struct target *target, size_t len, uint8_t *data, void *priv)  callback,
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,
uint32_t  exit_point,
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
arch_infotarget-specific description of the algorithm.

Definition at line 859 of file target/target.c.

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

Referenced by target_run_flash_async_algorithm().

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

Definition at line 403 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(), arm11_assert_reset(), arm11_examine(), arm7_9_assert_reset(), arm7_9_examine(), arm7_9_handle_target_request(), avr32_ap7k_examine(), COMMAND_HANDLER(), cortex_a_assert_reset(), cortex_a_deassert_reset(), 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_handle_target_request(), dsp563xx_examine(), feroceon_assert_reset(), handle_target(), hl_handle_target_request(), jim_mcrmrc(), jim_target_poll(), jim_target_was_examined(), mips32_examine(), mips_m4k_assert_reset(), mips_m4k_examine(), nds32_assert_reset(), nds32_read_opcode(), nds32_v2_examine(), nds32_v3_examine(), nds32_v3m_examine(), or1k_examine(), stm8_examine(), target_blank_check_memory(), target_checksum_memory(), 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(), and xscale_assert_reset().

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

Definition at line 2050 of file target/target.c.

References ERROR_FAIL, ERROR_OK, LOG_DEBUG, LOG_ERROR, 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(), arm_nandwrite(), armv4_5_run_algorithm_inner(), armv7m_blank_check_memory(), armv7m_checksum_memory(), armv7m_start_algorithm(), cfi_intel_write_block(), cfi_spansion_write_block(), cfi_spansion_write_block_mips(), COMMAND_HANDLER(), do_semihosting(), dsp563xx_run_algorithm(), efm32x_write_block(), em357_write_block(), fm3_chip_erase(), fm3_erase(), fm3_write_block(), fm4_flash_erase(), fm4_flash_write(), gdb_write_memory_binary_packet(), gdb_write_memory_packet(), imx31_write_page(), jim_nds32_bulk_write(), jim_nds32_multi_write(), kinetis_disable_wdog_algo(), kinetis_ke_stop_watchdog(), kinetis_ke_write_words(), kinetis_write_block(), lpc2000_write(), lpc288x_write(), lpc2900_write(), lpcspifi_erase(), lpcspifi_set_hw_mode(), lpcspifi_write(), mdr_write_block(), mips32_blank_check_memory(), mips32_checksum_memory(), mips32_run_algorithm(), mrvlqspi_flash_write(), mxc_write_page(), niietcm4_write_block(), nrf5_ll_flash_write(), numicro_writeblock(), pic32mx_write_block(), psoc4_sysreq(), 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(), stm8_blank_check_memory(), stm8_run_algorithm(), str7x_write_block(), str9x_write_block(), target_run_flash_async_algorithm(), xmc1xxx_erase(), xmc1xxx_erase_check(), and xmc1xxx_write().

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 1071 of file target/target.c.

References ERROR_FAIL, LOG_ERROR, 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_intel_write_word(), cfi_intel_write_words(), cfi_send_command(), cfi_spansion_write_word(), cfi_spansion_write_words(), COMMAND_HANDLER(), cortex_a_set_breakpoint(), cortex_a_unset_breakpoint(), cortex_a_write_memory_ahb(), cortex_m_set_breakpoint(), cortex_m_unset_breakpoint(), do_semihosting(), jim_target_mw(), 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(), mg_mflash_do_write_sects(), mg_verify_interface(), mips_m4k_set_breakpoint(), mips_m4k_unset_breakpoint(), nrf5_ll_flash_write(), numicro_write(), sam3_page_write(), sam4_page_write(), sam4l_write_page(), samd_modify_user_row(), samd_write(), samv_page_write(), stm8_unset_breakpoint(), str7x_write(), str9x_write(), target_array2mem(), target_restore_working_area(), target_write_buffer_default(), target_write_u16(), target_write_u32(), target_write_u64(), target_write_u8(), xmc1xxx_write(), and xscale_unset_breakpoint().

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_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_u32 ( struct target target,
target_addr_t  address,
uint32_t  value 
)

Definition at line 2341 of file target/target.c.

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

Referenced by adapter_load_core_reg_u32(), adapter_resume(), adapter_step(), adapter_store_core_reg_u32(), 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(), armv7m_trace_tpiu_config(), at91sam7_flash_command(), at91sam7_set_flash_mode(), at91sam9_disable(), at91sam9_ecc_init(), at91sam9_enable(), COMMAND_HANDLER(), cortex_m_dwt_set_reg(), cortex_m_dwt_setup(), cortex_m_enable_fpb(), cortex_m_endreset_event(), cortex_m_examine(), cortex_m_load_core_reg_u32(), cortex_m_set_breakpoint(), cortex_m_set_watchpoint(), cortex_m_store_core_reg_u32(), 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_StartCommand(), 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(), 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(), kinetis_check_run_mode(), kinetis_invalidate_flash_cache(), kinetis_ke_prepare_flash(), lpc288x_erase(), lpc288x_load_timer(), lpc288x_protect(), lpc288x_set_flash_clk(), lpc288x_write(), 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(), 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(), 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(), mxc_init(), niietcm4_dump_uflash_page(), niietcm4_erase(), niietcm4_load_uflash_page(), niietcm4_mass_erase(), niietcm4_opstatus_check(), niietcm4_probe_k1921vk01t(), niietcm4_protect_check(), niietcm4_uflash_page_erase(), niietcm4_uopstatus_check(), niietcm4_write(), nrf5_nvmc_erase_enable(), nrf5_nvmc_generic_erase(), nrf5_nvmc_read_only(), nrf5_nvmc_write_enable(), nrf5_protect(), nuc910_nand_address(), nuc910_nand_init(), numicro_erase(), numicro_fmc_cmd(), numicro_init_isp(), numicro_reg_unlock(), numicro_write(), pic32mx_erase(), pic32mx_nvm_exec(), pic32mx_write_word(), psoc4_sysreq(), pxa270_set_gpio_output_val(), pxa270_set_gpio_to_output(), s3c2410_init(), s3c2410_write_data(), s3c2412_init(), s3c2440_init(), s3c2440_set_gpio_output_val(), s3c2440_set_gpio_to_output(), s3c2440_write_block_data(), s3c2443_init(), s3c24xx_reset(), s3c6400_init(), sam3_page_write(), sam4_page_write(), sam4l_flash_command(), samd_erase_row(), samd_protect(), samv_efc_start_command(), sim3x_erase_page(), sim3x_flash_erase(), sim3x_init(), ssp_write_reg(), stellaris_erase(), stellaris_mass_erase(), stellaris_protect(), stellaris_set_flash_timing(), stellaris_write(), stm32l4_erase(), stm32l4_mass_erase(), stm32l4_unlock_option_reg(), stm32l4_unlock_reg(), stm32l4_wait_status_busy(), stm32l4_write(), stm32l4_write_block(), 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_lock_reg(), stm32x_mass_erase(), stm32x_unlock_option_reg(), stm32x_unlock_reg(), stm32x_wait_status_busy(), stm32x_write(), stm32x_write_block(), stm32x_write_options(), str7x_erase(), str7x_protect(), str7x_write(), target_run_flash_async_algorithm(), tms470_erase_check(), tms470_erase_sector(), tms470_flash_initialize_internal_state_machine(), tms470_protect(), tms470_protect_check(), tms470_read_part_info(), tms470_try_flash_keys(), tms470_write(), xmc4xxx_clear_flash_status(), xmc4xxx_enter_page_mode(), xmc4xxx_write_command_sequence(), xmc4xxx_write_page(), and xscale_set_breakpoint().

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

Variable Documentation