OPENAMP framework, initialize UART in seperate c file on DK2
Hello,
I have started to use the OPENAMP framework, especially with the CubeMX generated file openamp.h to communicate between the A7 and M4.
The example DK2_TIMER1_OpenAmp_Solution works fine, but unfortunately the CubeMX generates all the initialization of the OPENAMP framework in the main.c . Equivalent to the DK2_Timer1 example is also the following example on github:
Within my project, I would like to move the OPENAMP stuff into a separate c-file. However, when doing this I experienced a re-initialization of the rpmsg_virtio_device *rvdev e.g. rpmsg_endpoint ept. This resulted into a linux kernel crash on the A7 when too many endpoints are created ...
Even though, as I can see in the directory structure, the file
Middlewares/Third_Party/OpenAMP/virtual_driver/virt_uart.h
does include the "openamp.h" and respectively uses functions from this CubeMX generated file. This confuses me a bit?
1st question: why is Middlewares/Third_Party/OpenAMP/virtual_driver/virt_uart.h not independent from the DK2_TIMER1_OpenAmp_Soluttion/Src/openamp.c ?
virt_uart.c for instance includes the VIRT_UART_Init( *huart ) initialization which is called from the main.c ?!
2nd question: where does the Middlewares/Third_Party/OpenAMP/virtual_driver/virt_uart.c/h come from? from ST? What is the intention of placing this into Middleware?
3rd question: Is it possible to keep the CubeMX initialization of the OPENAMP framework in the main.c:
MX_OPENAMP_Init(RPMSG_REMOTE, NULL);and put any other function, like the UART device initialization and especially:
OPENAMP_check_for_message();into a different c file?
4th question: Is there a possibility not to poll the mbox device, like:
void OPENAMP_check_for_message(void)
{
MAILBOX_Poll(rvdev.vdev);
}-> but instead is it possible, such that the A7 generates an interrupt on the M4, but only when a message is sent from the A7 processor to the M4, to start the routine for parsing the message?
