aboutsummaryrefslogtreecommitdiffstats
path: root/iceprog
diff options
context:
space:
mode:
authorPablo Cossutta <pcossutt@itba.edu.ar>2019-04-27 19:33:07 -0300
committerPablo Cossutta <pcossutt@itba.edu.ar>2019-04-27 19:33:07 -0300
commitbd88dfe418b4d3ec06cf283c9af55fef5098e56e (patch)
treef6d3d2b3e2693ff6cc89e748537b30f1047fbc2e /iceprog
parentd9ea2e15fccebbbce59409b0ae7a1481d78aab86 (diff)
downloadicestorm-bd88dfe418b4d3ec06cf283c9af55fef5098e56e.tar.gz
icestorm-bd88dfe418b4d3ec06cf283c9af55fef5098e56e.tar.bz2
icestorm-bd88dfe418b4d3ec06cf283c9af55fef5098e56e.zip
Add -X option to iceprog
In my setup, in OSX I have problems reading from libftdi but not writing. In case of a failure iceprog exits and leaves the FPGA in an useless state. I think it would be a good option to have the possibility to skip the verification process.
Diffstat (limited to 'iceprog')
-rw-r--r--iceprog/iceprog.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/iceprog/iceprog.c b/iceprog/iceprog.c
index f9d1187..bae9e71 100644
--- a/iceprog/iceprog.c
+++ b/iceprog/iceprog.c
@@ -449,6 +449,7 @@ static void help(const char *progname)
fprintf(stderr, "\n");
fprintf(stderr, "Mode of operation:\n");
fprintf(stderr, " [default] write file contents to flash, then verify\n");
+ fprintf(stderr, " -X write file contents to flash only\n");
fprintf(stderr, " -r read first 256 kB from flash and write to file\n");
fprintf(stderr, " -R <size in bytes> read the specified number of bytes from flash\n");
fprintf(stderr, " (append 'k' to the argument for size in kilobytes,\n");
@@ -517,6 +518,7 @@ int main(int argc, char **argv)
bool test_mode = false;
bool slow_clock = false;
bool disable_protect = false;
+ bool disable_verify = false;
const char *filename = NULL;
const char *devstr = NULL;
int ifnum = 0;
@@ -529,7 +531,7 @@ int main(int argc, char **argv)
/* Decode command line parameters */
int opt;
char *endptr;
- while ((opt = getopt_long(argc, argv, "d:I:rR:e:o:cbnStvsp", long_options, NULL)) != -1) {
+ while ((opt = getopt_long(argc, argv, "d:I:rR:e:o:cbnStvspX", long_options, NULL)) != -1) {
switch (opt) {
case 'd': /* device string */
devstr = optarg;
@@ -616,6 +618,9 @@ int main(int argc, char **argv)
case 'p': /* disable flash protect before erase/write */
disable_protect = true;
break;
+ case 'X': /* disable verification */
+ disable_verify = true;
+ break;
case -2:
help(argv[0]);
return EXIT_SUCCESS;
@@ -921,7 +926,7 @@ int main(int argc, char **argv)
flash_read(rw_offset + addr, buffer, 256);
fwrite(buffer, read_size - addr > 256 ? 256 : read_size - addr, 1, f);
}
- } else if (!erase_mode) {
+ } else if (!erase_mode && !disable_verify) {
fprintf(stderr, "reading..\n");
for (int addr = 0; true; addr += 256) {
uint8_t buffer_flash[256], buffer_file[256];