#include <unistd.h>
-static const char *armv7a_state_strings[] =
-{
- "ARM", "Thumb", "Jazelle", "ThumbEE"
-};
-
static void armv7a_show_fault_registers(struct target *target)
{
uint32_t dfsr, ifsr, dfar, ifar;
};
struct armv7a_common *armv7a = target_to_armv7a(target);
- struct armv4_5_common_s *armv4_5 = &armv7a->armv4_5_common;
+ struct arm *armv4_5 = &armv7a->armv4_5_common;
if (armv7a->common_magic != ARMV7_COMMON_MAGIC)
{
LOG_USER("target halted in %s state due to %s, current mode: %s\n"
"cpsr: 0x%8.8" PRIx32 " pc: 0x%8.8" PRIx32 "\n"
"MMU: %s, D-Cache: %s, I-Cache: %s",
- armv7a_state_strings[armv7a->core_state],
+ armv4_5_state_strings[armv4_5->core_state],
Jim_Nvp_value2name_simple(nvp_target_debug_reason,
target->debug_reason)->name,
arm_mode_name(armv4_5->core_mode),
- buf_get_u32(armv4_5->core_cache
- ->reg_list[ARMV4_5_CPSR].value, 0, 32),
+ buf_get_u32(armv4_5->cpsr->value, 0, 32),
buf_get_u32(armv4_5->core_cache->reg_list[15].value, 0, 32),
state[armv7a->armv4_5_mmu.mmu_enabled],
state[armv7a->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled],
return dap_info_command(CMD_CTX, swjdp, apsel);
}
-int armv7a_register_commands(struct command_context *cmd_ctx)
-{
- struct command *arm_adi_v5_dap_cmd;
-
- arm_adi_v5_dap_cmd = register_command(cmd_ctx, NULL, "dap",
- NULL, COMMAND_ANY,
- "cortex dap specific commands");
-
- register_command(cmd_ctx, arm_adi_v5_dap_cmd, "info",
- handle_dap_info_command, COMMAND_EXEC,
- "dap info for ap [num], "
- "default currently selected AP");
- register_command(cmd_ctx, arm_adi_v5_dap_cmd, "apsel",
- handle_dap_apsel_command, COMMAND_EXEC,
- "select a different AP [num] (default 0)");
- register_command(cmd_ctx, arm_adi_v5_dap_cmd, "apid",
- handle_dap_apid_command, COMMAND_EXEC,
- "return id reg from AP [num], "
- "default currently selected AP");
- register_command(cmd_ctx, arm_adi_v5_dap_cmd, "baseaddr",
- handle_dap_baseaddr_command, COMMAND_EXEC,
- "return debug base address from AP [num], "
- "default currently selected AP");
- register_command(cmd_ctx, arm_adi_v5_dap_cmd, "memaccess",
- handle_dap_memaccess_command, COMMAND_EXEC,
- "set/get number of extra tck for mem-ap memory "
- "bus access [0-255]");
+static const struct command_registration armv7a_exec_command_handlers[] = {
+ {
+ .name = "info",
+ .handler = &handle_dap_info_command,
+ .mode = COMMAND_EXEC,
+ .help = "dap info for ap [num], "
+ "default currently selected AP",
+ },
+ {
+ .name = "apsel",
+ .handler = &handle_dap_apsel_command,
+ .mode = COMMAND_EXEC,
+ .help = "select a different AP [num] (default 0)",
+ },
+ {
+ .name = "apid",
+ .handler = &handle_dap_apid_command,
+ .mode = COMMAND_EXEC,
+ .help = "return id reg from AP [num], "
+ "default currently selected AP",
+ },
+ {
+ .name = "baseaddr",
+ .handler = &handle_dap_baseaddr_command,
+ .mode = COMMAND_EXEC,
+ .help = "return debug base address from AP [num], "
+ "default currently selected AP",
+ },
+ {
+ .name = "memaccess",
+ .handler = &handle_dap_memaccess_command,
+ .mode = COMMAND_EXEC,
+ .help = "set/get number of extra tck for mem-ap memory "
+ "bus access [0-255]",
+ },
+ COMMAND_REGISTRATION_DONE
+};
+const struct command_registration armv7a_command_handlers[] = {
+ {
+ .name = "dap",
+ .mode = COMMAND_ANY,
+ .help = "Cortex DAP command group",
+ .chain = armv7a_exec_command_handlers,
+ },
+ COMMAND_REGISTRATION_DONE
+};
- return ERROR_OK;
-}