]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
fast flash mode (button already held down) and both (os & fpga) flashing mode
authoradam@algroup.co.uk <adam@algroup.co.uk@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Fri, 24 Jul 2009 02:30:08 +0000 (02:30 +0000)
committeradam@algroup.co.uk <adam@algroup.co.uk@ef4ab9da-24cd-11de-8aaa-f3a34680c41f>
Fri, 24 Jul 2009 02:30:08 +0000 (02:30 +0000)
linux/flasher.c
linux/proxmark3.h

index 7cc8966ff323c5cee97063926a8d6887363cfae5..beea754eefe348ca52be9764585f70c4981a700c 100644 (file)
@@ -117,43 +117,61 @@ static void LoadFlashFromSRecords(char *file, int addr)
 
 int main(int argc, char **argv) {
        unsigned int addr = 0;
+       BOOL fastflash = 0, flashboth = 0;
        UsbCommand c;
 
-       if (argc != 3) {
-               fprintf(stderr,"Usage: %s {bootrom|os|fpga} image.s19\n", argv[0]);
+       if (argc != 3 && ! ((argc == 4 && *argv[3] == 'f') || (argc == 5 && *argv[4] == 'f'))) {
+               fprintf(stderr,"Usage: %s {bootrom|os|fpga} image.s19 [f]ast\n", argv[0]);
+               fprintf(stderr,"       %s {both} osimage.s19 fpgaimage.s19 [f]ast\n", argv[0]);
                exit(EXIT_FAILURE);
        }
 
        if (!strcmp(argv[1],"bootrom")) {
                addr = 0;
        } else if (!strcmp(argv[1],"os")) {
-               addr = 0x10000;
+               addr = FLASH_ADDR_OS;
        } else if (!strcmp(argv[1],"fpga")) {
-               addr = 0x2000;
+               addr = FLASH_ADDR_FPGA;
+       } else if (!strcmp(argv[1],"both")) {
+               flashboth = 1;
        } else {
                fprintf(stderr,"Unknown action '%s'!\n", argv[1]);
                exit(EXIT_FAILURE);
        }
 
+       if((argc == 4 && *argv[3] == 'f') || (argc == 5 && *argv[4] == 'f')) {
+               fastflash= 1;
+               fprintf(stderr,"Fastflash - device already in FLASH mode...\n");
+       }
+
        usb_init();
 
        fprintf(stderr,"Waiting for Proxmark to appear on USB...\n");
        while(!(devh=OpenProxmark(0))) { sleep(1); }
        fprintf(stderr,"Found...\n");
 
-       fprintf(stderr,"Entering flash-mode...\n");
-       bzero(&c, sizeof(c));
-       c.cmd = CMD_START_FLASH;
-       SendCommand(&c, FALSE);
-       CloseProxmark();
-       sleep(1);
-
-       fprintf(stderr,"Waiting for Proxmark to reappear on USB...\n");
-       fprintf(stderr,"(Press and hold down button NOW if your bootloader requires it)\n");
-       while(!(devh=OpenProxmark(0))) { sleep(1); }
-       fprintf(stderr,"Found...\n");
+       if(!fastflash){
+               fprintf(stderr,"Entering flash-mode...\n");
+               bzero(&c, sizeof(c));
+               c.cmd = CMD_START_FLASH;
+               SendCommand(&c, FALSE);
+               CloseProxmark();
+               sleep(1);
+
+               fprintf(stderr,"Waiting for Proxmark to reappear on USB...\n");
+               fprintf(stderr,"(Press and hold down button NOW if your bootloader requires it)\n");
+               while(!(devh=OpenProxmark(0))) { sleep(1); }
+               fprintf(stderr,"Found...\n");
+       }
 
-       LoadFlashFromSRecords(argv[2], addr);
+       if(!flashboth)
+               LoadFlashFromSRecords(argv[2], addr);
+       else {
+               fprintf(stderr,"Flashing os...\n");
+               LoadFlashFromSRecords(argv[2],FLASH_ADDR_OS);
+               fprintf(stderr,"Flashing fpga...\n");
+               LoadFlashFromSRecords(argv[3],FLASH_ADDR_FPGA);
+       }
 
        bzero(&c, sizeof(c));
        c.cmd = CMD_HARDWARE_RESET;
index 4868f2561cca805626dd3700c29b70ca1a1f85dd..67d808412ca8754a714bf89ba909f3ec421e3410 100644 (file)
@@ -1,5 +1,8 @@
 #define PROXPROMPT "proxmark3> "
 
+#define FLASH_ADDR_OS          0x10000
+#define FLASH_ADDR_FPGA                0x2000
+
 extern usb_dev_handle *devh;
 extern unsigned char return_on_error;
 extern unsigned char error_occured;
Impressum, Datenschutz