Difference between revisions of "DESK-MP1-L/Development/Asymmetric Multiprocessing (AMP) with OpenAMP"

From DAVE Developer's Wiki
Jump to: navigation, search
(Running the OpenAMP_TTY_echo example)
 
(One intermediate revision by the same user not shown)
Line 6: Line 6:
 
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white" |Notes
 
! style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white" |Notes
 
|-
 
|-
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000" |03/08/2023
+
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000" |2023/08/03
 
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000" |DESK-MP1-L-1.0.0 release
 
| style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000" |DESK-MP1-L-1.0.0 release
 
|-
 
|-
Line 14: Line 14:
 
<section begin="Body" />
 
<section begin="Body" />
  
==Introduction==
+
==Asymmetric Multiprocessing (AMP) with OpenAMP==
 
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 [https://en.wikipedia.org/wiki/Asymmetric_multiprocessing 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 [https://www.openampproject.org/ OpenAMP framework] is typically used to establish a [https://wiki.st.com/stm32mpu/wiki/Coprocessor_management_overview communication channel between the cores]. The [[DESK-MP1-L/Development/Building the Yocto BSP|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 <code>OpenAMP_TTY_echo</code>. This example is built when Yocto is run to generate the Linux root file system for the target.
 
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 [https://en.wikipedia.org/wiki/Asymmetric_multiprocessing 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 [https://www.openampproject.org/ OpenAMP framework] is typically used to establish a [https://wiki.st.com/stm32mpu/wiki/Coprocessor_management_overview communication channel between the cores]. The [[DESK-MP1-L/Development/Building the Yocto BSP|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 <code>OpenAMP_TTY_echo</code>. This example is built when Yocto is run to generate the Linux root file system for the target.
  
 
For more details, please see the [https://www.st.com/en/embedded-software/stm32cubemp1.html STM32CubeMP1 firmware] documentation and the associated [https://github.com/STMicroelectronics/STM32CubeMP1/tree/1.6.0/Projects/STM32MP157C-DK2/Applications/OpenAMP/OpenAMP_TTY_echo source code].
 
For more details, please see the [https://www.st.com/en/embedded-software/stm32cubemp1.html STM32CubeMP1 firmware] documentation and the associated [https://github.com/STMicroelectronics/STM32CubeMP1/tree/1.6.0/Projects/STM32MP157C-DK2/Applications/OpenAMP/OpenAMP_TTY_echo source code].
==Running the OpenAMP_TTY_echo example==
+
===Running the OpenAMP_TTY_echo example===
 
The example is automatically built by Yocto. To run it, please issue the following commands on the target's Linux console:
 
The example is automatically built by Yocto. To run it, please issue the following commands on the target's Linux console:
 
<pre class="board-terminal">
 
<pre class="board-terminal">

Latest revision as of 11:29, 8 January 2024

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.