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.

the code could not run from the flash under some conditions? a c_int00 problem on the 280049



Recently my customer encountered a problem when they debug the 280049, they found that when they add a defination of a variable like"int16 test" in their SW;the mcu worked abnormal,. While they use the "int16 test = 0;",the cpu worked normal.

We do a detail test today, found that when the cpu worked abnormal, the code could  not run in the main function! And when modify the code in the code-start.asm: change the code:

code_start:
    .if WD_DISABLE == 1
        LB wd_disable       ;Branch to watchdog disable code
    .else
        LB _c_int00         ;Branch to start of boot._asm in RTS library
    .endif

to

code_start:
    .if WD_DISABLE == 1
        LB wd_disable       ;Branch to watchdog disable code
    .else
        LB main         ;Branch to start of boot._asm in RTS library
    .endif

the cpu worked normal!  WHY!

And the problem can be reproduce on the  TI 280049 demo.

Attachment is the .out and .map file  for the normal and abnormal project.They use the same cmd file as attached.

for the normal file,when run on the demo,we can measure a period gpio toogle(gpio 59) after power on the demo. for the abnormal file could ont measure the toggle. 

Does anyone have encountered a similar problem?

Or how to locate the root of this problem?

280049cmd_file.zip

map and out file.zip

  • Hello

    This is likely a result of something related to your on-going issue here: e2e.ti.com/.../598734
    Once that is resolved, I'd guess that this will also.

    Best regards
    Chris
  • Chris,
    Thanks for your reply. I update and edit my problem ,could you help answer it?
  • Hi Chris,
    This problem is not likely my on-ging issue.Could you help answer it?
  • You have .ref _c_int00 as part of the code start asm file?
    For the project build linker settings, do you have the entry point set to "code_start"?
    I don't see the boot28.obj being pulled in form the rts2800_fpu32.lib for some reason. That's where the _c_int00 is.

    Best regards
    Chris
  • You have .ref _c_int00 as part of the code start asm file?

    Yes,the customer use the same asm file as the file in our c2000 ware.

    For the project build linker settings, do you have the entry point set to "code_start"?

    Does this settings on the CCS?I have not found it,can you tell me ?

    I don't see the boot28.obj being pulled in form the rts2800_fpu32.lib for some reason. That's where the _c_int00 is.

    You mean that we should add the  rts2800_fpu32.lib in the project?

     

     

  • Can someone help answer it?
  • Shuai,

    Sorry for the delayed response. Chris is on vacation.

    Regarding the project build linker settings that Chris mentioned: Right click on the project in CCS -> Show Build Settings -> Build -> C2000 Linker -> Advanced Options -> Symbol Management -> Specifiy program entry point for the output module (--entry_point, -e). You should have code_start mentioned here. Please check.

    Regarding rts2800_fpu32.lib: Yes, the run time support library should be included if it is not already included.

    Thanks and regards,
    Vamsi

  • Shuai,

    customers should always use branch to _c_int00 like below. You should not branch to main() directly because the global variables are initialized by the C start up code by the RTS support library functions as part of _c_int00, so that variables are ready for main().

    Also users should always initialize the global variables to a known value, like '0'. The code that works with global variables shouldn't assume that the globals are zero initialized.



    code_start:
    .if WD_DISABLE == 1
    LB wd_disable ;Branch to watchdog disable code
    .else
    LB _c_int00 ;Branch to start of boot._asm in RTS library
    .endif


    Also see if it helps if you turn on the ALIGN(4) for below, not sure why it is commented out? Between your working and not working map files , I see the only difference of data sizes from the command.obj. Inspect the command.obj file for any abnormalities with the code.

    .cinit : > CINIT_FLASH, PAGE = 0//, ALIGN(4)
    .pinit : > INIT_FLASH, PAGE = 0//, ALIGN(4)
    .switch : > INIT_FLASH, PAGE = 0//, ALIGN(4)


    Hope this helps.

    Best Regards
    Santosh Athuru
  • Hi Santosh,
    Thanks for you help,We have a try on the demo, turn on the ALIGN(4), but the problem still repeat.
  • FYI for others:

    This issue is debugged offline and closed.

    Details for the sake of others referring to this post:
    The .cinit section in the customer application is large. RTS library initializes all those globals/statics before reaching main. This is causing the watchdog to expire even before it is serviced. Suggested the customer to disable the watchdog before branching to _c_int00 in code_start.asm and enable it after reaching main.

    Customer's applications was working in debugger-connected case since gel file disables the watchdog.

    Also, we modified customer's linker command file to map some sections to Flash for loading and RAM for executing.

    Thanks and regards,
    Vamsi