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.

SK-AM62: NOLOAD section in the SBL linker

Part Number: SK-AM62
Other Parts Discussed in Thread: UNIFLASH

Hi experts,

in the mcu+sdk for AM62x, there is a boot example (uart uni flash stage 1) that basically gets loaded by the ROM, initializes drivers, and loads the stage 2 SBL which runs in the RAM. In the linker for the stage 1 SBL, there is a section that is used to store the images received by UART in the RAM and its attribute is set to NOLOAD. why is this section set to be NOLOAD ? I assume it's because the RAM is not yet initialized, is this correct or are there other reasons?

the follow-up question is that in the main code for stage 1 SBL, the buffer that is defined to store the image is defined to store in the .bss.filebuf which is basically the NOLOAD section that I talked about. But since the RAM is not yet initialized at the beginning, I wonder how memory allocation is handled in this case.

These are images from the code that I'm talking about :

  • Hi ,

    Using NOLOAD attribute on a section tells our intention that we do not want the section to be loaded at load time. At load time, .bss section is loaded & mostly initialized with value 0. However, if we use this attribute on a .bss {sub}section then it is not loaded and thus not initialiazed.

    This use case of NOLOAD perfectly fits here. The section .bss.filebuf only contains gUniflashFileBuf array which infact is initialized by the data received over xmodem. Thus, it makes sense to use NOLOAD for this section so that it is not initialized which will also save us some computation time which otherwise would have gone to initializing this section to value 0. 

    The below screenshot describes the difference between program headers when using & not using NOLOAD attribute respectively for the example "sbl_uart_uniflash_stage1_am62x-sk_r5fss0-0_nortos_ti-arm-clang\Debug\sbl_uart_uniflash_stage1_am62x-sk_r5fss0-0_nortos_ti-arm-clang.out" in CCS.

    We can see when not using NOLOAD, there is an extra entry in program headers which align with the load address of .bss.filebuf in DDR.

    Regards,

    Prashant

  • thanks, it makes sense. the only thing I'm a bit confused about, is that DDR is not yet initialized, wouldn't this make problems for the compiler? I guess maybe at the beginning it only creates a reference to that region of memory that doesn't depend on actual DDR ram initialization.

  • Hi ,

    Indeed DDR is not initialized yet. However, that would not be a problem as we are using NOLOAD attribute on the section that is mapped to DDR. This makes sure the DDR is not accessed while the SBL image is being loaded. After SBL is loaded, System_init does the DDR initialization after which only it is accessed for the first time in function call Bootloader_xmodemReceive.

    Regards,

    Prashant

  • Hi ,

    Does the above response resolve your query? If so, we can then close the thread.

    Regards,

    Prashant