Allocate memory#

Ensure that the memory regions used by the remote core and Linux do not overlap.

For more information about how to allocate memory in a multicore processor, refer to section How to allocate memory.

The default AM62Ax Linux devicetree files do not set aside an SRAM allocation for remote cores. That means that the Linux remoteproc driver will not be able to load remote core program data into the SRAM without modifying the Linux devicetree file.

If we check examples/hello_world/<board>/<core>/ti-arm-clang/linker.cmd, we can see that many of the data sections are currently getting placed into MSRAM. The MSRAM region is defined at 0x79100000, and has a size of 0x80000:

MEMORY
{
    ...
    MSRAM     : ORIGIN = 0x79100000 , LENGTH = 0x80000

We could either move the MSRAM data sections into the DDR memory allocations that Linux has already reserved for the remote core in the Linux devicetree file, or we could add an SRAM data allocation to the Linux devicetree file. Let’s add an SRAM allocation to the Linux devicetree file.

For more information about SRAM allocations in the Linux devicetree file, refer to section Allocating memory in Linux.

Now, rebuild the Linux devicetree file:

  • Set up the compiler, clean the kernel sources, and configure the kernel with the default kernel configurations, as documented in the Linux SDK Kernel User’s Guide.

  • Make the devicetree file, as documented in the Linux SDK Kernel User’s Guide. Note that you do NOT need to rebuild the kernel or kernel modules.

  • Copy the new Linux devicetree file to your SD card’s filesystem, under /boot/dtb/ti/. I usually save the original file by renaming it, like this:

    // example terminal output is from an AM64x EVM, but the same concept
    // applies to all devices
    
    root@am64xx-evm:~# ls /boot/dtb/ti/
    README.txt  // I create this file to remind myself of what the current "k3-am642-evm.dtb" is
    ...
    k3-am642-evm.dtb  // this is the new devicetree file, with SRAM allocation added
    k3-am642-evm.dtb.orig  // this is the original devicetree file