2020-03-08 01:25 PM
Hi, I'm currently porting OpenAMP virtio to Arduino platform:
https://github.com/stm32duino/Arduino_Core_STM32/pull/766
I would like to share one thing about the OpenAMP examples in CubeMP1.
Here is the implementation of MAILBOX_Poll:
int MAILBOX_Poll(struct virtio_device *vdev)
{
/* If we got an interrupt, ask for the corresponding virtqueue processing */
int ret = -1;
/* USER CODE BEGIN PRE_MAILBOX_POLL */
/* USER CODE END PRE_MAILBOX_POLL */
if (msg_received_ch1 == RX_BUF_FREE) {
/* USER CODE BEGIN MSG_CHANNEL1 */
/* USER CODE END MSG_CHANNEL1 */
OPENAMP_log_dbg("Running virt0 (ch_1 buf free)\r\n");
rproc_virtio_notified(vdev, VRING0_ID);
msg_received_ch1 = RX_NO_MSG;
ret = 0;
}
if (msg_received_ch2 == RX_NEW_MSG) {
/* USER CODE BEGIN MSG_CHANNEL2 */
/* USER CODE END MSG_CHANNEL2 */
OPENAMP_log_dbg("Running virt1 (ch_2 new msg)\r\n");
rproc_virtio_notified(vdev, VRING1_ID);
msg_received_ch2 = RX_NO_MSG;
/* The OpenAMP framework does not notify for free buf: do it here */
rproc_virtio_notified(NULL, VRING1_ID);
ret = 0;
}
I found a weird piece of code:
/* The OpenAMP framework does not notify for free buf: do it here */
rproc_virtio_notified(NULL, VRING1_ID);
Because rproc_virtio_notified(NULL) essentially do nothing because rproc_virtio_notified() will return a error code -EINVAL :
int rproc_virtio_notified(struct virtio_device *vdev, uint32_t notifyid)
{
unsigned int num_vrings, i;
struct virtio_vring_info *vring_info;
struct virtqueue *vq;
if (!vdev)
return -EINVAL;
/* We do nothing for vdev notification in this implementation */
if (vdev->index == notifyid)
return 0;
num_vrings = vdev->vrings_num;
for (i = 0; i < num_vrings; i++) {
vring_info = &vdev->vrings_info[i];
if (vring_info->notifyid == notifyid ||
notifyid == RSC_NOTIFY_ID_ANY) {
vq = vring_info->vq;
virtqueue_notification(vq);
}
}
return 0;
}
Could anyone tell me any reasons to suggest people using this line from the examples? I believe that this line should be considered as a bug.
Thank you,
Bumsik Kim.
Solved! Go to Solution.
2020-03-11 03:29 AM
2020-03-09 06:12 AM
Hello Bumsik,
Thanks for pointing out these lines.
We have to crosscheck but this looks to me legacy code from a previous implementation, that as not been cleaned.
Regards
Arnaud P
2020-03-09 07:20 PM
Thanks for reply. Please crosscheck, the line gave me an impression that I might need to put another parameters while I was porting it.
2020-03-11 03:29 AM
I confirm, we will fix this internally
Thanks for the feedback
2020-03-11 08:02 AM
Thank you for confirming it!
2020-03-13 08:45 PM
@Bumsik Kim -- what is the status on your port? I am attempting to get the powerSTEP01 IHM03A1 running on the DK2 (stm32mp1), and am very interested in being able to open /dev/ttyRPMSGx for bidirectional communication with the M4. I pulled the latest stm32 arduino core, and have selected the DK2, and am able to run a few examples, but the arduino examples I have used do not create the RPMSG connection. The openAMP demo works fine, so I am wondering what is involved in creating the port under arduino and using it.
Thanks in advance for any info you can provide. If you would like any assistance on the port I would be happy to chip in.
2020-03-13 08:57 PM
You can see the current status here: https://github.com/stm32duino/Arduino_Core_STM32/pull/766
So the port is completed and will be merged in a few days to the master branch. However, you will have to wait for an official v1.9.0 release to use the port out-of-the-box.
If you want to try this right now, go to "Getting Started" section of the README of stm32 to work with my kbumsik/virtio repository. https://github.com/stm32duino/Arduino_Core_STM32
Here is the full description on how to use the port: https://github.com/kbumsik/Arduino_Core_STM32/tree/3b88ae207b3186a1769b84fff60f116109f759bf/variants/STM32MP157_DK
2020-03-13 09:23 PM
Excellent response!
I will definitely check it out.
Any ideas on schedule for 1.9.0?
2020-03-13 09:25 PM
I'm not sure, but I guess it will be soon enough because the last v1.8.0 is December.