Part Number: TDA4VM
Tool/software:
Hello, experts
I want to test the IPC driver provided in the RTOS SDK on my J721E. However, during this process, I found that the program for testing IPC would be blocked when calling Sciclient_init, which prevented me from testing the IPC driver.
When testing the IPC driver, I hope to achieve the following functions:
mcu1_1(baremetal) sends a msg to mcu2_0(baremetal) through the IPC driver
In order to achieve the above-mentioned functions, I referred to 4.11.9.Writing HelloWorld App using IPCLLD
I also referred to the < PDK_INSTALL_PATH >/packages/ti/drv/ipc/examples/common/src/ipc_testsetup_baremetal.c file
I have respectively written two test codes, ipc_test_mcu1_1.c and ipc_test_mcu2_0.c, as follows:
/*
* ipc_test_mcu1_1.c
*/
#include <stdint.h>
#include <ti/board/board.h>
#include <ti/csl/tistdtypes.h>
#include <ti/drv/ipc/examples/common/src/ipc_setup.h>
#include <ti/drv/ipc/ipc.h>
#include <ti/drv/ipc/soc/V1/ipc_soc.h>
#include <ti/drv/sciclient/sciclient.h>
#include <ti/drv/uart/UART_stdio.h>
uint32_t virt2phy_func(const void *virtAddr) { return ((uint32_t)virtAddr); }
void *phy2virt_func(uint32_t phyAddr) {
uint32_t temp = phyAddr;
return ((void *)temp);
}
void newmsg_callback_func(uint32_t srcEndPt, uint32_t procId) { return; }
void uart_print(const char *str) {
UART_printf("%s", str);
return;
}
uint8_t vqBuf[VQ_BUF_SIZE]
__attribute__((section("my_ipc_data_buffer"), aligned(8)));
uint8_t selfBuf[RPMSG_DATA_SIZE]
__attribute__((section("my_ipc_data_buffer"), aligned(8)));
int main(void) {
Sciclient_ConfigPrms_t config;
Sciclient_configPrmsInit(&config);
Sciclient_init(&config);
Board_initCfg boardCfg;
boardCfg = BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_UART_STDIO;
Board_init(boardCfg);
UART_printf("IPC_echo_test mcu1_1\n");
uint32_t numProc = 1;
uint32_t pRemoteProcArray[] = {IPC_MCU2_0};
uint32_t selfProcId = IPC_MCU1_1;
uint32_t selfPt = 10;
uint32_t remotePt = 10;
uint32_t remoteProcId = IPC_MCU2_0;
Ipc_InitPrms initPrms;
Ipc_VirtIoParams vqParam;
/* Step1 : Initialize the multiproc */
if (IPC_SOK == Ipc_mpSetConfig(selfProcId, numProc, pRemoteProcArray)) {
UART_printf("IPC_echo_test (core : %s) .....\r\n", Ipc_mpGetSelfName());
/* Initialize params with defaults */
IpcInitPrms_init(0U, &initPrms);
initPrms.newMsgFxn = &newmsg_callback_func;
initPrms.virtToPhyFxn = &virt2phy_func;
initPrms.phyToVirtFxn = &phy2virt_func;
initPrms.printFxn = &uart_print;
if (IPC_SOK != Ipc_init(&initPrms)) {
return -1;
}
} else {
UART_printf("Ipc_mpSetConfig failed\n");
}
/* Step2 : Initialize Virtio */
vqParam.vqObjBaseAddr = (void *)vqBuf;
vqParam.vqBufSize = numProc * Ipc_getVqObjMemoryRequiredPerCore();
vqParam.vringBaseAddr = (void *)VRING_BASE_ADDRESS;
vqParam.vringBufSize = IPC_VRING_BUFFER_SIZE;
vqParam.timeoutCnt = 100; /* Wait for counts */
Ipc_initVirtIO(&vqParam);
/* Step 3: Initialize RPMessage */
RPMessage_Params selfRPMsgParam;
RPMessageParams_init(&selfRPMsgParam);
selfRPMsgParam.buf = selfBuf;
selfRPMsgParam.bufSize = RPMSG_DATA_SIZE;
selfRPMsgParam.stackBuffer = NULL;
selfRPMsgParam.stackSize = 0U;
selfRPMsgParam.requestedEndpt = remotePt;
RPMessage_init(&selfRPMsgParam);
RPMessage_Handle selfRPMsgHandle;
selfRPMsgHandle = RPMessage_create(&selfRPMsgParam, &selfPt);
char sendMsg[256] = "hello from mcu1_1";
uint32_t msgLen = strlen(sendMsg);
int32_t status = RPMessage_send(selfRPMsgHandle, remoteProcId, remotePt,
selfPt, (void *)sendMsg, msgLen);
if (status != IPC_SOK) {
UART_printf("Failed: RPMessage %s ----> %s\nMsg: %s\n", Ipc_mpGetSelfName(),
Ipc_mpGetName(remoteProcId), sendMsg);
} else {
UART_printf("Success: RPMessage %s ----> %s\nMsg: %s\n",
Ipc_mpGetSelfName(), Ipc_mpGetName(remoteProcId), sendMsg);
}
return (0);
}
/*
* ipc_test_mcu2_0.c
*/
#include <stdint.h>
#include <ti/board/board.h>
#include <ti/csl/tistdtypes.h>
#include <ti/drv/ipc/examples/common/src/ipc_setup.h>
#include <ti/drv/ipc/ipc.h>
#include <ti/drv/ipc/soc/V1/ipc_soc.h>
#include <ti/drv/sciclient/sciclient.h>
#include <ti/drv/uart/UART_stdio.h>
uint32_t virt2phy_func(const void *virtAddr) { return ((uint32_t)virtAddr); }
void *phy2virt_func(uint32_t phyAddr) {
uint32_t temp = phyAddr;
return ((void *)temp);
}
void newmsg_callback_func(uint32_t srcEndPt, uint32_t procId) { return; }
void uart_print(const char *str) {
UART_printf("%s", str);
return;
}
uint8_t vqBuf[VQ_BUF_SIZE]
__attribute__((section("my_ipc_data_buffer"), aligned(8)));
uint8_t selfBuf[RPMSG_DATA_SIZE]
__attribute__((section("my_ipc_data_buffer"), aligned(8)));
int main(void) {
Sciclient_ConfigPrms_t config;
Sciclient_configPrmsInit(&config);
Sciclient_init(&config);
Board_initCfg boardCfg;
boardCfg = BOARD_INIT_PINMUX_CONFIG | BOARD_INIT_UART_STDIO;
Board_init(boardCfg);
UART_printf("IPC_echo_test mcu2_0\n");
uint32_t numProc = 1;
uint32_t pRemoteProcArray[] = {IPC_MCU1_1};
uint32_t selfProcId = IPC_MCU2_0;
uint32_t selfPt = 10;
uint32_t remotePt = 10;
uint32_t remoteProcId = IPC_MCU1_1;
Ipc_InitPrms initPrms;
Ipc_VirtIoParams vqParam;
/* Step1 : Initialize the multiproc */
if (IPC_SOK == Ipc_mpSetConfig(selfProcId, numProc, pRemoteProcArray)) {
UART_printf("IPC_echo_test (core : %s) .....\r\n", Ipc_mpGetSelfName());
/* Initialize params with defaults */
IpcInitPrms_init(0U, &initPrms);
initPrms.newMsgFxn = &newmsg_callback_func;
initPrms.virtToPhyFxn = &virt2phy_func;
initPrms.phyToVirtFxn = &phy2virt_func;
initPrms.printFxn = &uart_print;
if (IPC_SOK != Ipc_init(&initPrms)) {
return -1;
}
} else {
UART_printf("Ipc_mpSetConfig failed\n");
}
/* Step2 : Initialize Virtio */
vqParam.vqObjBaseAddr = (void *)vqBuf;
vqParam.vqBufSize = numProc * Ipc_getVqObjMemoryRequiredPerCore();
vqParam.vringBaseAddr = (void *)VRING_BASE_ADDRESS;
vqParam.vringBufSize = IPC_VRING_BUFFER_SIZE;
vqParam.timeoutCnt = 100; /* Wait for counts */
Ipc_initVirtIO(&vqParam);
/* Step 3: Initialize RPMessage */
RPMessage_Params selfRPMsgParam;
RPMessageParams_init(&selfRPMsgParam);
selfRPMsgParam.buf = selfBuf;
selfRPMsgParam.bufSize = RPMSG_DATA_SIZE;
selfRPMsgParam.stackBuffer = NULL;
selfRPMsgParam.stackSize = 0U;
selfRPMsgParam.requestedEndpt = remotePt;
RPMessage_init(&selfRPMsgParam);
RPMessage_Handle selfRPMsgHandle;
selfRPMsgHandle = RPMessage_create(&selfRPMsgParam, &selfPt);
char recvMsg[256] = {0};
uint16_t msgLen = strlen(recvMsg);
int32_t status = RPMessage_recv(selfRPMsgHandle, recvMsg, &msgLen,
&remotePt, &remoteProcId, IPC_RPMESSAGE_TIMEOUT_FOREVER);
if (status != IPC_SOK) {
UART_printf("Failed: RPMessage %s <---- %s\nMsg: %s\n", Ipc_mpGetSelfName(),
Ipc_mpGetName(remoteProcId), recvMsg);
} else {
UART_printf("Success: RPMessage %s <---- %s\nMsg: %s\n",
Ipc_mpGetSelfName(), Ipc_mpGetName(remoteProcId), recvMsg);
}
return (0);
}
After successfully compiling the above code, I debugged the above code through CCS
The basic debugging process is:
1.Refer to EVM Setup for J721E to configure J721E
2.Refer to CCS Setup for J721E to successfully connect to J721E using CCS
3.Run the sciserver_testapp program in mcu1_0
4.Run the ipc_test_mcu2_0 program in mcu2_0
5.Run the ipc_test_mcu1_1 program on mcu1_1
During the debugging process, both ipc_test_mcu1_1 and ipc_test_mcu2_0 will be blocked in the Sciclient_init statement, causing the program to fail to execute normally
I want to ask the experts why my program is blocking to Sciclient_init?
How should I modify my program so that it can execute normally?
The version of SDK I'm using is:PROCESSOR-SDK-RTOS-J721E —10.00.00.05


