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.

PROCESSOR-SDK-AM64X: Log from R5 to Linux on A53

Part Number: PROCESSOR-SDK-AM64X

Tool/software:

Hi All,

we have a FreeRTOS application on an R5 core together with Linux running on an A53 core. At the moment logs from the R5 core are written independently from the A53 through UART.

For production devices it is not possible for me to access these logs and it would be interesting to know if there is a way to write the R5 log messages to the Linux side and merge them with the logs there (which are stored for later use).

I have seen some information on shared memory logging, but only for FreeRTOS/NoRTOS cases. Maybe someone could point me to examples/infos on FreeRTOS to Linux logging, if there is any available?

Thank you and kind regards

Philip Kees

  • Hello Philip,

    When you say "logs", are you looking for a text file where diagnostic output can be saved? Or are you looking specifically for output that is routed to a UART port?

    Accessing the trace log from Linux

    You can access the trace log for a remote core (i.e., non-Linux core) from /sys/kernel/debug/remoteproc/remoteprocX/trace0. Like this:

    // let's see which remoteprocX is associated with which core
    // this can change each boot, so make sure to check "name" each time
    root@am64xx-evm:~# head /sys/class/remoteproc/remoteproc*/name
    ==> /sys/class/remoteproc/remoteproc0/name <==
    78000000.r5f
    
    ==> /sys/class/remoteproc/remoteproc1/name <==
    78200000.r5f
    
    ==> /sys/class/remoteproc/remoteproc10/name <==
    ...
    ==> /sys/class/remoteproc/remoteproc9/name <==
    30034000.pru
    
    // let's check the trace logs for R5F0_0
    // I expect to see the IPC RPMsg Echo demo
    root@am64xx-evm:~# cat /sys/kernel/debug/remoteproc/remoteproc0/trace0
    [r5f0-0]     0.000431s : [IPC RPMSG ECHO] Jul  8 2024 10:25:09
    [r5f0-0]     0.105724s : [IPC RPMSG ECHO] Remote Core waiting for messages at end point 13 ... !!!
    [r5f0-0]     0.105746s : [IPC RPMSG ECHO] Remote Core waiting for messages at end point 14 ... !!!
    [r5f0-0]     0.296727s : [IPC RPMSG ECHO] Message exchange started with RTOS cores !!!
    [r5f0-0]     5.045893s : [IPC RPMSG ECHO] All echoed messages received by main core from 4 remote cores !!!
    [r5f0-0]     5.045908s : [IPC RPMSG ECHO] Messages sent to each core = 100000
    [r5f0-0]     5.045919s : [IPC RPMSG ECHO] Number of remote cores = 4
    [r5f0-0]     5.045930s : [IPC RPMSG ECHO] Total execution time = 4749153 usecs
    [r5f0-0]     5.045945s : [IPC RPMSG ECHO] One way message latency = 5936 nsec
    

    You can find more information about enabling the memory log in the AM64x Academy:
    Multicore > Application Development on Remote Cores > Add Linux IPC to the remote core project
    https://dev.ti.com/tirex/explore/node?node=A__Ac4gvmV7H7iX5x.qB.hWZw__AM64-ACADEMY__WI1KRXP__LATEST

    You can find more information about changing the size of the trace log in the AM64x Academy:
    Multicore > Application Development on Remote Cores > Adding an empty resource table
    https://dev.ti.com/tirex/explore/node?node=A__AbHsVQIi8pUVEQOLKmXydQ__AM64-ACADEMY__WI1KRXP__LATEST

    Regards,

    Nick

  • Hi Nick, 

    sorry for my late response, we had some other issues that needed attention. I looked into the remoteproc trace log and it does look good to check if there were any issue during the initialization of the core. For this use case it will definetly help debugging.

    For the case where I want to continously want to log something it does not work since there seems to be no good way to handle the ringbuffer nature of the trace0 file. On the AM64X EVM we write those to a UART, but this is no option for debugging production devices

    We will propably look into writing logs via RpMsg from the R5 to Linux side, since we already use this in our application and could be implemented with not much effort.

    Thank you and kind regards
    Philip

  • Hello Philip,

    Your observations make sense to me. If timing and latency are not big concerns, and you just need to have a record of what the software is doing, RPMsg is the easiest "plug and play" IPC implementation between Linux and non-Linux cores.

    If you have followup questions, feel free to reply here (or create a new thread for a new topic).

    Regards,

    Nick