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");
507 LOG_ERROR(
"BUG: no hardware comparator available");
646 LOG_ERROR(
"timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: %" PRIx32
"",
665 static uint8_t check_value[4], check_mask[4];
717 data = malloc(
size * (
sizeof(uint32_t)));
722 for (i = 0; i <
size; i++)
813 LOG_DEBUG(
"DBGACK already set during server startup.");
841 "DBGACK set, but the target did not end up in the halted state %d",
866 bool use_event =
false;
870 LOG_WARNING(
"Reset is not asserted because the target is not examined.");
871 LOG_WARNING(
"Use a reset button or power cycle the target.");
993 "srst pulls trst - can not reset into halted mode. Issuing halt after reset.");
1097 LOG_ERROR(
"Failed to halt CPU after 1 sec");
1116 uint32_t r0_thumb, pc_thumb;
1117 LOG_DEBUG(
"target entered debug from Thumb state, changing to ARM");
1143 for (i = 0; i <= 14; i++) {
1171 "BUG: arm7/9 does not support halt during reset. This is handled in arm7_9_assert_reset()");
1187 LOG_WARNING(
"target was in unknown state when halt was requested");
1228 uint32_t context[16];
1229 uint32_t *context_p[16];
1230 uint32_t r0_thumb, pc_thumb;
1231 uint32_t cpsr, cpsr_mask = 0;
1238 #ifdef _DEBUG_ARM7_9_
1269 LOG_DEBUG(
"target entered debug from Thumb state");
1275 ", pc_thumb: 0x%8.8" PRIx32, r0_thumb, pc_thumb);
1282 LOG_DEBUG(
"target entered debug from Jazelle state");
1284 cpsr_mask = 1 << 24;
1285 LOG_ERROR(
"Jazelle debug entry -- BROKEN!");
1287 LOG_DEBUG(
"target entered debug from ARM state");
1292 for (i = 0; i < 16; i++)
1293 context_p[i] = &context[i];
1310 LOG_ERROR(
"cpsr contains invalid mode value - communication failure");
1314 LOG_DEBUG(
"target entered debug state in %s mode",
1318 LOG_DEBUG(
"thumb state, applying fixups");
1319 context[0] = r0_thumb;
1320 context[15] = pc_thumb;
1323 context[15] -= 3 * 4;
1332 for (i = 0; i <= 15; i++) {
1335 LOG_DEBUG(
"r%i: 0x%8.8" PRIx32
"", i, context[i]);
1339 r->
dirty = (i == 0) || (i == 15);
1343 LOG_DEBUG(
"entered debug state at PC 0x%" PRIx32
"", context[15]);
1388 } read_cache[6 * (16 + 1)];
1389 int read_cache_idx = 0;
1399 LOG_ERROR(
"not a valid arm core mode - communication failure?");
1406 for (i = 0; i < 6; i++) {
1408 uint32_t *reg_p[16];
1414 for (j = 0; j <= 16; j++) {
1429 for (j = 0; j < 15; j++) {
1436 reg_p[j] = &read_cache[read_cache_idx].value;
1478 while (read_cache_idx) {
1480 buf_set_u32(read_cache[read_cache_idx].reg_p, 0, 32, read_cache[read_cache_idx].value);
1518 LOG_ERROR(
"not a valid arm core mode - communication failure?");
1525 for (i = 0; i < 6; i++) {
1532 for (j = 0; j <= 16; j++) {
1538 struct arm_reg *reg_arch_info;
1541 && (reg_arch_info->
mode != current_mode)
1550 LOG_ERROR(
"BUG: dirty register '%s', but no valid data",
1556 uint32_t
mask = 0x0;
1571 for (j = 0; j <= 14; j++) {
1581 LOG_DEBUG(
"writing register %i mode %s "
1582 "with value 0x%8.8" PRIx32, j,
1594 struct arm_reg *reg_arch_info;
1597 LOG_DEBUG(
"writing SPSR of mode %i with value 0x%8.8" PRIx32
"",
1612 LOG_DEBUG(
"writing lower 8 bit of cpsr with value 0x%2.2x", (
unsigned)(tmp_cpsr));
1617 LOG_DEBUG(
"writing cpsr with value 0x%8.8" PRIx32,
1627 LOG_DEBUG(
"writing PC with value 0x%8.8" PRIx32,
1702 int handle_breakpoints,
1703 int debug_execution)
1717 if (!debug_execution)
1724 uint32_t current_pc;
1728 if (handle_breakpoints) {
1744 uint32_t current_opcode;
1747 "Couldn't calculate PC of next instruction, current opcode was 0x%8.8" PRIx32
"",
1789 LOG_DEBUG(
"new PC after step: 0x%8.8" PRIx32,
1819 if (!debug_execution)
1829 if (!debug_execution) {
1852 uint32_t current_pc;
1855 if (next_pc != current_pc) {
1922 if (handle_breakpoints)
1936 uint32_t current_opcode;
1939 "Couldn't calculate PC of next instruction, current opcode was 0x%8.8" PRIx32
"",
1993 uint32_t *reg_p[16];
2001 if ((num < 0) || (num > 16))
2016 if ((num >= 0) && (num <= 15)) {
2018 reg_p[num] = &value;
2056 if ((num < 0) || (num > 16))
2070 if ((num >= 0) && (num <= 15)) {
2111 uint32_t num_accesses = 0;
2112 int thisrun_accesses;
2130 if (((
size == 4) && (address & 0x3u)) || ((
size == 2) && (address & 0x1u)))
2141 while (num_accesses <
count) {
2144 ((
count - num_accesses) >= 14) ? 14 : (
count - num_accesses);
2145 reg_list = (0xffff >> (15 - thisrun_accesses)) & 0xfffe;
2147 if (last_reg <= thisrun_accesses)
2148 last_reg = thisrun_accesses;
2165 buffer += thisrun_accesses * 4;
2166 num_accesses += thisrun_accesses;
2168 if ((j++%1024) == 0)
2173 while (num_accesses <
count) {
2176 ((
count - num_accesses) >= 14) ? 14 : (
count - num_accesses);
2177 reg_list = (0xffff >> (15 - thisrun_accesses)) & 0xfffe;
2179 for (i = 1; i <= thisrun_accesses; i++) {
2198 buffer += thisrun_accesses * 2;
2199 num_accesses += thisrun_accesses;
2201 if ((j++%1024) == 0)
2206 while (num_accesses <
count) {
2209 ((
count - num_accesses) >= 14) ? 14 : (
count - num_accesses);
2210 reg_list = (0xffff >> (15 - thisrun_accesses)) & 0xfffe;
2212 for (i = 1; i <= thisrun_accesses; i++) {
2230 buffer += thisrun_accesses * 1;
2231 num_accesses += thisrun_accesses;
2233 if ((j++%1024) == 0)
2242 for (i = 0; i <= last_reg; i++) {
2250 LOG_ERROR(
"JTAG error while reading cpsr");
2256 "memory read caused data abort "
2257 "(address: 0x%8.8" TARGET_PRIxADDR ", size: 0x%" PRIx32
", count: 0x%" PRIx32
")",
2283 uint32_t num_accesses = 0;
2284 int thisrun_accesses;
2290 #ifdef _DEBUG_ARM7_9_
2303 if (((
size == 4) && (address & 0x3u)) || ((
size == 2) && (address & 0x1u)))
2316 while (num_accesses <
count) {
2319 ((
count - num_accesses) >= 14) ? 14 : (
count - num_accesses);
2320 reg_list = (0xffff >> (15 - thisrun_accesses)) & 0xfffe;
2322 for (i = 1; i <= thisrun_accesses; i++) {
2355 num_accesses += thisrun_accesses;
2359 while (num_accesses <
count) {
2362 ((
count - num_accesses) >= 14) ? 14 : (
count - num_accesses);
2363 reg_list = (0xffff >> (15 - thisrun_accesses)) & 0xfffe;
2365 for (i = 1; i <= thisrun_accesses; i++) {
2374 for (i = 1; i <= thisrun_accesses; i++) {
2400 num_accesses += thisrun_accesses;
2404 while (num_accesses <
count) {
2407 ((
count - num_accesses) >= 14) ? 14 : (
count - num_accesses);
2408 reg_list = (0xffff >> (15 - thisrun_accesses)) & 0xfffe;
2410 for (i = 1; i <= thisrun_accesses; i++) {
2418 for (i = 1; i <= thisrun_accesses; i++) {
2444 num_accesses += thisrun_accesses;
2456 for (i = 0; i <= last_reg; i++) {
2464 LOG_ERROR(
"JTAG error while reading cpsr");
2470 "memory write caused data abort "
2471 "(address: 0x%8.8" TARGET_PRIxADDR ", size: 0x%" PRIx32
", count: 0x%" PRIx32
")",
2521 uint32_t exit_point,
2522 unsigned int timeout_ms,
2544 uint8_t reg_addr = ice_reg->
addr & 0x1f;
2555 for (i = 0; i <
count; i++) {
2594 if (address % 4 != 0)
2602 uint8_t dcc_code_buf[6 * 4];
2606 LOG_INFO(
"no working area available, falling back to memory writes");
2641 if (endaddress != (address +
count*4)) {
2643 "DCC write failed, expected end address 0x%08" TARGET_PRIxADDR " got 0x%0" PRIx32
"",
2644 (address +
count*4),
2706 "NOTE! DCC downloads have not been enabled, defaulting to slow memory writes. Type 'help dcc'.");
2709 LOG_WARNING(
"NOTE! Severe performance degradation without working memory enabled.");
2713 "NOTE! Severe performance degradation without fast memory access enabled. Type 'help fast'.");
2722 uint8_t *in = (uint8_t *)pu8_in;
2723 int size = (int)i_size;
2725 int flip = (int)i_flip;
2751 *in = readback & 0xff;
2772 "use of EmbeddedICE dbgrq instead of breakpoint for target halt %s",
2773 (arm7_9->
use_dbgrq) ?
"enabled" :
"disabled");
2792 "fast memory access is %s",
2812 "dcc downloads are %s",
2823 LOG_USER(
"current target isn't an ARM7/ARM9 target");
2831 if (!vector_catch->
valid)
2882 .handler = handle_arm7_9_dbgrq_command,
2884 .usage =
"['enable'|'disable']",
2885 .help =
"use EmbeddedICE dbgrq instead of breakpoint "
2886 "for target halt requests",
2889 .name =
"fast_memory_access",
2890 .handler = handle_arm7_9_fast_memory_access_command,
2892 .usage =
"['enable'|'disable']",
2893 .help =
"use fast memory accesses instead of slower "
2894 "but potentially safer accesses",
2897 .name =
"dcc_downloads",
2898 .handler = handle_arm7_9_dcc_downloads_command,
2900 .usage =
"['enable'|'disable']",
2901 .help =
"use DCC downloads for larger memory writes",
2915 .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.
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_dcc_completion(struct target *target, uint32_t exit_point, unsigned int timeout_ms, void *arch_info)
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)
struct reg * arm_reg_current(struct arm *arm, unsigned int regnum)
Returns handle to the register currently mapped to a given number.
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, unsigned int timeout_ms, void *arch_info, int(*run_it)(struct target *target, uint32_t exit_point, unsigned int timeout_ms, void *arch_info))
bool is_arm_mode(unsigned int psr_mode)
Return true iff the parameter denotes a valid ARM processor mode.
arm_mode
Represent state of an ARM core.
const struct command_registration arm_command_handlers[]
int arm_init_arch_info(struct target *target, struct arm *arm)
const char * arm_mode_name(unsigned int psr_mode)
Map PSR mode bits to the name of an ARM processor operating mode.
void arm_set_cpsr(struct arm *arm, uint32_t cpsr)
Configures host-side ARM records to reflect the specified CPSR.
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)
Inverts the ordering of bits inside a 32-bit word (e.g.
static uint32_t buf_get_u32(const uint8_t *_buffer, unsigned int first, unsigned int 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 int first, unsigned int 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)
int breakpoint_remove(struct target *target, target_addr_t address)
int breakpoint_add(struct target *target, target_addr_t address, unsigned int 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)
#define WATCHPOINT_IGNORE_DATA_VALUE_MASK
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_STATUS_SYSCOMP
@ EICE_DBG_CONTROL_DBGACK
@ EICE_DBG_CONTROL_INTDIS
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_runtest(unsigned 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,...
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)
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 @109 regs[]
void alive_sleep(uint64_t ms)
#define LOG_USER(expr ...)
#define LOG_WARNING(expr ...)
#define LOG_TARGET_ERROR(target, fmt_str,...)
#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)
int target_halt(struct target *target)
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.
const char * target_state_name(const struct target *t)
Return the name of this targets current state.
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.
bool target_has_event_action(const struct target *target, enum target_event event)
Returns true only if the target has a handler for the specified event.
int target_wait_state(struct target *target, enum target_state state, unsigned int ms)
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)
#define ERROR_TARGET_NOT_HALTED
static bool target_was_examined(const struct target *target)
#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
static const char * target_name(const struct target *target)
Returns the instance-specific name of the specified target.
#define ERROR_TARGET_NOT_EXAMINED
#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.
#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)