arm_adi_v5: add option 'root' to 'dap info' command

On ADIv6 the system root ROM table is found by reading the DAP DP
registers BASEPTR0 and BASEPTR1.

Add option 'root' to the commands 'dap info' to let it retrieve
the system root ROM table's AP from DAP DP, then use such AP for
following dump.

Change-Id: I1789457a005faa3870c5d14f763378d2f6a5f095
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6462
Tested-by: jenkins
This commit is contained in:
Antonio Borneo
2021-08-09 15:31:10 +02:00
parent 3f4bc6ce7f
commit 8c1d518232
4 changed files with 66 additions and 8 deletions

View File

@@ -471,6 +471,18 @@ COMMAND_HANDLER(handle_dap_info_command)
apsel = dap->apsel;
break;
case 1:
if (!strcmp(CMD_ARGV[0], "root")) {
if (!is_adiv6(dap)) {
command_print(CMD, "Option \"root\" not allowed with ADIv5 DAP");
return ERROR_COMMAND_ARGUMENT_INVALID;
}
int retval = adiv6_dap_read_baseptr(CMD, dap, &apsel);
if (retval != ERROR_OK) {
command_print(CMD, "Failed reading DAP baseptr");
return retval;
}
break;
}
COMMAND_PARSE_NUMBER(u64, CMD_ARGV[0], apsel);
if (!is_ap_num_valid(dap, apsel))
return ERROR_COMMAND_SYNTAX_ERROR;
@@ -515,9 +527,9 @@ static const struct command_registration dap_subcommand_handlers[] = {
.name = "info",
.handler = handle_dap_info_command,
.mode = COMMAND_EXEC,
.help = "display ROM table for MEM-AP of current target "
"(default currently selected AP)",
.usage = "[ap_num]",
.help = "display ROM table for specified MEM-AP (default MEM-AP of current target) "
"or the ADIv6 root ROM table of current target's DAP",
.usage = "[ap_num | 'root']",
},
COMMAND_REGISTRATION_DONE
};