This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28027F: hex2000 hex file format

Part Number: TMS320F28027F

I need to read metadata from a hex file generated with hex2000 utility. I allocated a section in linker file

PAGE 1 : /* Data Memory */
RAMM0_M1 : origin = 0x000000, length = 0x000600 /* on-chip RAM block M0 + M1. 0x600 to 0x800 reserved for InstaSPIN */

D_RAML0 : origin = 0x0081CC, length = 0x000E22 /* on-chip DRAM block L0 */
VERSION : origin = 0x008FEE, length = 0x000012 /* version data */
}

...

   version             : > VERSION      PAGE = 1

and put metadata structure into it

#pragma DATA_SECTION(versionStruct,"version");
static VersionStruct_t versionStruct = {.fwVersion = FW_VERSION,
.pcbRevision = 2,
.fwDate = DATE_PACK(__DATE__),
.fwTime = TIME_PACK(__TIME__),
.reserved = {0, 0}};

The generated hex file (hex2000 -boot -sci8 -a -o) has the following output:


AA 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3F 00 F6 7F 4B 00
3F 00 64 5A EE FF EE 8F 00 00 07 00 09 00 41 75 67 20 20 36 20 32 30 31
39 00 31 36 3A 32 34 3A 34 31 02 00 00 00 00 00 00 00 00 00 00 00 FE FF

The metadata structure is highlighted with red, the green one is the address I guess.

Then when I need to read the metadata, I skip on the file offset of the metadata. 

getc(file);
for (int i = 0; i < OFFSET; i++) {
     fscanf(app_file, "%x ", &read_byte);
}

Then read metadata starting from this offset.

The issue is that OFFSET depends on how the memory is filled and this offset changes. How can I find the hex file offset where the metadata is placed?
My guess is to skip data until meet EE 8F 00 00, but this may be met in the data as well, not necessarily an address. Could you provide me the decription of the format of this file? I didn't find it.

  • Hi,

    Please refer "Bootloader Data Stream Structure" section in the F28027F TRM

    http://www.ti.com/lit/ug/sprui09/sprui09.pdf

    Thanks, Katta

  • Thank you Katta, that is a very helpful link. Looks like it requires some effort to parse this file, as data blocks have different size.
    What I did for now was placing the const structure in the beginning FLASHA, and now the metadata is always placed in the beginning of the file, just after the header. So the offset should be always the same, will see how it works. 


    cmd:


    VERSION : origin = 0x3F2000, length = 0x000012 /* version data */
    FLASHA_C : origin = 0x3F2012, length = 0x005F6E /* on-chip FLASH */

      versionMem          : > VERSION      PAGE = 0

    c:

    static const VersionStruct_t versionStruct = {.fwVersion = FW_VERSION,
    .pcbRevision = EXPECTED_PCB_REVISION,
    .fwDate = DATE_PACK(__DATE__),
    .fwTime = TIME_PACK(__TIME__),
    .reserved = {0, 0}};

    hex:

    AA 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3F 00 F6 7F 12 00
    3F 00 00 20 07 00 09 00 41 75 67 20 20 36 20 32 30 31 39 00 31 39 3A 32
    31 3A 30 37 02 00 00 00 00 00 00 00 00 00 00 00