GetTargetVoltage: Print info about voltage only when info is relevant.

This commit is contained in:
Uwe Bonnes 2020-04-20 18:00:31 +02:00
parent ef816e3183
commit da45281696
6 changed files with 10 additions and 7 deletions

View File

@ -171,7 +171,8 @@ static bool cmd_jtag_scan(target *t, int argc, char **argv)
(void)t;
uint8_t irlens[argc];
gdb_outf("Target voltage: %s\n", platform_target_voltage());
if (platform_target_voltage())
gdb_outf("Target voltage: %s\n", platform_target_voltage());
if (argc > 1) {
/* Accept a list of IR lengths on command line */
@ -216,7 +217,8 @@ bool cmd_swdp_scan(target *t, int argc, char **argv)
(void)t;
(void)argc;
(void)argv;
gdb_outf("Target voltage: %s\n", platform_target_voltage());
if (platform_target_voltage())
gdb_outf("Target voltage: %s\n", platform_target_voltage());
if(connect_assert_srst)
platform_srst_set_val(true); /* will be deasserted after attach */

View File

@ -100,7 +100,7 @@ bool platform_srst_get_val(void) { return false; }
const char *platform_target_voltage(void)
{
return "ABSENT!";
return NULL;
}
void platform_request_boot(void)

View File

@ -85,7 +85,7 @@ bool platform_srst_get_val(void) { return false; }
const char *platform_target_voltage(void)
{
return "ABSENT!";
return NULL;
}
void platform_request_boot(void)

View File

@ -115,7 +115,7 @@ void platform_delay(uint32_t ms)
const char *platform_target_voltage(void)
{
return "not supported";
return NULL;
}
char *serialno_read(char *s)

View File

@ -272,7 +272,8 @@ int cl_execute(BMP_CL_OPTIONS_t *opt)
platform_srst_set_val(opt->opt_connect_under_reset);
if (opt->opt_mode == BMP_MODE_TEST)
printf("Running in Test Mode\n");
printf("Target voltage: %s Volt\n", platform_target_voltage());
if (platform_target_voltage())
printf("Target voltage: %s Volt\n", platform_target_voltage());
if (opt->opt_usejtag) {
num_targets = platform_jtag_scan(NULL);
} else {

View File

@ -177,7 +177,7 @@ const char *platform_target_voltage(void)
ret[2] = '0' + val_in_100mV % 10;
return ret;
}
return "ABSENT!";
return NULL;
}
void set_idle_state(int state)