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.

TMS320F280025: Generating Binary files

Part Number: TMS320F280025

1.Bcakground Introduction:

  • Operating System: windows 11
  • Code Composer Studio Version: 12.5.0.00007
  • Compiler Version:TI v22.6.1.LTS
  • Output format:eabi(ELF)
  • Flash uses SEC0 and SEC1, the final program and data is not full for the 2 flash sectors.

FLASH_BANK0_SEC0 : origin = 0x080000, length = 0x001000

FLASH_BANK0_SEC1 : origin = 0x081000, length = 0x001000

  • Final Hex has unused areas because of data alignment(flash holes)
  • I can generate HEX files(e.g. Intel Hex) right, and use this file to generate BIN files using other tools;
  • But I have some problems when generating BIN files using CCS directly;

2.Solutions I have tried:

2.1 Post-Build

Using tiobj2bin.exe in Post-Build (Properties→BuildStepsPost-build steps):

"${CCS_INSTALL_ROOT}/utils/tiobj2bin/tiobj2bin" "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" "${CG_TOOL_ROOT}/bin/ofd2000" "${CG_TOOL_ROOT}/bin/hex2000" "${CCS_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin"

<C28x files built with --abi=eabi are not supported>  erro will appear, because of  Project output format is eabi(ELF)

2.2 Using C2000 Hex Utility

Set output format to Binary(--binary,-b),  --memwidth=8 --order=MS --romwidth=16, and generate bin fies.

The final result is that, flash holes is not filled, and programe/data is written at the wrong places after the first falsh hole;

2.3 --image

Based on 2.2, I trun on the --image property and set --fill to 0xFFFF, add a file describing ROMS as below(because of 8-bit and 16-bit reason, the address is multiplied by 2):

ROMS
{
FLASH_ALL : org = 0x00100000, len = 0x004000
}

In this way, the bin can generate right with holes filled 0xFFFF, but the reserved flash that the programe is not used is set to 0xFFFF also.

For example, the hex end address is 0x081500, data from address 0x081500 to 0x081FFFF in bin file is also set to 0xFFFF, but there is no data at this address in hex files.

I want to get the bin files wihout ununsed flash area and it can change automatically according to programe size.

How should I do to get the right BIN file I want to get?

  • accoding to this TMS320F280039C: Post-build failed in CCS12.2 - C2000 microcontrollers forum - C2000Tm︎ microcontrollers - TI E2E support forums , I copy related files to one folder and call <tiobj2bin.bat> through windows.

    Step1 - Change line 109 of file <tiobj2bin.bat>

    %ofdcmd% --obj_display=none,header %outfile% | findstr/c:" ELF " > nul 2>&1

         to 2 lines

         %ofdcmd% --obj_display=none,header %outfile%
         findstr/c:" ELF " > nul 2>&1.

         When calling <tiobj2bin.bat>, it will stop with the information:

    OBJECT FILE:  test.out
    
     Object File Information
    
        File Name:           test.out
        Format:              ELF Version 1
        File Type:           executable file
        Machine:             TI C2000
        Machine Endian:      little endian
        Entry Point:         0x0008173a
        Vendor:              Texas Instruments, Inc.
        Producer:            Linker
        Linker Version:      22.6.1
        Number of Sections:  34
        File Length:         130792
        ELF Class:           32-bit objects
        ELF e_flags:         0

    Step2 - Change line 109 of file <tiobj2bin.bat> , delete "|" to

    %ofdcmd% --obj_display=none,header %outfile% findstr/c:" ELF " > nul 2>&1

    Step3 - Setting otuput file format, change line 163 of <tiobj2bin.bat>

    %hexcmd% -q -memwidth=16 -order=MS -romwidth=16 -fill=0xFFFF -b -image -o %binfile% %hextmp% %outfile%

    This time I can get the final BIN file I want. Whehter EABI files is not supported by tiobj2bin.bat? Does changing the file in this way cause other problems?

    And how should I eventually get the bin file I want?

  • Bo,

    Why do you want a bin file like this? Do you just want to be able to directly edit the bin file?

  • I need the bin file to do the OTA bootloader.

    I searched some forum posts, and in this one:TMS320F280025C: post build to generate .bin file, the size is too big - C2000 microcontrollers forum - C2000Tm︎ microcontrollers - TI E2E support forums

    I think EABI is not suupported by tiobj2bin.bat.  It is inconvenient for me to use  a workaround methond as the forum posts above, I have to change ROM files every time I compile; 

    Now I can genearate HEX file using hex2000 via script and get BIN file using third party tool. But it is a little inconvenient, is there any way to get BIN file through CCS in one step.

  • I think EABI is not suupported by tiobj2bin.bat.

    Correct.  To be more specific, the combination of C2000 and EABI is not supported by tiobj2bin.bat.  

    It is inconvenient for me to use  a workaround methond as the forum posts above, I have to change ROM files every time I compile; 

    If you want to use tools just from TI, then this is the best solution available, despite the inconvenience.

    I can genearate HEX file using hex2000 via script and get BIN file using third party tool.

    That's probably the best solution.

    is there any way to get BIN file through CCS in one step.

    Unfortunately, no.  

    I need the bin file to do the OTA bootloader.

    Is it a requirement there must be a single binary file?  What about multiple binary files, one per range of flash memory?  Is that practical?

    Thanks and regards,

    -George

  • Thanks for your reply. Multiple binary files may be a little inconvenience  for files management.

    The final choice is using the third party tool.