Hello @TArre.1,
I do not think we have a complete example of A7 code to read rmpsgs, but you are on the right track !
Indeed, in the context of a userspace application (in C or C++ for example), you will use file descriptor exactly like you did on your screenshot.
For an application, a good idea would be the next one:
- Having one main thread that will manage your main application loop, and the rpmsg that you send from A7 to M4.
- Having one other loop thread that will be used to receive all the messages in a read blocking loop, and will then take different actions at reception step depending on the message you receive (in a first step, you can just print your message, but I imagine that further you will develop your own communication protocol etc...)
Some attention point:
- Open you file descriptor once, before creating the second thread and use the reference of this fd to read and write. Of course you cannot open it twice, that is why you need to pass this reference.
- Stay coherent between buffer max size of M4 and A7 cortex
- Later, when you will begin to take some actions after a message reception, be careful to concurrent access (mutex will be useful there).
- Put in place a way to go out your reading loop thread properly when you want to stop your program, close the file descriptor and join your parallel thread to stop everything gracefully (of course) :).
If you have some trouble to develop your application, I will be glad to help you. Make a first try by yourself and come back to me if you face troubles :)
Kind regards,
Erwan.