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.

Question about the intel hex format

Hi all,

I am developing tools to convert the intel hex format to the ascii hex format (with boot table).  I am using the led example of 28004x to test the tool. When I compare the intel hex with the ascii hex generated by CCS, I have the following confusion.

This is one line from the intel hex file, the data at "0x00081128" is "00 1B 01 00 ..."

This is part of the ascii hex file, the data at "0x00081128" is "00 00 1B 00 01 00 00 00 ..."

The data from these two files don't align. It looks like the intel file is missing the high 16 bits of the data.  What's going on here?

Below is the CCS flags of intel file generation

--diag_wrap=off --boot --sci8 --intel

Thanks,

Hang.

  • I am unable to reproduce this result.  I'll illustrate with an example.  Start with this C code.

    /* file.c */
    
    #include <stdint.h>
    
    __attribute__((retain))
    const uint16_t table[] = {
        0xffaa, 0xeeee, 0xdddd, 0xcccc,
        0xbbaa, 0xaaaa, 0x9999, 0x8888,
        0x77aa, 0x6666, 0x5555, 0x4444,
        0x33aa, 0x2222, 0x1111, 0x0000
    };

    The retain attribute avoids the default behavior of the tools to remove anything, such as this table, which is not used by the program.

    Here is a minimal linker command file.

    /* minimal.cmd */
    
    MEMORY
    {
        ALL : o = 0x1118, l = 0x100
    }

    The only purpose of this linker command file is to cause all the code and data of the program to start at an address that is easily seen in the hex output.  In this case, that address is 0x1118.

    These commands build and link the program, and create the hex output for intel and ascii formats.

    $ cl2000 file.c
    
    $ cl2000 -z file.obj -o file.out minimal.cmd
    <Linking>
    warning: no suitable entry-point found; setting to 0
    
    $ hex2000 --boot --sci8 --intel -o=file_intel.hex file.out
    Translating to Intel format...
       "file.out" .econst ==> (BOOT TABLE)
    
    $ hex2000 --boot --sci8 --ascii -o=file_ascii.hex file.out
    Translating to ASCII-Hex format...
       "file.out" .econst ==> (BOOT TABLE)

    Here is the the contents of file_intel.hex.

    :20000000AA080000000000000000000000000000000000000000100000001811AAFFEEEE70
    :1C002000DDDDCCCCAABBAAAA99998888AA77666655554444AA3322221111000015
    :02003C000000C2
    :00000001FF

    Here is the contents of file_ascii.hex.

    
    AA 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 
    00 00 18 11 AA FF EE EE DD DD CC CC AA BB AA AA 99 99 88 88 AA 77 66 66 
    55 55 44 44 AA 33 22 22 11 11 00 00 
    00 00 
    

    Carefully compare them.  There is no difference.  

    To understand the contents of the first 20 bytes or so, please search the Technical Reference Manual (TRM) for your device for the sub-chapter titled Application Notes for Using the Bootloaders.

    Thanks and regards,

    -George

  • Hi George, 

    Thank you for your efforts reproducing the problem! I followed your steps of file generation and now the files are aligned. 

    Best regards,

    Hang.