]>
git.zerfleddert.de Git - proxmark3-svn/blob - client/hid-flasher/flasher.c
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 //-----------------------------------------------------------------------------
16 static void usage(char *argv0
)
18 fprintf(stderr
, "Usage: %s [-b] image.elf [image.elf...]\n\n", argv0
);
19 fprintf(stderr
, "\t-b\tEnable flashing of bootloader area (DANGEROUS)\n\n");
20 fprintf(stderr
, "Example: %s path/to/osimage.elf path/to/fpgaimage.elf\n", argv0
);
25 int main(int argc
, char **argv
)
30 flash_file_t files
[MAX_FILES
];
32 memset(files
, 0, sizeof(files
));
39 for (int i
= 1; i
< argc
; i
++) {
40 if (argv
[i
][0] == '-') {
41 if (!strcmp(argv
[i
], "-b")) {
48 res
= flash_load(&files
[num_files
], argv
[i
], can_write_bl
);
50 fprintf(stderr
, "Error while loading %s\n", argv
[i
]);
53 fprintf(stderr
, "\n");
60 fprintf(stderr
, "Waiting for Proxmark to appear on USB...");
61 while (!OpenProxmark(1)) {
65 fprintf(stderr
, " Found.\n");
67 res
= flash_start_flashing(can_write_bl
);
71 fprintf(stderr
, "\nFlashing...\n");
73 for (int i
= 0; i
< num_files
; i
++) {
74 res
= flash_write(&files
[i
]);
77 flash_free(&files
[i
]);
78 fprintf(stderr
, "\n");
81 fprintf(stderr
, "Resetting hardware...\n");
83 res
= flash_stop_flashing();
89 fprintf(stderr
, "All done.\n\n");
90 fprintf(stderr
, "Have a nice day!\n");