92 LOG_ERROR(
"BUG: no hardware comparator available");
113 LOG_WARNING(
"can't enable sw breakpoints with no watchpoint unit available");
126 LOG_ERROR(
"BUG: both watchpoints used, but wp_available >= 1");
143 LOG_ERROR(
"BUG: both watchpoints used, but wp_available >= 1");
212 LOG_ERROR(
"BUG: no hardware comparator available");
223 uint32_t verify = 0xffffffff;
243 uint16_t verify = 0xffff;
303 LOG_DEBUG(
"BPID: %" PRIu32
" Releasing hw wp: %d",
320 uint32_t current_instr;
327 if (current_instr == arm7_9->
arm_bkpt) {
335 uint16_t current_instr;
388 LOG_INFO(
"no watchpoint unit available for hardware breakpoint");
393 LOG_INFO(
"only breakpoints of two (Thumb) or four (ARM) bytes length supported");
506 LOG_ERROR(
"BUG: no hardware comparator available");
645 LOG_ERROR(
"timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: %" PRIx32
"",
664 static uint8_t check_value[4], check_mask[4];
716 data = malloc(
size * (
sizeof(uint32_t)));
721 for (i = 0; i <
size; i++)
812 LOG_DEBUG(
"DBGACK already set during server startup.");
840 "DBGACK set, but the target did not end up in the halted state %d",
865 bool use_event =
false;
869 LOG_WARNING(
"Reset is not asserted because the target is not examined.");
870 LOG_WARNING(
"Use a reset button or power cycle the target.");
992 "srst pulls trst - can not reset into halted mode. Issuing halt after reset.");
1096 LOG_ERROR(
"Failed to halt CPU after 1 sec");
1115 uint32_t r0_thumb, pc_thumb;
1116 LOG_DEBUG(
"target entered debug from Thumb state, changing to ARM");
1142 for (i = 0; i <= 14; i++) {
1170 "BUG: arm7/9 does not support halt during reset. This is handled in arm7_9_assert_reset()");
1186 LOG_WARNING(
"target was in unknown state when halt was requested");
1227 uint32_t context[16];
1228 uint32_t *context_p[16];
1229 uint32_t r0_thumb, pc_thumb;
1230 uint32_t cpsr, cpsr_mask = 0;
1237 #ifdef _DEBUG_ARM7_9_
1268 LOG_DEBUG(
"target entered debug from Thumb state");
1274 ", pc_thumb: 0x%8.8" PRIx32, r0_thumb, pc_thumb);
1281 LOG_DEBUG(
"target entered debug from Jazelle state");
1283 cpsr_mask = 1 << 24;
1284 LOG_ERROR(
"Jazelle debug entry -- BROKEN!");
1286 LOG_DEBUG(
"target entered debug from ARM state");
1291 for (i = 0; i < 16; i++)
1292 context_p[i] = &context[i];
1309 LOG_ERROR(
"cpsr contains invalid mode value - communication failure");
1313 LOG_DEBUG(
"target entered debug state in %s mode",
1317 LOG_DEBUG(
"thumb state, applying fixups");
1318 context[0] = r0_thumb;
1319 context[15] = pc_thumb;
1322 context[15] -= 3 * 4;
1331 for (i = 0; i <= 15; i++) {
1334 LOG_DEBUG(
"r%i: 0x%8.8" PRIx32
"", i, context[i]);
1338 r->
dirty = (i == 0) || (i == 15);
1342 LOG_DEBUG(
"entered debug state at PC 0x%" PRIx32
"", context[15]);
1387 } read_cache[6 * (16 + 1)];
1388 int read_cache_idx = 0;
1398 LOG_ERROR(
"not a valid arm core mode - communication failure?");
1405 for (i = 0; i < 6; i++) {
1407 uint32_t *reg_p[16];
1413 for (j = 0; j <= 16; j++) {
1428 for (j = 0; j < 15; j++) {
1435 reg_p[j] = &read_cache[read_cache_idx].value;
1477 while (read_cache_idx) {
1479 buf_set_u32(read_cache[read_cache_idx].reg_p, 0, 32, read_cache[read_cache_idx].value);
1517 LOG_ERROR(
"not a valid arm core mode - communication failure?");
1524 for (i = 0; i < 6; i++) {
1531 for (j = 0; j <= 16; j++) {
1537 struct arm_reg *reg_arch_info;
1540 && (reg_arch_info->
mode != current_mode)
1549 LOG_ERROR(
"BUG: dirty register '%s', but no valid data",
1555 uint32_t
mask = 0x0;
1571 for (j = 0; j <= 14; j++) {
1582 LOG_DEBUG(
"writing register %i mode %s "
1583 "with value 0x%8.8" PRIx32, j,
1595 struct arm_reg *reg_arch_info;
1598 LOG_DEBUG(
"writing SPSR of mode %i with value 0x%8.8" PRIx32
"",
1613 LOG_DEBUG(
"writing lower 8 bit of cpsr with value 0x%2.2x", (
unsigned)(tmp_cpsr));
1618 LOG_DEBUG(
"writing cpsr with value 0x%8.8" PRIx32,
1628 LOG_DEBUG(
"writing PC with value 0x%8.8" PRIx32,
1703 int handle_breakpoints,
1704 int debug_execution)
1718 if (!debug_execution)
1725 uint32_t current_pc;
1729 if (handle_breakpoints) {
1745 uint32_t current_opcode;
1748 "Couldn't calculate PC of next instruction, current opcode was 0x%8.8" PRIx32
"",
1790 LOG_DEBUG(
"new PC after step: 0x%8.8" PRIx32,
1820 if (!debug_execution)
1830 if (!debug_execution) {
1853 uint32_t current_pc;
1856 if (next_pc != current_pc) {
1923 if (handle_breakpoints)
1937 uint32_t current_opcode;
1940 "Couldn't calculate PC of next instruction, current opcode was 0x%8.8" PRIx32
"",
1994 uint32_t *reg_p[16];
2002 if ((num < 0) || (num > 16))
2017 if ((num >= 0) && (num <= 15)) {
2019 reg_p[num] = &value;
2057 if ((num < 0) || (num > 16))
2071 if ((num >= 0) && (num <= 15)) {
2112 uint32_t num_accesses = 0;
2113 int thisrun_accesses;
2131 if (((
size == 4) && (address & 0x3u)) || ((
size == 2) && (address & 0x1u)))
2142 while (num_accesses <
count) {
2145 ((
count - num_accesses) >= 14) ? 14 : (
count - num_accesses);
2146 reg_list = (0xffff >> (15 - thisrun_accesses)) & 0xfffe;
2148 if (last_reg <= thisrun_accesses)
2149 last_reg = thisrun_accesses;
2166 buffer += thisrun_accesses * 4;
2167 num_accesses += thisrun_accesses;
2169 if ((j++%1024) == 0)
2174 while (num_accesses <
count) {
2177 ((
count - num_accesses) >= 14) ? 14 : (
count - num_accesses);
2178 reg_list = (0xffff >> (15 - thisrun_accesses)) & 0xfffe;
2180 for (i = 1; i <= thisrun_accesses; i++) {
2199 buffer += thisrun_accesses * 2;
2200 num_accesses += thisrun_accesses;
2202 if ((j++%1024) == 0)
2207 while (num_accesses <
count) {
2210 ((
count - num_accesses) >= 14) ? 14 : (
count - num_accesses);
2211 reg_list = (0xffff >> (15 - thisrun_accesses)) & 0xfffe;
2213 for (i = 1; i <= thisrun_accesses; i++) {
2231 buffer += thisrun_accesses * 1;
2232 num_accesses += thisrun_accesses;
2234 if ((j++%1024) == 0)
2243 for (i = 0; i <= last_reg; i++) {
2251 LOG_ERROR(
"JTAG error while reading cpsr");
2257 "memory read caused data abort "
2258 "(address: 0x%8.8" TARGET_PRIxADDR ", size: 0x%" PRIx32
", count: 0x%" PRIx32
")",
2284 uint32_t num_accesses = 0;
2285 int thisrun_accesses;
2291 #ifdef _DEBUG_ARM7_9_
2304 if (((
size == 4) && (address & 0x3u)) || ((
size == 2) && (address & 0x1u)))
2317 while (num_accesses <
count) {
2320 ((
count - num_accesses) >= 14) ? 14 : (
count - num_accesses);
2321 reg_list = (0xffff >> (15 - thisrun_accesses)) & 0xfffe;
2323 for (i = 1; i <= thisrun_accesses; i++) {
2356 num_accesses += thisrun_accesses;
2360 while (num_accesses <
count) {
2363 ((
count - num_accesses) >= 14) ? 14 : (
count - num_accesses);
2364 reg_list = (0xffff >> (15 - thisrun_accesses)) & 0xfffe;
2366 for (i = 1; i <= thisrun_accesses; i++) {
2375 for (i = 1; i <= thisrun_accesses; i++) {
2401 num_accesses += thisrun_accesses;
2405 while (num_accesses <
count) {
2408 ((
count - num_accesses) >= 14) ? 14 : (
count - num_accesses);
2409 reg_list = (0xffff >> (15 - thisrun_accesses)) & 0xfffe;
2411 for (i = 1; i <= thisrun_accesses; i++) {
2419 for (i = 1; i <= thisrun_accesses; i++) {
2445 num_accesses += thisrun_accesses;
2457 for (i = 0; i <= last_reg; i++) {
2465 LOG_ERROR(
"JTAG error while reading cpsr");
2471 "memory write caused data abort "
2472 "(address: 0x%8.8" TARGET_PRIxADDR ", size: 0x%" PRIx32
", count: 0x%" PRIx32
")",
2522 uint32_t exit_point,
2545 uint8_t reg_addr = ice_reg->
addr & 0x1f;
2556 for (i = 0; i <
count; i++) {
2595 if (address % 4 != 0)
2603 uint8_t dcc_code_buf[6 * 4];
2607 LOG_INFO(
"no working area available, falling back to memory writes");
2642 if (endaddress != (address +
count*4)) {
2644 "DCC write failed, expected end address 0x%08" TARGET_PRIxADDR " got 0x%0" PRIx32
"",
2645 (address +
count*4),
2707 "NOTE! DCC downloads have not been enabled, defaulting to slow memory writes. Type 'help dcc'.");
2710 LOG_WARNING(
"NOTE! Severe performance degradation without working memory enabled.");
2714 "NOTE! Severe performance degradation without fast memory access enabled. Type 'help fast'.");
2723 uint8_t *in = (uint8_t *)pu8_in;
2724 int size = (int)i_size;
2726 int flip = (int)i_flip;
2752 *in = readback & 0xff;
2773 "use of EmbeddedICE dbgrq instead of breakpoint for target halt %s",
2774 (arm7_9->
use_dbgrq) ?
"enabled" :
"disabled");
2793 "fast memory access is %s",
2813 "dcc downloads are %s",
2824 LOG_USER(
"current target isn't an ARM7/ARM9 target");
2832 if (!vector_catch->
valid)
2883 .handler = handle_arm7_9_dbgrq_command,
2885 .usage =
"['enable'|'disable']",
2886 .help =
"use EmbeddedICE dbgrq instead of breakpoint "
2887 "for target halt requests",
2890 .name =
"fast_memory_access",
2891 .handler = handle_arm7_9_fast_memory_access_command,
2893 .usage =
"['enable'|'disable']",
2894 .help =
"use fast memory accesses instead of slower "
2895 "but potentially safer accesses",
2898 .name =
"dcc_downloads",
2899 .handler = handle_arm7_9_dcc_downloads_command,
2901 .usage =
"['enable'|'disable']",
2902 .help =
"use DCC downloads for larger memory writes",
2916 .help =
"arm7/9 specific commands",
void init_reg_param(struct reg_param *param, char *reg_name, uint32_t size, enum param_direction direction)
void destroy_reg_param(struct reg_param *param)
static void arm7_9_enable_watchpoints(struct target *target)
Enable the watchpoints on an ARM7/9 target.
static int arm7_9_read_core_reg(struct target *target, struct reg *r, int num, enum arm_mode mode)
static int arm7_9_execute_fast_sys_speed(struct target *target)
Restarts the target by sending a RESTART instruction and moving the JTAG state to IDLE.
int arm7_9_endianness_callback(jtag_callback_data_t pu8_in, jtag_callback_data_t i_size, jtag_callback_data_t i_be, jtag_callback_data_t i_flip)
static int arm7_9_unset_watchpoint(struct target *target, struct watchpoint *watchpoint)
Unset an existing watchpoint and clear the used watchpoint unit.
static int arm7_9_set_software_breakpoints(struct arm7_9_common *arm7_9)
Setup an ARM7/9 target's embedded ICE registers for software breakpoints.
static const uint8_t * dcc_buffer
int arm7_9_write_memory_opt(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
static int arm7_9_full_context(struct target *target)
Validate the full context for an ARM7/9 target in all processor modes.
static int arm7_9_clear_halt(struct target *target)
Clears the halt condition for an ARM7/9 target.
static int arm7_9_unset_breakpoint(struct target *target, struct breakpoint *breakpoint)
Unsets an existing breakpoint on an ARM7/9 target.
static int arm7_9_clear_watchpoints(struct arm7_9_common *arm7_9)
Clear watchpoints for an ARM7/9 target.
int arm7_9_examine(struct target *target)
Perform per-target setup that requires JTAG access.
void arm7_9_disable_eice_step(struct target *target)
void arm7_9_deinit(struct target *target)
int arm7_9_read_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
int arm7_9_add_breakpoint(struct target *target, struct breakpoint *breakpoint)
Add a breakpoint to an ARM7/9 target.
int arm7_9_soft_reset_halt(struct target *target)
Issue a software reset and halt to an ARM7/9 target.
const struct command_registration arm7_9_command_handlers[]
static void arm7_9_assign_wp(struct arm7_9_common *arm7_9, struct breakpoint *breakpoint)
Assign a watchpoint to one of the two available hardware comparators in an ARM7 or ARM9 target.
static const struct command_registration arm7_9_any_command_handlers[]
int arm7_9_assert_reset(struct target *target)
Asserts the reset (SRST) on an ARM7/9 target.
static const uint32_t dcc_code[]
int arm7_9_poll(struct target *target)
Polls an ARM7/9 target for its current status.
int arm7_9_execute_sys_speed(struct target *target)
Restarts the target by sending a RESTART instruction and moving the JTAG state to IDLE.
static int arm7_9_dcc_completion(struct target *target, uint32_t exit_point, int timeout_ms, void *arch_info)
int arm7_9_halt(struct target *target)
Halt an ARM7/9 target.
int arm7_9_remove_breakpoint(struct target *target, struct breakpoint *breakpoint)
Removes a breakpoint from an ARM7/9 target.
int arm7_9_remove_watchpoint(struct target *target, struct watchpoint *watchpoint)
Remove a watchpoint from an ARM7/9 target.
static int arm7_9_setup(struct target *target)
Setup the common pieces for an ARM7/9 target after reset or on startup.
int arm7_9_deassert_reset(struct target *target)
Deassert the reset (SRST) signal on an ARM7/9 target.
int arm7_9_write_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
static int arm7_9_setup_semihosting(struct target *target, int enable)
void arm7_9_enable_eice_step(struct target *target, uint32_t next_pc)
static void arm7_9_enable_breakpoints(struct target *target)
Enable the breakpoints on an ARM7/9 target.
static int arm7_9_set_breakpoint(struct target *target, struct breakpoint *breakpoint)
Set either a hardware or software breakpoint on an ARM7/9 target.
int arm7_9_bulk_write_memory(struct target *target, target_addr_t address, uint32_t count, const uint8_t *buffer)
static int arm7_9_debug_entry(struct target *target)
Handle an ARM7/9 target's entry into debug mode.
int arm7_9_write_memory_no_opt(struct target *target, uint32_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
static int arm7_9_restart_core(struct target *target)
Restart the core of an ARM7/9 target.
int arm7_9_step(struct target *target, int current, target_addr_t address, int handle_breakpoints)
int arm7_9_target_request_data(struct target *target, uint32_t size, uint8_t *buffer)
Get some data from the ARM7/9 target.
COMMAND_HANDLER(handle_arm7_9_dbgrq_command)
int arm7_9_add_watchpoint(struct target *target, struct watchpoint *watchpoint)
Add a watchpoint to an ARM7/9 target.
int arm7_9_check_reset(struct target *target)
static int arm7_9_set_watchpoint(struct target *target, struct watchpoint *watchpoint)
Sets a watchpoint for an ARM7/9 target in one of the watchpoint units.
static int arm7_9_handle_target_request(void *priv)
Handles requests to an ARM7/9 target.
static int arm7_9_write_core_reg(struct target *target, struct reg *r, int num, enum arm_mode mode, uint8_t *value)
int arm7_9_init_arch_info(struct target *target, struct arm7_9_common *arm7_9)
int arm7_9_resume(struct target *target, int current, target_addr_t address, int handle_breakpoints, int debug_execution)
static int arm7_9_restore_context(struct target *target)
Restore the processor context on an ARM7/9 target.
#define ARM7_9_COMMON_MAGIC
static struct arm7_9_common * target_to_arm7_9(struct target *target)
static bool is_arm7_9(struct arm7_9_common *arm7_9)
arm_mode
Represent state of an ARM core.
bool is_arm_mode(unsigned psr_mode)
Return true iff the parameter denotes a valid ARM processor mode.
const struct command_registration arm_command_handlers[]
const char * arm_mode_name(unsigned psr_mode)
Map PSR mode bits to the name of an ARM processor operating mode.
int arm_init_arch_info(struct target *target, struct arm *arm)
void arm_set_cpsr(struct arm *arm, uint32_t cpsr)
Configures host-side ARM records to reflect the specified CPSR.
int armv4_5_run_algorithm_inner(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, int timeout_ms, void *arch_info, int(*run_it)(struct target *target, uint32_t exit_point, int timeout_ms, void *arch_info))
struct reg * arm_reg_current(struct arm *arm, unsigned regnum)
Returns handle to the register currently mapped to a given number.
int arm_jtag_setup_connection(struct arm_jtag *jtag_info)
int arm_jtag_close_connection(struct arm_jtag *jtag_info)
static int arm_jtag_set_instr(struct jtag_tap *tap, uint32_t new_instr, void *no_verify_capture, tap_state_t end_state)
int arm_semihosting(struct target *target, int *retval)
Checks for and processes an ARM semihosting request.
int arm_simulate_step(struct target *target, uint32_t *dry_run_pc)
enum arm_mode armv4_5_number_to_mode(int number)
Map linear number indexing armv4_5_core_reg_map to PSR mode bits.
#define ARMV4_5_CORE_REG_MODE(cache, mode, num)
uint32_t flip_u32(uint32_t value, unsigned int num)
static uint32_t buf_get_u32(const uint8_t *_buffer, unsigned first, unsigned num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 32-bit word.
static void buf_set_u32(uint8_t *_buffer, unsigned first, unsigned num, uint32_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
static uint32_t fast_target_buffer_get_u32(const void *p, bool le)
void breakpoint_remove(struct target *target, target_addr_t address)
int breakpoint_add(struct target *target, target_addr_t address, uint32_t length, enum breakpoint_type type)
struct breakpoint * breakpoint_find(struct target *target, target_addr_t address)
static void watchpoint_set(struct watchpoint *watchpoint, unsigned int number)
static void breakpoint_hw_set(struct breakpoint *breakpoint, unsigned int hw_number)
void command_print(struct command_invocation *cmd, const char *format,...)
#define CMD
Use this macro to access the command being handled, rather than accessing the variable directly.
#define CMD_ARGV
Use this macro to access the arguments for the command being handled, rather than accessing the varia...
#define ERROR_COMMAND_SYNTAX_ERROR
#define CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
#define COMMAND_PARSE_ENABLE(in, out)
parses an enable/disable command argument
#define CMD_CTX
Use this macro to access the context of the command being handled, rather than accessing the variable...
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
void embeddedice_write_dcc(struct jtag_tap *tap, int reg_addr, const uint8_t *buffer, int little, int count)
This is an inner loop of the open loop DCC write of data to target.
void embeddedice_set_reg(struct reg *reg, uint32_t value)
Queue a write for an EmbeddedICE register, updating the register cache.
void embeddedice_free_reg_cache(struct reg_cache *reg_cache)
Free all memory allocated for EmbeddedICE register cache.
int embeddedice_setup(struct target *target)
Initialize EmbeddedICE module, if needed.
struct reg_cache * embeddedice_build_reg_cache(struct target *target, struct arm7_9_common *arm7_9)
Probe EmbeddedICE module and set up local records of its registers.
void embeddedice_write_reg(struct reg *reg, uint32_t value)
Queue a write for an EmbeddedICE register, bypassing the register cache.
int embeddedice_receive(struct arm_jtag *jtag_info, uint32_t *data, uint32_t size)
Receive a block of size 32-bit words from the DCC.
void embeddedice_store_reg(struct reg *reg)
Queue a write for an EmbeddedICE register, using cached value.
int embeddedice_read_reg(struct reg *reg)
Queue a read for an EmbeddedICE register into the register cache, not checking the value read.
int embeddedice_read_reg_w_check(struct reg *reg, uint8_t *check_value, uint8_t *check_mask)
Queue a read for an EmbeddedICE register into the register cache, optionally checking the value read.
@ EICE_DBG_CONTROL_DBGACK
@ EICE_DBG_CONTROL_INTDIS
@ EICE_DBG_STATUS_SYSCOMP
static struct esp_usb_jtag * priv
struct reg_cache * etm_build_reg_cache(struct target *target, struct arm_jtag *jtag_info, struct etm_context *etm_ctx)
int etm_setup(struct target *target)
const struct command_registration etm_command_handlers[]
void jtag_add_reset(int req_tlr_or_trst, int req_srst)
A reset of the TAP state machine can be requested.
int jtag_execute_queue(void)
For software FIFO implementations, the queued commands can be executed during this call or earlier.
static enum reset_types jtag_reset_config
void jtag_add_sleep(uint32_t us)
void jtag_add_runtest(int num_cycles, tap_state_t state)
Goes to TAP_IDLE (if we're not already there), cycle precisely num_cycles in the TAP_IDLE state,...
enum reset_types jtag_get_reset_config(void)
intptr_t jtag_callback_data_t
Defines the type of data passed to the jtag_callback_t interface.
static const struct @101 regs[]
void alive_sleep(uint64_t ms)
#define LOG_USER(expr ...)
#define LOG_WARNING(expr ...)
#define LOG_ERROR(expr ...)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
struct reg_cache ** register_get_last_cache_p(struct reg_cache **first)
void register_cache_invalidate(struct reg_cache *cache)
Marks the contents of the register cache as invalid (and clean).
size_t size
Size of the control block search area.
Structure for items that are common between both ARM7 and ARM9 targets.
void(* enable_single_step)(struct target *target, uint32_t next_pc)
bool has_vector_catch
Specifies if the target has a reset vector catch.
void(* read_xpsr)(struct target *target, uint32_t *xpsr, int spsr)
Function for reading CPSR or SPSR.
unsigned int common_magic
void(* store_hword_reg)(struct target *target, int num)
void(* write_xpsr_im8)(struct target *target, uint8_t xpsr_im, int rot, int spsr)
Function for writing an immediate value to CPSR or SPSR.
void(* write_core_regs)(struct target *target, uint32_t mask, uint32_t core_regs[16])
uint32_t arm_bkpt
ARM breakpoint instruction.
bool debug_entry_from_reset
Specifies if debug entry was from a reset.
bool use_dbgrq
Specifies if DBGRQ should be used to halt the target.
struct working_area * dcc_working_area
int(* bulk_write_memory)(struct target *target, target_addr_t address, uint32_t count, const uint8_t *buffer)
Write target memory in multiples of 4 bytes, optimized for writing large quantities of data.
void(* branch_resume)(struct target *target)
int sw_breakpoints_added
Specifies which watchpoint software breakpoints are setup on.
int breakpoint_count
Current number of set breakpoints.
int(* write_memory)(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
Variant specific memory write function that does not dispatch to bulk_write_memory.
struct arm_jtag jtag_info
JTAG information for target.
void(* set_special_dbgrq)(struct target *target)
Function for setting DBGRQ if the normal way won't work.
void(* read_core_regs_target_buffer)(struct target *target, uint32_t mask, void *buffer, int size)
int wp1_used
Specifies if and how watchpoint unit 1 is used.
void(* store_byte_reg)(struct target *target, int num)
bool need_bypass_before_restart
Specifies if there should be a bypass before a JTAG restart.
struct reg_cache * eice_cache
Embedded ICE register cache.
int(* post_debug_entry)(struct target *target)
Callback function called after entering debug mode.
void(* load_word_regs)(struct target *target, uint32_t mask)
void(* load_byte_reg)(struct target *target, int num)
void(* read_core_regs)(struct target *target, uint32_t mask, uint32_t *core_regs[16])
Function for reading the core registers.
int wp1_used_default
Specifies if and how watchpoint unit 1 is used by default.
int sw_breakpoint_count
keep track of number of software breakpoints we have set
void(* load_hword_reg)(struct target *target, int num)
void(* disable_single_step)(struct target *target)
void(* write_pc)(struct target *target, uint32_t pc)
Function for writing to the program counter.
int wp0_used
Specifies if and how watchpoint unit 0 is used.
uint16_t thumb_bkpt
Thumb breakpoint instruction.
void(* store_word_regs)(struct target *target, uint32_t mask)
void(* pre_restore_context)(struct target *target)
Callback function called before restoring the processor context.
int dbgreq_adjust_pc
Amount of PC adjustment caused by a DBGREQ.
int(* examine_debug_reason)(struct target *target)
Function for determining why debug state was entered.
int wp_available_max
Maximum number of available watchpoint units.
void(* branch_resume_thumb)(struct target *target)
void(* change_to_arm)(struct target *target, uint32_t *r0, uint32_t *pc)
Function for changing from Thumb to ARM mode.
void(* write_xpsr)(struct target *target, uint32_t xpsr, int spsr)
Function for writing to CPSR or SPSR.
int wp_available
Current number of available watchpoint units.
unsigned int common_magic
enum arm_state core_state
Represents a generic ARM core, with standard application registers.
int(* full_context)(struct target *target)
Retrieve all core registers, for display.
struct etm_context * etm
Handle for the Embedded Trace Module, if one is present.
enum arm_core_type core_type
Indicates what registers are in the ARM state core register set.
enum arm_mode core_mode
Record the current core mode: SVC, USR, or some other mode.
struct reg * cpsr
Handle to the CPSR/xPSR; valid in all core modes.
struct reg * pc
Handle to the PC; valid in all core modes.
int(* write_core_reg)(struct target *target, struct reg *reg, int num, enum arm_mode mode, uint8_t *value)
int(* setup_semihosting)(struct target *target, int enable)
int(* read_core_reg)(struct target *target, struct reg *reg, int num, enum arm_mode mode)
Retrieve a single core register.
struct reg_cache * core_cache
struct reg * spsr
Handle to the SPSR; valid only in core modes with an SPSR.
enum arm_state core_state
Record the current core state: ARM, Thumb, or otherwise.
enum breakpoint_type type
const struct command_registration * chain
If non-NULL, the commands in chain will be registered in the same context and scope of this registrat...
struct arm_jtag * jtag_info
uint32_t working_area_size
enum target_debug_reason debug_reason
enum target_endianness endianness
struct reg_cache * reg_cache
struct breakpoint * breakpoints
struct watchpoint * watchpoints
int target_call_event_callbacks(struct target *target, enum target_event event)
void target_free_all_working_areas(struct target *target)
const char * target_state_name(struct target *t)
Return the name of this targets current state.
int target_halt(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.
int target_write_u16(struct target *target, target_addr_t address, uint16_t value)
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.
int target_alloc_working_area(struct target *target, uint32_t size, struct working_area **area)
bool get_target_reset_nag(void)
int target_write_u32(struct target *target, target_addr_t address, uint32_t value)
int target_examine_one(struct target *target)
Examine the specified target, letting it perform any Initialisation that requires JTAG access.
int target_poll(struct target *target)
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 spec...
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)
uint16_t target_buffer_get_u16(struct target *target, const 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.
struct target * get_current_target(struct command_context *cmd_ctx)
void target_buffer_set_u32_array(struct target *target, uint8_t *buffer, uint32_t count, const uint32_t *srcbuf)
void target_handle_event(struct target *target, enum target_event e)
uint32_t target_buffer_get_u32(struct target *target, const uint8_t *buffer)
int target_wait_state(struct target *target, enum target_state state, int ms)
#define ERROR_TARGET_NOT_HALTED
#define ERROR_TARGET_UNALIGNED_ACCESS
#define ERROR_TARGET_INVALID
@ TARGET_TIMER_TYPE_PERIODIC
@ TARGET_EVENT_DEBUG_RESUMED
@ TARGET_EVENT_DEBUG_HALTED
@ TARGET_EVENT_RESET_ASSERT
#define ERROR_TARGET_NOT_EXAMINED
static const char * target_name(struct target *target)
Returns the instance-specific name of the specified target.
#define ERROR_TARGET_TIMEOUT
#define ERROR_TARGET_RESOURCE_NOT_AVAILABLE
static void target_set_examined(struct target *target)
Sets the examined flag for the given target.
static bool target_was_examined(struct target *target)
#define ERROR_TARGET_DATA_ABORT
#define ERROR_TARGET_FAILURE
int target_request(struct target *target, uint32_t request)
static void h_u32_to_be(uint8_t *buf, uint32_t val)
static void h_u16_to_be(uint8_t *buf, uint16_t val)
static uint16_t le_to_h_u16(const uint8_t *buf)
static void h_u32_to_le(uint8_t *buf, uint32_t val)
#define ARRAY_SIZE(x)
Compute the number of elements of a variable length array.
static void h_u16_to_le(uint8_t *buf, uint16_t val)
static uint32_t le_to_h_u32(const uint8_t *buf)