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.

TMS320F28P650SH: twice generated .bin file by tiobj2bin are not the same of the same code but in different location

Part Number: TMS320F28P650SH
Other Parts Discussed in Thread: C2000WARE

Tool/software:

  1. The same code, when I copy to other place and use CCS to build once, the generated .bin file is different on the APP part, the different parts indicated the code location.

I searched in the web, someone said that the “assert” function works, we use assert function as the TI example suggested. Is it possible to make the same code generated the same .bin file? How to do?

  1. We configure the bootloader flash range as 0x80000-0x81FFF, the APP flash range as 0x82000- 0xBFFFF. The bootloader flash range should not be changed when we update App code.

But We found that when we change some structure element of App code from 0 to non-zero, one data located in the bootloader flash will add 1 if there is one structure element changed to non-zero from 0, add 2 if there are 2 structure elements changed to non-zero from 0. This data lactation is in the TI function “ComputeCntrSeedValue”. Of course, the same address of App location in the function “ComputeCntrSeedValue” is also changed. (Because we do the initialization twice in bootloader and App.) Is it normal? Will this change impact the bootloader code execution?

  • I can explain why using assert causes the difference in the generated code.  I cannot tell you the best way to fix it.

    Consider this example ...

    C:\examples>type subdir\file.c
    #include <assert.h>
    
    int fxn(int input)
    {
       assert(input > 0);
       return -input;
    }
    
    C:\examples>cl2000 --gen_preprocessor_listing C:\examples\subdir\file.c
    
    C:\examples>findstr input file.rl
    Nint fxn(int input)
    N   assert(input > 0);
    X   _assert((input > 0) != 0, "Assertion failed, (" "input > 0" "), file " "C:\\examples\\subdir\\file.c" ", line " "5" "\n");
    N   return -input;

    The first command shows the contents of file.c in the directory subdir.  Note how it uses the assert macro from assert.h.  The second command builds it with the option --gen_preprocessor_listing.  Learn more about that option by searching for it in the C28x compiler manual.  Details relevant here:

    • It creates a file with the same name as the source file, but the file extension is changed to .rl
    • You can see a source line before and after macro expansion

    The third command shows the lines in file.rl that have the string input.  Lines that start with N are copied from the original source.  Lines that start with X show the same line after macro expansion.  Notice how the full path to the file is now a string in the source.  

    In your case, you must be building source code that is in different directories.  Thus different strings are in each build.  

    Regarding ...

    We configure the bootloader flash range as 0x80000-0x81FFF, the APP flash range as 0x82000- 0xBFFFF. The bootloader flash range should not be changed when we update App code.

    Does this function come from C2000Ware ...

    the TI function “ComputeCntrSeedValue”

    If not, what package from TI supplies it?

    Thanks and regards,

    -George

  • Yes, the TI function “ComputeCntrSeedValue” is from C2000.

  • Hi,

    This data lactation is in the TI function “ComputeCntrSeedValue”. Of course, the same address of App location in the function “ComputeCntrSeedValue” is also changed.

    Can you elaborate on this, i couldn't get the issue completely.

    Thanks

    Aswin