70 else if (strcmp(
CMD_ARGV[0],
"cpu") == 0)
75 LOG_DEBUG(
"memory access channel is changed to %s",
107 "local memory. Set memory mode to MEMORY",
114 if (strcmp(
CMD_ARGV[0],
"auto") == 0) {
116 }
else if (strcmp(
CMD_ARGV[0],
"mem") == 0) {
118 }
else if (strcmp(
CMD_ARGV[0],
"ilm") == 0) {
124 }
else if (strcmp(
CMD_ARGV[0],
"dlm") == 0) {
160 if (strcmp(
CMD_ARGV[0],
"invalidate") == 0) {
239 if (strcmp(
CMD_ARGV[0],
"invalidate") == 0) {
240 if (icache->
enable ==
true) {
255 }
else if (strcmp(
CMD_ARGV[0],
"enable") == 0) {
259 }
else if (strcmp(
CMD_ARGV[0],
"disable") == 0) {
263 }
else if (strcmp(
CMD_ARGV[0],
"dump") == 0) {
293 if (strcmp(
CMD_ARGV[0],
"invalidate") == 0) {
294 if (dcache->
enable ==
true) {
320 }
else if (strcmp(
CMD_ARGV[0],
"enable") == 0) {
324 }
else if (strcmp(
CMD_ARGV[0],
"disable") == 0) {
328 }
else if (strcmp(
CMD_ARGV[0],
"dump") == 0) {
351 if (strcmp(
CMD_ARGV[0],
"off") == 0)
378 if (strcmp(
CMD_ARGV[0],
"off") == 0)
403 if (strcmp(
CMD_ARGV[0],
"off") == 0)
428 if (strcmp(
CMD_ARGV[0],
"off") == 0)
483 uint32_t misc_reg_no;
515 if (strcmp(
CMD_ARGV[0],
"off") == 0)
535 if (strcmp(
CMD_ARGV[0],
"off") == 0)
566 while (i < insn_count) {
610 if (strcmp(
CMD_ARGV[0],
"off") == 0)
645 if (value_psw & 0x20)
670 const char *cmd_name = Jim_GetString(argv[0],
NULL);
676 Jim_SetResultFormatted(goi.
interp,
677 "usage: %s <address> <count> <data>", cmd_name);
692 uint32_t *data = malloc(
count *
sizeof(uint32_t));
697 for (i = 0; i <
count; i++) {
704 data[i] = (uint32_t)tmp;
733 Jim_SetResultFormatted(goi.
interp,
734 "usage: %s # of pairs [<address> <data>]+", cmd_name);
739 jim_wide num_of_pairs;
754 for (i = 0; i < num_of_pairs; i++) {
759 address = (uint32_t)tmp;
764 data = (uint32_t)tmp;
781 const char *cmd_name = Jim_GetString(argv[0],
NULL);
787 Jim_SetResultFormatted(goi.
interp,
788 "usage: %s <address> <count>", cmd_name);
810 uint32_t *data = malloc(
count *
sizeof(uint32_t));
816 Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
817 for (i = 0; i <
count; i++) {
818 sprintf(data_str,
"0x%08" PRIx32
" ", data[i]);
819 Jim_AppendStrings(interp, Jim_GetResult(interp), data_str,
NULL);
835 Jim_SetResultFormatted(goi.
interp,
836 "usage: %s <edm_sr_name>", cmd_name);
841 const char *edm_sr_name;
851 uint32_t edm_sr_number;
852 uint32_t edm_sr_value;
853 if (strncmp(edm_sr_name,
"edm_dtr", edm_sr_name_len) == 0)
855 else if (strncmp(edm_sr_name,
"edmsw", edm_sr_name_len) == 0)
868 sprintf(data_str,
"0x%08" PRIx32, edm_sr_value);
869 Jim_SetResult(interp, Jim_NewEmptyStringObj(interp));
870 Jim_AppendStrings(interp, Jim_GetResult(interp), data_str,
NULL);
877 const char *cmd_name = Jim_GetString(argv[0],
NULL);
883 Jim_SetResultFormatted(goi.
interp,
884 "usage: %s <edm_sr_name> <value>", cmd_name);
889 const char *edm_sr_name;
904 uint32_t edm_sr_number;
905 if (strncmp(edm_sr_name,
"edm_dtr", edm_sr_name_len) == 0)
923 .handler = handle_nds32_query_target_command,
926 .help =
"reply 'OCD' for gdb to identify server-side is OpenOCD",
930 .handler = handle_nds32_query_endian_command,
933 .help =
"query target endian",
937 .handler = handle_nds32_query_cpuid_command,
940 .help =
"query CPU ID",
949 .handler = handle_nds32_dssim_command,
951 .usage =
"['on'|'off']",
952 .help =
"display/change $INT_MASK.DSSIM status",
955 .name =
"mem_access",
956 .handler = handle_nds32_memory_access_command,
958 .usage =
"['bus'|'cpu']",
959 .help =
"display/change memory access channel",
963 .handler = handle_nds32_memory_mode_command,
965 .usage =
"['auto'|'mem'|'ilm'|'dlm']",
966 .help =
"display/change memory mode",
970 .handler = handle_nds32_cache_command,
972 .usage =
"['invalidate']",
973 .help =
"cache control",
977 .handler = handle_nds32_icache_command,
979 .usage =
"['invalidate'|'enable'|'disable'|'dump']",
980 .help =
"icache control",
984 .handler = handle_nds32_dcache_command,
986 .usage =
"['invalidate'|'enable'|'disable'|'dump']",
987 .help =
"dcache control",
990 .name =
"auto_break",
991 .handler = handle_nds32_auto_break_command,
993 .usage =
"['on'|'off']",
994 .help =
"convert software breakpoints to hardware breakpoints if needed",
997 .name =
"virtual_hosting",
998 .handler = handle_nds32_virtual_hosting_command,
1000 .usage =
"['on'|'off']",
1001 .help =
"turn on/off virtual hosting",
1004 .name =
"global_stop",
1005 .handler = handle_nds32_global_stop_command,
1007 .usage =
"['on'|'off']",
1008 .help =
"turn on/off global stop. After turning on, every load/store "
1009 "instructions will be stopped to check memory access.",
1012 .name =
"soft_reset_halt",
1013 .handler = handle_nds32_soft_reset_halt_command,
1015 .usage =
"['on'|'off']",
1016 .help =
"as issuing rest-halt, to use soft-reset-halt or not."
1017 "the feature is for backward-compatible.",
1020 .name =
"boot_time",
1021 .handler = handle_nds32_boot_time_command,
1023 .usage =
"milliseconds",
1024 .help =
"set the period to wait after srst.",
1027 .name =
"login_edm_passcode",
1028 .handler = handle_nds32_login_edm_passcode_command,
1030 .usage =
"passcode",
1031 .help =
"set EDM passcode for secure MCU debugging.",
1034 .name =
"login_edm_operation",
1035 .handler = handle_nds32_login_edm_operation_command,
1037 .usage =
"misc_reg_no value",
1038 .help =
"add EDM operations for secure MCU debugging.",
1041 .name =
"reset_halt_as_init",
1042 .handler = handle_nds32_reset_halt_as_init_command,
1044 .usage =
"['on'|'off']",
1045 .help =
"reset halt as openocd init.",
1048 .name =
"keep_target_edm_ctl",
1049 .handler = handle_nds32_keep_target_edm_ctl_command,
1051 .usage =
"['on'|'off']",
1052 .help =
"Backup/Restore target EDM_CTL register.",
1056 .handler = handle_nds32_decode_command,
1058 .usage =
"address icount",
1059 .help =
"decode instruction.",
1062 .name =
"word_access_mem",
1063 .handler = handle_nds32_word_access_mem_command,
1065 .usage =
"['on'|'off']",
1066 .help =
"Always use word-aligned address to access memory.",
1069 .name =
"bulk_write",
1072 .help =
"Write multiple 32-bit words to target memory",
1073 .usage =
"address count data",
1076 .name =
"multi_write",
1079 .help =
"Write multiple addresses/words to target memory",
1080 .usage =
"num_of_pairs [address data]+",
1083 .name =
"bulk_read",
1086 .help =
"Read multiple 32-bit words from target memory",
1087 .usage =
"address count",
1090 .name =
"read_edmsr",
1093 .help =
"Read EDM system register",
1094 .usage =
"['edmsw'|'edm_dtr']",
1097 .name =
"write_edmsr",
1100 .help =
"Write EDM system register",
1101 .usage =
"['edm_dtr'] value",
1106 .help =
"Andes query command group",
1118 .help =
"Andes command group",
@ AICE_COMMAND_MODE_NORMAL
@ AICE_CACHE_CTL_L1D_WBALL
@ AICE_CACHE_CTL_L1D_INVALALL
@ AICE_CACHE_CTL_L1I_INVALALL
struct command_context * current_command_context(Jim_Interp *interp)
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 CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
#define COMMAND_PARSE_NUMBER(type, in, out)
parses the string in into out as a type, or prints a command error and passes the error code to the c...
#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.
int jim_getopt_wide(struct jim_getopt_info *goi, jim_wide *puthere)
Remove argv[0] as wide.
int jim_getopt_setup(struct jim_getopt_info *p, Jim_Interp *interp, int argc, Jim_Obj *const *argv)
GetOpt - how to.
int jim_getopt_string(struct jim_getopt_info *goi, const char **puthere, int *len)
Remove argv[0] as string.
#define LOG_INFO(expr ...)
#define LOG_DEBUG(expr ...)
int nds32_get_mapped_reg(struct nds32 *nds32, unsigned regnum, uint32_t *value)
int nds32_set_mapped_reg(struct nds32 *nds32, unsigned regnum, uint32_t value)
set register internally
Holds the interface to Andes cores.
#define NDS32_EDM_OPERATION_MAX_NUM
static struct nds32 * target_to_nds32(struct target *target)
Convert target handle to generic Andes target state handle.
static bool is_nds32(struct nds32 *nds32)
static struct aice_port_s * target_to_aice(struct target *target)
int aice_cache_ctl(struct aice_port_s *aice, uint32_t subtype, uint32_t address)
int aice_set_command_mode(struct aice_port_s *aice, enum aice_command_mode command_mode)
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)
static int aice_memory_access(struct aice_port_s *aice, enum nds_memory_access a_access)
static int aice_memory_mode(struct aice_port_s *aice, enum nds_memory_select mem_select)
uint32_t nds32_edm_ops_num
static const char *const nds_memory_access_name[]
COMMAND_HANDLER(handle_nds32_dssim_command)
const struct command_registration nds32_command_handlers[]
struct nds32_edm_operation nds32_edm_ops[NDS32_EDM_OPERATION_MAX_NUM]
static const struct command_registration nds32_query_command_handlers[]
static int jim_nds32_bulk_read(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int jim_nds32_write_edm_sr(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int jim_nds32_multi_write(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int jim_nds32_bulk_write(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int jim_nds32_read_edm_sr(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static const char *const nds_memory_select_name[]
static const struct command_registration nds32_exec_command_handlers[]
int nds32_evaluate_opcode(struct nds32 *nds32, uint32_t opcode, uint32_t address, struct nds32_instruction *instruction)
int nds32_read_opcode(struct nds32 *nds32, uint32_t address, uint32_t *value)
A TCL -ish GetOpt like code.
int line_size
cache line size
bool enable
enable cache or not
bool direct_access_local_memory
EDM_CFG.DALM, indicate if direct local memory access feature is supported or not.
bool access_control
Support ACC_CTL register.
enum nds_memory_access access_channel
Memory access method.
int dlm_base
On-chip data local memory base.
int ilm_base
On-chip instruction local memory base.
struct nds32_cache dcache
DCache.
struct nds32_cache icache
ICache.
enum nds_memory_select mode
Memory access mode.
Represents a generic Andes core.
bool auto_convert_hw_bp
Flag to indicate if auto convert software breakpoints to hardware breakpoints or not in ROM.
uint32_t boot_time
Period to wait after SRST.
bool reset_halt_as_examine
reset-halt as target examine
bool keep_target_edm_ctl
backup/restore target EDM_CTL value.
bool word_access_mem
always use word-aligned address to access memory
struct nds32_memory memory
Memory information.
bool global_stop
Flag reporting whether global stop is active.
bool soft_reset_halt
Flag reporting whether to use soft-reset-halt or not as issuing reset-halt.
char * edm_passcode
EDM passcode for debugging secure MCU.
struct nds32_edm edm
Handle for the debug module.
bool virtual_hosting
Flag reporting whether virtual hosting is active.
bool step_isr_enable
Flag to indicate HSS steps into ISR or not.
int target_write_buffer(struct target *target, target_addr_t address, uint32_t size, const uint8_t *buffer)
int target_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
struct target * get_current_target(struct command_context *cmd_ctx)
static const char * target_name(struct target *target)
Returns the instance-specific name of the specified target.