How read data from rpmsg-sdb device with A7 of STM32MP157A-DK1?
Hi,
I'm using STM32MP157A-DK1 and I built the image adding the logicanalyser layer (https://github.com/STMicroelectronics/meta-st-stm32mpu-app-logicanalyser).
I follow the tutorial "How to exchange data buffers with the coprocessor".
I add the rpmsg_hdr code to send message from the M4 to the DDR memory.
The message is "Hello\r\n".
I would like to see this message with A7.
In the folder /dev there is the device rpmsg-sdb.
For the code I follow the section "rpmsg_sdb driver" of https://wiki.st.com/stm32mpu/wiki/How_to_exchange_data_buffers_with_the_coprocessor#cite_note-sdb-driver-2
I have no problem to open the file descritpor but when I use the command mmap occurs an error that I get with strerror(errno): "Invalid Argument".
This is the code:
void *buff0_id;
int fd;
size_t size;
int main(void)
{
printf("Hello OpenSTLinux World!\n");
size = 7;
fd = open("/dev/rpmsg-sdb", O_RDWR);
if(fd < 0)
{
printf("Error descriptor\n");
printf("%s\n", strerror(errno));
}
buff0_id = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
if(buff0_id == MAP_FAILED)
{
printf("Error map\n");
printf("%s\n", strerror(errno));
}
close(fd);
}What I get on terminal is:
Hello OpenSTLinux World!
Error map
Invalid Argument
I don't understand why it returns me this error.
Is it correct the way to communicate with the DDR memory?
Is there some code example used to manage the memory for the A7?
Thanks in advance.
Best Regards,
Andrea Segalla
