hosted: Really handle setting tpwr on remote on the command line #817
Expect the command to fail, due to old firmware or remote not implementing the power switch.
This commit is contained in:
parent
c49c895f39
commit
09c000eca8
|
@ -73,7 +73,7 @@ bool remote_target_get_power(void)
|
||||||
return (construct[1] == '1');
|
return (construct[1] == '1');
|
||||||
}
|
}
|
||||||
|
|
||||||
void remote_target_set_power(bool power)
|
bool remote_target_set_power(bool power)
|
||||||
{
|
{
|
||||||
uint8_t construct[REMOTE_MAX_MSG_SIZE];
|
uint8_t construct[REMOTE_MAX_MSG_SIZE];
|
||||||
int s;
|
int s;
|
||||||
|
@ -87,8 +87,9 @@ void remote_target_set_power(bool power)
|
||||||
if ((!s) || (construct[0] == REMOTE_RESP_ERR)) {
|
if ((!s) || (construct[0] == REMOTE_RESP_ERR)) {
|
||||||
DEBUG_WARN("platform_target_set_power failed, error %s\n",
|
DEBUG_WARN("platform_target_set_power failed, error %s\n",
|
||||||
s ? (char *)&(construct[1]) : "unknown");
|
s ? (char *)&(construct[1]) : "unknown");
|
||||||
exit(-1);
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void remote_srst_set_val(bool assert)
|
void remote_srst_set_val(bool assert)
|
||||||
|
|
|
@ -34,7 +34,7 @@ int remote_swdptap_init(swd_proc_t *swd_proc);
|
||||||
int remote_jtagtap_init(jtag_proc_t *jtag_proc);
|
int remote_jtagtap_init(jtag_proc_t *jtag_proc);
|
||||||
bool remote_target_get_power(void);
|
bool remote_target_get_power(void);
|
||||||
const char *remote_target_voltage(void);
|
const char *remote_target_voltage(void);
|
||||||
void remote_target_set_power(bool power);
|
bool remote_target_set_power(bool power);
|
||||||
void remote_srst_set_val(bool assert);
|
void remote_srst_set_val(bool assert);
|
||||||
bool remote_srst_get_val(void);
|
bool remote_srst_get_val(void);
|
||||||
void remote_max_frequency_set(uint32_t freq);
|
void remote_max_frequency_set(uint32_t freq);
|
||||||
|
|
|
@ -377,6 +377,20 @@ uint32_t platform_max_frequency_get(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void platform_target_set_power(bool power)
|
||||||
|
{
|
||||||
|
switch (info.bmp_type) {
|
||||||
|
case BMP_TYPE_BMP:
|
||||||
|
if (remote_target_set_power(power))
|
||||||
|
DEBUG_INFO("Powering up device!\n");
|
||||||
|
else
|
||||||
|
DEBUG_WARN("Powering up device unimplemented or failed\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void platform_buffer_flush(void)
|
void platform_buffer_flush(void)
|
||||||
{
|
{
|
||||||
switch (info.bmp_type) {
|
switch (info.bmp_type) {
|
||||||
|
|
|
@ -313,13 +313,10 @@ int cl_execute(BMP_CL_OPTIONS_t *opt)
|
||||||
{
|
{
|
||||||
int res = -1;
|
int res = -1;
|
||||||
int num_targets;
|
int num_targets;
|
||||||
#if defined(PLATFORM_HAS_POWER_SWITCH)
|
|
||||||
if (opt->opt_tpwr) {
|
if (opt->opt_tpwr) {
|
||||||
DEBUG_INFO("Powering up device");
|
|
||||||
platform_target_set_power(true);
|
platform_target_set_power(true);
|
||||||
platform_delay(500);
|
platform_delay(500);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (opt->opt_connect_under_reset)
|
if (opt->opt_connect_under_reset)
|
||||||
DEBUG_INFO("Connecting under reset\n");
|
DEBUG_INFO("Connecting under reset\n");
|
||||||
connect_assert_srst = opt->opt_connect_under_reset;
|
connect_assert_srst = opt->opt_connect_under_reset;
|
||||||
|
|
Loading…
Reference in New Issue