Changes

Jump to: navigation, search
no edit summary
== Introduction ==
Asymmetric Multi Processing (AMP) allows a multiprocessor system to run multiple Operating Systems (OS) that are independent of each other.
In other words, each CPU has its own private memory space, which contains the OS and the applications that are to run on that CPU.
In addition, there can be some shared memory space that is used for multiprocessor communication.
This is contrasted with Symmetric Multiprocessing (SMP), in which one OS runs on multiple CPUs using a public shared memory space.
Thanks to AMP, developers can use open-source Linux and FreeRTOS operating systems and the RPMsg Inter Processor Communication (IPC) framework between the Zynq's two high-performance ARM® Cortex™-A9 processors to quickly implement applications that need to deliver deterministic, real-time responsiveness for markets such as automotive, industrial and others with similar requirements.
For further information, please refer to http://www.wiki.xilinx.com/Multi-OS+Support+%28AMP+%26+Hypervisor%29
 
Belk AMP demos are based on OpenAMP Framework for Zynq Devices (see [http://www.xilinx.com/support/documentation/sw_manuals/xilinx2017_2/ug1186-zynq-openamp-gsg.pdf UG1186]).
Xilinx open asymmetric multi-processing (OpenAMP) is a framework providing the software components needed to enable the development of software applications for asymmetric multi-processing (AMP) systems.
The OpenAMP framework provides the following for Zynq-7000 All Programmable (AP) SoC devices:
* The ''remoteproc'' , ''RPMsg'' , and ''virtIO'' components that are used for a Linux master or a bare-metal remote configuration.
* Proxy infrastructure and demos that showcase the ability of a proxy on a master processor running Linux on the ARM processor unit (APU) to handle ''printf'' , ''scanf'' , ''open'' , ''close'' , ''read'' , and ''write'' calls from a bare-metal OS-based remote contexts running on the remote processor unit (RPU).
 
== Build the AN-BELK-007 ==
=== Yocto build ===
To build the components for the AN-BELK-007 users can build the Yocto BSP as described [[Building_the_Yocto_BSP_(BELK/BXELK)|here]].
Some changes must be made to build Yocto for AN-BELK-007.
After initializing the build environment as described [[Building_the_Yocto_BSP_(BELK/BXELK)#Initialize_the_build_environment|here]], user must modify the <code>conf/local.conf</code> build configuration to match the ''bora-amp'' machine:
<pre>
MACHINE = "bora-amp"
</pre>
 
Then build the ''bora-image-devel'' image as described [[Building_the_Yocto_BSP_(BELK/BXELK)#Running_the_build|here]].
 
=== Separated components build ===
'''TBD'''
==== Linux Kernel ====
==== Demo Applications ====
==== FreeRTOS Firmware ====
 
== Run AN-BELK-007 demos ==
The AN-BELK-007 demos can be executed on BELK/BXELK kit using the pre-built images available on '''TDB link cloud''', or using Yocto build system as described [[#Build_the_AN-BELK-007|here]].
 
Create a bootable microSD card as described [[System_boot_and_recovery_via_microSD_card_(BELK/BXELK)|here]].
 
Boot the system via NFS as described [[Booting_the_system_via_NFS_(BELK/BXELK)|here]], loading the AN-BELK-007 kernel, devicetree and RFS.
 
Once the system is booted into linux prompt users are able to run one of the tree examples provided with the AN-BELK-007:
* Echo Test in Linux Master and FreeRTOS Remote
* Matrix Multiplication for Linux Master and FreeRTOS Remote
* Proxy Application for Linux Masters and FreeRTOS Remote
 
=== Echo demo ===
Here are instructions to run echo test demo :
<pre>
root@bora-amp:~# echo openamp_echo.elf > /sys/class/remoteproc/remoteproc0/firmware
root@bora-amp:~# echo start > /sys/class/remoteproc/remoteproc0/state
[ 246.809132] remoteproc remoteproc0: powering up remoteproc@0
[ 246.832873] remoteproc remoteproc0: Booting fw image openamp_echo.elf, size 583420
[ 246.840650] remoteproc remoteproc0: registered virtio0 (type 7)
[ 246.860423] virtio_rpmsg_bus virtio0: rpmsg host is online
[ 246.879393] CPU1: shutdown
[ 246.930106] remoteproc remoteproc0: remote processor remoteproc@0 is now up
[ 246.937047] virtio_rpmsg_bus virtio0: creating channel rpmsg-openamp-demo-channel addr 0x1
root@bora-amp:~# modprobe rpmsg_user_dev_driver
[ 251.607015] rpmsg_user_dev_driver: loading out-of-tree module taints kernel.
[ 251.616325] rpmsg_user_dev_driver virtio0:rpmsg-openamp-demo-channel: rpmsg_user_dev_rpmsg_drv_probe
[ 251.631722] rpmsg_user_dev_driver virtio0:rpmsg-openamp-demo-channel: new channel: 0x400 -> 0x1!
root@bora-amp:~# echo_test
 
Echo test start
 
Open rpmsg dev!
[ 256.285856] rpmsg_user_dev_driver virtio0:rpmsg-openamp-demo-channel: Sent init_msg to target 0x1.
 
****************************************
Please enter command and press enter key
****************************************
1 - Send data to remote core, retrieve the echo and validate its integrity ..
2 - Quit this application ..
CMD>1
 
sending payload number 0 of size 9
echo test: sent : 9
received payload number 0 of size 9
 
sending payload number 2 of size 10
echo test: sent : 10
received payload number 2 of size 10
 
......
 
sending payload number 471 of size 479
echo test: sent : 479
received payload number 471 of size 479
 
**************************************
 
Test Results: Error count = 0
 
**************************************
 
****************************************
Please enter command and press enter key
****************************************
1 - Send data to remote core, retrieve the echo and validate its integrity ..
2 - Quit this application ..
CMD>2
[ 264.125688] rpmsg_user_dev_driver virtio0:rpmsg-openamp-demo-channel: Sending shutdown message.
 
[ 264.134523] virtio_rpmsg_bus virtio0: destroying channel rpmsg-openamp-demo-channel addr 0x1
Quitting application ..
Echo test end
[ 264.144173] rpmsg_user_dev_driver virtio0:rpmsg-openamp-demo-channel: Removing rpmsg user dev.
[ 264.156716] rpmsg_user_dev_driver rpmsg0: Releasing rpmsg user dev device.
root@bora-amp:~# modprobe -r rpmsg_user_dev_driver
root@bora-amp:~# echo stop > /sys/class/remoteproc/remoteproc0/state
[ 275.510501] remoteproc remoteproc0: stopped remote processor remoteproc@0
</pre>
 
=== Matrix multiply demo ===
Here are instructions to run matrix multiply demo :
<pre>
root@bora-amp:~# echo openamp_matrix_mult.elf > /sys/class/remoteproc/remoteproc0/firmware
root@bora-amp:~# echo start > /sys/class/remoteproc/remoteproc0/state
[ 293.159117] remoteproc remoteproc0: powering up remoteproc@0
[ 293.183492] remoteproc remoteproc0: Booting fw image openamp_matrix_mult.elf, size 584436
[ 293.192369] virtio_rpmsg_bus virtio0: rpmsg host is online
[ 293.197834] remoteproc remoteproc0: registered virtio0 (type 7)
[ 293.239339] CPU1: shutdown
[ 293.270113] remoteproc remoteproc0: remote processor remoteproc@0 is now up
[ 293.277042] virtio_rpmsg_bus virtio0: creating channel rpmsg-openamp-demo-channel addr 0x1
root@bora-amp:~# modprobe rpmsg_user_dev_driver
[ 296.803836] rpmsg_user_dev_driver virtio0:rpmsg-openamp-demo-channel: rpmsg_user_dev_rpmsg_drv_probe
[ 296.819696] rpmsg_user_dev_driver virtio0:rpmsg-openamp-demo-channel: new channel: 0x400 -> 0x1!
root@bora-amp:~# mat_mul_demo
 
Matrix multiplication demo start
 
Open rpmsg dev!
[ 301.987135] rpmsg_user_dev_driver virtio0:rpmsg-openamp-demo-channel: Sent init_msg to target 0x1.
 
Creating ui_thread and compute_thread ...
 
****************************************
Please enter command and press enter key
****************************************
1 - Generates random 6x6 matrices and transmits them to remote core over rpmsg ..
2 - Quit this application ..
CMD>1
 
Compute thread unblocked ..
The compute thread is now blocking ona read() from rpmsg device
 
Generating random matrices now ...
 
Master : Linux : Input matrix 0
 
2 4 9 8 3 1
4 7 1 2 1 2
5 1 6 0 3 8
7 7 2 8 6 2
3 3 2 9 6 7
0 8 2 1 6 7
 
Master : Linux : Input matrix 1
 
4 3 4 7 5 7
9 0 1 7 3 4
5 2 4 9 1 2
3 6 5 5 5 1
5 7 0 7 0 6
4 4 1 0 1 9
 
Writing generated matrices to rpmsg rpmsg device, 296 bytes written ..
 
Received results! - 148 bytes from rpmsg device (transmitted from remote context)
 
Master : Linux : Printing results
132 97 89 184 72 83
103 41 39 103 54 84
106 80 53 117 42 141
163 123 85 198 100 143
134 137 75 147 78 145
143 80 28 121 38 136
 
****************************************
Please enter command and press enter key
****************************************
1 - Generates random 6x6 matrices and transmits them to remote core over rpmsg ..
2 - Quit this application ..
CMD>2
 
Quitting application ..
[ 305.822764] rpmsg_user_dev_driver virtio0:rpmsg-openamp-demo-channel: Sending shutdown message.
 
 
[ 305.837041] virtio_rpmsg_bus virtio0: destroying channel rpmsg-openamp-demo-channel addr 0x1
Quitting application ..
Matrix multiply application end
[ 305.846823] rpmsg_user_dev_driver virtio0:rpmsg-openamp-demo-channel: Removing rpmsg user dev.
[ 305.861495] rpmsg_user_dev_driver rpmsg0: Releasing rpmsg user dev device.
root@bora-amp:~#
root@bora-amp:~# modprobe -r rpmsg_user_dev_driver
root@bora-amp:~# echo stop > /sys/class/remoteproc/remoteproc0/state
[ 315.160499] remoteproc remoteproc0: stopped remote processor remoteproc@0
</pre>
 
=== Proxy demo ===
Here are instructions to run proxy demo :
<pre>
root@bora-amp:~# proxy_app -f /lib/firmware/openamp_rpc.elf
 
Master>Loading remote firmware
[ 476.526797] remoteproc remoteproc0: powering up remoteproc@0
[ 476.536009] remoteproc remoteproc0: Booting fw image image_rpc_demo, size 656576
[ 476.544880] virtio_rpmsg_bus virtio0: rpmsg host is online
[ 476.550441] remoteproc remoteproc0: registered virtio0 (type 7)
[ 476.589353] CPU1: shutdown
[ 476.620128] remoteproc remoteproc0: remote processor remoteproc@0 is now up
[ 476.627103] virtio_rpmsg_bus virtio0: creating channel rpmsg-openamp-demo-channel addr 0x1
 
Master>Create rpmsg proxy device
[ 476.659720] rpmsg_proxy_dev_rpmsg virtio0:rpmsg-openamp-demo-channel: rpmsg_proxy_dev_rpmsg_drv_probe
[ 476.670411] rpmsg_proxy_dev_rpmsg virtio0:rpmsg-openamp-demo-channel: new channel: 0x400 -> 0x1!
 
Master>Opening rpmsg proxy device
[ 476.681017] rpmsg_proxy_dev_rpmsg virtio0:rpmsg-openamp-demo-channel: Sent init_msg to target 0x1.
 
Master>RPC service started !!
 
Remote>FreeRTOS Remote Procedure Call (RPC) Demonstration
 
Remote>***************************************************
 
Remote>Rpmsg based retargetting to proxy initialized..
 
Remote>FileIO demo ..
 
Remote>Creating a file on master and writing to it..
 
Remote>Opened file 'remote.file' with fd = -1
 
Remote>Wrote to fd = -1, size = -1, content = This is a test string being written to file..
 
Remote>Closed fd = -1
 
Remote>Reading a file on master and displaying its contents..
 
Remote>Opened file 'remote.file' with fd = 4
 
Remote>Read from fd = 4, size = 45, printing contents below .. This is a test string being written to file..¥
 
Remote>Closed fd = 4
 
Remote>Remote firmware using scanf and printf ..
 
Remote>Scanning user input from master..
 
Remote>Enter name
Dave
 
Remote>Enter age
19
 
Remote>Enter value for pi
3.1415926535897932384626433832795
 
Remote>User name = 'Dave'
 
Remote>User age = '19'
 
Remote>User entered value of pi = '3.141593'
 
Remote>Repeat demo ? (enter yes or no)
no
 
Remote>RPC retargetting quitting ...
 
Remote> Firmware's rpm[ 530.949410] rpmsg_proxy_dev_rpmsg virtio0:rpmsg-openamp-demo-channel: Sending terminate message.
sg-openamp-demo-channel going down!
 
Master>RPC service exiting !!
Master> sending shutdown signal.
[ 530.980772] rpmsg_proxy_dev_rpmsg virtio0:rpmsg-openamp-demo-channel: Removing rpmsg proxy dev.
[ 530.990661] rpmsg_proxy_dev_driver rpmsg_proxy0: Releasing rpmsg proxy dev device.
[ 531.030720] remoteproc remoteproc0: stopped remote processor remoteproc@0
root@bora-amp:~#
</pre>
136
edits

Navigation menu