Introduction
Linux running on A53 core can load the fimrware to the remote cores. MCU M4F core incase of AM62X. Refer Linux Academy for AM62X for more details on how to boot the remotecores. This section explains how to add support for graceful shutdown on the remotecore.
Implementing graceful shutdown on remotecore
- When the following command is used on the Linux to shutdown the remotecore, an IPC message is send to the remote core before shutting it down.
echo stop > /sys/class/remoteproc/remoteproc0/state
- To receive and handle this IPC message, register a callback as shown below.
- On the callback unblock the RPMessage for all the RPMsg objects used in the code.
volatile uint8_t gbShutdown = 0u;
volatile uint8_t gbShutdownRemotecoreID = 0u;
void ipc_rp_mbox_callback(uint16_t remoteCoreId, uint16_t clientId, uint32_t msgValue, void *args)
{
{
{
gbShutdown = 1u;
gbShutdownRemotecoreID = remoteCoreId;
}
}
}
- On the main thread where the IPC is happening, break all the loops when gbShutdown == 1
while(1)
{
recvMsgSize = IPC_RPMESSAGE_MAX_MSG_SIZE;
recvMsg, &recvMsgSize,
&remoteCoreId, &remoteCoreEndPt,
if (gbShutdown == 1u)
{
break;
}
recvMsg, recvMsgSize,
remoteCoreId, remoteCoreEndPt,
}
- Then follow the below sequence to go to WFI
- Close all the dirvers used
- Send acknowledgement to Linux core that the core is ready for shutdown
- Deinit system (It will disable the interrupts and stops the tick timer)
- Go to WFI / IDLE
Drivers_close();
System_deinit();
__asm__ __volatile__ ("wfi" "\n\t": : : "memory");
This is implemented on IPC RP Message Linux Echo