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.

AWRL6432: How to init .bss (APP) to zero value after loading APP

Part Number: AWRL6432
Other Parts Discussed in Thread: SYSBIOS, AWRL1432

Tool/software:

Hi,

My customer is using SBL+APP. They want to init .bss section of APP to all zero value after APP is copied from flash to RAM.

I tried to add fill=0 in cmd file, but it will fill zero to .bss in link time and will erase the memory range of .bss to 0 when copying from flash to RAM. This is not what customer wants. Customer wants the value of .bss to zero after APP copy to RAM and run.

I found --zero_init=on build option but it seems it can only work in rom mode, but ram mode is used currently.

I searched in forum and found in sysbios, it will init .bss to zero by default in statup.c. (+) Initializing BSS Section - Processors forum - Processors - TI E2E support forums

Would you pls kindly advise how to init .bss (APP) to zero after loading APP for AWRL1432 (freertos/TI CLANG complier)?

Thanks,

Chris

  • Hey Chris,

    Thanks for posting your question regarding initializing the BSS to zero. Similar to the startupC function found in SYSBIOS, the L-SDK also initializes the BSS to zero after program code and data has been loaded into the RAM. This is done by the _system_pre_init function found under <MMWAVE_LSDK5_INSTALL_DIR>/source/kernel/nortos/dpl/m4/boot_armv7m.c which is called during the boot vector entry point _c_int00.

    I have also tested and verified on my side that the .bss section is overwritten with zeros after _system_pre_init is called, but please let me know if that does not appear to be the case.

    Regards,

    Kristien 

  • Kristien,

    Thanks for your reply.

    The problem seems to be the change on cmd as below. The value of __BSS_END and __BSS_START are ffffffff with below cmd.

    .bss:    {} align(8)  >> M4F_RAM3|M4F_RAM12

    Thanks,

    Chris

  • Hey Chris,

    Just to clarify, is the memory region spanning _BSS_START to _BSS_END all set to 0xFFFFFFFF? Is it always 0xFFFFFFFF or does it start off at a different value or get overwritten at a later point?

    Could you step through the _c_int00 and _system_pre_init function and verify whether the .bss region changes after executing the memset in the _system_pre_init? You can load the SBL program through the CCS debugger, set a breakpoint at the end of the sbl_switchtoapp function, and load the symbols from the APP after the asm instructions have executed. You should be in _c_int00 if done correctly and then can step through it.

    Regards,

    Kristien

  • Kristien,

    The problem is gone with below cmd.

    .bss:    {} align(8)  > M4F_RAM12

    Thanks,

    Chris

  • Hey Chris,

    Thank you for letting us know what resolved this issue. I will close out this thread now.

    Regards,

    Kristien