86 uint32_t wp_config = 0;
87 bool ld_stop, st_stop;
90 ld_stop = st_stop =
false;
94 if (wp_num < nds32_v3->used_n_wp) {
130 ld_stop = st_stop =
true;
153 bool clean_global_stop =
false;
157 if (wp_num < nds32_v3->used_n_wp) {
162 " mask %08" PRIx32, wp_num,
166 clean_global_stop =
true;
170 if (clean_global_stop) {
173 edm_ctl = edm_ctl & (~0x30);
190 LOG_ERROR(
"<-- TARGET ERROR! Reaching the max interrupt stack level %" PRIu32
". -->",
222 bool switch_to_v3_stack =
false;
223 uint32_t value_edm_ctl;
226 if (((value_edm_ctl >> 6) & 0x1) == 0) {
229 if (((value_edm_ctl >> 6) & 0x1) == 1)
230 switch_to_v3_stack =
true;
232 switch_to_v3_stack =
false;
238 LOG_WARNING(
"%s: ran after reset and before halt ...",
249 uint32_t interrupt_level;
251 if (switch_to_v3_stack ==
true) {
254 interrupt_level = (value >> 1) & 0x3;
257 value |= (interrupt_level << 1);
283 "hardware breakpoints/watchpoints! "
284 "The limit of combined hardware "
285 "breakpoints/watchpoints is %" PRId32
". -->",
287 LOG_WARNING(
"<-- TARGET STATUS: Inserted number of "
288 "hardware breakpoint: %" PRId32
", hardware "
289 "watchpoints: %" PRId32
". -->",
351 "watchpoints exceeds the hardware "
352 "resources. Stop at every load/store "
353 "instruction to check for watchpoint matches. -->");
357 LOG_WARNING(
"<-- TARGET WARNING! Insert too many hardware "
358 "breakpoints/watchpoints! The limit of combined "
359 "hardware breakpoints/watchpoints is %" PRId32
". -->",
361 LOG_WARNING(
"<-- TARGET STATUS: Inserted number of "
362 "hardware breakpoint: %" PRId32
", hardware "
363 "watchpoints: %" PRId32
". -->",
409 nds32_v3 = calloc(1,
sizeof(*nds32_v3));
437 nds32_v3->
n_hbr = (edm_cfg & 0x7) + 1;
#define CHECK_RETVAL(action)
#define LOG_WARNING(expr ...)
#define LOG_ERROR(expr ...)
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
int nds32_poll(struct target *target)
int nds32_mmu(struct target *target, int *enabled)
int nds32_halt(struct target *target)
int nds32_gdb_fileio_end(struct target *target, int retcode, int fileio_errno, bool ctrl_c)
int nds32_get_gdb_reg_list(struct target *target, struct reg **reg_list[], int *reg_list_size, enum target_register_class reg_class)
get all register list
int nds32_arch_state(struct target *target)
int nds32_get_mapped_reg(struct nds32 *nds32, unsigned regnum, uint32_t *value)
int nds32_get_gdb_fileio_info(struct target *target, struct gdb_fileio_info *fileio_info)
int nds32_edm_config(struct nds32 *nds32)
int nds32_step(struct target *target, int current, target_addr_t address, int handle_breakpoints)
int nds32_read_phys_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
int nds32_add_software_breakpoint(struct target *target, struct breakpoint *breakpoint)
int nds32_profiling(struct target *target, uint32_t *samples, uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds)
int nds32_virtual_to_physical(struct target *target, target_addr_t address, target_addr_t *physical)
int nds32_write_phys_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
int nds32_resume(struct target *target, int current, target_addr_t address, int handle_breakpoints, int debug_execution)
int nds32_set_mapped_reg(struct nds32 *nds32, unsigned regnum, uint32_t value)
set register internally
int nds32_assert_reset(struct target *target)
int nds32_remove_software_breakpoint(struct target *target, struct breakpoint *breakpoint)
int nds32_reset_halt(struct nds32 *nds32)
static bool nds32_reach_max_interrupt_level(struct nds32 *nds32)
static struct aice_port_s * target_to_aice(struct target *target)
static int aice_write_debug_reg(struct aice_port_s *aice, uint32_t addr, const uint32_t val)
static int aice_read_debug_reg(struct aice_port_s *aice, uint32_t addr, uint32_t *val)
const struct command_registration nds32_command_handlers[]
static int nds32_v3_deactivate_hardware_watchpoint(struct target *target)
static int nds32_v3_add_breakpoint(struct target *target, struct breakpoint *breakpoint)
static int nds32_v3_activate_hardware_breakpoint(struct target *target)
static int nds32_v3_deactivate_hardware_breakpoint(struct target *target)
static int nds32_v3_remove_breakpoint(struct target *target, struct breakpoint *breakpoint)
static int nds32_v3_target_create(struct target *target, Jim_Interp *interp)
static int nds32_v3_activate_hardware_watchpoint(struct target *target)
static int nds32_v3_add_watchpoint(struct target *target, struct watchpoint *watchpoint)
static int nds32_v3_examine(struct target *target)
static int nds32_v3_restore_interrupt_stack(struct nds32 *nds32)
static int nds32_v3_deassert_reset(struct target *target)
static int nds32_v3_remove_watchpoint(struct target *target, struct watchpoint *watchpoint)
struct target_type nds32_v3_target
Holds methods for Andes1337 targets.
static int nds32_v3_check_interrupt_stack(struct nds32 *nds32)
static struct nds32_v3_common * target_to_nds32_v3(struct target *target)
int nds32_v3_write_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
int nds32_v3_init_target(struct command_context *cmd_ctx, struct target *target)
int nds32_v3_run_algorithm(struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, target_addr_t entry_point, target_addr_t exit_point, int timeout_ms, void *arch_info)
int nds32_v3_target_create_common(struct target *target, struct nds32 *nds32)
int nds32_v3_checksum_memory(struct target *target, target_addr_t address, uint32_t count, uint32_t *checksum)
int nds32_v3_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
int nds32_v3_read_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
int nds32_v3_target_request_data(struct target *target, uint32_t size, uint8_t *buffer)
target_type functions:
int nds32_v3_hit_watchpoint(struct target *target, struct watchpoint **hit_watchpoint)
find out which watchpoint hits get exception address and compare the address to watchpoints
void nds32_v3_common_register_callback(struct nds32_v3_common_callback *callback)
int nds32_v3_write_buffer(struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)
enum breakpoint_type type
bool address_translation
Address translation.
int(* check_interrupt_stack)(struct nds32 *nds32)
int32_t used_n_wp
number of used hardware watchpoints
bool low_interference_profile
low interference profiling
int32_t next_hbr_index
next hardware breakpoint index
int32_t n_hbr
number of hardware breakpoints
Represents a generic Andes core.
struct target * target
Backpointer to the target.
bool auto_convert_hw_bp
Flag to indicate if auto convert software breakpoints to hardware breakpoints or not in ROM.
bool reset_halt_as_examine
reset-halt as target examine
struct nds32_memory memory
Memory information.
bool global_stop
Flag reporting whether global stop is active.
uint32_t max_interrupt_level
maximum interrupt level
uint32_t current_interrupt_level
current interrupt level
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 breakpoint * breakpoints
struct watchpoint * watchpoints
int target_halt(struct target *target)
static const char * target_name(struct target *target)
Returns the instance-specific name of the specified target.
#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)