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.

TMS320F280049C: Is there an application to convert hex to binary file?

Part Number: TMS320F280049C
Other Parts Discussed in Thread: UNIFLASH, TMS320F280041, C2000WARE

Fyi, we had enabled 'C2000 Hex Utility' in the CCS Properties. Hence, could you please provide us the application for the conversion of hex to binary file. By the way, is this *.hex output file can be directly download to the flash via 'Uniflash' application? Thanks !!

  • Hi Guangjun,

    Uniflash can load hex file to flash.

    You can generate binary file by using --binary option with hex2000 utility.

    Thanks and regards,
    Vamsi

  • Hi Vamsi,

    thanks, another issue happens, scenario like bellows:

    1. Use CCS generates SM5300X.out and SM5300X.bin files.
    2. Use CCS loads SM5300X.out into our mainboard with TMS320F280041 (application address: 0x84000-0x8CFFF)
    3. Use UniFlash read out the binary file from the mainboard (0x84000-0x8CFFF), named it "read2.bin">
    4. Use our bootloader download read2.bin, can successfully jump to the application address 0c84000 and runs well.
    5. Use our bootloader download SM5300x.bin, it cannot run.
    6. Then compare read2.bin and SM5300X.bin.
    7. Find out SM5300X.bin generated by CCS lost many words "0xFFFF" compared with  read2.bin.

    see the attached pictures 

    Best regards,

  • Hi Guangjun,

    When you download the image from CCS or Uniflash for an entire address range, all the holes (erased locations) also will be part of the image that you download.  When you create the binary from CCS, it won't include that unless you use the fill directive in the linker cmd file to fill unused locations with a constant value (in your case 0xFFFF).

    Regarding the binary not running successfully: 

    1) Make sure the linker cmd file has all the sections mapped to flash are aligned on 128-bit boundary using ALIGN(8).  

    2) Assuming your custom bootloader is using Fapi_AutoEccGeneration mode for program operation, search for below question in this FAQ: https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/951658/faq-faq-for-flash-ecc-usage-in-c2000-devices---includes-ecc-test-mode-linker-ecc-options 

    Why do you use align directive (ALIGN(x)) in the linker cmd files provided in the C2000Ware examples?

    Thanks and regards,

    Vamsi

  • Hi Vamsi, could you please enlighten or show us how to manage our linker file to include all the unused bytes as generated via the *.out file? Attaching our linker file for your reference. Thanks.

  • Gunagjun,

    You can simply say something like this:

    .text :> FLASH, PAGE = 0, ALIGN(8), fill = 0xFFFF

    Below snapshots are taken from the TMS320C28x Assembly Language Tools guide https://www.ti.com/lit/pdf/spru513 

    NOTE: I noticed the usage of ALIGN(4).  I would suggest ALIGN(8).

    Thanks and regards,
    Vamsi

  • Hi Vamsi,
    According datasheet,  create holes in output sections, the hole space locating between two file, my case happens somewhere in one file. 
    I attach the link file, map file, binary file generated by CCS (cannot run), and the binary file read-out by uniflash (run normally, it loaded into flash by .out format)

    thanks.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    MEMORY
    {
    PAGE 0 :
    /* BEGIN is used for the "boot to Flash" bootloader mode */
    BEGIN : origin = 0x080000, length = 0x000002
    RAMM0 : origin = 0x0000F4, length = 0x00030C
    RAMLS0 : origin = 0x008000, length = 0x000800
    RAMLS1 : origin = 0x008800, length = 0x000800
    RAMLS2 : origin = 0x009000, length = 0x000800
    RAMLS3 : origin = 0x009800, length = 0x000800
    RAMLS4 : origin = 0x00A000, length = 0x000800
    RESET : origin = 0x3FFFC0, length = 0x000002
    /* Flash sectors */
    /* BANK 0 */
    FLASH_BANK0_SEC0 : origin = 0x080002, length = 0x000FFE /* on-chip Flash */
    FLASH_BANK0_SEC1 : origin = 0x081000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK0_SEC2 : origin = 0x082000, length = 0x001000 /* on-chip Flash */
    FLASH_BANK0_SEC3 : origin = 0x083000, length = 0x001000 /* on-chip Flash */
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    ******************************************************************************
    TMS320C2000 Linker PC v20.2.4
    ******************************************************************************
    >> Linked Fri Jul 16 14:21:09 2021
    OUTPUT FILE NAME: <SM5300X.out>
    ENTRY POINT SYMBOL: "code_start" address: 00084000
    MEMORY CONFIGURATION
    name origin length used unused attr fill
    ---------------------- -------- --------- -------- -------- ---- --------
    PAGE 0:
    RAMM0 000000f4 0000030c 00000000 0000030c RWIX
    RAMLS0 00008000 00000800 0000054b 000002b5 RWIX
    RAMLS1 00008800 00000800 00000000 00000800 RWIX
    RAMLS2 00009000 00000800 00000000 00000800 RWIX
    RAMLS3 00009800 00000800 00000000 00000800 RWIX
    RAMLS4 0000a000 00000800 00000000 00000800 RWIX
    BEGIN 00080000 00000002 00000000 00000002 RWIX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Readout file by Uniflash read out from flash, it loaded into flash with .out format

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    48 00 32 b1 ff ff ff ff 04 fe 42 1e 01 29 44 ff
    31 ff 30 ff 18 ff 7f 00 44 1e 44 8a 42 92 1f 90
    c4 a3 a9 16 22 56 5a ff 00 9b ab 92 a8 2f 01 90
    a9 27 a9 a9 84 fe 06 00 48 76 aa 41 48 76 3c 42
    48 76 7a 42 48 76 6e 4b 48 76 9d 42 48 76 eb 42
    48 76 b4 43 48 76 c7 43 48 76 6b 41 48 76 6b 41
    48 76 6b 41 48 76 6b 41 48 76 6b 41 06 00 0a fe
    42 a8 49 2b 06 9a 48 76 86 9e a9 0e 44 1e 46 1e
    48 1e 1f 76 a6 02 00 02 0e 1e 49 2b 49 92 64 52
    17 63 06 9a 48 76 86 9e a9 0e 44 1e 46 06 44 0f
    03 67 44 06 46 1e 48 06 44 0f 03 69 44 06 48 1e
    1e 02 48 76 1f 60 49 0a 49 92 64 52 eb 64 48 06
    1f 76 a6 02 05 19 0e 1e 08 02 48 76 04 40 58 ff
    10 60 1f 76 a3 02 10 46 07 6d 0a 02 1f 76 a6 02
    48 07 0e 1e 06 6f 0f 02 1f 76 a6 02 48 07 0e 1e
    0e 06 1f 76 a4 02 08 1e 1f 76 a7 02 0e 1e 42 8a
    c4 1e 42 8a 48 06 d4 1e 42 8a 46 06 e4 1e 8a fe
    06 00 02 fe 41 2b 00 02 1f 76 a6 02 0e 1e 41 2b
    41 92 1e 52 10 63 06 9a 48 76 86 9e 1f 76 a6 02
    a9 0e 01 56 0e 00 1e 02 48 76 1f 60 41 0a 41 92
    1e 52 f2 64 1e 02 a6 1e 1f 76 a6 02 0e a3 00 02
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    the binary file generated by CCS, cannot run for lost many words 0xFFFF

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    48 00 36 b1 04 fe 42 1e 01 29 44 ff 31 ff 30 ff
    18 ff 7f 00 44 1e 44 8a 42 92 1f 90 c4 a3 a9 16
    22 56 5a ff 00 9b ab 92 a8 2f 01 90 a9 27 a9 a9
    84 fe 06 00 48 76 ae 41 48 76 40 42 48 76 7e 42
    48 76 72 4b 48 76 a1 42 48 76 ef 42 48 76 b8 43
    48 76 cb 43 48 76 6f 41 48 76 6f 41 48 76 6f 41
    48 76 6f 41 48 76 6f 41 06 00 0a fe 42 a8 49 2b
    06 9a 48 76 86 9e a9 0e 44 1e 46 1e 48 1e 1f 76
    a6 02 00 02 0e 1e 49 2b 49 92 64 52 17 63 06 9a
    48 76 86 9e a9 0e 44 1e 46 06 44 0f 03 67 44 06
    46 1e 48 06 44 0f 03 69 44 06 48 1e 1e 02 48 76
    1f 60 49 0a 49 92 64 52 eb 64 48 06 1f 76 a6 02
    05 19 0e 1e 08 02 48 76 08 40 58 ff 10 60 1f 76
    a3 02 10 46 07 6d 0a 02 1f 76 a6 02 48 07 0e 1e
    06 6f 0f 02 1f 76 a6 02 48 07 0e 1e 0e 06 1f 76
    a4 02 08 1e 1f 76 a7 02 0e 1e 42 8a c4 1e 42 8a
    48 06 d4 1e 42 8a 46 06 e4 1e 8a fe 06 00 02 fe
    41 2b 00 02 1f 76 a6 02 0e 1e 41 2b 41 92 1e 52
    10 63 06 9a 48 76 86 9e 1f 76 a6 02 a9 0e 01 56
    0e 00 1e 02 48 76 1f 60 41 0a 41 92 1e 52 f2 64
    1e 02 a6 1e 1f 76 a6 02 0e a3 00 02 1f f6 17 56
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Gunagjun,

    Did you fill in the holes with 0xFFFF in your linker cmd file as I suggested?  Also, I still see ALIGN(4) - please use ALIGN(8) instead.

    Note: I did not go through the files that you pasted.

    Thanks and regards,
    Vamsi