77 #define CSR_BPCONTROL_X (1<<0)
78 #define CSR_BPCONTROL_W (1<<1)
79 #define CSR_BPCONTROL_R (1<<2)
80 #define CSR_BPCONTROL_U (1<<3)
81 #define CSR_BPCONTROL_S (1<<4)
82 #define CSR_BPCONTROL_H (1<<5)
83 #define CSR_BPCONTROL_M (1<<6)
84 #define CSR_BPCONTROL_BPMATCH (0xf<<7)
85 #define CSR_BPCONTROL_BPACTION (0xff<<11)
87 #define DEBUG_ROM_START 0x800
88 #define DEBUG_ROM_RESUME (DEBUG_ROM_START + 4)
89 #define DEBUG_ROM_EXCEPTION (DEBUG_ROM_START + 8)
90 #define DEBUG_RAM_START 0x400
92 #define SETHALTNOT 0x10c
96 #define DTMCONTROL 0x10
97 #define DTMCONTROL_DBUS_RESET (1<<16)
98 #define DTMCONTROL_IDLE (7<<10)
99 #define DTMCONTROL_ADDRBITS (0xf<<4)
100 #define DTMCONTROL_VERSION (0xf)
103 #define DBUS_OP_START 0
104 #define DBUS_OP_SIZE 2
115 #define DBUS_DATA_START 2
116 #define DBUS_DATA_SIZE 34
117 #define DBUS_ADDRESS_START 36
133 #define DMCONTROL 0x10
134 #define DMCONTROL_INTERRUPT (((uint64_t)1)<<33)
135 #define DMCONTROL_HALTNOT (((uint64_t)1)<<32)
136 #define DMCONTROL_BUSERROR (7<<19)
137 #define DMCONTROL_SERIAL (3<<16)
138 #define DMCONTROL_AUTOINCREMENT (1<<15)
139 #define DMCONTROL_ACCESS (7<<12)
140 #define DMCONTROL_HARTID (0x3ff<<2)
141 #define DMCONTROL_NDRESET (1<<1)
142 #define DMCONTROL_FULLRESET 1
145 #define DMINFO_ABUSSIZE (0x7fU<<25)
146 #define DMINFO_SERIALCOUNT (0xf<<21)
147 #define DMINFO_ACCESS128 (1<<20)
148 #define DMINFO_ACCESS64 (1<<19)
149 #define DMINFO_ACCESS32 (1<<18)
150 #define DMINFO_ACCESS16 (1<<17)
151 #define DMINFO_ACCESS8 (1<<16)
152 #define DMINFO_DRAMSIZE (0x3f<<10)
153 #define DMINFO_AUTHENTICATED (1<<5)
154 #define DMINFO_AUTHBUSY (1<<4)
155 #define DMINFO_AUTHTYPE (3<<2)
156 #define DMINFO_VERSION 3
158 #define DMAUTHDATA0 0x12
159 #define DMAUTHDATA1 0x13
163 #define DBUS_ADDRESS_UNKNOWN 0xffff
165 #define DRAM_CACHE_SIZE 16
185 uint64_t mstatus_actual;
219 #define DEBUG_LENGTH 264
225 assert(
info->version_specific);
226 return info->version_specific;
240 return info->dramsize - 1;
250 return info->dramsize - 2;
253 LOG_ERROR(
"slot_offset called with xlen=%d, slot=%d",
260 unsigned int base, int16_t
offset)
273 unsigned int base, int16_t
offset)
306 return 0x40 + index - 0x10;
323 LOG_ERROR(
"failed jtag scan: %d", retval);
339 info->dbus_busy_delay +=
info->dbus_busy_delay / 10 + 1;
340 LOG_DEBUG(
"dtmcontrol_idle=%d, dbus_busy_delay=%d, interrupt_high_delay=%d",
341 info->dtmcontrol_idle,
info->dbus_busy_delay,
342 info->interrupt_high_delay);
350 info->interrupt_high_delay +=
info->interrupt_high_delay / 10 + 1;
351 LOG_DEBUG(
"dtmcontrol_idle=%d, dbus_busy_delay=%d, interrupt_high_delay=%d",
352 info->dtmcontrol_idle,
info->dbus_busy_delay,
353 info->interrupt_high_delay);
358 uint16_t
address, uint64_t data)
363 if (r->reset_delays_wait >= 0) {
364 r->reset_delays_wait--;
365 if (r->reset_delays_wait < 0) {
366 info->dbus_busy_delay = 0;
367 info->interrupt_high_delay = 0;
381 int idle_count =
info->dtmcontrol_idle +
info->dbus_busy_delay;
383 idle_count +=
info->interrupt_high_delay;
391 static const char *
const op_string[] = {
"nop",
"r",
"w",
"?"};
392 static const char *
const status_string[] = {
"+",
"?",
"F",
"b"};
401 unsigned int out_data = out >> 2;
407 unsigned int in_data = in >> 2;
411 __FILE__, __LINE__,
"scan",
412 "%ub %s %c%c:%08x @%02x -> %s %c%c:%08x @%02x",
414 op_string[out_op], out_interrupt, out_haltnot, out_data,
416 status_string[in_op], in_interrupt, in_haltnot, in_data,
421 uint64_t *data_in,
dbus_op_t op, uint16_t address_out, uint64_t data_out)
425 uint8_t out[8] = {0};
434 if (
info->addrbits == 0) {
446 int idle_count =
info->dtmcontrol_idle +
info->dbus_busy_delay;
575 for (
unsigned int i = 0; i < scans->
next_scan; i++)
583 LOG_ERROR(
"failed jtag scan: %d", retval);
661 unsigned int first,
unsigned int num)
667 unsigned int first,
unsigned int num)
703 if (address_in == (1<<
info->addrbits) - 1 &&
705 LOG_ERROR(
"TDO seems to be stuck high.");
716 }
while (address_in > 0x10 && address_in !=
DMCONTROL);
746 LOG_ERROR(
"Timed out waiting for debug int to clear."
747 "Increase timeout with riscv set_command_timeout_sec.");
758 if (expected != actual) {
759 LOG_ERROR(
"Wrote 0x%x to Debug RAM at %d, but read back 0x%x",
760 expected, index, actual);
769 if (
info->dram_cache[index].valid &&
770 info->dram_cache[index].data == data) {
772 LOG_DEBUG(
"cache[0x%x] = 0x%08x: DASM(0x%x) (hit)", index, data, data);
775 LOG_DEBUG(
"cache[0x%x] = 0x%08x: DASM(0x%x)", index, data, data);
776 info->dram_cache[index].data = data;
777 info->dram_cache[index].valid =
true;
778 info->dram_cache[index].dirty =
true;
816 LOG_ERROR(
"Debug RAM 0x%x: 0x%08x", i, value);
824 for (
unsigned int i = 0; i <
info->dramsize; i++) {
825 info->dram_cache[i].valid =
false;
826 info->dram_cache[i].dirty =
false;
835 for (
unsigned int i = 0; i <
info->dramsize; i++) {
837 info->dram_cache[i].valid =
false;
838 info->dram_cache[i].dirty =
false;
847 for (
unsigned int i = 0; i <
info->dramsize; i++) {
848 if (
info->dram_cache[i].valid && !
info->dram_cache[i].dirty) {
864 #define CACHE_NO_READ 128
873 unsigned int last =
info->dramsize;
874 for (
unsigned int i = 0; i <
info->dramsize; i++) {
875 if (
info->dram_cache[i].dirty)
879 if (last ==
info->dramsize) {
884 for (
unsigned int i = 0; i <
info->dramsize; i++) {
885 if (
info->dram_cache[i].dirty) {
886 bool set_interrupt = (i == last && run);
911 for (
unsigned int i = 0; i < scans->
next_scan; i++) {
918 LOG_ERROR(
"Debug RAM write failed. Hardware error?");
936 for (
unsigned int i = 0; i <
info->dramsize; i++) {
937 if (i == last && run)
941 info->dram_cache[i].dirty =
false;
947 LOG_ERROR(
"Debug interrupt didn't clear.");
957 for (
unsigned int i = 0; i <
info->dramsize; i++)
958 info->dram_cache[i].dirty =
false;
968 LOG_ERROR(
"Debug interrupt didn't clear.");
978 LOG_INFO(
"Got data from 0x%x but expected it from 0x%x",
981 info->dram_cache[read_addr].data =
983 info->dram_cache[read_addr].valid =
true;
1033 LOG_ERROR(
"Timed out waiting for state %d. "
1034 "Increase timeout with riscv set_command_timeout_sec.",
state);
1053 LOG_WARNING(
"Got exception 0x%x when reading %s", exception,
1089 if (
info->tselect_dirty) {
1093 info->tselect_dirty =
false;
1103 if (!
info->tselect_dirty) {
1107 info->tselect_dirty =
true;
1144 if (mstatus_reg->
valid) {
1146 if (mstatus_user !=
info->mstatus_actual) {
1176 LOG_ERROR(
"Debug interrupt didn't clear.");
1200 LOG_ERROR(
"Timed out waiting for step to complete."
1201 "Increase timeout with riscv set_command_timeout_sec");
1232 if (mstatus_reg->
valid) {
1253 LOG_ERROR(
"Don't know how to read register %d", regnum);
1336 LOG_WARNING(
"Got exception 0x%x when writing %s", exception,
1440 free(
info->version_specific);
1468 bool handle_breakpoints)
1474 LOG_WARNING(
"Asked to resume at 32-bit PC on %d-bit target.",
1482 if (handle_breakpoints) {
1496 uint32_t dtmcontrol;
1498 LOG_ERROR(
"Could not scan dtmcontrol. Check JTAG connectivity/board power.");
1502 LOG_DEBUG(
"dtmcontrol=0x%x", dtmcontrol);
1508 LOG_ERROR(
"Unsupported DTM version %d. (dtmcontrol=0x%x)",
1518 if (
info->dtmcontrol_idle == 0) {
1521 if (idcode == 0x10e31913)
1522 info->dtmcontrol_idle = 1;
1541 LOG_ERROR(
"OpenOCD only supports Debug Module version 1, not %d "
1549 LOG_ERROR(
"Authentication required by RISC-V core but not "
1550 "supported by OpenOCD. dminfo=0x%x", dminfo);
1567 for (
unsigned int i = 6; i <
info->dramsize; i++)
1582 if (word0 == 1 && word1 == 0) {
1583 generic_info->
xlen = 32;
1584 }
else if (word0 == 0xffffffff && word1 == 3) {
1585 generic_info->
xlen = 64;
1586 }
else if (word0 == 0xffffffff && word1 == 0xffffffff) {
1587 generic_info->
xlen = 128;
1590 LOG_ERROR(
"Failed to discover xlen; word0=0x%x, word1=0x%x, exception=0x%x",
1591 word0, word1, exception);
1598 const unsigned int old_csr_misa = 0xf10;
1604 LOG_ERROR(
"Failed to read misa at 0x%x.", old_csr_misa);
1612 info->never_halted =
true;
1619 LOG_INFO(
"Examined RISCV core; XLEN=%d, misa=0x%" PRIx64,
1671 LOG_ERROR(
"JTAG execute failed: %d", retval);
1675 unsigned int dbus_busy = 0;
1676 unsigned int interrupt_set = 0;
1677 unsigned int result = 0;
1682 for (
unsigned int i = 1; i < scans->
next_scan && dbus_busy == 0; i++) {
1692 LOG_ERROR(
"Debug access failed. Hardware error?");
1811 LOG_ERROR(
"Got invalid register result %d", result);
1819 value = data & 0xffffffff;
1835 if (interrupt_set) {
1863 LOG_ERROR(
"handle_halt_routine failed");
1883 LOG_ERROR(
"Invalid halt cause %d in DCSR (0x%" PRIx64
")",
1887 if (
info->never_halted) {
1888 info->never_halted =
false;
1913 const char *cause_string[] = {
1915 "software breakpoint",
1925 LOG_USER(
"halted at 0x%" PRIx64
" due to %s",
info->dpc, cause_string[cause]);
1941 if (
bits.haltnot &&
bits.interrupt) {
1944 }
else if (
bits.haltnot && !
bits.interrupt) {
1947 }
else if (!
bits.haltnot &&
bits.interrupt) {
1950 }
else if (!
bits.haltnot && !
bits.interrupt) {
1964 bool debug_execution)
1982 LOG_ERROR(
"Debug interrupt didn't clear.");
2022 const uint32_t increment = args.
increment;
2025 if (increment !=
size) {
2026 LOG_ERROR(
"read_memory with custom increment not implemented");
2054 const unsigned int max_batch_size = 256;
2059 uint32_t result_value = 0x777;
2061 while (i <
count + 3) {
2062 unsigned int batch_size =
MIN(
count + 3 - i, max_batch_size);
2065 for (
unsigned int j = 0; j < batch_size; j++) {
2066 if (i + j ==
count) {
2069 }
else if (i + j >=
count + 1) {
2081 LOG_ERROR(
"JTAG execute failed: %d", retval);
2086 int execute_busy = 0;
2087 for (
unsigned int j = 0; j < batch_size; j++) {
2094 LOG_ERROR(
"Debug RAM write failed. Hardware error?");
2107 if (i + j ==
count + 2) {
2108 result_value = data;
2109 }
else if (i + j > 1) {
2133 if (dbus_busy || execute_busy) {
2144 if (result_value != 0) {
2145 LOG_USER(
"Core got an exception (0x%x) while reading from 0x%"
2150 "didn't check then.)",
2223 const unsigned int max_batch_size = 256;
2228 uint32_t result_value = 0x777;
2230 while (i <
count + 2) {
2231 unsigned int batch_size =
MIN(
count + 2 - i, max_batch_size);
2234 for (
unsigned int j = 0; j < batch_size; j++) {
2235 if (i + j >=
count) {
2266 LOG_ERROR(
"JTAG execute failed: %d", retval);
2271 int execute_busy = 0;
2272 for (
unsigned int j = 0; j < batch_size; j++) {
2279 LOG_ERROR(
"Debug RAM write failed. Hardware error?");
2291 if (i + j ==
count + 1)
2298 if (dbus_busy || execute_busy) {
2319 if (result_value != 0) {
2320 LOG_ERROR(
"Core got an exception (0x%x) while writing to 0x%"
2325 "didn't check then.)",
2358 riscv_print_info_line(
CMD,
"target",
"memory.read_while_running8", 0);
2359 riscv_print_info_line(
CMD,
"target",
"memory.write_while_running8", 0);
2360 riscv_print_info_line(
CMD,
"target",
"memory.read_while_running16", 0);
2361 riscv_print_info_line(
CMD,
"target",
"memory.write_while_running16", 0);
2362 riscv_print_info_line(
CMD,
"target",
"memory.read_while_running32", 0);
2363 riscv_print_info_line(
CMD,
"target",
"memory.write_while_running32", 0);
2364 riscv_print_info_line(
CMD,
"target",
"memory.read_while_running64", 0);
2365 riscv_print_info_line(
CMD,
"target",
"memory.write_while_running64", 0);
2366 riscv_print_info_line(
CMD,
"target",
"memory.read_while_running128", 0);
2367 riscv_print_info_line(
CMD,
"target",
"memory.write_while_running128", 0);
2383 LOG_ERROR(
"Timed out after %ds waiting for authbusy to go low (dminfo=0x%x). "
2384 "Increase the timeout with riscv set_command_timeout_sec.",
2397 LOG_ERROR(
"Spec 0.11 only has a two authdata registers.");
2413 LOG_ERROR(
"Spec 0.11 only has a two authdata registers.");
2444 generic_info->print_info = &riscv011_print_info;
2449 if (!generic_info->version_specific)
2453 generic_info->xlen = 32;
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 uint64_t buf_get_u64(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 64-bit word.
static void buf_set_u64(uint8_t *_buffer, unsigned int first, unsigned int num, uint64_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
#define CMD
Use this macro to access the command being handled, rather than accessing the variable directly.
uint64_t buffer
Pointer to data buffer to send over SPI.
uint32_t size
Size of dw_spi_transaction::buffer.
uint32_t address
Starting address. Sector aligned.
#define DCSR_CAUSE_DEBUGINT
enum esirisc_reg_num number
static uint64_t set_field(uint64_t reg, uint64_t mask, uint64_t val)
static uint32_t get_field32(uint64_t reg, uint64_t mask)
static uint64_t get_field(uint64_t reg, uint64_t mask)
static struct device_config config
void jtag_add_runtest(unsigned int num_cycles, enum tap_state state)
Goes to TAP_IDLE (if we're not already there), cycle precisely num_cycles in the TAP_IDLE state,...
int jtag_execute_queue(void)
For software FIFO implementations, the queued commands can be executed during this call or earlier.
void jtag_add_dr_scan(struct jtag_tap *active, int in_num_fields, const struct scan_field *in_fields, enum tap_state state)
Generate a DR SCAN using the fields passed to the function.
void jtag_add_ir_scan(struct jtag_tap *active, struct scan_field *in_fields, enum tap_state state)
Generate an IR SCAN with a list of scan fields with one entry for each enabled TAP.
The JTAG interface can be implemented with a software or hardware fifo.
void log_printf_lf(enum log_levels level, const char *file, unsigned int line, const char *function, const char *format,...)
#define LOG_USER(expr ...)
#define ERROR_NOT_IMPLEMENTED
#define LOG_WARNING(expr ...)
#define LOG_TARGET_ERROR(target, fmt_str,...)
#define LOG_ERROR(expr ...)
#define LOG_LEVEL_IS(FOO)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
static uint32_t sb(unsigned int src, unsigned int base, int16_t offset) __attribute__((unused))
static uint32_t sd(unsigned int src, unsigned int base, int16_t offset) __attribute__((unused))
static uint32_t csrw(unsigned int source, unsigned int csr) __attribute__((unused))
static uint32_t ld(unsigned int rd, unsigned int base, int16_t offset) __attribute__((unused))
static uint32_t fence_i(void) __attribute__((unused))
static uint32_t fsw(unsigned int src, unsigned int base, int16_t offset) __attribute__((unused))
static uint32_t lw(unsigned int rd, unsigned int base, int16_t offset) __attribute__((unused))
static uint32_t lh(unsigned int rd, unsigned int base, int16_t offset) __attribute__((unused))
static uint32_t csrr(unsigned int rd, unsigned int csr) __attribute__((unused))
static uint32_t csrsi(unsigned int csr, uint8_t imm) __attribute__((unused))
static uint32_t flw(unsigned int dest, unsigned int base, int16_t offset) __attribute__((unused))
static uint32_t fsd(unsigned int src, unsigned int base, int16_t offset) __attribute__((unused))
static uint32_t srli(unsigned int dest, unsigned int src, uint8_t shamt) __attribute__((unused))
static uint32_t jal(unsigned int rd, int32_t imm) __attribute__((unused))
static uint32_t xori(unsigned int dest, unsigned int src, int16_t imm) __attribute__((unused))
static uint32_t sh(unsigned int src, unsigned int base, int16_t offset) __attribute__((unused))
static uint32_t addi(unsigned int dest, unsigned int src, int16_t imm) __attribute__((unused))
static uint32_t sw(unsigned int src, unsigned int base, int16_t offset) __attribute__((unused))
static uint32_t lb(unsigned int rd, unsigned int base, int16_t offset) __attribute__((unused))
static uint32_t fld(unsigned int dest, unsigned int base, int16_t offset) __attribute__((unused))
uint8_t bits[QN908X_FLASH_MAX_BLOCKS *QN908X_FLASH_PAGES_PER_BLOCK/8]
static void scans_add_write32(scans_t *scans, uint16_t address, uint32_t data, bool set_interrupt)
Add a 32-bit dbus write to the scans structure.
static riscv_error_t handle_halt_routine(struct target *target)
static void scans_add_write_load(scans_t *scans, uint16_t address, unsigned int reg, slot_t slot, bool set_interrupt)
Add a 32-bit dbus write for an instruction that loads from the indicated slot.
int riscv011_get_register(struct target *target, riscv_reg_t *value, enum gdb_regno regid)
struct target_type riscv011_target
static uint64_t reg_cache_get(struct target *target, unsigned int number)
static int maybe_read_tselect(struct target *target)
static int riscv011_poll(struct target *target)
static int access_memory(struct target *target, const struct riscv_mem_access_args args)
static int register_write(struct target *target, unsigned int number, uint64_t value)
static unsigned int slot_offset(const struct target *target, slot_t slot)
static int wait_for_authbusy(struct target *target)
static void scans_add_write_store(scans_t *scans, uint16_t address, unsigned int reg, slot_t slot, bool set_interrupt)
Add a 32-bit dbus write for an instruction that stores to the indicated slot.
static int strict_step(struct target *target, bool announce)
static uint64_t scans_get_u64(scans_t *scans, unsigned int index, unsigned int first, unsigned int num)
static int read_remote_csr(struct target *target, uint64_t *value, uint32_t csr)
#define DMCONTROL_INTERRUPT
static void dump_field(const struct scan_field *field)
static void increase_dbus_busy_delay(struct target *target)
static uint32_t load_slot(const struct target *target, unsigned int dest, slot_t slot)
static void scans_dump(scans_t *scans)
#define DMCONTROL_HALTNOT
static int dram_check32(struct target *target, unsigned int index, uint32_t expected)
static uint32_t cache_get32(struct target *target, unsigned int address)
static dbus_status_t dbus_scan(struct target *target, uint16_t *address_in, uint64_t *data_in, dbus_op_t op, uint16_t address_out, uint64_t data_out)
static void cache_set(struct target *target, slot_t slot, uint64_t data)
static uint32_t load(const struct target *target, unsigned int rd, unsigned int base, int16_t offset)
static uint32_t scans_get_u32(scans_t *scans, unsigned int index, unsigned int first, unsigned int num)
static uint64_t dbus_read(struct target *target, uint16_t address)
#define DTMCONTROL_DBUS_RESET
static void cache_clean(struct target *target)
static uint16_t dram_address(unsigned int index)
#define DBUS_ADDRESS_START
static int examine(struct target *target)
static int maybe_write_tselect(struct target *target)
static int deassert_reset(struct target *target)
static int register_read(struct target *target, riscv_reg_t *value, int regnum)
static void scans_add_read(scans_t *scans, slot_t slot, bool set_interrupt)
Add one or more scans to read the indicated slot.
static uint32_t store_slot(const struct target *target, unsigned int src, slot_t slot)
static int full_step(struct target *target, bool announce)
#define DTMCONTROL_ADDRBITS
static int assert_reset(struct target *target)
static int read_bits(struct target *target, bits_t *result)
Read the haltnot and interrupt bits.
static void cache_invalidate(struct target *target)
#define DTMCONTROL_VERSION
static int poll_target(struct target *target, bool announce)
static scans_t * scans_new(struct target *target, unsigned int scan_count)
static int write_memory(struct target *target, const struct riscv_mem_access_args args)
static void cache_set_load(struct target *target, unsigned int index, unsigned int reg, slot_t slot)
static int cache_write(struct target *target, unsigned int address, bool run)
static int init_target(struct command_context *cmd_ctx, struct target *target)
static int arch_state(struct target *target)
static riscv011_info_t * get_info(const struct target *target)
static uint32_t dram_read32(struct target *target, unsigned int index)
int riscv011_set_register(struct target *target, enum gdb_regno regid, riscv_reg_t value)
static int setup_write_memory(struct target *target, uint32_t size)
static int write_gpr(struct target *target, unsigned int gpr, uint64_t value)
static int cache_check(struct target *target)
static COMMAND_HELPER(riscv011_print_info, struct target *target)
static uint64_t cache_get(struct target *target, slot_t slot)
static void scans_add_read32(scans_t *scans, uint16_t address, bool set_interrupt)
Add a 32-bit dbus read.
static int update_mstatus_actual(struct target *target)
static int riscv011_authdata_read(struct target *target, uint32_t *value, unsigned int index)
#define CACHE_NO_READ
Write cache to the target, and optionally run the program.
static uint64_t set_ebreakx_fields(uint64_t dcsr, const struct target *target)
static int write_remote_csr(struct target *target, uint32_t csr, uint64_t value)
static int halt(struct target *target)
static void add_dbus_scan(const struct target *target, struct scan_field *field, uint8_t *out_value, uint8_t *in_value, dbus_op_t op, uint16_t address, uint64_t data)
static int wait_for_debugint_clear(struct target *target, bool ignore_first)
static int step(struct target *target, bool current, target_addr_t address, bool handle_breakpoints)
static int read_memory(struct target *target, const struct riscv_mem_access_args args)
static void dbus_write(struct target *target, uint16_t address, uint64_t value)
static bool riscv011_get_impebreak(const struct target *target)
static void dram_write32(struct target *target, unsigned int index, uint32_t value, bool set_interrupt)
static void cache_set32(struct target *target, unsigned int index, uint32_t data)
static void reg_cache_set(struct target *target, unsigned int number, uint64_t value)
static void dump_debug_ram(struct target *target)
static void scans_add_write_jump(scans_t *scans, uint16_t address, bool set_interrupt)
Add a 32-bit dbus write for an instruction that jumps to the beginning of debug RAM.
static uint32_t idcode_scan(struct target *target)
static void cache_set_jump(struct target *target, unsigned int index)
static int riscv011_resume(struct target *target, bool current, target_addr_t address, bool handle_breakpoints, bool debug_execution)
static void increase_interrupt_high_delay(struct target *target)
static int wait_for_state(struct target *target, enum target_state state)
static void deinit_target(struct target *target)
static void cache_set_store(struct target *target, unsigned int index, unsigned int reg, slot_t slot)
static int execute_resume(struct target *target, bool step)
static int scans_execute(scans_t *scans)
static int handle_halt(struct target *target, bool announce)
Since almost everything can be accomplish by scanning the dbus register, all functions here assume db...
static unsigned int riscv011_get_progbufsize(const struct target *target)
#define DMINFO_AUTHENTICATED
static void scans_reset(scans_t *scans)
#define DMINFO_SERIALCOUNT
static void dram_write_jump(struct target *target, unsigned int index, bool set_interrupt)
static scans_t * scans_delete(scans_t *scans)
static int riscv011_authdata_write(struct target *target, uint32_t value, unsigned int index)
static uint32_t store(const struct target *target, unsigned int src, unsigned int base, int16_t offset)
int riscv011_reg_init_all(struct target *target)
This file describes additional register cache interface available to the RISC-V Debug Specification v...
struct scan_field select_idcode
unsigned int riscv_xlen(const struct target *target)
struct scan_field select_dbus
int dtmcs_scan(struct jtag_tap *tap, uint32_t out, uint32_t *in_ptr)
int riscv_add_watchpoint(struct target *target, struct watchpoint *watchpoint)
int riscv_remove_watchpoint(struct target *target, struct watchpoint *watchpoint)
int riscv_get_command_timeout_sec(void)
int riscv_enumerate_triggers(struct target *target)
Count triggers, and initialize trigger_count for each hart.
static bool riscv_mem_access_is_valid(const struct riscv_mem_access_args args)
static struct riscv_info * riscv_info(const struct target *target) __attribute__((unused))
enum semihosting_result riscv_semihosting(struct target *target, int *retval)
Check for and process a semihosting request using the ARM protocol).
static bool riscv_mem_access_is_write(const struct riscv_mem_access_args args)
static bool riscv_mem_access_is_read(const struct riscv_mem_access_args args)
static struct riscv_private_config * riscv_private_config(const struct target *target)
void riscv_reg_cache_invalidate_all(struct target *target)
Invalidate all registers - forget their cached register values.
const char * riscv_reg_gdb_regno_name(const struct target *target, enum gdb_regno regno)
This file describes the register cache interface available to the RISC-V target.
int riscv_reg_flush_all(struct target *target)
Write all dirty registers to the target.
unsigned int dbus_busy_delay
unsigned int interrupt_high_delay
unsigned int dtmcontrol_idle
struct command_context * cmd_ctx
const uint8_t * write_buffer
This structure defines a single scan field in the scan.
uint8_t * in_value
A pointer to a 32-bit memory location for data scanned out.
const uint8_t * out_value
A pointer to value to be scanned into the device.
unsigned int num_bits
The number of bits this field specifies.
struct scan_field * field
const struct target * target
This holds methods shared between all instances of a given target type.
const char * name
Name of this type of target.
enum target_debug_reason debug_reason
struct reg_cache * reg_cache
struct watchpoint * watchpoints
int target_call_event_callbacks(struct target *target, enum target_event event)
static bool target_was_examined(const struct target *target)
static void target_set_examined(struct target *target)
Sets the examined flag for the given target.
#define ARRAY_SIZE(x)
Compute the number of elements of a variable length array.
static struct ublast_lowlevel_priv info