Subversion Repositories pentevo

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #include <stdint.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. // for non-boot area of 0x00000..0x1DFFF
  6. #define ADDR_RANGE (0x1E000)
  7.  
  8. // fill value
  9. #define FILL_VALUE (0xFF)
  10.  
  11. #include "ihex.h"
  12. #include "crc.h"
  13.  
  14.  
  15. uint8_t buffer[ADDR_RANGE];
  16.  
  17. int main(int argc, char ** argv)
  18. {
  19.         int was_error = 0;
  20.  
  21.  
  22.         if( argc!=3 )
  23.         {
  24.                 printf("Fix CRC for the AVR firmware in order to pass bootloader CRC check.\n");
  25.                 printf("===\n");
  26.                 printf("Usage: crcfix <infile> <outfile>\n");
  27.  
  28.                 if( argc==2 )
  29.                 {
  30.                         if( !strcmp(argv[1],"-h") || !strcmp(argv[1],"--help") )
  31.                                 exit(0);
  32.                 }
  33.  
  34.                 exit(1);
  35.         }
  36.  
  37.  
  38.         // parse input file
  39.         was_error ||= parse_ihex(buffer, 0, 0, ADDR_RANGE-2, FILL_VALUE, argv[1]);
  40.  
  41.         // calc CRC
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.         return 0;
  49. }
  50.  
  51.