H7 FW 1.11.0 openamp broken? Problem with openamp.c from 2023
Hi Guys,
So this is with a TouchGfx Cube v6.7.0 generated project with FW 1.11.0
I have added OpenAmp via Cube and based the code I am adding on the old PingPong example.
The following line fails with -2005 (RPMSG_ERR_BUFF_SIZE):
int32_t status = OPENAMP_create_endpoint(&rp_endpoint, RPMSG_SERVICE_NAME, RPMSG_ADDR_ANY, rpmsg_recv_callback, NULL);This is due to the metal_io_region being incorrect, physmap as far as I can see should be 0 but it is 939525120 (0x38000400).
This first image is the values in the working PingPong example:
The second image is in the non working code:
This can be tracked down to OPENAMP_shmem_init() in openamp.c.
In the working PingPong example openamp.c is from 2019 and we have:
static metal_phys_addr_t shm_physmap[] = { 0 };
.
.
.
metal_io_init(&device->regions[0], (void *)SHM_START_ADDRESS, shm_physmap,
SHM_SIZE, -1U, 0, NULL);
shm_io = metal_device_io_region(device, 0);The openamp.c from the cube project is from 2023 and in there we have:
static metal_phys_addr_t shm_physmap;
.
.
.
shm_physmap = SHM_START_ADDRESS;
metal_io_init(&device->regions[0], (void *)SHM_START_ADDRESS, &shm_physmap,
SHM_SIZE, -1, 0, NULL);
/* USER CODE BEGIN PRE_SHM_IO_INIT */
/* USER CODE END PRE_SHM_IO_INIT */
shm_io = metal_device_io_region(device, 0);That code to me looks wrong, if I change the code to:
shm_physmap = 0;
metal_io_init(&device->regions[0], (void *)SHM_START_ADDRESS, &shm_physmap,
SHM_SIZE, -1, 0, NULL);
/* USER CODE BEGIN PRE_SHM_IO_INIT */
/* USER CODE END PRE_SHM_IO_INIT */
shm_io = metal_device_io_region(device, 0);Now everything works, the call to OPENAMP_create_endpoint() now works.
I also have some other issues I am investigating that I will report here.