{{WarningMessage|text=This application note was validated against specific versions of the kit only. It may not work with other versions. Supported versions are listed in the ''History'' section.}}
{{ImportantMessage|text=The implementation described in this document applies do the BELK/BXELK versions indicated in the [[#History|History]] section. For previous releases, please refer to [[AN-BELK-001:_Asymmetric_Multiprocessing_(AMP)_on_Bora_–_Linux_FreeRTOS|this page]].
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/BXELK 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]).
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 Xilinx implementation of 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, the 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 <code>bora-amp</code> machine:
<pre>
MACHINE = "bora-amp"
</pre>
Then build the <code>bora-image-devel</code> image as described [[Building_the_Yocto_BSP_(BELK/BXELK)#Running_the_build|here]].
=== Separated components build ===
==== Linux Kernel ====
To build Linux Kernel for AN-BELK-007 follow the instructions described [[Building_Linux_kernel_(BELK/BXELK)|here]] to setup the build environment and run the following commands in the source tree directory:
<pre>
make bora_defconfig
make UIMAGE_LOADADDR=0x10008000 uImage bora-amp.dtb
</pre>
==== Demo Applications ====
To build the AN-BELK-007 linux userspace demo applications run the following commands (the following is for the ''rpmsg-echo-test''):
Copy the ''echo_test'' executable binary into target rootfilesystem.
==== FreeRTOS Firmware ====
FreeRTOS Firmware for the AN-BELK-007 demos can be buildt starting from the BELK/BXELK Vivado project described [[Creating_and_building_example_Vivado_project_(BELK/BXELK)|here]], or from a custom BORA/BORAX Vivado project.
Follow these steps with the Vivado project already opened:
* launch the SDK session, clicking on File -> Launch SDK
* once the Xilinx SDK is ready, perform the following operations from the GUI:
** Click on ''File -> New -> Application Project''
** select the ''Project Name'': ''openamp_echo'' (or ''openamp_matrix_mult'' or ''openamp_rpc'' for the other demos)
** select ''OS Platform'': ''freertos901_xilinx''
** select ''Processor'': ''ps7_cortexa9_1''
** Click ''Next''
** Select ''Template'': ''OpenAMP echo-test'' (or ''OpenAMP matrix multiplication Demo'' or ''OpenAMP RPC Demo'' for the other demos)
** Click on ''Finish''
* On ''Project Explorer'' tab right click on the ''openamp_echo_bsp'' project and select ''Board Support Package Settings''
** under ''Overview -> freertos901_xilinx -> openamp'' set <code>WITH_PROXY</code> parameter to <code>FALSE</code> for echo and matrix demos, set to <code>TRUE</code> for proxy demo
** under ''drivers -> ps7_cortexa9_1'' add <code>-DUSE_AMP=1</code> to <code>extra_compiler_flags</code> parameter
** close settings by clicking ''OK'' button
* rebuild project by right clicking on the project name in ''Project Explorer'' and selecting first ''Clean Project'' and then ''Build Project''
* the FreeRTOS Firmware demo project (ELF file) is then built and available under the Debug directory of the project
* copy the ''openamp_echo.elf'' (or ''openamp_matrix_mult.elf'' or ''openamp_rpc.elf'' for the other demos) into the target root filesystem under the <code>/lib/firmware/</code> directory.
== Run AN-BELK-007 demos ==
The AN-BELK-007 demos can be executed on BELK/BXELK kit using the pre-built images release along with the kit, 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