2022-11-25 01:53 AM
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
2022-11-25 02:18 AM
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.
2022-11-25 02:44 AM
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:
Can I use this part of the memory to share data?
Regards.
2022-11-25 02:55 AM
Hi,
what you want to do seems to fit into:
Regards,
2022-11-25 03:01 AM
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!
2022-11-25 03:09 AM
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,
2022-11-28 05:18 AM
I will try to do it with devmem2.
Thanks @PatrickF !