Skip to main content
TArre.1
Associate III
November 25, 2022
Question

STM32MP1 read SRAM3 memory on A7 core

  • November 25, 2022
  • 4 replies
  • 1645 views

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

This topic has been closed for replies.

4 replies

PatrickF
Technical Moderator
November 25, 2022

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 'Best Answer' on the reply which solved your issue or answered your question.Tip of the day: Try Sidekick STM32 AI agent
TArre.1
TArre.1Author
Associate III
November 25, 2022

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
Technical Moderator
November 25, 2022
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.Tip of the day: Try Sidekick STM32 AI agent
TArre.1
TArre.1Author
Associate III
November 25, 2022

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!

PatrickF
Technical Moderator
November 25, 2022

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 'Best Answer' on the reply which solved your issue or answered your question.Tip of the day: Try Sidekick STM32 AI agent
TArre.1
TArre.1Author
Associate III
November 28, 2022

I will try to do it with devmem2.

Thanks @PatrickF​ !