1 //-----------------------------------------------------------------------------
2 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
3 // at your option, any later version. See the LICENSE.txt file for the text of
5 //-----------------------------------------------------------------------------
6 // Flasher frontend tool
7 //-----------------------------------------------------------------------------
15 static void usage(char *argv0
)
17 fprintf(stderr
, "Usage: %s [-b] image.elf [image.elf...]\n\n", argv0
);
18 fprintf(stderr
, "\t-b\tEnable flashing of bootloader area (DANGEROUS)\n\n");
19 fprintf(stderr
, "Example: %s path/to/osimage.elf path/to/fpgaimage.elf\n", argv0
);
24 int main(int argc
, char **argv
)
29 flash_file_t files
[MAX_FILES
];
31 memset(files
, 0, sizeof(files
));
38 for (int i
= 1; i
< argc
; i
++) {
39 if (argv
[i
][0] == '-') {
40 if (!strcmp(argv
[i
], "-b")) {
47 res
= flash_load(&files
[num_files
], argv
[i
], can_write_bl
);
49 fprintf(stderr
, "Error while loading %s\n", argv
[i
]);
52 fprintf(stderr
, "\n");
59 fprintf(stderr
, "Waiting for Proxmark to appear on USB...");
60 while (!OpenProxmark(1)) {
64 fprintf(stderr
, " Found.\n");
66 res
= flash_start_flashing(can_write_bl
);
70 fprintf(stderr
, "\nFlashing...\n");
72 for (int i
= 0; i
< num_files
; i
++) {
73 res
= flash_write(&files
[i
]);
76 flash_free(&files
[i
]);
77 fprintf(stderr
, "\n");
80 fprintf(stderr
, "Resetting hardware...\n");
82 res
= flash_stop_flashing();
88 fprintf(stderr
, "All done.\n\n");
89 fprintf(stderr
, "Have a nice day!\n");