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.

Linux/66AK2H14: Device tree?/Resource table/

Part Number: 66AK2H14

Tool/software: Linux

Hi.

I have a program to create a heap and allocate memory on it. For this purpose I use DDR3A. My EVM has 2 GB memory. when  Linux is running on the ARM, I want to load my program (that is created by CCS) via mpmcl to DSP0. My goal is to create a heap on start memory address 0xA0000000 (virtual) and 0x820000000 (physical) for each DSP. The default DTS and mpm-config.json are attached. How should I change them? It is clear that if DSP wants to call back some result, using a mechanism like IPC is inevitable. For using IPC, we must custom resource table? or always need to custom resource table? How can I change the resource table in my code?

files.rar

  • Hi,

    Basically the answers to your questions are described in this thread:
    e2e.ti.com/.../709788

    You should modify the resource table and mpm_config by following the bellow wikis:
    processors.wiki.ti.com/.../MCSDK_UG_Chapter_Developing_System_Mgmt
    processors.wiki.ti.com/.../IPC_Resource_customTable

    You should add your custom carveouts to match your use case (cma pools). As I said You can follow the e2e thread I've posted, just change the addresses with the ones you use. Jeff has shared the details of his solution.

    Best Regards,
    Yordan
  • Hi Yordan
    I read all of this links,but none of them don't have an example! My borad is diffrent from Jeff's board!
    dsp_common_cma_pool: dsp_common_cma_pool@81f800000 {
    compatible = "shared-dma-pool";
    reg = <0x00000008 0x1f800000 0x00000000 0x800000>;
    reusable;
    status = "okay";
    };

    dsp_common_mpm_pool: dsp_common_mpm_pool@820000000 {
    compatible = "shared-dma-pool";
    reg = <0x00000008 0x20000000 0x00000000 0x10000000>;
    no-map;
    status = "okay";
    };
    which one of this is related to dsp memory?dsp_common_mpm_pool or dsp_common_cma_pool?

    &dsp0 {
    memory-region = <&dsp_common_cma_pool>;
    };

    &dsp1 {
    memory-region = <&dsp_common_cma_pool>;
    };

    &dsp2 {
    memory-region = <&dsp_common_cma_pool>;
    };

    &dsp3 {
    memory-region = <&dsp_common_cma_pool>;
    };

    &dsp4 {
    memory-region = <&dsp_common_cma_pool>;
    };

    &dsp5 {
    memory-region = <&dsp_common_cma_pool>;
    };

    &dsp6 {
    memory-region = <&dsp_common_cma_pool>;
    };

    &dsp7 {
    memory-region = <&dsp_common_cma_pool>;
    };

    for each DSP is it necesarry to define a diffrent cma?
    And this is part of mpm_config:
    "name": "local-ddr",
    "globaladdr": "0xa0000000",
    "length": "1FFFFC00",
    "devicename": "/dev/dspmem"
    },
    Do you mean that I change globaladdr to 0x80000000and length to 800000000 (for my 2GB DDR3)? Dose not it conflict with start address of Linux?

  • Hi,

    Do you mean that I change globaladdr to 0x80000000and length to 800000000 (for my 2GB DDR3)? Dose not it conflict with start address of Linux?

    No, you should use a higher start address, because 0x80000000 is the address, where linux is loaded. For example 90000000 or A0000000.

    which one of this is related to dsp memory?dsp_common_mpm_pool or dsp_common_cma_pool?


    The cma pool.
  • Hi Yoradn.

    Should I define a single  node for 8 DSPs or a different one for each of them and pass their pointer address to memory region of DSPs?

    After this step, how can I change the resource table in my code? By adding its header file or in another way?

  • Mahtat,

    The process for modifying your resource table is located in the link Yordan provided: processors.wiki.ti.com/.../IPC_Resource_customTable

    A few notes, and Yordan may correct me on this:

    • The dsp_common_mpm_pool is for the Vrings/MessageQ.  The resource table should use this address for the Vrings.  The mpm-mem node (dts) must have this address or the Vrings will not work.  You will see strange vring errors in the dsp trace.
    • As Yordan said, the dsp_common_cma_pool is where your dsp code will live.  I don't know how this would change for SoCs that have multiple DSPs.  Note that this is not quite how I did it, and that my implementation may be incorrect.
    • think that you will not need to make a separate dts node for every dsp, and that the Linux cma/cmem subsystem will handle where each DSP code gets placed.  This may not be correct.
    • The way I did it (as outlined in the post linked by Yordan) was to:
      • Make a new reserved-memory node that reserved the portion of the DDR I wanted to use as application heap for the DSP. (no-map, compatible="shared-dma-pool")
      • Make a new cmem entry that describes this reserved-memory node and gives it to Linux. (requires "no-map")
      • Add this address range to the mpm-mem memory array.
      • Point the dsp0 memory-region node to this reserved-memory node.
      • Make a TYPE_CARVEOUT entry in my custom resource table that matches the start address and size of the reserved-memory node
      • Make sure mpm_config.json includes these ranges in the local-ddr entry.

    You will need to modify the resource table to include a carveout that is the size/address of the dsp_common_cma_pool.  Without this carveout in the resource table, Linux will be unable to load the processor.  If you check /var/log/messages on Linux you will see more information regarding these errors.  The process for including your own resource table in the project is pretty clearly outlined in the wiki articles that have been linked to previously.  If you need a starting place for the K2H resource table, TI may have a recommendation for you.  I know for K2G it was the rsc_table_tci6638.h file located in <IPC_DIR>/packages/ti/ipc/remoteproc/ (Much thanks to the apps engineer who shared this).  It may be different for you, but I think it's the same CorePac.  Again, I'm not familiar with K2H, so bear in mind that I'm not an expert.

    Hope this helps,

    Jeff

  • Hi,

    Just wanted to confirm Jeff's answers.

    Best Regards,
    Yordan
  • Hi.

    I changed my DTS files like below:

    reserved-memory {
    #address-cells = <2>;
    #size-cells = <2>;
    ranges;

    dsp_common_cma_pool: dsp_common_cma_pool@840000000 {
    compatible = "shared-dma-pool";
    reg = <0x00000008 0x40000000 0x00000000 0x20000000>;
    reusable;
    status = "okay";
    };

    dsp_common_mpm_pool: dsp_common_mpm_pool@860000000 {
    compatible = "shared-dma-pool";
    reg = <0x00000008 0x60000000 0x00000000 0x10000000>;
    no-map;
    status = "okay";
    };
    };

    .

    .

    .

    mpm_mem: dspmem@e0000000 {
    compatible = "ti,keystone-dsp-mem";
    reg = <0xe0000000 0x10000000>;
    };

    .

    .

    .

    {
    reserved-memory {

    cmem_block_mem_0: cmem_block_mem@870000000 {
    reg = <0x00000008 0x70000000 0x00000000 0x10000000>;
    no-map;
    status = "okay";
    };
    };

    cmem {
    compatible = "ti,cmem";
    #address-cells = <1>;
    #size-cells = <0>;

    #pool-size-cells = <2>;

    status = "okay";

    cmem_block_0: cmem_block@0 {
    reg = <0>;
    memory-region = <&cmem_block_mem_0>;
    cmem-buf-pools = <1 0x00000000 0x10000000>;
    };

    cmem_block_1: cmem_block@1 {
    reg = <1>;
    sram = <&sram_cmem>;
    };
    };
    };

    &msm_ram {
    sram_cmem: sram-cmem@100000 {
    reg = <0x100000 0x480000>;
    };
    };

    and then compiled device tree and changed mpm_config.json too:

    "name": "local-ddr",
    "globaladdr": "0xa0000000",
    "length": "0x5FFFFC00"

    but when I wanted to reset DSP 0-7, gave error -105!

    root@k2hk-evm:~# mpmcl reset dsp0
    reset failed (error: -105)

    Here are some logs:

    root@k2hk-evm:~# cat /proc/cmem

    Block 0: Pool 0: 1 bufs size 0x10000000 (0x10000000 requested)

    Pool 0 busy bufs:

    Pool 0 free bufs:
    id 0: phys addr 0x870000000

    root@k2hk-evm:~# dmesg | grep -i cma
    [ 0.000000] Reserved memory: created CMA memory pool at 0x0000000840000000, size 512 MiB
    [ 0.000000] OF: reserved mem: initialized node dsp_common_cma_pool@840000000, compatible id shared-dma-pool
    [ 0.000000] cma: Reserved 64 MiB at 0x000000083c000000
    [ 0.000000] Memory: 953060K/1572864K available (8192K kernel code, 250K rwdata, 2256K rodata, 2048K init, 288K bss, 29980K reserved, 589824K cma-reserved, 196608K highmem)
    [ 8.861026] HPLIBMOD Debug: hplibmod_init_module: Allocated 0xf00000 size memory from CMA.
    [ 10.238906] keystone-rproc 10800000.dsp: assigned reserved memory node dsp_common_cma_pool@840000000
    [ 10.268449] keystone-rproc 11800000.dsp: assigned reserved memory node dsp_common_cma_pool@840000000
    [ 10.296423] keystone-rproc 12800000.dsp: assigned reserved memory node dsp_common_cma_pool@840000000
    [ 10.321688] keystone-rproc 13800000.dsp: assigned reserved memory node dsp_common_cma_pool@840000000
    [ 10.343332] keystone-rproc 14800000.dsp: assigned reserved memory node dsp_common_cma_pool@840000000
    [ 10.362434] keystone-rproc 15800000.dsp: assigned reserved memory node dsp_common_cma_pool@840000000
    [ 10.384767] keystone-rproc 16800000.dsp: assigned reserved memory node dsp_common_cma_pool@840000000
    [ 10.407534] keystone-rproc 17800000.dsp: assigned reserved memory node dsp_common_cma_pool@840000000

    root@k2hk-evm:~# tail -f /var/log/syslog
    Dec 23 14:05:29 k2hk-evm syslogd[506]: syslogd: read from /dev/log: Resource temporarily unavailable
    Dec 23 14:05:29 k2hk-evm mpmsrv[545]: mpmssm.c:541:mpm_reset_slave: resetting dsp0
    Dec 23 14:05:29 k2hk-evm systemd[1]: busybox-syslog.service: Main process exited, code=exited, status=128/n/a
    Dec 23 14:05:29 k2hk-evm mpmsrv[545]: mpmdlif.c:384:mpm_rproc_cpu_reset: Rproc user cpu reset failed ffffffff
    Dec 23 14:05:29 k2hk-evm mpmsrv[545]: mpmdlif.c:426:mpm_dlif_reset: Can't reset DSP
    Dec 23 14:05:29 k2hk-evm mpmsrv[545]: mpmdlif.c:520:mpm_dlif_stop: rproc reset fail
    Dec 23 14:05:29 k2hk-evm systemd[1]: busybox-syslog.service: Unit entered failed state.
    Dec 23 14:05:29 k2hk-evm mpmsrv[545]: mpmssm.c:544:mpm_reset_slave: Reset DSP failed for dsp0
    Dec 23 14:05:29 k2hk-evm systemd[1]: busybox-syslog.service: Failed with result 'exit-code'.
    Dec 23 14:05:29 k2hk-evm mpmsrv[545]: mpmsrv.c:77:mpm_server: waiting for slave message

    root@k2hk-evm:~# tail -f /proc/iomem
    80000000-dfffffff : System RAM (boot alias)
    800000000-85fffffff : System RAM
    800008000-800dfffff : Kernel code
    801000000-8010880ef : Kernel data
    870000000-87fffffff : CMEM

    I don't know what's wrong!

    I'm also wondering about this:

    Reserved memory: created CMA memory pool at 0x0000000840000000, size 512 MiB
    [ 0.000000] OF: reserved mem: initialized node dsp_common_cma_pool@840000000, compatible id shared-dma-pool
    [ 0.000000] Reserved memory: created DMA memory pool at 0x0000000860000000, size 256 MiB
    [ 0.000000] OF: reserved mem: initialized node dsp_common_mpm_pool@860000000, compatible id shared-dma-pool
    [ 0.000000] cma: Reserved 64 MiB at 0x000000083c000000

    why dsp_common_cma_pool is still 256 MB even when I defined its length as 128 MB?

  • I apologize if this reply seems delayed.  I was not in the office for the weekend.

    If I remember correctly, the -105 errors on reset tended to occur when there was a problem with mpm_config.json.  Also make sure that you have current versions of the kernel modules built.

    It is also a good idea to make sure that the dsp node has the correct "memory-region".  For example, if you wanted to put the code/heap into "dsp_common_cma_pool" your dsp0 node would look like:

    &dsp0{
    ... memory-region=<&dsp_common_cma_pool>;
    ... }

    I am a little confused why you have your mpm_memory pointing to 0xe0000000 (0x8 0x70000000), the cmem_block_mem_0 node.  You will probably not need to do anything with that node.  Instead, have the address of the mpm_memory pointing to the address where you plan to load the code.

    As for your last question, I do not see anywhere where you have declared anything to be 128MB (0x0800 0000) in size.  These messages:

    Reserved memory: created CMA memory pool at 0x0000000840000000, size 512 MiB
    [ 0.000000] OF: reserved mem: initialized node dsp_common_cma_pool@840000000, compatible id shared-dma-pool
    [ 0.000000] Reserved memory: created DMA memory pool at 0x0000000860000000, size 256 MiB
    [ 0.000000] OF: reserved mem: initialized node dsp_common_mpm_pool@860000000, compatible id shared-dma-pool
    [ 0.000000] cma: Reserved 64 MiB at 0x000000083c000000

    are referring to reserved-memory nodes that have the compatible string "shared-dma-pool".  In the reserved memory nodes you shared, the sizes are 0x20000000 (512MB) for the cma pool and 0x10000000 (256MB) for the mpm pool.  Those are the sizes reflected in the syslog as well.

    CMA Pool:

    Reserved memory: created CMA memory pool at 0x0000000840000000, size 512 MiB
    [ 0.000000] OF: reserved mem: initialized node dsp_common_cma_pool@840000000, compatible id shared-dma-pool

    MPM Pool:

    [ 0.000000] Reserved memory: created DMA memory pool at 0x0000000860000000, size 256 MiB
    [ 0.000000] OF: reserved mem: initialized node dsp_common_mpm_pool@860000000, compatible id shared-dma-pool

    Hope this helps,

    Jeff

  • Hi Jeff and thanks for your supporting.

    I apologize that gave you some wrong info.

    for now, I just define 512MB for all DSPs in one node ( as you said, there is no need to define separate nodes). This 512MB is defined in 0xc0000000 (0x840000000), because I think Linus start at 0xa0000000 (0x820000000), because we set its address at 0x820000000 in Uboot although this info :

    root@k2hk-evm:~# tail -f /proc/iomem
    80000000-dfffffff : System RAM (boot alias)
    800000000-85fffffff : System RAM
    800008000-800dfffff : Kernel code
    801000000-8010880ef : Kernel data
    870000000-87fffffff : CMEM

    show that it is in 0x800000000-0x820000000 !!!!

    I want to create a heap for my app from 0xc0000000 (0x840000000) with 512 MB length! After that, I define dsp_common_mpm_pool for 256MB  and I define mpm_mem in this address as you said.

    I also have defined :

    "name": "local-ddr",
    "globaladdr": "0xa0000000",
    "length": "0x5FFFFC00" 

    in mpm_config.json as part of all space in DDR3. I just changed its size from 1FFFFFC00 to 0x05FFFFC00, and I didn't change  its start address.

    So, the only thing that remains is CMEM, that I define it from 0x870000000 to 0x880000000 and there is no conflict between it and dsp_common_mpm_pool! Right?

    So, at this moment the problem is mpmcl cannot reset DSP and it seems that I didn't change address correctly and mpmcl can not work! (and when I didn't load my program yet, so this error did not relate to my code).

    This is my problem right now!

  • Hi.

    I changed my config and I succeed to reset DSP:

    cmem_block_mem_0: cmem_block_mem@850000000 {
    reg = <0x00000008 0x40000000 0x00000000 0x18000000>;
    no-map;
    status = "okay";
    };

    reserved-memory {
    #address-cells = <2>;
    #size-cells = <2>;
    ranges;

    dsp_common_cma_pool: dsp_common_cma_pool@830000000 {
    compatible = "shared-dma-pool";
    reg = <0x00000008 0x30000000 0x00000000 0x20000000>;
    reusable;
    status = "okay";
    };

    dsp_common_mpm_pool: dsp_common_mpm_pool@820000000 {
    compatible = "shared-dma-pool";
    reg = <0x00000008 0x20000000 0x00000000 0x10000000>;
    no-map;
    status = "okay";
    };
    };

    mpm_mem: dspmem@a0000000 {
    compatible = "ti,keystone-dsp-mem";
    reg = <0xa0000000 0x10000000>;
    };

    For now I dont know how to change defaut resource table in IPC!

    /*
    * Copyright (c) 2012-2013, Texas Instruments Incorporated
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * * Neither the name of Texas Instruments Incorporated nor the names of
    * its contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
    /*
    * ======== rsc_table_tci6638.h ========
    *
    * Include this table in each base image, which is read from remoteproc on
    * host side.
    *
    */

    #ifndef _RSC_TABLE_TCI6638_H_
    #define _RSC_TABLE_TCI6638_H_

    #include <ti/ipc/remoteproc/rsc_types.h>

    /* virtio ids: keep in sync with the linux "include/linux/virtio_ids.h" */
    #define VIRTIO_ID_RPMSG 7 /* virtio remote processor messaging */

    /* flip up bits whose indices represent features we support */
    #define RPMSG_IPU_C0_FEATURES 1

    #define RPMSG_VRING0_DA 0xA0000000
    #define RPMSG_VRING1_DA 0xA0004000

    /*
    * sizes of the virtqueues (expressed in number of buffers supported,
    * and must be power of 2)
    */
    #define RPMSG_VQ0_SIZE 256
    #define RPMSG_VQ1_SIZE 256

    struct my_resource_table {
    struct resource_table base;

    #ifndef TRACE_RESOURCE_ONLY
    UInt32 offset[2];
    #else
    UInt32 offset[1];
    #endif

    #ifndef TRACE_RESOURCE_ONLY
    /* rpmsg vdev entry */
    struct fw_rsc_vdev rpmsg_vdev;
    struct fw_rsc_vdev_vring rpmsg_vring0;
    struct fw_rsc_vdev_vring rpmsg_vring1;
    #endif

    /* trace entry */
    struct fw_rsc_trace trace;
    };

    /* Add trace buffer information to the resource table */
    #define TRACEBUFADDR (UInt32)&xdc_runtime_SysMin_Module_State_0_outbuf__A
    #define TRACEBUFSIZE 0x8000

    #define CARVEOUTADDR TRACEBUFADDR
    #define CARVEOUTSIZE TRACEBUFSIZE

    #pragma DATA_SECTION(ti_ipc_remoteproc_ResourceTable, ".resource_table")
    #pragma DATA_ALIGN(ti_ipc_remoteproc_ResourceTable, 4096)

    struct my_resource_table ti_ipc_remoteproc_ResourceTable = {
    1, /* we're the first version that implements this */
    #ifndef TRACE_RESOURCE_ONLY
    2, /* number of entries in the table */
    #else
    1,
    #endif
    0, 0, /* reserved, must be zero */
    /* offsets to entries */
    {
    #ifndef TRACE_RESOURCE_ONLY
    offsetof(struct my_resource_table, rpmsg_vdev),
    #endif
    offsetof(struct my_resource_table, trace),
    },

    #ifndef TRACE_RESOURCE_ONLY
    /* rpmsg vdev entry */
    {
    TYPE_VDEV, VIRTIO_ID_RPMSG, 0,
    RPMSG_IPU_C0_FEATURES, 0, 0, 0, 2, { 0, 0 },
    /* no config data */
    },
    /* the two vrings */
    { RPMSG_VRING0_DA, 4096, RPMSG_VQ0_SIZE, 1, 0 },
    { RPMSG_VRING1_DA, 4096, RPMSG_VQ1_SIZE, 2, 0 },
    #endif

    {
    TYPE_TRACE, TRACEBUFADDR, TRACEBUFSIZE, 0, "trace:dsp",
    },
    };

    #endif /* _RSC_TABLE_TCI6638_H_ */

    How can I add my changes to it??

  • Mahtat,

    The file that you pasted in your post is the resource table example you will want to start with. The instructions for modifying the resource table may be found here:
    processors.wiki.ti.com/.../IPC_Resource_customTable

    You will want to add a carveout entry as indicated here:
    processors.wiki.ti.com/.../Linux_IPC_on_AM57xx
  • Hi Jeff and Yordan.

    I have changed everything that we talked about it, but it has not work still.

    reserved-memory {
    #address-cells = <2>;
    #size-cells = <2>;
    ranges;
    
    dsp_common_cma_pool: dsp_common_cma_pool@81f800000 {
    compatible = "shared-dma-pool";
    reg = <0x00000008 0x1f800000 0x00000000 0x800000>;
    reusable;
    status = "okay";
    };
    
    dsp_ddr: dsp_ddr@830000000 {
    compatible = "shared-dma-pool";
    reg = <0x00000008 0x30000000 0x00000000 0x20000000>;
    no-map;
    status = "okay";
    };
    
    dsp_common_mpm_pool: dsp_common_mpm_pool@820000000 {
    compatible = "shared-dma-pool";
    reg = <0x00000008 0x20000000 0x00000000 0x10000000>;
    no-map;
    status = "okay";
    };
    };
    
    

    In CMEM:

    cmem_dsp: cmem_dsp@2 {
    reg = <2>;
    memory-region = <&dsp_ddr>;
    cmem-buf-pools = <1 0x00000000 0xFFFFFFF>; //This has to be smaller than the reserved-memory length?
    };
    
    

    And in resource table:

    #ifndef _RSC_TABLE_DSP_H_
    #define _RSC_TABLE_DSP_H_
    
    #include <ti/ipc/remoteproc/rsc_types.h>
    
    /* virtio ids: keep in sync with the linux "include/linux/virtio_ids.h" */
    #define VIRTIO_ID_RPMSG 7 /* virtio remote processor messaging */
    
    /* flip up bits whose indices represent features we support */
    #define RPMSG_IPU_C0_FEATURES 1
    
    #define RPMSG_VRING0_DA 0xA0000000
    #define RPMSG_VRING1_DA 0xA0004000
    
    /* NOTE: Make sure this matches what is configured in the linux device tree */
    #define DSP_CMEM_IOBUFS 0xD0000000
    #define PHYS_CMEM_IOBUFS 0xD0000000
    #define DSP_CMEM_IOBUFS_SIZE (SZ_1M * 384)
    
    /*
    * sizes of the virtqueues (expressed in number of buffers supported,
    * and must be power of 2)
    */
    #define RPMSG_VQ0_SIZE 256
    #define RPMSG_VQ1_SIZE 256
    
    struct my_resource_table {
    struct resource_table base;
    
    UInt32 offset[4];
    
    /* rpmsg vdev entry */
    struct fw_rsc_vdev rpmsg_vdev;
    struct fw_rsc_vdev_vring rpmsg_vring0;
    struct fw_rsc_vdev_vring rpmsg_vring1;
    
    /* trace entry */
    struct fw_rsc_trace trace;
    /* devmem entry */
    struct fw_rsc_devmem devmem0;
    struct fw_rsc_carveout carveout0;
    };
    
    /* Add trace buffer information to the resource table */
    //#define TRACEBUFADDR (UInt32)&xdc_runtime_SysMin_Module_State_0_outbuf__A
    extern char ti_trace_SysMin_Module_State_0_outbuf__A;
    #define TRACEBUFADDR (UInt32)&ti_trace_SysMin_Module_State_0_outbuf__A
    #define TRACEBUFSIZE 0x8000
    
    #define CARVEOUTADDR TRACEBUFADDR
    #define CARVEOUTSIZE TRACEBUFSIZE
    
    #pragma DATA_SECTION(ti_ipc_remoteproc_ResourceTable, ".resource_table")
    #pragma DATA_ALIGN(ti_ipc_remoteproc_ResourceTable, 4096
    
    #define DSP_MEM_CODE 0xb0000000
    #define DSP_MEM_CODE_SIZE (SZ_1M * 512)
    
    struct my_resource_table ti_ipc_remoteproc_ResourceTable = {
    1, /* we're the first version that implements this */
    4, /* number of entries in the table */
    0, 0, /* reserved, must be zero */
    /* offsets to entries */
    {
    offsetof(struct my_resource_table, rpmsg_vdev),
    offsetof(struct my_resource_table, trace),
    offsetof(struct my_resource_table, devmem0),
    offsetof(struct my_resource_table, carveout0),
    },
    
    /* rpmsg vdev entry */
    {
    TYPE_VDEV, VIRTIO_ID_RPMSG, 0,
    RPMSG_IPU_C0_FEATURES, 0, 0, 0, 2, { 0, 0 },
    /* no config data */
    },
    /* the two vrings */
    { RPMSG_VRING0_DA, 4096, RPMSG_VQ0_SIZE, 1, 0 },
    { RPMSG_VRING1_DA, 4096, RPMSG_VQ1_SIZE, 2, 0 },
    
    {
    TYPE_TRACE, TRACEBUFADDR, TRACEBUFSIZE, 0, "trace:dsp",
    },
    {
    TYPE_DEVMEM,
    DSP_CMEM_IOBUFS, PHYS_CMEM_IOBUFS,
    DSP_CMEM_IOBUFS_SIZE, 0, 0, "DSP_CMEM_IOBUFS",
    },
    {
    TYPE_CARVEOUT,
    DSP_MEM_CODE, 0,
    DSP_MEM_CODE_SIZE, 0, 0, "DSP_MEM_CODE",
    }, 
    };
    
    #endif /* _RSC_TABLE_DSP_H_ */
    
    
    
    

    And in config.bld ( bigdata example):

    /*
    * ======== config.bld ========
    *
    */
    var Build = xdc.useModule('xdc.bld.BuildEnvironment');
    
    
    var evmTCI6636K2H_ExtMemMapDsp = {
    EXT_CODE: {
    name: "EXT_CODE",
    base: 0xb0000000,
    len: 0x10000000,
    space: "code",
    access: "RWX"
    },
    };
    
    Build.platformTable["ti.platforms.evmTCI6636K2H:dsp"] = {
    externalMemoryMap: [
    [ "EXT_CODE", evmTCI6636K2H_ExtMemMapDsp.EXT_CODE ],
    ],
    codeMemory: "EXT_CODE",
    };
    
    /*
    * ======== ti.targets.elf.C66 ========
    */
    var C66 = xdc.useModule('ti.targets.elf.C66');
    C66.ccOpts.suffix += " -mi10 -mo -pdr -pden -pds=238 -pds=880 -pds1110 ";
    Build.targets.$add(C66);
    
    

    After loading my code I gave this error:

    root@k2hk-evm:~# tail -f /var/log/syslog 
    Dec 23 15:23:19 k2hk-evm mpmsrv[542]: mpmsrv.c:233:mpm_server: received reset command
    Dec 23 15:23:19 k2hk-evm mpmsrv[542]: mpmssm.c:541:mpm_reset_slave: resetting dsp0
    Dec 23 15:23:19 k2hk-evm kernel: [ 4830.943137] remoteproc remoteproc0: stopped remote processor 10800000.dsp
    Dec 23 15:23:19 k2hk-evm mpmsrv[542]: mpmsrv.c:77:mpm_server: waiting for slave message
    Dec 23 15:23:19 k2hk-evm mpmsrv[542]: mpmsrv.c:110:mpm_server: received message of size 61 bytes for cmd 1
    Dec 23 15:23:19 k2hk-evm mpmsrv[542]: mpmsrv.c:134:mpm_server: received load command for dsp0 filename /server_dsp.xe66
    Dec 23 15:23:19 k2hk-evm mpmsrv[542]: mpmdlif.c:741:DLOAD_set_rsc_table_runaddr:  Set rsc Table run addr fail ffffffff
    Dec 23 15:23:19 k2hk-evm mpmsrv[542]: mpmdlif.c:895:mpm_dlif_load:  ERROR: setting vring addr -1
    Dec 23 15:23:19 k2hk-evm mpmsrv[542]: mpmsrv.c:77:mpm_server: waiting for slave message
    Dec 23 15:23:19 k2hk-evm kernel: [ 4831.013192] keystone-rproc 10800000.dsp: error in ioctl call: cmd 0x40044902 (2), ret -22
    

  • Hi,

    Did you try using different addresses, smaller regions (carveouts) etc.. ? Also try to modify the mpm_config.json This is a custom application and we cannot debug it, the best we can do is provide some hints..

    Best Regards,
    Yrodan
  • Hi Yordan. Tnx for your answer.

    I changed everything, I also did it even for 1 MB carveout, but it didn't work. Please help me, Is there any example for evmk2h?

    Right now, I'm just running IPC big data example and changed device tree and resource table, and gave me error -107 for resource table!

  • Hi,

    The example for EVMK2H is the Linux SDK:
    www.ti.com/.../processor-sdk-k2h
    Additionally we have the following wikis:
    processors.wiki.ti.com/.../MCSDK_UG_Chapter_Developing_System_Mgmt --> outdated. Just for reference.
    processors.wiki.ti.com/.../IPC_Resource_customTable
    software-dl.ti.com/.../Foundational_Components.html ---> see all links in this article.

    Best Regards,
    Yordan
  • Dear Yordan, I read all these links , and I also search in processor-sdk and the problem is that the resource table for TCI6638 was not complete and it didn't work!!!!
    Actually after this long time that I have worked about this problem, I'm not sure where to place my code in DDR, CMA, MPM-COMMON ?!

  • Ok, which processor are you using: 66AK2H14 or TCI6638?

  • You know, there is no difference between them, at least Memory aspect, and my problem is memory management! but let assume it is 66AK2H14

  • Okay. Then what do you mean that the resource table for K2H in the SDK is not complete.. MPM can load the dsp firmware successfully and use the memory when you run the dsp examples in the SDK.

    Moreover the linked wikis in this post + the following e2e threads:
    e2e.ti.com/.../709788
    e2e.ti.com/.../2617597
    should provide a complete guide on how to set a custom resource table & mpm_config file & dts cmem.

    Best Regards,
    Yordan
  • Hi.

    There is no example in the SDK that uses DDR memory ( I mean K2H board).

    I found my purpose in big data IPC in RTOS SDK and load it to my board because it gave an error that pointed out to the resource table, as I comment it here!!!!  

  • Hi, Mahat,

    please refer to the following thread in which our DSP engineer listed what needs to be modified. However, it is on K2G platform, but should apply to K2H.

    e2e.ti.com/.../2662640

    Rex