Skip to main content
Visitor II
November 12, 2020
Question

How to do the synchronization between A7 and M4 using IPCC interrupt?

  • November 12, 2020
  • 7 replies
  • 2178 views

I would syncrhonize A7 and M4 on STM32MP151A using IPCC interrupt, how can I do it?

Moreover, using FreeRTOS, I need to start some task before of MX_OPENAMP_Init, but I noticed if I move this function after the Kernel starting, it doesn't work. I don't understand why?

    This topic has been closed for replies.

    7 replies

    Technical Moderator
    November 17, 2020

    Have you tried to use OpenAMP examples provided inside the STM32Cube_FW_MP1 software package release? (Application/OpenAMP). Some examples are given to exercise FreeRTOS and OpenAMP which initialises/configures IPCC events.

    Here's the entrypoint. https://wiki.st.com/stm32mpu/wiki/STM32CubeMP1_Package

    GNapo.1Author
    Visitor II
    November 20, 2020

    Hi Olivier,

    thank you for the response.

    I looked to entrypoint but it doesn't resolve my troubles. Due to in Openamp init the rproc_virtio_wait_remote_ready is blocking until Linux wakes up and due to some functionalities need to start before of Linux, I would manage the init of library in a separate task while another task containing the cited functionalities runs without waiting Linux.

    I noticed that I moved the openamp initialization when Linux starts this task is blocked on waiting yet while the others starts fine, but I don't understand the reason of that. Is it possible that starting the FreeRTOS kernel before the OpenAmp init then it changes some memory areas where M4 expects to read the status from A7? How can I do it?

    Technical Moderator
    November 20, 2020

    ​Hi GNapo.1 (Community Member)

    It seems that your are experiencing a similar issue as described in the following post:

    https://community.st.com/s/question/0D53W000004l5HJ/openamp-hangs-at-mxopenampinit-when-started-from-uboot-even-after-waited-for-linux-to-fully-booted-up

    Could you please have a look at it and let me know if it solves your problem?

    Best Regards,

    Olivier

    GNapo.1Author
    Visitor II
    November 24, 2020

    Hi Oliver,

    thank again. I saw the post but resource table is found, but investigating I noticed that in the MX_OPENAMP_Init function it returns -1 after executing

    vdev = rproc_virtio_create_vdev(RPMsgRole, VDEV_ID, &rsc_table->vdev,

                     rsc_io, NULL, MAILBOX_Notify, NULL);

     if (vdev == NULL)

     {

      return -1;

     }

    It is strange because the function seems is not able to allocate dynamically vdev. How it is possible?

    I have scheduled the MX_OPENAMP_Init inside StartDefaultTask

     defaultTaskHandle = osThreadNew(StartDefaultTask, NULL,NULL);

    Best Regards,

    Giuseppe

    GNapo.1Author
    Visitor II
    November 30, 2020

    Hi @OlivierK​ ,

    do you have news for about that?

    Thank you in advance.

    King Regards

    Technical Moderator
    December 2, 2020

    ​Hi GNapo.1 (Community Member),

    I am not able to reproduce. It seems your having an issue during the memory allocation . Have you tried to increase the heap/stack config sizes?

    Kind Regards.

    GNapo.1Author
    Visitor II
    December 2, 2020

    Hi Olivier,

    thanks.

    Do you mean heap\stack of FreeRtos or in linker file of M4?

    King Regards.

    Technical Moderator
    December 2, 2020

    ​Hi GNapo.1 (Community Member)

    The problem may come from the allocated shared memory for OPENAMP defined in the linker file.

    MEMORY

    {

    m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000298

    m_text (RX) : ORIGIN = 0x10000000, LENGTH = 0x00020000

    m_data (RW) : ORIGIN = 0x10020000, LENGTH = 0x00020000

    m_ipc_shm (RW) : ORIGIN = 0x10040000, LENGTH = 0x00008000

    }

    As in the OpenAMP_FreeRTOS_echo example, can you make sure you haven't modified this?

    Kind Regards

    GNapo.1Author
    Visitor II
    December 3, 2020

    Hi @OlivierK​ ,

    this is my linker file

    /* Highest address of the user mode stack */

    _estack = 0x10040000;  /* end of RAM */

    _Min_Heap_Size = 0x200 ; /* required amount of heap */

    _Min_Stack_Size = 0x400 ; /* required amount of stack */

    /* Memories definition */

    MEMORY

    {

     m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000298

     m_text    (RX) : ORIGIN = 0x10000000, LENGTH = 0x00020000

     m_data    (RW) : ORIGIN = 0x10020000, LENGTH = 0x00020000

     m_ipc_shm  (RW) : ORIGIN = 0x10040000, LENGTH = 0x00008000

    }

     /* Symbols needed for OpenAMP to enable rpmsg */

    __OPENAMP_region_start__ = ORIGIN(m_ipc_shm);

    __OPENAMP_region_end__ = ORIGIN(m_ipc_shm)+LENGTH(m_ipc_shm);

    Today I will try to increase the heap\stack size as you said in the previous response. I will give you a feedback.

    King Regards.