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/TMS570LC4357: Rename the bin file using post build

Part Number: TMS570LC4357

Tool/software: Code Composer Studio

Dear Forum Member

I was generated the bin file using post build command, But i need to rename the bin file and add the timestamp of file generated time.

Eg:

  • Normal file name: "APPLICATION.bin".
  • Expected file name: "APPLICATION_20200319T103901.bin"

any possibilities to do this using post build?

  • Arun,

    You can do this in a post-build step as well, by writing a batch file or script to first generate the timestamp in the format you desire and then renaming the generated .bin to include the timestamp. 

  • Arun Prakash said:
    I was generated the bin file using post build command, But i need to rename the bin file and add the timestamp of file generated time.

    There is the current_date Eclipse Dynamic Variable which can be used.

    E.g. using CCS 10 and the C2000 TI v20.20.0.LTS tool chain in which the hex utility supports a binary output, in the output file name in the CCS project property I was able to insert ${current_date:yyyyMMdd'T'HHmm} into the generated name:

    And when the project is built you can see the current date inserted into the filename of the binary file:

    Building files: "cla_ex3_background_nesting_task.out"
    Invoking: C2000 Hex Utility
    "/home/mr_halfword/ti/ccs1000/ccs/tools/compiler/ti-cgt-c2000_20.2.0.LTS/bin/hex2000" --binary -o "cla_ex3_background_nesting_task_20200322T1314.bin"  "cla_ex3_background_nesting_task.out" 
    Translating to Binary format...
       "cla_ex3_background_nesting_task.out" codestart ==> codestart
       "cla_ex3_background_nesting_task.out" .TI.ramfunc ==> .TI.ramfunc
       "cla_ex3_background_nesting_task.out" .cinit ==> .cinit
       "cla_ex3_background_nesting_task.out" Cla1Prog ==> Cla1Prog
       "cla_ex3_background_nesting_task.out" .text.1 ==> .text.1
       "cla_ex3_background_nesting_task.out" .text.2 ==> .text.2
       "cla_ex3_background_nesting_task.out" .const ==> .const
    Finished building: "cla_ex3_background_nesting_task.out"

    The argument for the the current_date Eclipse Dynamic Variable, the part after the colon, is the format string.

    The format string is defined by the Java SimpleDateFormat - as defined by Class SimpleDateFormat

    The default format string, if not provided, is yyyyMMdd_HHmm (as found in DateTimeResolver.java). I couldn't seem to find the definition of the format string in the Eclipse documentation, but found the source from a web search.

    I don't which which post build command you are using, but hopefully you can use the current_date Eclipse Dynamic Variable.

  • Dear 

    Thanks a lot. for above solution. Its working also very simple.

    I was wrote the batch file also. Its working fine.

    Refer the following steps

    • Step1: Store this batch TimestampAppendinBinfileUsingCCS.bat file in C:\ti\ccsv8\utils
    • Step2: Add this line "${CCS_INSTALL_ROOT}/utils/TimestampAppendinBinfileUsingCCS" "${ProjName}.bin" in post build step in CCS tool

    Result will be like : APPLICATION_20200323T220605.bin

    [Note] This will only wor for bin file. Change ".bin" insteat ".hex" in line 17, if you wanna change the hex format.

     

    rem ====================================
    
    rem [File Name] TimestampAppendinBinfileUsingCCS.bat
    
    rem [Title]     TimeStamp append in CCS tool
    
    rem [Author]    Arun(Arun9047474939@gmail.com)
    
    rem [Date]      20200323
    
    rem [Note]      This will only wor for bin file. Change ".bin" insteat ".hex" in line 18, if you wanna change the hex format.
    
    rem ====================================
    
    
    set DateFormat=%date:~10,4%_%date:~4,2%_%date:~7,2%
    
    Set DateFormat=%DateFormat:_=%
    
    
    set time=%time::=%
    
    set timeFormat=%time:~0,6%
    
    
    set DateTimeFormat=%DateFormat%T%timeFormat%
    
    
    set OriginalBinFileName=%~n1
    
    ren *%OriginalBinFileName%.bin  *%OriginalBinFileName%_%DateTimeFormat%.bin
    
    
    pause