cl_utils: Allow to connect under reset.

This commit is contained in:
Uwe Bonnes 2020-03-06 22:55:28 +01:00 committed by UweBonnes
parent 919d9320fd
commit e48d9ebc92
2 changed files with 10 additions and 2 deletions

View File

@ -118,6 +118,7 @@ static void cl_help(char **argv, BMP_CL_OPTIONS_t *opt)
printf("\t-s \"string\"\t: Use dongle with (partial) " printf("\t-s \"string\"\t: Use dongle with (partial) "
"serial number \"string\"\n"); "serial number \"string\"\n");
printf("\t-c \"string\"\t: Use ftdi dongle with type \"string\"\n"); printf("\t-c \"string\"\t: Use ftdi dongle with type \"string\"\n");
printf("\t-C\t\t: Connect under reset\n");
printf("\t-n\t\t: Exit immediate if no device found\n"); printf("\t-n\t\t: Exit immediate if no device found\n");
printf("\tRun mode related options:\n"); printf("\tRun mode related options:\n");
printf("\t-t\t\t: Scan SWD, with no target found scan jtag and exit\n"); printf("\t-t\t\t: Scan SWD, with no target found scan jtag and exit\n");
@ -143,7 +144,7 @@ void cl_init(BMP_CL_OPTIONS_t *opt, int argc, char **argv)
opt->opt_target_dev = 1; opt->opt_target_dev = 1;
opt->opt_flash_start = 0x08000000; opt->opt_flash_start = 0x08000000;
opt->opt_flash_size = 16 * 1024 *1024; opt->opt_flash_size = 16 * 1024 *1024;
while((c = getopt(argc, argv, "Ehv::s:c:nN:tVta:S:jprR")) != -1) { while((c = getopt(argc, argv, "Ehv::s:c:CnN:tVta:S:jprR")) != -1) {
switch(c) { switch(c) {
case 'c': case 'c':
if (optarg) if (optarg)
@ -159,6 +160,9 @@ void cl_init(BMP_CL_OPTIONS_t *opt, int argc, char **argv)
case 'j': case 'j':
opt->opt_usejtag = true; opt->opt_usejtag = true;
break; break;
case 'C':
opt->opt_connect_under_reset = true;
break;
case 'n': case 'n':
opt->opt_no_wait = true; opt->opt_no_wait = true;
break; break;
@ -235,6 +239,9 @@ int cl_execute(BMP_CL_OPTIONS_t *opt)
platform_delay(500); platform_delay(500);
} }
#endif #endif
if (opt->opt_connect_under_reset)
printf("Connecting under reset\n");
platform_srst_set_val(opt->opt_connect_under_reset);
if (opt->opt_mode == BMP_MODE_TEST) if (opt->opt_mode == BMP_MODE_TEST)
printf("Running in Test Mode\n"); printf("Running in Test Mode\n");
if (opt->opt_usejtag) { if (opt->opt_usejtag) {

View File

@ -39,6 +39,7 @@ typedef struct BMP_CL_OPTIONS_s {
bool opt_usejtag; bool opt_usejtag;
bool opt_no_wait; bool opt_no_wait;
bool opt_tpwr; bool opt_tpwr;
bool opt_connect_under_reset;
char *opt_flash_file; char *opt_flash_file;
char *opt_serial; char *opt_serial;
char *opt_cable; char *opt_cable;