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.

MCU-PLUS-SDK-AM243X: Global variables on DDR is not initialized

Part Number: MCU-PLUS-SDK-AM243X

HI BU experts,

My customer is using OSPI boot on am243x. Now they can switch to the APP image but find that the global variables are not initialized and have random values. These global variables are on DDR. 

May I know how to initialized these variables? Also, normally in which step global variables are initialized. Is there any document for this?

Thanks,

Hang.

  • Hello Hang,

    Thanks for reaching out to Texas Instruments E2E support forum. 

    I have taken your inputs and working on it. Please allow some time to revert back.

    Regards,

    Tushar

  • Hello Hang,

    Thanks for your patience.

    Can you please confirm, where the global variables are stored in your application? Is it stored in .bss section or .data section?

    Can you please also share the *.map file of the application?

    May I know how to initialized these variables? Also, normally in which step global variables are initialized

    At what stage are you checking the global variables?

    If the global variables are stored in .bss section then it will be initialized to 0 when the application loads(i.e after complete execution of _c_int00).

    Regards,

    Tushar

  • Hi Tushar,

    The global is stored in .data section and has user defined initial values, instead of zero. How to initial the variables in the .data section?

    Regards,

    Hang.

  • Hello Hang,

    Thanks for your reply.

    The global is stored in .data section and has user defined initial values

    Can you please confirm, does the global variable stores user defined value or some random values?

    If the global variable holds user defined value then it is expected behavior, as the value is defined by user in the program. If you want the variable to hold value '0' when application loads, please define the variable with '0' as initial value.  

    Please note .data section of the memory will contain the value which is defined by user for a specific variable.

    Regards,

    Tushar

  • Hi Tushar, 

    We expect the global variables to hold user defined values , but it holds random values instead. We don't want the global values to be zero.

    Regards,

    Hang.

  • Hello Hang,

    Can you please tell us what is the exact version of MCU+SDK used?

    Can you please also share the *.map file of the example as asked in earlier replies also?\

    Can you please also provide a sample code to replicate the issue on TI-EVM?

    Regards,

    Tushar

  • Hello Hang,

    As discussed internally, I understood that the customer is able to see the correct value getting assigned to global variable when the example is loaded & run with CCS debugger.

    The customer is seeing random value only when the example is flashed using SBL_OSPI. Meanwhile I have tried to replicate the issue on my end and I am unable to reproduce it.

    I have created a empty project in which a global variable named g_initialized is defined with 0x20 value in DDR section. When I load the symbols after flashing the SBL OSPI, I am able to see the SBL logs and also defined value getting assigned to global variable instead of random value.

    Please refer below screenshot.

    CCS Sample Project  - empty_am243x_evm_r5fss0_0_nortos_ti_arm_clang.zip

    Regards,

    Tushar

  • Hi Tushar,

    Thanks for the sample project. However, as the customer tried it, the global variable is initialized as incorrect values. Meanwhile, from the memory browser we can see that the memory in DDR is very different from yours. Any idea what might cause this issue? 

    Regards,

    Hang.

  • Hello Hang,

    1. Can you please confirm, Have you ran the above provided code on TI EVM or custom board?

    2. If the example is ran on custom board, Is there any modifications done?

    It would be very difficult to help on this query if I can't reproduce the issue.

    It would be helpful if you can provide sample code for the issue reproduction.

    Regards,

    Tushar

  • Hi Tushar,

    Customer ran the project you shared on custom board without any changes. Since this project works well on EVM, it may be difficult to reproduce on EVM. Could you share with us the process of data copying so that we can check where it goes wrong? If the data are copied from FLASH to DDR in _c_int00(), we can check where data is stored on FLASH, then step through the _c_int00() to see the copy process.

    Regards,

    Hang.. 

  • Hello Hang,

    Thanks for your response.

    Since this project works well on EVM, it may be difficult to reproduce on EVM.

    Can you please check keeping the global variable in MSRAM and see whether you are getting correct data or not?

    It might be possible that the DDR is unstable and is not initialized properly.

    Please let us know the result of above experiment.

    Regards,

    Tushar

  • Hi Tushar,

    With the project you shared, customer finds that there are issues in their DDR configs. Now the issue is solved. Thanks for supporting!

    Regards,

    Hang.

  • Hello Hang,

    With the project you shared, customer finds that there are issues in their DDR configs. Now the issue is solved

    Thanks for the confirmation.

    Thanks for supporting!

    Happy to help Slight smile.

    Regards,

    Tushar