DESK-MP1-L/Development/Asymmetric Multiprocessing (AMP) with OpenAMP

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes
2023/08/03 DESK-MP1-L-1.0.0 release



Asymmetric Multiprocessing (AMP) with OpenAMP[edit | edit source]

As known, the STM32MP115x SoC is powered by a heterogeneous architecture comprising a single/dual ARM Cortex-A7 (CA7) and an ARM Cortex-M4 (CM4). When the application requires implementing an Asymmetric Multiprocessing configuration (AMP), the most common scenario is to use Linux on the CA7, and bare metal or RTOS-based firmware on the CM4. In either case, the OpenAMP framework is typically used to establish a communication channel between the cores. The Yocto build system at the heart of the DESK-MP1-L provides some examples based on OpenAMP to demonstrate how to set up AMP configurations. The following section illustrates one of them, namely OpenAMP_TTY_echo. This example is built when Yocto is run to generate the Linux root file system for the target.

For more details, please see the STM32CubeMP1 firmware documentation and the associated source code.

Running the OpenAMP_TTY_echo example[edit | edit source]

The example is automatically built by Yocto. To run it, please issue the following commands on the target's Linux console:

root@desk-mp1:~# cp /usr/local/Cube-M4-examples/STM32MP157C-DK2/Applications/OpenAMP/OpenAMP_TTY_echo/lib/firmware/OpenAMP_TTY_echo.elf /lib/firmware/
root@desk-mp1:~# echo -n OpenAMP_TTY_echo.elf  > /sys/class/remoteproc/remoteproc0/firmware
root@desk-mp1:~# echo start >/sys/class/remoteproc/remoteproc0/state
root@desk-mp1:~# dmesg | tail -n 8
[   69.935241] remoteproc remoteproc0: powering up m4
[   69.940260] remoteproc remoteproc0: Booting fw image OpenAMP_TTY_echo.elf, size 219192
[   69.947843]  remoteproc0#vdev0buffer: assigned reserved memory node vdev0buffer@10042000
[   69.957458] virtio_rpmsg_bus virtio0: creating channel rpmsg-tty addr 0x400
[   69.964031] virtio_rpmsg_bus virtio0: rpmsg host is online
[   69.968816]  remoteproc0#vdev0buffer: registered virtio0 (type 7)
[   69.976364] remoteproc remoteproc0: remote processor m4 is now up
[   69.981515] virtio_rpmsg_bus virtio0: creating channel rpmsg-tty addr 0x401
root@desk-mp1:~# stty -onlcr -echo -F /dev/ttyRPMSG0
root@desk-mp1:~# cat /dev/ttyRPMSG0 &
root@desk-mp1:~# echo "Hello Virtual UART0" > /dev/ttyRPMSG0
Hello Virtual UART0
root@desk-mp1:~# cat /sys/class/remoteproc/remoteproc0/state
running

To stop the demo:

root@desk-mp1:~# echo stop > /sys/class/remoteproc/remoteproc0/state
[  104.989459] remoteproc remoteproc0: warning: remote FW shutdown without ack
[1]+  Done                       cat /dev/ttyRPMSG0
root@desk-mp1:~# cat /sys/class/remoteproc/remoteproc0/state
offline
root@desk-mp1:~#

It is worth remembering that it is also possible to start the CM4 firmware before the Linux kernel is started.