cl_utils: Clip opt_flash_start only when not set.

This commit is contained in:
Uwe Bonnes 2020-10-18 15:41:40 +02:00 committed by UweBonnes
parent c161521c26
commit f15b1d7763
2 changed files with 3 additions and 2 deletions

View File

@ -51,7 +51,7 @@ static int report_size = 512 + 1; // TODO: read actual report size
/* LPC845 Breakout Board Rev. 0 report invalid response with > 65 bytes */
int dap_init(bmp_info_t *info)
{
printf("dap_init\n");
DEBUG_INFO("dap_init\n");
if (hid_init())
return -1;
int size = strlen(info->serial);

View File

@ -158,6 +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;
opt->opt_flash_start = 0xffffffff;
while((c = getopt(argc, argv, "eEhHv:d:s:I:c:CnltVta:S:jpP:rR")) != -1) {
switch(c) {
case 'c':
@ -362,7 +363,7 @@ int cl_execute(BMP_CL_OPTIONS_t *opt)
break;
}
}
if (opt->opt_flash_start < flash_start)
if (opt->opt_flash_start == 0xffffffff)
opt->opt_flash_start = flash_start;
if (opt->opt_mode == BMP_MODE_TEST)
goto target_detach;