M4 cannot read or write the memory address obtained from rpmsg-sdb
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-07 1:46 AM
Hi,
I follow the tutorial "How to exchange data buffers with the coprocessor".
Unfortunately, my board doesn't run the tutorial directly.
I read the code "stm32_rpmsg_sdb.c","backend.c","main.c" and modified it slightly. Now M4 can receive the address sent by rpmsg-sdb, but when M4 writes directly to this address, it will enter"void HardFault_Handler(void)",also cannot read the correct data.
I modified the code of "stm32_rpmsg_sdb.c" to test whether the applied memory can be used. After successfully applying for memory, data was written and correctly read in app, indicating that memory allocation and mapping should have been successful.
Can M4 read and write the memory allocated from rpMSG-sdb directly?
Or can you only use DMA to copy M4 memory into the requested memory?
Thanks in advance.
Solved! Go to Solution.
- Labels:
-
STM32MP15 Lines
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-08 8:00 AM
Hello @毅 黄​ ,
When you say "and modified it slightly.", Can I know what are your changes?
Because the code must work directly without modifying the source code.
Normally the only things to update are:
- your DT file to correctly defines the shared-dma-pool and reserved memory area.
- The DTS of TF-A to define in the node ETZPC, the isolation of each peripheral
You can see examples in the DTS provided with the LogicAnalyser.
To answer your question, theoretically, it can be possible to access directly to the memory allocated from rpmsg-sdb by using the M4, but it is not recommended. You have to be sure that M4 can access to the DDR area by looking at the ETZPC configuration in your TF-a DT.
If you read directly with M4, you will have:
- Bad performance because the M4 doesn't have a cache which will be way slower than by using the DMA. The M4 waits until each DDR access is completed before resume, which will have a huge impact on the M4 performance.
- You may pollute the allocated area which would disrupt the DMAs to work nicely.
That's why it is recommended to use the DMA to access to this memory.
Regards,
Kévin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-08 8:00 AM
Hello @毅 黄​ ,
When you say "and modified it slightly.", Can I know what are your changes?
Because the code must work directly without modifying the source code.
Normally the only things to update are:
- your DT file to correctly defines the shared-dma-pool and reserved memory area.
- The DTS of TF-A to define in the node ETZPC, the isolation of each peripheral
You can see examples in the DTS provided with the LogicAnalyser.
To answer your question, theoretically, it can be possible to access directly to the memory allocated from rpmsg-sdb by using the M4, but it is not recommended. You have to be sure that M4 can access to the DDR area by looking at the ETZPC configuration in your TF-a DT.
If you read directly with M4, you will have:
- Bad performance because the M4 doesn't have a cache which will be way slower than by using the DMA. The M4 waits until each DDR access is completed before resume, which will have a huge impact on the M4 performance.
- You may pollute the allocated area which would disrupt the DMAs to work nicely.
That's why it is recommended to use the DMA to access to this memory.
Regards,
Kévin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-17 8:11 AM
Hello @Kevin HUBER
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-02-17 8:12 AM
Hello @Kevin HUBER
Thank you for your reply
My board does not have LCD, so I cannot run the program "How to Exchange data Buffers with the Coprocessor "directly, so I need to modify part of the code.
At present, A7 has actually transferred the address to M4, and the data received by SPI in M4 has been written into DDR through DMA, which can meet my requirements.
After I tried to modify the device tree of TF-A, I still could not read and write DDR directly. Thank you for telling me about the disadvantages of reading and writing DDR directly, maybe using DMA is the best way for me.
Thank you again for
