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.

RTOS/TDA2PXEVM: Global variables not initialized in IPU ( M4 )

Part Number: TDA2PXEVM
Other Parts Discussed in Thread: TDA2

Tool/software: TI-RTOS

When we try to run a Algolink ( VSDK 3.03) which was earlier running on A15 in IPU on TDA2P, we see the uninitialized global variables are not getting initialized to 0. Can you tell us if there is something we need to check on the compiler/linker options which might help.

  • Hi,

    By default the memory map sections for VSDK is uninitialized to reduce the boot up time.
    If you want initialize some global variables then you can create 1 section in cfg file under bss section and map it with IPU1_0_DATA_MEM and assign its type as "INIT".
    And map your global variables to this new section.
    Please refer to autosarIpcShm section in VSDK3.5 release onwards.

    Regards,
    Anuj
  • Hi Poorva

    FYI, there is a build option also available, but this one will apply globally to all uninitialized variables, arrays etc. and this can impact on boot time.

    --zero_init=on

    So as mentioned earlier,  Zero init a specific section would be the recommended option.

    BTW, you do not need this logic at all, if your C code is capable of performing all the required variable initialization at run-time!

    regards, Shiju

  • Hi Shiju,

    I made --zero_init=on for LNKFLAGS_GLOBAL_ipu1_0 and LNKFLAGS_GLOBAL_ipu1_1 in source\vision\platform\ti\tda2\build\rtos\makerules\build_config.mk. file.

    After this change I checked the global variable values again but they weren't still initialized. Could you please mention the location where the change needs to happen?

    Also, in the same file for LNKFLAGS_GLOBAL_a15_0, no value for zero_init was set. Is that correct?

  • Hi Poorva

    Yes, your changes are correct, I doubt there may be some other make files overriding your changes

    Please do a grep in /vision_sdk/build folder and make appropriate changes if any cfg/make files overriding your changes

    regards, Shiju

  • I searched all the places where zero_init is off for IPU1_0 in the vision_sdk/build folder, but there is no override. Any other possibility do you suspect for it to be not working?

    Does zero_init has to be set with any other combination of compiler/linker options? I had explored cinit_compression option but there is no effect with it's value also.

  • Poorva

    We have used this in C66x & M4 CPUs, with TI compilers.

    BTW, are you trying on A15 with GCC compiler?

    If yes, this combination is not checked!

    regards, Shiju

  • Hi Shiju,

    We are also using M4 CPU with TI compiler (i.e. cg_tools), but it doesn't work for us.

    Regards,
    Poorva
  • Poorva

    This needs to be checked again.

    Meantime can you check the first option described in the beginning of the post?

    regards, Shiju

  • Hi Anuj,

    I tried the solution you had mentioned, but is there any other solution that zero initializes all the global variables automatically as it is not feasible for me to initialize each one of them individually.

    I also tried the Shiju's solution but it does not seem to be working for us.

    Regards,

    Poorva

  • Hi,

    I hope you are doing this for a specific section only.
    You can keep some value in any variable which is in that section and after boot just check that 1 variable and if that has a value of 0 then it will work for the entire session.

    Regards,
    Anuj
  • Hi,

    zero_init flag works on DSP but not on IPU core so using that you will not be initialize variables to 0.
    You can try out the experiment which has been suggested earlier.

    You can map all your wanted variables to a section like below assuming section name is "temp" and variable name "gVar"
    #pragma DATA_SECTION(gVar, ".bss:temp")

    Then open below file
    links_fw/src/rtos/bios_app_common/${platform}/${core}/${core}.cfg
    and map your temp section to data_memory section of that core like below assuming you are doing it for IPU1_0
    Program.sectMap[".bss:temp"] = "IPU1_0_DATA_MEM";
    Program.sectMap[".bss:temp"].type = "INIT";

    Regards,
    Anuj
  • Hi Anuj,

    Thanks for the response. This resolves our query. But we want to understand the reason of this restriction for IPU.

    Could you please help us understand that?

    Regards,

    Poorva

  • Hi Poorva,

    Are you asking for IPU or MPU.

    As the above example should work for IPU1_0 core.

    Regards,

    Anuj

  • Hi,

    Its been long since any update on this thread.
    I hope the issue is resolved.
    If not then please reply below or create a new thread for different issue.

    Regards,
    Anuj