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.

  • Resolved

Linux: How to comms between DSP and Linux using the resource table on OMAPL138

Tool/software: Linux

Hi there, I am trying to create a design similar to the example shown in the IPC ipc_3_46_00_02

I have added the resource table file to the DSP app and I am able to run the ex02_messageq example.

I have installed the SDK 4.0.0.4 for Linux and also check the DTS filr for the CMA pool its set to 0xc3000000 and there are two buffers at location:

#define RPMSG_VRING0_DA 0xc3000000
#define RPMSG_VRING1_DA 0xc3004000

The problem I have is as follows:

The examples ex02 in the IPC disables the cache for location 0xc3000000 and the whole dsp application is located in the same heap. I want to use cache for DSP app and would like to create a new heap just for IPC comms.

I have modified the resource table with the following:

#define DATA_DA1                0xc5000000

#ifndef DATA_SIZE
# define DATA_SIZE (SZ_1M * 15)
#endif

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;

/* data carveout entry */
struct fw_rsc_carveout data_cout;

/* data carveout entry */
struct fw_rsc_carveout data_cout1;

/* trace entry */
struct fw_rsc_trace trace;
};
extern char xdc_runtime_SysMin_Module_State_0_outbuf__A;
#define TRACEBUFADDR (UInt32)&xdc_runtime_SysMin_Module_State_0_outbuf__A
#define TRACEBUFSIZE 0x8000

#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 */
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, data_cout),
offsetof(struct my_resource_table, data_cout1),
offsetof(struct my_resource_table, trace),
},

/* rpmsg vdev entry */
{
TYPE_VDEV, VIRTIO_ID_RPMSG, 0,
RPMSG_DSP_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_CARVEOUT, DATA_DA, DATA_DA, DATA_SIZE, 0, 0, "DSP_MEM_DATA",
},

{
TYPE_CARVEOUT, DATA_DA1, DATA_DA1, DATA_SIZE, 0, 0, "DSP_MEM_DATA1",
},

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

That's added extra TYPE_CARVEOUT with address 0xc5000000

and also made similar changes in the DTS Linux file:

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

dsp_cma_pool: dsp_cma@c3000000 {
compatible = "shared-dma-pool";
reg = <0xc3000000 0x1000000>;
reusable;
status = "okay";
};
dsp_cma_pool1: dsp_cma_ipc@c5000000 {
compatible = "shared-dma-pool";
reg = <0xc5000000 0x1000000>;
reusable;
status = "okay";
};

};

In the DSP.cfg I have also added :

var Cache = xdc.useModule('ti.sysbios.family.c64p.Cache');
Cache.MAR192_223 = 0x00000008;

to enable cache only for 0xc3000000 for DSP app and disabled cache for rest (0xc5000000).

When trying to boot DSP from remoteproc I get the following error:

root@omapl138-lcdk:/sys/bus/platform/drivers/davinci-rproc# echo davinci-rproc.0 > bind
davinci-rproc davinci-rproc.0: assigned reserved memory node dsp_cma@c3000000
remoteproc remoteproc0: dsp is available
root@omapl138-lcdk:/sys/bus/platform/drivers/davinci-rproc# remoteproc remoteproc0: powering up dsp
remoteproc remoteproc0: Booting fw image rproc-dsp-fw, size 5604612
davinci-rproc davinci-rproc.0: failed to allocate dma memory: len 0xf00000
remoteproc remoteproc0: Failed to process resources: -12

All I want to do is:

* Implement some heap buffer to be used to comms between DSP and Linux using MessageQ.

Thanks in advance.

  • Hi there, one more thing I don't understand is
    If I change the CMA Pool in DTS Linux to 0xC4000000 and also change the resource table addresses to 0xc4.. rather than 0xc3.. ANd when I boot DSP from remoteproc then are no errors as expected! however, it doesn't seems to run the app on the DSP!!!

    Now this I can't understand!!!
  • In reply to Mitesh Hiran:

    Hi,

    We're looking into this.
    Note that feedback will be delayed because of the holidays.

    Best Regards,
    Yordan

     


     Please make sure you read the forum guidelines first.

  • In reply to Yordan Kovachev:

    Hi, Mitesh,

    The CMA allocation are done through DMA API, and only a single pool can be tied to a device. You have 2 carved out areas, but both will be from the same CMA pool which is why remoteproc complains not being able to allocate that 15MB space.

    Rex

     

  • In reply to Rex Chang:

    Hi Rex, thanks for your reply.

    Okay. What about just changing the default resource table code to address 0xc4000000 rather than 0xc3000000

    and making similar chnages in the DTS file for the CMA pool to 0xc4000000

    it still doesn't boot DSP sw.

  • In reply to Mitesh Hiran:

    One more thing, I don't understand Rex,
    * If the resource table VRING is at 0xc3000000 address and the CMA pool is of 16MB from 0xc3000000 does the DSP app entry point have to be at around 0xc3000000 address?
  • In reply to Mitesh Hiran:

    Hi Mitesh,

    You also need to make the corresponding changes to the table in config.bld. Can you verify that you've done this? If so, what does it look like?

    Regards,
    Sahin

    Sahin Okur
    Applications Engineer

  • In reply to Sahin Okur:

    Hi Sahin,

    No, I have not made any changes to the config.bld file

    Could you let me know what needs to be added and what is this file for.

    Thanks.

  • In reply to Sahin Okur:

    On top of the config.bld file it says "/* THIS IS A GENERATED FILE -- DO NOT EDIT */"
  • In reply to Mitesh Hiran:

    Hi Mitesh,

    The config.bld file defines the memory layout for the DSP and needs to match what is in the resource table. For example, in your resource table since you have:

    #define DATA_DA1 0xc5000000 and #define DATA_SIZE (SZ_1M * 15)

    In config.bld, change base: 0xC3100000, len: 0x800000 to base: 0xc5000000, len: 0xF00000 


    The config.bld file for this messageQ example can be found in ipc_3_46_02_04\examples\OMAPL138_linux_elf\ex02_messageq\dsp

    You can refer to this wiki for more info on the config.bld file: processors.wiki.ti.com/.../Config_bld_basics

    Also, have you set Resource.customTable config parameter to true? (see processors.wiki.ti.com/.../IPC_Resource_customTable )

    Regards,
    Sahin


    Sahin Okur
    Applications Engineer

  • In reply to Sahin Okur:

    Hi Sahin, yes I had added this in the cfg file.

    /* Override the default resource table with my own */
    var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
    Resource.customTable = true;

    Attached config.bld file from my current project design.

    0652.config.txt

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.