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.

CCS/TMS320F28335: Generating hex file using C2000 Hex Utility

Part Number: TMS320F28335

Tool/software: Code Composer Studio

Hi,

I am trying to generate hex file (Intel hex format) using the C2000 hex utility. For further processing, I need to ensure that

1. Single output hex file is generated

2.does not contain empty address spaces.

For point number 1:

I went through some posts and found that if the sections are defined in Page 0 and Page 1, the utility generates two output files. Is my understanding correct? How to generate a single hex file?

For point number 2:

I tried to use the following option to avoid any empty address space. Even then, the output map shows an empty address (for example, between ramfuncs and .econst). What I mean by that is, the ramfuncs ends at address 0x30cde and .econst section starts at 0x30ce0. I checked the .cmd file to find if these sections were defined to be placed like that. I did not find any evidence.  I am not sure if this has something to do with some other setting in Code Composer Studio.

Please provide inputs to solve the issue

  • Regarding ...

    Arpit Agrawal said:
    1. Single output hex file is generated

    The usual method is to have no initialized sections on PAGE 1, only PAGE 0.  For example, PAGE 1 has uninitialized sections like .stack, .ebss, and .esysmem, but no initialized sections like .text or .cinit.  All the linker command files from TI, for C2000 devices that use Flash memory, meet this requirement.  If a PAGE has no initialized sections, then no file is output for it.

    Regarding ...

    Arpit Agrawal said:
    2.does not contain empty address spaces.

    Please read the sub-chapter titled Image Mode and the --fill Option in the hex utility chapter of the C28x Assembly Tools Manual.

    Thanks and regards,

    -George

  • Hi George,

    Thanks for your response.

    I used your inputs to generate the hex file. When I went through the output file I found that the adress increment by 0x10 for 0x20 bytes of data. Is that a valid output? My understanding is that the address increments by the data size. I have used men width = 16, romwidth = 16 and the format is intel.
  • Arpit Agrawal said:
    adress increment by 0x10 for 0x20 bytes of data

    By the term byte, I presume you mean an 8-bit wide piece of data.  On a C2000 CPU, the smallest unit that can be addressed is a 16-bit word, and not an 8-bit byte.  So, across 0x20 8-bit bytes, the address increment is 0x10.  

    Thanks and regards,

    -George

  • Thanks George. By the term byte, I mean an 8-bit wide piece of data. Below is a sample output from the hex utility in Intel hex format. Please let me know if this is a valid hex output.

    :200000000000000000000000000000000000000000000000000000000000000000000000E0

    :200010000000000000000000000000000000000000000000000000000000000000000000D0

    :200020000000000000000000000000000000000000000000000000000000000000000000C0

    :200030000000000000000000000000000000000000000000000000000000000000000000B0

    :200040000000000000000000000000000000000000000000000000000000000000000000A0

    :20005000000000000000000000000000000000000000000000000000000000000000000090

    :20006000000000000000000000000000000000000000000000000000000000000000000080

    :20007000000000000000000000000000000000000000000000000000000000000000000070

    :20008000800000030084003000713ACA49F4003149F4003149F4003149F4003149F400318E

    I enabled the "output as byte" option. The generated output hex file had address increments of 0x20 for 0x20 bytes of data. The issue in this case is that the base address got doubled. For example, I had set the origin as 0x300000 in the ROMS directive. The output hex file had the extended linear address  as mentioned below:

    0200000400609A

    Please help me understand the above observations.

  • Arpit Agrawal said:
    Please let me know if this is a valid hex output.

    It is.

    Arpit Agrawal said:
    The issue in this case is that the base address got doubled.

    To change from each 16-bit word having its own address to each 8-bit byte having its own address, the base address must be doubled.

    Thanks and regards,

    -George

  • I was going through some links and found that for C2000 processor, a byte means 16 bits of data. Please confirm.
    If that be so, should the hex file address increment by 0x20 when the data bytes per line are 0x20.

    Thanks,
    Arpit
  • I was going through a link and found that for C2000 processor, a byte means 16-bit data. Please  confirm.

    If this be so, should the address in the hex file increment by 0x20 when there are 0x20 bytes of data per line (considering that C2000 processor has 16-bit flash).

    Also, can you please explain the 'output as byte' mode in the hex utility and how is the base address affected by this setting.

    Thanks,

    Arpit

  • Arpit Agrawal said:
    I was going through a link and found that for C2000 processor, a byte means 16-bit data. Please  confirm.

    The smallest unit of memory the C2000 CPU can address is 16-bits wide.  While an argument can be made that piece of memory should be called a byte, that can lead to confusion.  Because in most contexts, for most processors, the term byte means an 8-bit wide piece of memory.  When discussions, such as this one, arise that require very precise terms, I tend to explicitly write 16-bit word or 8-bit byte.

    Arpit Agrawal said:
    If this be so, should the address in the hex file increment by 0x20 when there are 0x20 bytes of data per line

    Just within this paragraph, let the term byte mean a 16-bit wide piece of memory in a C2000 system.  Yes, the address should increment by 0x20 when there are 0x20 bytes of data per line.  But, in the hex utility output you show above, there are only 0x10 bytes of data per line.

    Arpit Agrawal said:
    please explain the 'output as byte' mode in the hex utility

    Unfortunately, I'm not sure what you mean.  What hex utility option, or feature, do you use to turn on output as byte mode?  It would be ideal if you name the sub-chapter of the C28x assembly tools manual which describes it.

    Thanks and regards,

    -George

  • Thanks for your response.

    By 'output as byte' mode, I was referring to '--byte' option (Number output locations by bytes rather than by target
    addressing) mentioned in Table 12-1 (Basic Hex Utility Conversion Options). When I use this option, the base address in the output hex file is 2x'origin' (origin defined in the ROMS directive).
    if I understand correctly, the base address of the hex file should remain the same irrespective of the addressing mode. Please explain.
    Also, is there a way to generate byte addressed hex file with base address same as the 'origin'.

    For example, in the current scenario, If the origin = 0x300000, the output hex file (byte addressing mode) has base address as 0200000400609A.

    Can I generate the hex file (byte addressing mode and origin = 0x300000) with base address as 020000040030CA?


    Thanks,
    Arpit

  • Arpit Agrawal said:
    if I understand correctly, the base address of the hex file should remain the same irrespective of the addressing mode.

    Incorrect.  The code and data in a C2000 executable is configured so that each 16-bit word of memory has a distinct address.  To change from that, to a configuration where each 8-bit byte of memory has a distinct address, every address must be doubled.  This includes the base address.

    Arpit Agrawal said:
    Can I generate the hex file (byte addressing mode and origin = 0x300000) with base address as 020000040030CA?

    No.

    Thanks and regards,

    -George