Part Number: PROCESSOR-SDK-OMAPL138
Other Parts Discussed in Thread: OMAPL138, OMAP-L138, DA8XX
Hi Support,
I am experiencing some issues regarding IPC communication between ARM & DSP on the OMAPL138 SoM.
The Issue:
The ARM is running Linux and acts as the host in the IPC communication. The DSP is running SYS/BIOS and acts as the slave in the IPC communication.
From Linux I control the DSP with Remoteproc & RPmsg.
I understand that in order for the IPC communication to work the "LAD/IPC Daemon" is required to run?
When I do "Ipc_start()" in my ARM application the LAD outputs:"NameServer_attach: connect failed: procId=1, errno=22 (Invalid argument)".
This error occurs if I start the DSP application both after and before the ARM application.
FAQ:
I've read through the FAQ's at https://software-dl.ti.com/processor-sdk-rtos/esd/docs/latest/rtos/index_Foundational_Components.html#ipc-training
- Failure to load the slave image. If the a slave executable fails to load, the sockets to communicate with it are not created. Make sure the slaves you need to communicate with are already loaded.
- Failure to provide the correct KERNEL_INSTALL_DIR when building the user-side IPC libraries. Some customers reported this error when using Linux 3.9+ kernels (where the AF_MAX value in socket.h has increased). This created a mismatch in what AF_RPMSG was set to in user libs and the kernel, and the connect call failed. The solution was to require users set KERNEL_INSTALL_DIR when building the user-space libraries so IPC can interrogate the kernel version and set AF_RPMSG appropriately.
- Failure to configure the slave image correctly. Internally, the slave-side MessageQ transport (TransportRpmsg) broadcasts its availability to the Linux host. If this broadcast doesn’t occur (e.g., b/c the slave wasn’t configured with TransportRpmsg), the socket connection will fail with error 22.
- General slave-to-host interrupt failure. Some devices (e.g. DRA7XX) have interrupt crossbars that must be configured correctly as part of system boot (e.g. uboot). If these crossbars aren’t initialized correctly, the slave-side broadcast that TransportRpmsg is available won’t be received, the underlying socket connection won’t be available, and the first sign of failure will be LAD trying to connect to the socket.
I am certain that the slave image runs when I load firmware into the DSP with remoteproc as I am writing to various shared memory locations in the DSP firmware. I have confirmed this using "devmem" in Linux.
Additionally, I have loaded the "RPMSG_PROTO" module and confirmed that the AF_RPMSG value is the same in my Linux kernel build and IPC library build.
With regards to the last two scenarios, I do not know how to verify that the DSP is configured correctly with Transport Rpmsg. I suspect that it has something to do with the configuration script (.cfg) file and my resource table?
I have attached my cfg file, resource table, DSP memory map & LAD Daemon log.
[0.696236]
Initializing LAD... [0.707983]
opening FIFO: /tmp/LAD/LADCMDS
[9.093058] Retrieving command...
[9.096121]
LAD_CONNECT:
[9.096309] client FIFO name = /tmp/LAD/849
[9.096427] client PID = 849
[9.096523] assigned client handle = 0
[9.097035] FIFO /tmp/LAD/849 created
[9.097593]
WARN: Client /tmp/LAD/849 has not yet opened, will retry
[9.098990]
WARN: Client /tmp/LAD/849 has not yet opened, will retry
[9.101604]
WARN: Client /tmp/LAD/849 has not yet opened, will retry
[9.102376]
WARN: Client /tmp/LAD/849 has not yet opened, will retry
[9.103579] FIFO /tmp/LAD/849 opened for writing
[9.104062] sent response
[9.104205] DONE
[9.104307] Retrieving command...
[9.105905] Sending response...
[9.106194] Retrieving command...
[9.107103] LAD_MULTIPROC_GETCONFIG: calling MultiProc_getConfig()...
[9.107363] MultiProc_getConfig() - 2 procs
[9.107492] # processors in cluster: 2
[9.107582] cluster baseId: 0
[9.107665] ProcId 0 - "HOST"
[9.107753] ProcId 1 - "DSP"
[9.107840] status = 0
[9.107922] DONE
[9.107997] Sending response...
[9.108821] Retrieving command...
[9.109113] LAD_NAMESERVER_SETUP: calling NameServer_setup()...
[9.109305] NameServer_setup: entered, refCount=0
[9.109566] NameServer_setup: creating listener thread
[9.110574] NameServer_setup: exiting, refCount=1
[9.110967] status = 0
[9.111109] DONE
[9.111209] Sending response...
[9.111862] Retrieving command...
[9.112162] LAD_MESSAGEQ_GETCONFIG: calling MessageQ_getConfig()...
[9.112304] status = 0
[9.112411] DONE
[9.112503] Sending response...
[9.113152] Retrieving command...
[9.113453] LAD_MESSAGEQ_SETUP: calling MessageQ_setup()...
[9.113601] MessageQ_setup: entered, refCount=0
[9.113713] NameServer_create(): 'MessageQ'
[9.114027] MessageQ_setup: exiting, refCount=1
[9.114177] status = 0
[9.114283] DONE
[9.114372] Sending response...
[9.117043] listener_cb: Entered Listener thread.
[9.117285] NameServer: waiting for unblockFd: 1, and socks: maxfd: 1
[9.117576] Retrieving command...
[9.117848] NameServer_attach: --> procId=1, refCount=0
[9.118153] NameServer_attach: created send socket: 5, procId 1
[9.118498] NameServer_attach: connect failed: procId=1, errno=22 (Invalid argument)
[9.118771] closing send socket: 5
[9.118999] NameServer_attach: <-- refCount=0, status=-1
[9.119136] Sending response...
[9.122363] Retrieving command...
[9.122672] NameServer_attach: --> procId=1, refCount=0
[9.122926] NameServer_attach: created send socket: 5, procId 1
[9.123117] NameServer_attach: connect failed: procId=1, errno=22 (Invalid argument)
[9.123305] closing send socket: 5
[9.123525] NameServer_attach: <-- refCount=0, status=-1
[9.123664] Sending response...
[9.128105] Retrieving command...
[9.139783] LAD_MESSAGEQ_CREATE: calling MessageQ_create(0x1f798, 0x1f7b8)...
[9.139980] MessageQ_create: creating 'dspsystem'
[9.140133] MessageQ_create: returning obj=0x239d8, qid=0x80
[9.140254] status = 0
[9.140349] DONE
[9.140433] Sending response...
[9.140586] Retrieving command...
[9.142020] LAD_MESSAGEQ_ANNOUNCE: calling MessageQ_announce(0x1f798, 0x239d8)...
[9.142217] MessageQ_announce: announcing 0x239d8
[9.142381] NameServer_add: Entered key: 'dspsystem', data: 0x80
[9.142515] status = 0
[9.142614] DONE
[9.142699] Sending response...
[9.142850] Retrieving command...
/*
* ======== rsc_table_omapl138.h ========
*
* Include this table in each base image, which is read from remoteproc on
* host side.
*
*/
#ifndef _RSC_TABLE_OMAPL138_H_
#define _RSC_TABLE_OMAPL138_H_
#include "rsc_types.h"
/* DSP Memory Map */
#define L3_CBA_RAM_BASE (0x80000000)
#define IRAM_BASE (0x11800000)
#define DSP_MEM_DATA (0xc6100000)
#define STREAMING_DATA (0xc7030000)
#define DSP_MEM_IPC_DATA (0xc6800000)
#define DSP_MEM_IPC_VRING (0xc6000000)
#define DSP_MEM_RPMSG_VRING0 (0xc6000000)
#define DSP_MEM_RPMSG_VRING1 (0xc6004000)
#define DSP_MEM_VRING_BUFS0 (0xc6040000)
#define DSP_MEM_VRING_BUFS1 (0xc6080000)
#define RPMSG_VRING_ADDR_ANY FW_RSC_ADDR_ANY
/* Sizes */
#define L3_CBA_RAM_SIZE (0x20000)
#define IRAM_SIZE (0x20000)
#define STREAMING_DATA_SIZE (0x600000)
#define TRACEBUFSIZE (0x20000)
#define DSP_MEM_DATA_SIZE (SZ_1M * 15)
// #define DSP_MEM_IPC_VRING_SIZE (SZ_1M * 1)
// #define DSP_MEM_IPC_DATA_SIZE (SZ_1M * 1)
#define DSP_MEM_IPC_VRING_SIZE (0x8000)
#define DSP_MEM_IPC_DATA_SIZE (0x8000)
/*
* The following values need to match Linux side device tree reserved
* memory region start address for specific processor core.
* The addresses are used to create mmu entry for IPC vrings and buffers
*/
#if defined (VAYU_DSP_1)
#define PHYS_MEM_IPC_VRING 0x99000000
#elif defined (VAYU_DSP_2)
#define PHYS_MEM_IPC_VRING 0x9F000000
#endif
/*
* 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
/* flip up bits whose indices represent features we support */
#define RPMSG_DSP_FEATURES 1
/* Amount of rsc table entries */
#define NUM_RSC_ENTRIES 7
struct my_resource_table {
struct resource_table base;
UInt32 offset[NUM_RSC_ENTRIES];
/* rpmsg vdev entry */
struct fw_rsc_vdev rpmsg_vdev;
struct fw_rsc_vdev_vring rpmsg_vring0;
struct fw_rsc_vdev_vring rpmsg_vring1;
/* ipcdata carveout entry */
struct fw_rsc_carveout ipcdata_cout;
/* data carveout entry */
struct fw_rsc_carveout data_cout;
/* iram carveout entry */
struct fw_rsc_carveout iram_cout;
/* shared mem carveout entry */
struct fw_rsc_carveout sm;
/* streaming data carveout entry */
struct fw_rsc_carveout streaming_data_cout;
/* trace entry */
struct fw_rsc_trace trace;
/* devmem entry */
// struct fw_rsc_devmem devmem0;
};
/* Add trace buffer information to the resource table */
extern char * xdc_runtime_SysMin_Module_State_0_outbuf__A;
#define TRACEBUFADDR (UInt32)&xdc_runtime_SysMin_Module_State_0_outbuf__A
#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 */
NUM_RSC_ENTRIES, /* 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, ipcdata_cout),
offsetof(struct my_resource_table, data_cout),
offsetof(struct my_resource_table, iram_cout),
offsetof(struct my_resource_table, streaming_data_cout),
offsetof(struct my_resource_table, sm),
offsetof(struct my_resource_table, trace),
// offsetof(struct my_resource_table, devmem0),
},
/* rpmsg vdev entry */
{
TYPE_VDEV, VIRTIO_ID_RPMSG, 0,
RPMSG_DSP_FEATURES, 0, 0, 0, 2, { 0, 0 },
/* no config data */
},
/* the two vrings */
{ DSP_MEM_RPMSG_VRING0, 4096, RPMSG_VQ0_SIZE, 1, 0 },
{ DSP_MEM_RPMSG_VRING1, 4096, RPMSG_VQ1_SIZE, 2, 0 },
{
TYPE_CARVEOUT,
DSP_MEM_IPC_DATA, 0,
DSP_MEM_IPC_DATA_SIZE, 0, 0, "DSP_MEM_IPC_DATA",
},
{
TYPE_CARVEOUT,
DSP_MEM_DATA, DSP_MEM_DATA,
DSP_MEM_DATA_SIZE, 0, 0, "DSP_MEM_DATA",
},
{
TYPE_CARVEOUT,
IRAM_BASE, IRAM_BASE,
IRAM_SIZE, 0, 0, "IRAM",
},
{
TYPE_CARVEOUT,
L3_CBA_RAM_BASE, L3_CBA_RAM_BASE,
L3_CBA_RAM_SIZE, 0, 0, "SHARED_MEM",
},
{
TYPE_CARVEOUT,
STREAMING_DATA, STREAMING_DATA,
STREAMING_DATA_SIZE, 0, 0, "STREAMING_DATA",
},
{
TYPE_TRACE,
TRACEBUFADDR,
TRACEBUFSIZE, 0, "trace:dsp",
},
// {
// TYPE_DEVMEM,
// DSP_MEM_IPC_VRING, DSP_MEM_IPC_VRING,
// DSP_MEM_IPC_VRING_SIZE, 0, 0, "DSP_MEM_IPC_VRING",
// },
};
#endif /* _RSC_TABLE_OMAPL138_H_ */
Tools:
- SYS/BIOS 6_76_03_01
- IPC 3_50_04_08
- XDCTOOLS 3_55_02_22_core
- Linux 4.19
Thank you & Regards,
Kim