Ignore:
Timestamp:
2010-03-25T20:34:49+01:00 (7 years ago)
Author:
markus
Message:

added support for wrt54g3gv2-vf and new trx header format

  • hacked addpattern due to changes in header format
  • added "-5" to addpattern, some 0xFF are needed for trx2 header "-4" broke CRC checking in CFE
  • hacked trx.c due to new header format version
  • added target to create trx-V2 images

the flashmap driver possibly needs to be customized.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/firmware-utils/src/trx.c

    r17537 r20433  
    3636 * 
    3737 * Add -a (align offset) and -b (absolute offset) 
     38 * 
     39 * March 24, 2010 - markus 
     40 * 
     41 * extend trx header struct for new version 
     42 * assume v1 for as default 
     43 * Add option -2 to allow v2 header 
    3844 */ 
    3945 
     
    6066 
    6167#define TRX_MAGIC       0x30524448      /* "HDR0" */ 
    62 #define TRX_VERSION     1 
    6368#define TRX_MAX_LEN     0x720000 
    6469#define TRX_NO_HEADER   1               /* Do not write TRX header */    
     
    6974        uint32_t crc32;                 /* 32-bit CRC from flag_version to end of file */ 
    7075        uint32_t flag_version;  /* 0:15 flags, 16:31 version */ 
    71         uint32_t offsets[3];    /* Offsets of partitions from start of header */ 
     76        uint32_t offsets[4];    /* Offsets of partitions from start of header */ 
    7277}; 
    7378 
     
    7883void usage(void) 
    7984{ 
    80         fprintf(stderr, "Usage: trx [-o outfile] [-m maxlen] [-a align] [-b offset] [-f file] [-f file [-f file]]\n"); 
     85        fprintf(stderr, "Usage:\n"); 
     86        fprintf(stderr, " trx [-2] [-o outfile] [-m maxlen] [-a align] [-b offset] \\\n"); 
     87        fprintf(stderr, "     [-f file] [-f file [-f file [-f file (v2 only)]]]\n"); 
    8188        exit(EXIT_FAILURE); 
    8289} 
     
    94101        unsigned long maxlen = TRX_MAX_LEN; 
    95102        struct trx_header *p; 
     103        char trx_version = 1; 
    96104 
    97105        fprintf(stderr, "mjn3's trx replacement - v0.81.1\n"); 
     
    105113 
    106114        p->magic = STORE32_LE(TRX_MAGIC); 
    107         cur_len = sizeof(struct trx_header); 
    108         p->flag_version = STORE32_LE((TRX_VERSION << 16)); 
     115        cur_len = sizeof(struct trx_header) - 4; /* assume v1 header */ 
     116        p->flag_version = STORE32_LE((trx_version << 16)); 
    109117 
    110118        in = NULL; 
    111119        i = 0; 
    112120 
    113         while ((c = getopt(argc, argv, "-:o:m:a:b:f:A:")) != -1) { 
     121        while ((c = getopt(argc, argv, "-:2o:m:a:b:f:A:")) != -1) { 
    114122                switch (c) { 
     123                        case '2': 
     124                                /* take care that nothing was written to buf so far */ 
     125                                if (cur_len != sizeof(struct trx_header) - 4) { 
     126                                        fprintf(stderr, "-2 has to be used before any other argument!\n"); 
     127                                } 
     128                                else { 
     129                                        trx_version = 2; 
     130                                        cur_len += 4; 
     131                                } 
     132                                break; 
    115133                        case 'A': 
    116134                                append = 1; 
Note: See TracChangeset for help on using the changeset viewer.