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.

Hex Conversion Utility Issue

Other Parts Discussed in Thread: TM4C1290NCPDT

I am working with tiva c series on generating a motorola format image in its 32 bit address form and have had issues.  I have tried the following compiler versions without success:

- TI v5.1.6

- TI v5.1.9

- TI v5.1.10

The generated motorola formatted hex files do not match with byte by byte comparison (taking into account ascii formatted bytes in the motorola format and the binary bytes being in their raw format, etc) of the data bytes with a generated binary file and the hex file is smaller than the binary file.  Is there a reason for such a failure in the hex conversion?  Is there a setting that I am missing?

Thank you in advance for your help.

  • The hex utility is described in the chapter titled Hex Conversion Utility Description in the ARM assembly language tools manual.  The section titled Motorola Exorciser Object Format gives the details of hex utility output for that format.  Perhaps this will help you understand what you see.

    Thanks and regards,

    -George

  • I have followed those instructions and I have also used the built-in arm hex utility in CCS 6.0 on the above-mentioned compiler versions without a proper motorola format file with the full program in it. The resulting file is the same size as the binary that is generated and that is impossible since the values are ascii-encoded and the file format added in should make it more than double in size. Byte by byte comparison proves the output is wrong. I have gone to using a bin2mot converter to get the proper motorola format for now, but I do not consider that a proper solution since the arm hex utility exists.
  • Is there any way you could show a small portion of code or data that has not converted correctly?  Maybe the first 20 bytes of a function, or data table.  Please describe how you developed the view of the object code or data prior to conversion to Motorola format.  I usually use the Unix command od.  But there are many other ways to do it.  In addition, show how the hex utility is being invoked.  If that includes a command file, show the contents of that file.  I am unlikely to figure this out based on that information alone, but it should advance the issue.

    Thanks and regards,

    -George

  • Non-working (should be full vector table, with some spillover):
    S00600004844521B
    S32200018000182D27532B2B2B000000002B2B002B2B2B2B2B2B2B2B2B2B2B2B2B2B2B41
    S322000180742B2B2B2B2BF9012B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B312B2B2B5F
    S322000180E82B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B00002BEB
    S3220001815C2B2B2B002B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B4B
    S31B000181D02B2B2B2B2B2B2B2B2B2B2B2B2B0002040000FFFFFFFF61
    S3220001822808B058B038B018B018010200A500A400A300A2003DB0649E006496002D03

    Working (created from binary with bin2mot, contains some bytes past end of vector table):
    S010000062696E326D6F7420284B544F29D5
    S31500018000181900202D9A0200277D0200530F020045
    S315000180102B6602002B6602002B66020000000000A0
    S315000180200000000000000000000000002B660200B6
    S315000180302B660200000000002B6602002B66020080
    S315000180402B6602002B6602002B6602002B660200DD
    S315000180502B6602002B6602002B6602002B660200CD
    S315000180602B6602002B6602002B6602002B660200BD
    S315000180702B6602002B6602002B6602002B660200AD
    S315000180802B6602002B660200F986020001F301004D
    S315000180902B6602002B6602002B6602002B6602008D
    S315000180A02B6602002B6602002B6602002B6602007D
    S315000180B02B6602002B6602002B6602002B6602006D
    S315000180C02B6602002B6602002B6602002B6602005D
    S315000180D02B6602002B66020031E101002B660200CD
    S315000180E02B6602002B6602002B6602002B6602003D
    S315000180F02B6602002B6602002B6602002B6602002D
    S315000181002B6602002B6602002B6602002B6602001C
    S315000181102B6602002B6602002B6602002B6602000C
    S315000181202B6602002B6602002B6602002B660200FC
    S315000181302B6602002B6602002B6602002B660200EC
    S315000181402B6602002B6602002B6602002B660200DC
    S3150001815000000000000000002B6602002B660200F2
    S315000181602B6602002B660200000000002B6602004F
    S315000181702B6602002B6602002B6602002B660200AC
    S315000181802B6602002B6602002B6602002B6602009C
    S315000181902B6602002B6602002B6602002B6602008C
    S315000181A02B6602002B6602002B6602002B6602007C
    S315000181B02B6602002B6602002B6602002B6602006C
    S315000181C02B6602002B6602002B6602002B6602005C
    S315000181D02B6602002B6602002B6602002B6602004C
    S315000181E02B6602002B6602002B6602002B6602003C
    S315000181F02B6602002B6602002B6602002B6602002C
    S315000182002B6602000000000002FF01FF04FF03FFCE
    S31500018210682D010012DF3390FFFFFFFFFFFFFFFF15
    S31500018220FFFFFFFFFFFFFFFF08B5A148B0F9000000

    Console Output for hex utility:
    'Invoking: ARM Hex Utility'
    "c:/ti/ccsv6/tools/compiler/arm_5.1.10/bin/armhex" --diag_wrap=on --display_error_number --issue_remarks --motorola=3 -o "some_App.hex" "some_App.out"
    Translating to Motorola-S3 format...
    "some_App.out" ==> .intvecs
    "some_App.out" ==> .text
    "some_App.out" ==> .const
    "some_App.out" ==> .specSect
    "some_App.out" ==> .cinit
    warning #21056-D: section some_App.out(.text) was padded by 2 to a size of 71712
    to satisfy the specified memory width of 4
    warning #21056-D: section some_App.out(.const) was padded by 3 to a size of 4276
    to satisfy the specified memory width of 4
    warning #21056-D: section some_App.out(.specSect) was padded by 1 to a size of
    392 to satisfy the specified memory width of 4
    'Finished building: some_App.hex'
    ' '
  • After carefully parsing it out, you can see that both of the memory blocks shown start at target address 0x00018000.  The non-working block shows contents of 0x182d2753 at that address.  The working block shows 0x18190020.  Let's focus on this one difference.  It is probably typical.  I presume 0x18190020 is the correct contents.  I don't know anything about the vector table.  What is contained there?  An address?  Or an instruction?  What could possibly explain this difference?  Does it make sense to disassemble the original executable (usually .out) file and see what it shows at this address?

    Thanks and regards,

    -George

  • Judging by the value and the memory map, that is an address in RAM for the stack pointer for a TM4C1290NCPDT.
  • Please attach the linker map file.  This file is usually the same name as the executable .out file, but with the extension .map instead.  That file will show me what section is loaded at address 0x00018000.  

    Thanks and regards,

    -George

  • George,

    A portion of the map file is listed below as this is a company project and
    gives you what you need (I have also included the vector table in another response):

    ******************************************************************************
    TI ARM Linker PC v5.1.10
    ******************************************************************************
    >> Linked Fri Mar 27 15:45:08 2015

    OUTPUT FILE NAME: <some_App.out>
    ENTRY POINT SYMBOL: "_c_int00" address: 00028861


    MEMORY CONFIGURATION

    name origin length used unused attr fill
    ---------------------- -------- --------- -------- -------- ---- --------
    FLASH 00018000 000e8000 00012cd6 000d532a R X
    SRAM 20000000 00040000 00001e86 0003e17a RW X


    SEGMENT ALLOCATION MAP

    run origin load origin length init length attrs members
    ---------- ----------- ---------- ----------- ----- -------
    00018000 00018000 00012ce0 00012ce0 r-x
    00018000 00018000 00000228 00000228 r-- .intvecs
    00018228 00018228 00011796 00011796 r-x .text
    000299c0 000299c0 000010b1 000010b1 r-- .const
    0002aa74 0002aa74 00000187 00000187 r-- .specSect
    0002ac00 0002ac00 000000e0 000000e0 r-- .cinit
    20000000 20000000 00001e89 00000000 rw-
    20000000 20000000 00001000 00000000 rw- .sysmem
    20001000 20001000 00000800 00000000 rw- .stack
    20001800 20001800 00000511 00000000 rw- .bss
    20001d14 20001d14 00000175 00000000 rw- .data


    SECTION ALLOCATION MAP

    output attributes/
    section page origin length input sections
    -------- ---- ---------- ---------- ----------------
    .init_array
    * 0 00018000 00000000 UNINITIALIZED

    .intvecs 0 00018000 00000228
    00018000 00000228 tm4c1290ncpdt_startup_ccs.obj (.intvecs)

    .text 0 00018228 00011796
  • The vector table:
    #pragma DATA_SECTION(g_pfnVectors, ".intvecs")
    void (* const g_pfnVectors[])(void) =
    {
    (void (*)(void))((uint32_t)&__STACK_TOP),
    // The initial stack pointer
    ResetISR, // The reset handler
    NmiSR, // The NMI handler
    FaultISR, // The hard fault handler
    IntDefaultHandler, // The MPU fault handler
    IntDefaultHandler, // The bus fault handler
    IntDefaultHandler, // The usage fault handler
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    IntDefaultHandler, // SVCall handler
    IntDefaultHandler, // Debug monitor handler
    0, // Reserved
    IntDefaultHandler, // The PendSV handler
    IntDefaultHandler, // The SysTick handler
    IntDefaultHandler, // GPIO Port A
    IntDefaultHandler, // GPIO Port B
    IntDefaultHandler, // GPIO Port C
    IntDefaultHandler, // GPIO Port D
    IntDefaultHandler, // GPIO Port E
    IntDefaultHandler, // UART0 Rx and Tx
    IntDefaultHandler, // UART1 Rx and Tx
    IntDefaultHandler, // SSI0 Rx and Tx
    IntDefaultHandler, // I2C0 Master and Slave
    IntDefaultHandler, // PWM Fault
    IntDefaultHandler, // PWM Generator 0
    IntDefaultHandler, // PWM Generator 1
    IntDefaultHandler, // PWM Generator 2
    IntDefaultHandler, // Quadrature Encoder 0
    IntDefaultHandler, // ADC Sequence 0
    IntDefaultHandler, // ADC Sequence 1
    IntDefaultHandler, // ADC Sequence 2
    IntDefaultHandler, // ADC Sequence 3
    WatchdogIntHandler, // Watchdog timer
    Timer0IntHandler, // Timer 0 subtimer A
    IntDefaultHandler, // Timer 0 subtimer B
    IntDefaultHandler, // Timer 1 subtimer A
    IntDefaultHandler, // Timer 1 subtimer B
    IntDefaultHandler, // Timer 2 subtimer A
    IntDefaultHandler, // Timer 2 subtimer B
    IntDefaultHandler, // Analog Comparator 0
    IntDefaultHandler, // Analog Comparator 1
    IntDefaultHandler, // Analog Comparator 2
    IntDefaultHandler, // System Control (PLL, OSC, BO)
    IntDefaultHandler, // FLASH Control
    IntDefaultHandler, // GPIO Port F
    IntDefaultHandler, // GPIO Port G
    IntDefaultHandler, // GPIO Port H
    IntDefaultHandler, // UART2 Rx and Tx
    IntDefaultHandler, // SSI1 Rx and Tx
    IntDefaultHandler, // Timer 3 subtimer A
    IntDefaultHandler, // Timer 3 subtimer B
    IntDefaultHandler, // I2C1 Master and Slave
    CAN0IntHandler, // CAN0
    IntDefaultHandler, // CAN1
    IntDefaultHandler, // Ethernet
    IntDefaultHandler, // Hibernate
    IntDefaultHandler, // USB0
    IntDefaultHandler, // PWM Generator 3
    IntDefaultHandler, // uDMA Software Transfer
    IntDefaultHandler, // uDMA Error
    IntDefaultHandler, // ADC1 Sequence 0
    IntDefaultHandler, // ADC1 Sequence 1
    IntDefaultHandler, // ADC1 Sequence 2
    IntDefaultHandler, // ADC1 Sequence 3
    IntDefaultHandler, // External Bus Interface 0
    IntDefaultHandler, // GPIO Port J
    IntDefaultHandler, // GPIO Port K
    IntDefaultHandler, // GPIO Port L
    IntDefaultHandler, // SSI2 Rx and Tx
    IntDefaultHandler, // SSI3 Rx and Tx
    IntDefaultHandler, // UART3 Rx and Tx
    IntDefaultHandler, // UART4 Rx and Tx
    IntDefaultHandler, // UART5 Rx and Tx
    IntDefaultHandler, // UART6 Rx and Tx
    IntDefaultHandler, // UART7 Rx and Tx
    IntDefaultHandler, // I2C2 Master and Slave
    IntDefaultHandler, // I2C3 Master and Slave
    IntDefaultHandler, // Timer 4 subtimer A
    IntDefaultHandler, // Timer 4 subtimer B
    IntDefaultHandler, // Timer 5 subtimer A
    IntDefaultHandler, // Timer 5 subtimer B
    IntDefaultHandler, // FPU
    0, // Reserved
    0, // Reserved
    IntDefaultHandler, // I2C4 Master and Slave
    IntDefaultHandler, // I2C5 Master and Slave
    IntDefaultHandler, // GPIO Port M
    IntDefaultHandler, // GPIO Port N
    0, // Reserved
    IntDefaultHandler, // Tamper
    IntDefaultHandler, // GPIO Port P (Summary or P0)
    IntDefaultHandler, // GPIO Port P1
    IntDefaultHandler, // GPIO Port P2
    IntDefaultHandler, // GPIO Port P3
    IntDefaultHandler, // GPIO Port P4
    IntDefaultHandler, // GPIO Port P5
    IntDefaultHandler, // GPIO Port P6
    IntDefaultHandler, // GPIO Port P7
    IntDefaultHandler, // GPIO Port Q (Summary or Q0)
    IntDefaultHandler, // GPIO Port Q1
    IntDefaultHandler, // GPIO Port Q2
    IntDefaultHandler, // GPIO Port Q3
    IntDefaultHandler, // GPIO Port Q4
    IntDefaultHandler, // GPIO Port Q5
    IntDefaultHandler, // GPIO Port Q6
    IntDefaultHandler, // GPIO Port Q7
    IntDefaultHandler, // GPIO Port R
    IntDefaultHandler, // GPIO Port S
    IntDefaultHandler, // SHA/MD5 0
    IntDefaultHandler, // AES 0
    IntDefaultHandler, // DES3DES 0
    IntDefaultHandler, // LCD Controller 0
    IntDefaultHandler, // Timer 6 subtimer A
    IntDefaultHandler, // Timer 6 subtimer B
    IntDefaultHandler, // Timer 7 subtimer A
    IntDefaultHandler, // Timer 7 subtimer B
    IntDefaultHandler, // I2C6 Master and Slave
    IntDefaultHandler, // I2C7 Master and Slave
    IntDefaultHandler, // HIM Scan Matrix Keyboard 0
    IntDefaultHandler, // One Wire 0
    IntDefaultHandler, // HIM PS/2 0
    IntDefaultHandler, // HIM LED Sequencer 0
    IntDefaultHandler, // HIM Consumer IR 0
    IntDefaultHandler, // I2C8 Master and Slave
    IntDefaultHandler, // I2C9 Master and Slave
    IntDefaultHandler, // GPIO Port T
    IntDefaultHandler, // Fan 1
    0, // Reserved
    (void (*)(void))0xFF01FF02,
    (void (*)(void))0xFF03FF04,
    (void (*)(void))0x00000000,
    (void (*)(void))0x00000000,
    (void (*)(void))0xFFFFFFFF,
    (void (*)(void))0xFFFFFFFF,
    (void (*)(void))0xFFFFFFFF,
    (void (*)(void))0xFFFFFFFF
    };
  • #pragma DATA_SECTION(g_pfnVectors, ".intvecs")
    void (* const g_pfnVectors[])(void) =
    {
    (void (*)(void))((uint32_t)&__STACK_TOP),
    // The initial stack pointer
    ResetISR, // The reset handler
    NmiSR, // The NMI handler
    FaultISR, // The hard fault handler
    IntDefaultHandler, // The MPU fault handler
    IntDefaultHandler, // The bus fault handler
    IntDefaultHandler, // The usage fault handler
    0, // Reserved
    0, // Reserved
    0, // Reserved
    0, // Reserved
    IntDefaultHandler, // SVCall handler
    IntDefaultHandler, // Debug monitor handler
    0, // Reserved
    IntDefaultHandler, // The PendSV handler
    IntDefaultHandler, // The SysTick handler
    IntDefaultHandler, // GPIO Port A
    IntDefaultHandler, // GPIO Port B
    IntDefaultHandler, // GPIO Port C
    IntDefaultHandler, // GPIO Port D
    IntDefaultHandler, // GPIO Port E
    IntDefaultHandler, // UART0 Rx and Tx
    IntDefaultHandler, // UART1 Rx and Tx
    IntDefaultHandler, // SSI0 Rx and Tx
    IntDefaultHandler, // I2C0 Master and Slave
    IntDefaultHandler, // PWM Fault
    IntDefaultHandler, // PWM Generator 0
    IntDefaultHandler, // PWM Generator 1
    IntDefaultHandler, // PWM Generator 2
    IntDefaultHandler, // Quadrature Encoder 0
    IntDefaultHandler, // ADC Sequence 0
    IntDefaultHandler, // ADC Sequence 1
    IntDefaultHandler, // ADC Sequence 2
    IntDefaultHandler, // ADC Sequence 3
    WatchdogIntHandler, // Watchdog timer
    Timer0IntHandler, // Timer 0 subtimer A
    IntDefaultHandler, // Timer 0 subtimer B
    IntDefaultHandler, // Timer 1 subtimer A
    IntDefaultHandler, // Timer 1 subtimer B
    IntDefaultHandler, // Timer 2 subtimer A
    IntDefaultHandler, // Timer 2 subtimer B
    IntDefaultHandler, // Analog Comparator 0
    IntDefaultHandler, // Analog Comparator 1
    IntDefaultHandler, // Analog Comparator 2
    IntDefaultHandler, // System Control (PLL, OSC, BO)
    IntDefaultHandler, // FLASH Control
    IntDefaultHandler, // GPIO Port F
    IntDefaultHandler, // GPIO Port G
    IntDefaultHandler, // GPIO Port H
    IntDefaultHandler, // UART2 Rx and Tx
    IntDefaultHandler, // SSI1 Rx and Tx
    IntDefaultHandler, // Timer 3 subtimer A
    IntDefaultHandler, // Timer 3 subtimer B
    IntDefaultHandler, // I2C1 Master and Slave
    CAN0IntHandler, // CAN0
    IntDefaultHandler, // CAN1
    IntDefaultHandler, // Ethernet
    IntDefaultHandler, // Hibernate
    IntDefaultHandler, // USB0
    IntDefaultHandler, // PWM Generator 3
    IntDefaultHandler, // uDMA Software Transfer
    IntDefaultHandler, // uDMA Error
    IntDefaultHandler, // ADC1 Sequence 0
    IntDefaultHandler, // ADC1 Sequence 1
    IntDefaultHandler, // ADC1 Sequence 2
    IntDefaultHandler, // ADC1 Sequence 3
    IntDefaultHandler, // External Bus Interface 0
    IntDefaultHandler, // GPIO Port J
    IntDefaultHandler, // GPIO Port K
    IntDefaultHandler, // GPIO Port L
    IntDefaultHandler, // SSI2 Rx and Tx
    IntDefaultHandler, // SSI3 Rx and Tx
    IntDefaultHandler, // UART3 Rx and Tx
    IntDefaultHandler, // UART4 Rx and Tx
    IntDefaultHandler, // UART5 Rx and Tx
    IntDefaultHandler, // UART6 Rx and Tx
    IntDefaultHandler, // UART7 Rx and Tx
    IntDefaultHandler, // I2C2 Master and Slave
    IntDefaultHandler, // I2C3 Master and Slave
    IntDefaultHandler, // Timer 4 subtimer A
    IntDefaultHandler, // Timer 4 subtimer B
    IntDefaultHandler, // Timer 5 subtimer A
    IntDefaultHandler, // Timer 5 subtimer B
    IntDefaultHandler, // FPU
    0, // Reserved
    0, // Reserved
    IntDefaultHandler, // I2C4 Master and Slave
    IntDefaultHandler, // I2C5 Master and Slave
    IntDefaultHandler, // GPIO Port M
    IntDefaultHandler, // GPIO Port N
    0, // Reserved
    IntDefaultHandler, // Tamper
    IntDefaultHandler, // GPIO Port P (Summary or P0)
    IntDefaultHandler, // GPIO Port P1
    IntDefaultHandler, // GPIO Port P2
    IntDefaultHandler, // GPIO Port P3
    IntDefaultHandler, // GPIO Port P4
    IntDefaultHandler, // GPIO Port P5
    IntDefaultHandler, // GPIO Port P6
    IntDefaultHandler, // GPIO Port P7
    IntDefaultHandler, // GPIO Port Q (Summary or Q0)
    IntDefaultHandler, // GPIO Port Q1
    IntDefaultHandler, // GPIO Port Q2
    IntDefaultHandler, // GPIO Port Q3
    IntDefaultHandler, // GPIO Port Q4
    IntDefaultHandler, // GPIO Port Q5
    IntDefaultHandler, // GPIO Port Q6
    IntDefaultHandler, // GPIO Port Q7
    IntDefaultHandler, // GPIO Port R
    IntDefaultHandler, // GPIO Port S
    IntDefaultHandler, // SHA/MD5 0
    IntDefaultHandler, // AES 0
    IntDefaultHandler, // DES3DES 0
    IntDefaultHandler, // LCD Controller 0
    IntDefaultHandler, // Timer 6 subtimer A
    IntDefaultHandler, // Timer 6 subtimer B
    IntDefaultHandler, // Timer 7 subtimer A
    IntDefaultHandler, // Timer 7 subtimer B
    IntDefaultHandler, // I2C6 Master and Slave
    IntDefaultHandler, // I2C7 Master and Slave
    IntDefaultHandler, // HIM Scan Matrix Keyboard 0
    IntDefaultHandler, // One Wire 0
    IntDefaultHandler, // HIM PS/2 0
    IntDefaultHandler, // HIM LED Sequencer 0
    IntDefaultHandler, // HIM Consumer IR 0
    IntDefaultHandler, // I2C8 Master and Slave
    IntDefaultHandler, // I2C9 Master and Slave
    IntDefaultHandler, // GPIO Port T
    IntDefaultHandler, // Fan 1
    0, // Reserved
    (void (*)(void))0xFF01FF02,
    (void (*)(void))0xFF03FF04,
    (void (*)(void))0x00000000,
    (void (*)(void))0x00000000,
    (void (*)(void))0xFFFFFFFF,
    (void (*)(void))0xFFFFFFFF,
    (void (*)(void))0xFFFFFFFF,
    (void (*)(void))0xFFFFFFFF
    };
  • What is the value of the symbol __STACK_TOP?  Is it possible that it could change between builds?

    Thanks and regards,

    -George