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.

Compiler/AM5708: AM57x DSP program memory allocation

Part Number: AM5708


Tool/software: TI C/C++ Compiler

The size of my dsp program is 11.7M, and the arm reports an error when using load-firmware.sh to load the dsp program. The address 0x40800000 is the L2RAM address of dsp1, and the DMA memory allocation error is reported. Ask how to modify to solve the error message? (Dsp executable file 11.7M, the robot program is too large and cannot be reduced)。

load-firmware.sh :

if [ -f "server_dsp1.xe66" ];then
path=$(cd "$(dirname "$0")"; pwd)"/server_dsp1.xe66"
rm /lib/firmware/dra7-dsp1-fw.xe66
ln -s $path /lib/firmware/dra7-dsp1-fw.xe66
echo 40800000.dsp > /sys/bus/platform/drivers/omap-rproc/unbind
echo 40800000.dsp > /sys/bus/platform/drivers/omap-rproc/bind
fi

The memory allocation of dsp is as follows:

 

  • Can you share some info from the map file of your DSP firmware?

    Just the top portion with the address and size for each memory section.

  • I tried many times and found that the CODE_SIZEcannot exceed 26M and the HEAP_SIZE cannot exceed 6M. TEXT_SIZE  Can be set to 32M. 

    the map file as follows:

    --args 0x64
    -heap 0x0
    -stack 0x1000

    MEMORY
    {
    L2SRAM (RWX) : org = 0x800000, len = 0x40000
    OCMC_RAM1 (RWX) : org = 0x40300000, len = 0x80000
    OCMC_RAM2 (RWX) : org = 0x40400000, len = 0x100000
    OCMC_RAM3 (RWX) : org = 0x40500000, len = 0x100000
    EXT_CODE (RWX) : org = 0x95000000, len = 0x2000000
    EXT_DATA (RW) : org = 0x97000000, len = 0x2000000
    EXT_HEAP (RW) : org = 0x99000000, len = 0x2000000
    TRACE_BUF (RW) : org = 0x9f000000, len = 0x60000
    EXC_DATA (RW) : org = 0x9f060000, len = 0x10000
    PM_DATA (RWX) : org = 0x9f070000, len = 0x20000
    CMEM (RW) : org = 0xa0000000, len = 0x1000000
    }

    xdc_runtime_Startup__EXECFXN__C = 1;
    xdc_runtime_Startup__RESETFXN__C = 1;

    SECTIONS
    {
    .text: load >> EXT_CODE
    .ti.decompress: load > EXT_CODE
    .stack: load > EXT_DATA
    GROUP: load > EXT_DATA
    {
    .bss:
    .neardata:
    .rodata:
    }
    .cinit: load > EXT_DATA
    .pinit: load >> EXT_DATA
    .init_array: load > EXT_DATA
    .const: load >> EXT_DATA
    .data: load >> EXT_DATA
    .fardata: load >> EXT_DATA
    .switch: load >> EXT_DATA
    .sysmem: load > EXT_DATA
    .far: load >> EXT_DATA
    .args: load > EXT_DATA align = 0x4, fill = 0 {_argsize = 0x64; }
    .cio: load >> EXT_DATA
    .ti.handler_table: load > EXT_DATA
    .c6xabi.exidx: load > EXT_DATA
    .c6xabi.extab: load >> EXT_DATA
    .tracebuf: load > TRACE_BUF
    .errorbuf: load > EXC_DATA
    .vecs: load > EXT_CODE
    .resource_table: load > 0x95000000, type = NOINIT
    xdc.meta: load > EXT_DATA, type = COPY

    }

  • Can you also share the cma region configurations for dsp memory in your linux dts file?

  •  Thank you for your prompt reply.  linux dts file as follw:

     

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/6505.dts.7z

  • In DTS file, you have the following configuration to set aside DDR memory from Linux for DSP to use, which is 0x99000000 with size of 0x4000000 Bytes.

    dsp1_cma_pool: dsp1_cma@99000000 {
    compatible = "shared-dma-pool";
    reg = <0x0 0x99000000 0x0 0x4000000>;
    reusable;
    status = "okay";
    };

    In your DSP side linker command file, you have to make sure to only use that area in DDR.

    Regards,
    Stanley

  • thank you for your reply,

    Now,I use CMEM for data transfer between ARM and DSP1, and I need to transfer about 2M data. But it is found that the maximum transmission is 4480Byte (1120 int). When the data transmission exceeds, the data read by CMEM will be messed up. May I need to modify the position in rsc_table_dsp1.h ? or config.bld ?

    rsc_table_dsp1.h :

    #define DSP_MEM_TEXT 0x95000000
    /* Co-locate alongside TILER region for easier flushing */
    #define DSP_MEM_IOBUFS 0x80000000
    #define DSP_MEM_DATA 0x95400000
    #define DSP_MEM_HEAP 0x98400000define DSP_MEM_IPC_DATA 0x9F000000

    #define DSP_MEM_IPC_VRING 0xB0000000
    #define DSP_MEM_RPMSG_VRING0 0xB0000000
    #define DSP_MEM_RPMSG_VRING1 0xB0004000
    #define DSP_MEM_VRING_BUFS0 0xB0040000
    #define DSP_MEM_VRING_BUFS1 0xB0080000

    #define DSP_MEM_IPC_VRING_SIZE SZ_1M
    #define DSP_MEM_IPC_DATA_SIZE SZ_1M
    #define DSP_MEM_TEXT_SIZE (SZ_1M * 4)
    #define DSP_MEM_DATA_SIZE (SZ_1M * 48)
    #define DSP_MEM_HEAP_SIZE (SZ_1M * 3)
    #define DSP_MEM_IOBUFS_SIZE (SZ_1M * 90)

    #define DSP_CMEM_IOBUFS 0xA0000000
    #define PHYS_CMEM_IOBUFS 0xA0000000
    #define DSP_CMEM_IOBUFS_SIZE (SZ_1M * 192)

     

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/dsp1.7z