hosted: Allow to disable high level commands for BMP.

Useful for tracking low level problems on native with hosted.
This commit is contained in:
Uwe Bonnes 2020-08-06 12:20:27 +02:00 committed by UweBonnes
parent 014abf6cc9
commit 4d18496a6f
3 changed files with 12 additions and 2 deletions

View File

@ -263,9 +263,10 @@ static int find_debuggers( BMP_CL_OPTIONS_t *cl_opts,bmp_info_t *info)
return (found_debuggers == 1) ? 0 : -1;
}
static BMP_CL_OPTIONS_t cl_opts;
void platform_init(int argc, char **argv)
{
BMP_CL_OPTIONS_t cl_opts = {0};
cl_opts.opt_idstring = "Blackmagic PC-Hosted";
cl_init(&cl_opts, argc, argv);
atexit(exit_function);
@ -426,6 +427,10 @@ void platform_adiv5_dp_defaults(ADIv5_DP_t *dp)
{
switch (info.bmp_type) {
case BMP_TYPE_BMP:
if (cl_opts.opt_no_hl) {
DEBUG_WARN("Not using HL commands\n");
return;
}
return remote_adiv5_dp_defaults(dp);
case BMP_TYPE_STLINKV2:
return stlink_adiv5_dp_defaults(dp);

View File

@ -143,6 +143,7 @@ static void cl_help(char **argv, BMP_CL_OPTIONS_t *opt)
DEBUG_WARN("\t-r\t\t: Read flash and write to binary file\n");
DEBUG_WARN("\t-p\t\t: Supplies power to the target (where applicable)\n");
DEBUG_WARN("\t-R\t\t: Reset device\n");
DEBUG_WARN("\t-H\t\t: Do not use high level commands (BMP-Remote)\n");
DEBUG_WARN("Flash operation modifiers options:\n");
DEBUG_WARN("\tDefault action with given file is to write to flash\n");
DEBUG_WARN("\t-a <addr>\t: Start flash operation at flash address <addr>\n"
@ -157,7 +158,7 @@ void cl_init(BMP_CL_OPTIONS_t *opt, int argc, char **argv)
int c;
opt->opt_target_dev = 1;
opt->opt_flash_size = 16 * 1024 *1024;
while((c = getopt(argc, argv, "eEhv:d:s:I:c:CnltVta:S:jpP:rR")) != -1) {
while((c = getopt(argc, argv, "eEhHv:d:s:I:c:CnltVta:S:jpP:rR")) != -1) {
switch(c) {
case 'c':
if (optarg)
@ -166,6 +167,9 @@ void cl_init(BMP_CL_OPTIONS_t *opt, int argc, char **argv)
case 'h':
cl_help(argv, opt);
break;
case 'H':
opt->opt_no_hl = true;
break;
case 'v':
if (optarg)
cl_debuglevel = strtol(optarg, NULL, 0) & (BMP_DEBUG_MAX - 1);

View File

@ -43,6 +43,7 @@ typedef struct BMP_CL_OPTIONS_s {
bool opt_list_only;
bool opt_connect_under_reset;
bool external_resistor_swd;
bool opt_no_hl;
char *opt_flash_file;
char *opt_device;
char *opt_serial;