I have to address the topic ‘RPMSG uses char device driver’ again.
The solution stated in this Thread is that e.g. /dev/rpmsg_ctrl0 can be used to create an endpoint.
This then appears as device /dev/rpmsg0 … #.
With the firmware for the M4 specified in the thread, it should then react to a ‘write()’ from the user space, etc.
@nickvo uses a verdin-imx8mm board.
If the code works on this board, it should also work (adapted) on an imx8qm. Or am I wrong there?
How important is it that remoteproc is available? (I start the m4 code using the u-boot method. But I can also load the FW onto the M4 using the segger jlink and start it.)
The PingPong kernel module works. The ttyRPMSG example also works.
I can access the /dev/rpmsg0 via ‘ioctl(fd, RPMSG_CREATE_EPT_IOCTL, &ept_info);’ created. However, the m4 FW does not respond.
What are the requirements for the example to work?
At what point does the M4 FW have to be started?
Do I have to use the m4_0? I’m using m4_1.
How do your device tree and the full source code of the M4 look like? Did you add the right addresses for the shared memory? Unfortunately, we don’t have an overlay available yet for the Apalis iMX8QM but maybe you can find some inspiration by having a look at the Colibri iMX8X:
In order to test the connection, here is the code for a C console program … then executed in a Docker container.
I have to start the program twice and comment out the relevant parts, otherwise I will have access-/ permission-problems.
What if you change the RPMSG_LITE_NS_ANNOUNCE_STRING to “rpmsg-raw”? If I understand the chardev driver correctly it is expected to receive this string from the M4 and not “rpmsg-openamp-demo-channel-1”. The openamp demo is only for the ping pong example.
struct rpmsg_endpoint_info ept_info = {"rpmsg-raw", 0x2, 0x1f};
used here: ioctl(fd, RPMSG_CREATE_EPT_IOCTL, &ept_info); // /dev/rpmsg# created
Nothing has any effect.
a sequence from the rpmsg.h:
/**
* struct rpmsg_endpoint_info - endpoint info representation
* @name: name of service
* @src: local address. To set to RPMSG_ADDR_ANY if not used.
* @dst: destination address. To set to RPMSG_ADDR_ANY if not used.
*/
struct rpmsg_endpoint_info {
char name[32];
__u32 src;
__u32 dst;
};
in our case:
name: “rpmsg-raw”,
src: 0x2,
dst: 0x1f
How to know the value of src?
It’s poking in the fog.
…
I have to correct myself:
The: #define RPMSG_LITE_NS_ANNOUNCE_STRING "rpmsg-raw"
in the m4 apparently causes a character device (rpmsg0) to be created.
So I no longer have to do this in user space, but can use this device.
I need to do more tests.
But we are on the right track!
I tested today on the Cortex M4 0 and it works for me. I took the normal rpmsg_lite_str_echo_rtos demo, set the RPMSG_LITE_NS_ANNOUNCE_STRING to “rpmsg-raw” and then when I do:
echo hello > /dev/rpmsg0 && cat /dev/rpmsg0
I get hello in return.
The end point is already created when booting up. Maybe it’s important to know for understanding if you’re dealing with it for the first time.
Don’t want to be a wisenheimer …