cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP1 read SRAM3 memory on A7 core

TArre.1
Associate III

Hi!

I am using STM32MP157C-DK2 board and I want to share memory between to processor. My idea is to update variable in the M4 core and then read it in the A7 core (linux). To do this, I create a section in SRAM3 (both cores can access) and save the variable in it:

STM32MP157CACX_RAM.ld

/* MODIFICATION STARTS HERE */

.buffer(NOLOAD) :

{

. = ALIGN (1);

. = ABSOLUTE (0x10041000);

*(.TxBuffer)

} > SRAM3_ipc_shm

I am using STM32MP157C-DK2 board and I want to share memory between to processor. My idea is to update variable in the M4 core and then read it in the A7 core (linux). To do this, I create a section in SRAM3 (both cores can access) and save the variable in it:

STM32MP157CACX_RAM.ld

/* MODIFICATION STARTS HERE */

.buffer(NOLOAD) :

{

. = ALIGN (1);

. = ABSOLUTE (0x10041000);

*(.TxBuffer)

} > SRAM3_ipc_shm

Main.c

uint8_t x[4] __attribute__ ((section(".TxBuffer"), used));

I have debugged and checked that the variable is saved in the section memory.

Now I am trying to read this on Linux side but I am not getting it.

Can someone help me?

Thanks!

Telmo

6 REPLIES 6
PatrickF
ST Employee

Hi @TArre.1​ 

Linux user application are using virtual addressing. I'm not sure it is a good idea to try to access an absolute address.

This is devoted to Linux kernel and drivers.

We recommend to use RPMsg/OpenAMP for sharing information between Linux and Cortex-M4 coprocessor.

Please refer to https://wiki.st.com/stm32mpu/wiki/Exchanging_buffers_with_the_coprocessor

There is some examples available and running on STM32MP157C-DK2 starter Package.

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
TArre.1
Associate III

Hi @PatrickF​ 

Thank you for your answear.

I can share data using RPMsg/OpenAMP. Now I'm trying to see if there is another way to share data, such as accessing memory instead of sending the information.

My idea is to write to the M4 core and then read it to the A7 core. I see that the SRAM space is shared between the processor:

0693W00000WJVTAQA5.pngCan I use this part of the memory to share data?

Regards.

PatrickF
ST Employee

Hi,

what you want to do seems to fit into:

https://wiki.st.com/stm32mpu/wiki/Exchanging_buffers_with_the_coprocessor#Indirect_buffer_exchange_mode

0693W00000WJVXlQAP.png 

Regards,

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
TArre.1
Associate III

Hi @PatrickF​ 

Do you know how to read memory on Linux side? I can write in the memory on M4 side but I can´t read it on A7.

Thanks!

I'm not SW expert, but I guess a Linux application does have access only to its owned memory assigned somewhere by the kernel. You can't access absolute address (Kernel setting of MMU will likely block that)

To read absolute address you probably need to build a driver.

For debugging, you could use sysfs applications like devmem2, but not guaranteed to work on SRAMs.

This is why I think best is to use existing mechanisms like RPMsg. This will be more portable for future Linux evolution.

Regards,

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

I will try to do it with devmem2.

Thanks @PatrickF​ !