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.

AM625: void ipc_recv_task_main(void *args); 极耗处理器时间,有办法改进程序快速处理吗?

Part Number: AM625

void USER_PROGRAM_task(void *arg) {
// 用户程序代码
TimerP_Params timerParams;
uint32_t count=0;

DebugP_log("USER PROGRAM START running---\r\n");

while(1)
{
main_loop_count++;
if(main_loop_count>5000000)
{
main_loop_count=0;
// DebugP_log("Timer0_count = %d \r\n", TimerP_getCount(timer0BaseAddr));
DebugP_log("USER PROGRAM is running--- %d \r\n",count++);
// vTaskDelay(1);
}
}

如果   vTaskDelay(1); 不执行,独占 M4 ,while 循环能达到每秒上千万次

执行 vTaskDelay(1),while 循环只能达到 每秒 1 千多次

说明void ipc_recv_task_main(void *args) ; 极耗处理器时间,有办法改进程序快速处理吗?

创建了 2 个 task

#if ((defined (SOC_AM62X) || defined (SOC_AM62AX)) && defined(CONFIG_UART_NUM_INSTANCES))
if( IpcNotify_getSelfCoreId() == gMcuCoreID )
{
/* create task to monitor MCU uart to wakeup main domain. */
// lpm_create_wakeup_task();
}
#endif

/* create message receive tasks, these tasks always run and never exit */
ipc_rpmsg_create_recv_tasks();

ipc_rpmsg_create_user_program_task();

  • void ipc_recv_task_main(void *args)
    {
    int32_t status;
    char recvMsg[IPC_RPMESSAGE_MAX_MSG_SIZE+1]; /* +1 for NULL char in worst case */
    uint16_t recvMsgSize, remoteCoreId;
    uint32_t remoteCoreEndPt;
    RPMessage_Object *pRpmsgObj = (RPMessage_Object *)args;

    DebugP_log("[IPC RPMSG ECHO] Remote Core waiting for messages at end point %d ... !!!\r\n",
    RPMessage_getLocalEndPt(pRpmsgObj)
    );

    /* wait for messages forever in a loop */
    while(1)
    {
    /* set 'recvMsgSize' to size of recv buffer,
    * after return `recvMsgSize` contains actual size of valid data in recv buffer
    */
    recvMsgSize = IPC_RPMESSAGE_MAX_MSG_SIZE;
    status = RPMessage_recv(pRpmsgObj,
    recvMsg, &recvMsgSize,
    &remoteCoreId, &remoteCoreEndPt,
    SystemP_WAIT_FOREVER);

    if (gbShutdown == 1u)
    {
    // break;
    }

    if (gbSuspended == 1u)
    {
    // continue;
    }

    DebugP_assert(status==SystemP_SUCCESS);

    /* echo the same message string as reply */
    #if 0 /* not logging this so that this does not add to the latency of message exchange */
    recvMsg[recvMsgSize] = 0; /* add a NULL char at the end of message */
    DebugP_log("%s\r\n", recvMsg);
    #endif

    /* send ack to sender CPU at the sender end point */
    status = RPMessage_send(
    recvMsg, recvMsgSize,
    remoteCoreId, remoteCoreEndPt,
    RPMessage_getLocalEndPt(pRpmsgObj),
    SystemP_WAIT_FOREVER);
    DebugP_assert(status==SystemP_SUCCESS);
    }

  • if (gbSuspended == 1u)
    {
    // continue;             <-------不能注释掉
    }

  • 非常感谢分享解决办法!