X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=flash%2Fmain.c;h=f1d0b4f845d0cd90f62ab313624c2cb60156621e;hb=67db39b0b31dc76dcc83405f7dba28ee04f90432;hp=a443f95f6bb58b59460e3231a5a650d637763d6c;hpb=152989ba1c2cd61620f18d145b805e75adc1ef2a;p=fw%2Fstlink diff --git a/flash/main.c b/flash/main.c index a443f95..f1d0b4f 100644 --- a/flash/main.c +++ b/flash/main.c @@ -21,6 +21,7 @@ static void usage(void) { puts("stlinkv1 command line: ./flash {read|write} /dev/sgX path addr "); puts("stlinkv2 command line: ./flash {read|write} path addr "); + puts(" use hex format for addr and "); } static int get_opts(struct opts* o, int ac, char** av) @@ -46,7 +47,7 @@ static int get_opts(struct opts* o, int ac, char** av) i = 1; } - o->size = strtoul(av[i + 3], NULL, 10); + o->size = strtoul(av[i + 3], NULL, 16); } else if (strcmp(av[0], "write") == 0) { @@ -86,13 +87,18 @@ int main(int ac, char** av) if (o.devname != NULL) /* stlinkv1 */ { +#if CONFIG_USE_LIBSG static const int scsi_verbose = 2; sl = stlink_quirk_open(o.devname, scsi_verbose); if (sl == NULL) goto on_error; +#else + printf("not compiled for use with STLink/V1"); + goto on_error; +#endif } else /* stlinkv2 */ { - sl = stlink_open_usb(10); + sl = stlink_open_usb(1); if (sl == NULL) goto on_error; }