This repository is the home for the Open Asymmetric Multi Processing (OpenAMP) framework project. The OpenAMP framework provides software components that enable development of software applications for Asymmetric Multiprocessing (AMP) systems. The framework provides the following key capabilities.
OpenAMP library libopen_amp is composed of the following directories in lib/
:
virtio/
rpmsg/
remoteproc/
proxy/
OpenAMP system/machine support has been moved to libmetal, the system/machine layer in the apps/
directory is for system application initialization, and resource table definition.
Here are the libmetal APIs used by OpenAMP, if you want to port OpenAMP for your system, you will need to implement the following libmetal APIs in the libmetal's lib/system/<SYS>
directory:
lib/system/generic/
)Please refer to lib/system/generic
when you port libmetal for your system.
If you a different compiler to GNU gcc, please refer to lib/compiler/gcc/
to port libmetal for your compiler. At the moment, OpenAMP needs the atomic operations defined in lib/compiler/gcc/atomic.h
.
OpenAMP uses CMake for library and demonstration application compilation. OpenAMP requires libmetal library. For now, you will need to download and compile libmetal library separately before you compiling OpenAMP library. In future, we will try to make libmetal as a submodule to OpenAMP to make this flow easier.
Some Cmake options are available to allow user to customize to the OpenAMP library for it project:
The Zephyr open-amp repo implements the open-amp library for the Zephyr project. It is mainly a fork of this repository, with some add-ons for integration in the Zephyr project. The standard way to compile OpenAMP for a Zephyr project is to use Zephyr build environment. Please refer to Zephyr OpenAMP samples for examples and Zephyr documentation for the build process.
build libmetal library on your host as follows:
``` $ mkdir -p build-libmetal $ cd build-libmetal $ cmake <libmetal_source> $ make VERBOSE=1 DESTDIR=<libmetal_install> install ```
$ mkdir -p build-openamp $ cd build-openamp $ cmake <openamp_source> -DCMAKE_INCLUDE_PATH=<libmetal_built_include_dir> \ -DCMAKE_LIBRARY_PATH=<libmetal_built_lib_dir> [-DWITH_APPS=ON] $ make VERBOSE=1 DESTDIR=$(pwd) installThe OpenAMP library will be generated to
build/usr/local/lib
directory, headers will be generated to build/usr/local/include
directory, and the applications executable will be generated to build/usr/local/bin
directory.-DWITH_APPS=ON
is to build the demonstration applications.-DWITH_APPS=ON
to build the demos, you can try them on your Linux host as follows:$ sudo LD_LIBRARY_PATH=<openamp_built>/usr/local/lib:<libmetal_built>/usr/local/lib \ build/usr/local/bin/rpmsg-echo-shared
$ sudo LD_LIBRARY_PATH=<openamp_built>/usr/local/lib:<libmetal_built>/usr/local/lib \ build/usr/local/bin/rpmsg-echo-ping-shared 1 ```
$ sudo LD_LIBRARY_PATH=<openamp_built>/usr/local/lib:<libmetal_built>/usr/local/lib \ build/usr/local/bin/rpmsg-nocopy-echo-shared
$ sudo LD_LIBRARY_PATH=<openamp_built>/usr/local/lib:<libmetal_built>/usr/local/lib \ build/usr/local/bin/rpmsg-nocopy-ping-shared 1 ```
Create your on cmake toolchain file to compile libmetal for your generic (baremetal) platform. Here is the example of the toolchain file:
``` set (CMAKE_SYSTEM_PROCESSOR "arm" CACHE STRING "") set (MACHINE "zynqmp_r5" CACHE STRING "")
set (CROSS_PREFIX "armr5-none-eabi-" CACHE STRING "") set (CMAKE_C_FLAGS "-mfloat-abi=soft -mcpu=cortex-r5 -Wall -Werror -Wextra \ -flto -Os -I/ws/xsdk/r5_0_bsp/psu_cortexr5_0/include" CACHE STRING "")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto") SET(CMAKE_AR "gcc-ar" CACHE STRING "") SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>") SET(CMAKE_C_ARCHIVE_FINISH true)
include (cross-generic-gcc) ```
Compile libmetal library:
``` $ mkdir -p build-libmetal $ cd build-libmetal $ cmake <libmetal_source> -DCMAKE_TOOLCHAIN_FILE=<toolchain_file> $ make VERBOSE=1 DESTDIR=<libmetal_install> install ```
Create your on cmake toolchain file to compile openamp for your generic (baremetal) platform. Here is the example of the toolchain file: ``` set (CMAKE_SYSTEM_PROCESSOR "arm" CACHE STRING "") set (MACHINE "zynqmp_r5" CACHE STRING "") set (CROSS_PREFIX "armr5-none-eabi-" CACHE STRING "") set (CMAKE_C_FLAGS "-mfloat-abi=soft -mcpu=cortex-r5 -Os -flto \ -I/ws/libmetal-r5-generic/usr/local/include \ -I/ws/xsdk/r5_0_bsp/psu_cortexr5_0/include" CACHE STRING "") set (CMAKE_ASM_FLAGS "-mfloat-abi=soft -mcpu=cortex-r5" CACHE STRING "") set (PLATFORM_LIB_DEPS "-lxil -lc -lm" CACHE STRING "") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto") SET(CMAKE_AR "gcc-ar" CACHE STRING "") SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>") SET(CMAKE_C_ARCHIVE_FINISH true) set (CMAKE_FIND_ROOT_PATH /ws/libmetal-r5-generic/usr/local/lib \ /ws/xsdk/r5_bsp/psu_cortexr5_0/lib )
include (cross_generic_gcc) ```
find_path
and find_library
to check if libmetal includes and libmetal library is in the includes and library search paths. However, for non-linux system, it doesn't work with CMAKE_INCLUDE_PATH
and CMAKE_LIBRARY_PATH
variables, and thus, we need to specify those paths in the toolchain file with CMAKE_C_FLAGS
and CMAKE_FIND_ROOT_PATH
.Compile the OpenAMP library:
``` $ mkdir -p build-openamp $ cd build-openamp $ cmake <openamp_source> -DCMAKE_TOOLCHAIN_FILE=<toolchain_file> $ make VERBOSE=1 DESTDIR= install ```
The OpenAMP library will be generated to build/usr/local/lib
directory, headers will be generated to build/usr/local/include
directory, and the applications executable will be generated to build/usr/local/bin
directory.
We can use yocto to build the OpenAMP Linux userspace library and application. open-amp and libmetal recipes are in this yocto layer: https://github.com/OpenAMP/meta-openamp
meta-openamp
layer to your layers in your yocto build project's bblayers.conf
file.libmetal
and open-amp
to your packages list. E.g. add libmetal
and open-amp
to the IMAGE_INSTALL_append
in the local.conf
file.meta-openamp
: https://github.com/OpenAMP/meta-openamp/tree/master/recipes-openamp/rpmsg-examplesIn order to user OpenAMP(RPMsg) in Linux userspace, you will need to have put the IPI device, vring memory and shared buffer memory to your Linux kernel device tree. The device tree example can be found here: https://github.com/OpenAMP/open-amp/blob/main/apps/machine/zynqmp/openamp-linux-userspace.dtsi
The OpenAMP version follows the set of rule proposed in Semantic Versioning specification.
For now, it supports:
sudo
is required to run the OpenAMP demos between Linux processes, as it doesn't work on some systems if you are normal users.As an open-source project, we welcome and encourage the community to submit patches directly to the project. As a contributor you should be familiar with common developer tools such as Git and CMake, and platforms such as GitHub. Then following points should be rescpected to facilitate the review process.
Code is contributed to the Linux kernel under a number of licenses, but all code must be compatible with version the BSD License, which is the license covering the OpenAMP distribution as a whole. In practice, use the following tag instead of the full license text in the individual files:
``` SPDX-License-Identifier: BSD-3-Clause SPDX-License-Identifier: BSD-2-Clause ```
Commit message must contain Signed-off-by: line and your email must match the change authorship information. Make sure your .gitconfig is set up correctly:
``` git config --global user.name "first-name Last-Namer" git config --global user.email "yourmail@company.com" ```
Before you submit a pull request to the project, verify your commit messages meet the requirements. The check can be performed locally using the the gitlint command.
Run gitlint locally in your tree and branch where your patches have been committed:
```gitlint```
Note, gitlint only checks HEAD (the most recent commit), so you should run it after each commit, or use the –commits option to specify a commit range covering all the development patches to be submitted.
In general, follow the Linux kernel coding style, with the following exceptions:
The Linux kernel GPL-licensed tool checkpatch is used to check coding style conformity.Checkpatch is available in the scripts directory.
To check your <n> commits in your git branch:
We use standard github mechanism for pull request. Please refer to github documentation for help.
Subscribe to the OpenAMP mailing list(opena). mp-r p@lis ts.o penam ppro ject. org
For more details on the framework please refer to the OpenAMP Docs.