@henrique.tx Thanks for the answers, I agree with your points here.
@chalu the whole question depends, at the end, on what you need to do and what are your timings requirements.
The RPMSG framework implements an easier way to communicate between the processors, it’s thread-safe, you can write and read, it’s ready to use and etc.
However, the whole framework that will be slower if you just need to share some memory area between the two processors. For example, if you need to write data with the MCU and just read with Linux, a simple code for the MCU could be:
#define SHARED_MEM_ADDRESS 0x8FF00000
void SharedMemTask(void *pvParameters)
uint32_t value = 0;
uint32_t *ddr_shared_mem = (uint32_t*)SHARED_MEM_ADDRESS;
// Print the initial banner
PRINTF("\r\nShared Memory Demo!\n\n\r");
PRINTF("Shared address: 0x%X\n\r",SHARED_MEM_ADDRESS);
PRINTF("Type r to show the contend of shared memory address (0x%X)\n\r",SHARED_MEM_ADDRESS);
PRINTF("Type w to write new value in the shared memory address (0x%X)\n\r",SHARED_MEM_ADDRESS);
PRINTF("\n\rYou can also write and read the shared memory from linux with devmem2 utility:\n\r");
PRINTF("READ: $devmem2 0x%X\n\r",SHARED_MEM_ADDRESS);
PRINTF("WRITE the value of 0xCC: $devmem2 0x%X w 0xCC\n\r",SHARED_MEM_ADDRESS);
// write 0xBB in the shared memory address
// First, get character
receiveBuff = GETCHAR();
case 'r' :
PRINTF("\r\n0x%X: 0x%X\n\r",SHARED_MEM_ADDRESS, *ddr_shared_mem);
case 'w' :
PRINTF("\r\nWrite a value for this register (in HEX): \n\r");
PRINTF("\r\nValue: 0x%X \n\r",value);
*ddr_shared_mem = value;
// Initialize demo application pins setting and clock setting.
// Create a demo task which will print the shared memory content.
xTaskCreate(SharedMemTask, "Print Task", configMINIMAL_STACK_SIZE,
NULL, tskIDLE_PRIORITY+1, NULL);
// Start FreeRTOS scheduler.
// Should never reach this point.
On linux, you reserve the memory address and read from it, as an example:
reg = <0x8FF00000 0x100000>;
So, for example, this removes all the overhead from the RPMSG framework but also introduces a lot of issues that you will need to deal with (threads, don’t write at the same time…). This is just a very simple example, not suitable for more complex scenarios.