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.

[FAQ] MCU-PLUS-SDK-AM243X: Use SBL's memory from application

Part Number: MCU-PLUS-SDK-AM243X

How can I use SBL's memory from application once it is done executing as it will be wasted otherwise?

  • Hi,

    You can use the SBL memory in primary R5's application by allocating it to a uninitialized sections (NOLOAD) section.

    Steps to do that -

    1. Define MSRAM_SBL section in Primary R5Fs app

    /* SBL used memory, use only for uninitalized sections */
    MSRAM_SBL : ORIGIN = 0x70000000 , LENGTH = 0x60000

    2.  Allocate uninitialized/NOLOAD sections like .bss, .stack to this newly created section 

    /* This is rest of uninitialized data. This can be placed in DDR if DDR is available and needed */
    GROUP {
    .bss: {} palign(8) /* This is where uninitialized globals go */
    RUN_START(__BSS_START)
    RUN_END(__BSS_END)
    .sysmem: {} palign(8) /* This is where the malloc heap goes */
    .stack: {} palign(8) /* This is where the main() stack goes */
    } > MSRAM_SBL

    3. Confirm from the memory map file, the allocation of uninitialized sections. Check the UNINITILIAZED section attribute at the beginning. 

    .bss       0    70000000    00001498     UNINITIALIZED
                      70000000    00001008     (.common:gHwiCtrl)
                      70001008    00000280     ti_drivers_config.o (.bss.gUartObjects)
                      70001288    00000120     libsysbm.a : trgmsg.c.obj (.bss:_CIOBUF_)
                      700013a8    000000a0     (.common:__TI_tmpnams)
                      70001448    00000038     (.common:gClockCtrl)
                      70001480    00000008     (.common:parmbuf)
                      70001488    00000004     nortos.am243x.r5f.ti-arm-clang.debug.lib : HwiP_armv7r_vim.obj (.bss.gdummy)
                      7000148c    00000004     libc.a : memory.c.obj (.bss.sys_free)
                      70001490    00000004     (.common:gUartHandle)
                      70001494    00000004     --HOLE--
    
    .sysmem    0    70001498    00008000     UNINITIALIZED
                      70001498    00000010     libc.a : memory.c.obj (.sysmem)
                      700014a8    00007ff0     --HOLE--
    
    .stack     0    70009498    00004000     UNINITIALIZED
                      70009498    00000004     nortos.am243x.r5f.ti-arm-clang.debug.lib : boot_armv7r_asm.obj (.stack)
                      7000949c    00003ffc     --HOLE--

     

    Some points to note:

    • Strictly allocate the SBL memory for the NOLOAD or uninitialized sections on primary R5
      • This memory can be only used by primary R5 which runs the bootloader/SBL. If memory is allocated to other R5 cores, as they can start executing before SBL is fully done, they may overwrite SBL's content causing boot failure

    Hope this helps!

    Regards,

    Prasad