diff --git a/src/platforms/pc/cl_utils.c b/src/platforms/pc/cl_utils.c index e869f61..1a88b8d 100644 --- a/src/platforms/pc/cl_utils.c +++ b/src/platforms/pc/cl_utils.c @@ -118,7 +118,8 @@ static void cl_help(char **argv, BMP_CL_OPTIONS_t *opt) printf("\t-s \"string\"\t: Use dongle with (partial) " "serial number \"string\"\n"); printf("\t-c \"string\"\t: Use ftdi dongle with type \"string\"\n"); - printf("\t-n\t\t: Exit immediate if no device found\n"); + printf("\t-C\t\t: Connect under reset\n"); + printf("\t-n\t\t: Exit immediate if no device found\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-E\t\t: Erase flash until flash end or for given size\n"); @@ -143,7 +144,7 @@ void cl_init(BMP_CL_OPTIONS_t *opt, int argc, char **argv) opt->opt_target_dev = 1; opt->opt_flash_start = 0x08000000; 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) { case 'c': if (optarg) @@ -159,6 +160,9 @@ void cl_init(BMP_CL_OPTIONS_t *opt, int argc, char **argv) case 'j': opt->opt_usejtag = true; break; + case 'C': + opt->opt_connect_under_reset = true; + break; case 'n': opt->opt_no_wait = true; break; @@ -235,6 +239,9 @@ int cl_execute(BMP_CL_OPTIONS_t *opt) platform_delay(500); } #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) printf("Running in Test Mode\n"); if (opt->opt_usejtag) { diff --git a/src/platforms/pc/cl_utils.h b/src/platforms/pc/cl_utils.h index 644d39c..850112b 100644 --- a/src/platforms/pc/cl_utils.h +++ b/src/platforms/pc/cl_utils.h @@ -39,6 +39,7 @@ typedef struct BMP_CL_OPTIONS_s { bool opt_usejtag; bool opt_no_wait; bool opt_tpwr; + bool opt_connect_under_reset; char *opt_flash_file; char *opt_serial; char *opt_cable;