Skip to main content
毅黄.1
Associate
February 7, 2022
Solved

M4 cannot read or write the memory address obtained from rpmsg-sdb

  • February 7, 2022
  • 3 replies
  • 1418 views

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.

This topic has been closed for replies.
Best answer by Kevin HUBER

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

3 replies

Kevin HUBER
Kevin HUBERBest answer
ST Employee
February 8, 2022

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

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
毅黄.1
毅黄.1Author
Associate
February 17, 2022