• Home
  • History
  • Annotate
Name
Date
Size
#Lines
LOC

..--

cmake/18-Mar-2025-307236

doc/18-Mar-2025-3,3472,651

lib/18-Mar-2025-10,3385,837

.gitignoreD18-Mar-2025121 1613

CMakeLists.txtD18-Mar-2025819 4231

DoxyfileD18-Mar-2025120.1 KiB2,7702,176

LICENSE.mdD18-Mar-20254.6 KiB10578

MAINTAINERS.mdD18-Mar-2025524 1812

README.mdD18-Mar-202514.7 KiB327286

VERSIOND18-Mar-202554 43

README.md

1# open-amp
2This repository is the home for the Open Asymmetric Multi Processing (OpenAMP)
3framework project. The OpenAMP framework provides software components that
4enable development of software applications for Asymmetric Multiprocessing
5(AMP) systems. The framework provides the following key capabilities.
6
71. Provides Life Cycle Management, and Inter Processor Communication
8   capabilities for management of remote compute resources and their associated
9   software contexts.
102. Provides a stand alone library usable with RTOS and Baremetal software
11   environments
123. Compatibility with upstream Linux remoteproc and rpmsg components
134. Following AMP configurations supported
14	a. Linux host/Generic(Baremetal) remote
15	b. Generic(Baremetal) host/Linux remote
165. Proxy infrastructure and supplied demos showcase ability of proxy on host
17   to handle printf, scanf, open, close, read, write calls from Bare metal
18   based remote contexts.
19
20## OpenAMP Source Structure
21```
22|- lib/
23|  |- virtio/     # virtio implementation
24|  |- rpmsg/      # rpmsg implementation
25|  |- remoteproc/ # remoteproc implementation
26|  |- proxy/      # implement one processor access device on the
27|  |              # other processor with file operations
28|- apps/        # demonstration/testing applications
29|  |- examples/ # Application samples using the OpenAMP framework.
30|  |- machine/  # common files for machine can be shared by applications
31|  |            # It is up to each app to decide whether to use these files.
32|  |- system/   # common files for system can be shared by applications
33|               # It is up to each app to decide whether to use these files.
34|- cmake        # CMake files
35|- script       # helper scripts (such as checkpatch) for contributors.
36```
37
38OpenAMP library libopen_amp is composed of the following directories in `lib/`:
39*   `virtio/`
40*   `rpmsg/`
41*   `remoteproc/`
42*   `proxy/`
43
44OpenAMP system/machine support has been moved to libmetal, the system/machine
45layer in the `apps/` directory is for system application initialization, and
46resource table definition.
47
48### libmetal APIs used in OpenAMP
49Here are the libmetal APIs used by OpenAMP, if you want to port OpenAMP for your
50system, you will need to implement the following libmetal APIs in the libmetal's
51`lib/system/<SYS>` directory:
52* alloc, for memory allocation and memory free
53* cache, for flushing cache and invalidating cache
54* io, for memory mapping. OpenAMP required memory mapping in order to access
55  vrings and carved out memory.
56* irq, for IRQ handler registration, IRQ disable/enable and global IRQ handling.
57* mutex
58* shmem (For RTOS, you can usually use the implementation from
59  `lib/system/generic/`)
60* sleep, at the moment, OpenAMP only requires microseconds sleep as when OpenAMP
61  fails to get a buffer to send messages, it will call this function to sleep and
62  then try again.
63* time, for timestamp
64* init, for libmetal initialization.
65* atomic
66
67Please refer to `lib/system/generic` when you port libmetal for your system.
68
69If you a different compiler to GNU gcc, please refer to `lib/compiler/gcc/` to
70port libmetal for your compiler. At the moment, OpenAMP needs the atomic
71operations defined in `lib/compiler/gcc/atomic.h`.
72
73## OpenAMP Compilation
74OpenAMP uses CMake for library and demonstration application compilation.
75OpenAMP requires libmetal library. For now, you will need to download and
76compile libmetal library separately before you compiling OpenAMP library.
77In future, we will try to make libmetal as a submodule to OpenAMP to make this
78flow easier.
79
80Some Cmake options are available to allow user to customize to the OpenAMP
81library for it project:
82* **WITH_PROXY** (default OFF): Include proxy support in the library.
83* **WITH APPS** (default OFF): Build with sample applications.
84* **WITH_PROXY_APPS** (default OFF):Build with proxy sample applications.
85* **WITH_VIRTIO_DRIVER** (default ON): Build with virtio driver enabled.
86  This option can be set to OFF if the only the remote mode is implemented.
87* **WITH_VIRTIO_DEVICE** (default ON): Build with virtio device enabled.
88  This option can be set to OFF if the only the driver mode is implemented.
89* **WITH_VQ_RX_EMPTY_NOTIFY** (default OFF): Choose notify mode. When set to
90  ON, only notify when there are no more Message in the RX queue. When set to
91  OFF, notify for each RX buffer released.
92* **WITH_STATIC_LIB** (default ON): Build with a static library.
93* **WITH_SHARED_LIB** (default ON): Build with a shared library.
94* **WITH_ZEPHYR** (default OFF): Build open-amp as a zephyr library. This option
95  is mandatory in a Zephyr environment.
96* **WITH_DCACHE_VRINGS** (default OFF): Build with data cache operations
97  enabled on vrings.
98* **WITH_DCACHE_BUFFERS** (default OFF): Build with data cache operations
99  enabled on buffers.
100* **WITH_DCACHE_RSC_TABLE** (default OFF): Build with data cache operations
101  enabled on resource table.
102* **WITH_DCACHE** (default OFF): Build with all cache operations
103  enabled. When set to ON, cache operations for vrings, buffers and resource
104  table are enabled.
105* **RPMSG_BUFFER_SIZE** (default 512): adjust the size of the RPMsg buffers.
106  The default value of the RPMsg size is compatible with the Linux Kernel hard
107  coded value. If you AMP configuration is Linux kernel host/ OpenAMP remote,
108  this option must not be used.
109
110### Example to compile OpenAMP for Zephyr
111The [Zephyr open-amp repo](https://github.com/zephyrproject-rtos/open-amp)
112implements the open-amp library for the Zephyr project. It is mainly a fork of
113this repository, with some add-ons for integration in the Zephyr project.
114The standard way to compile OpenAMP for a Zephyr project is to use Zephyr build
115environment. Please refer to
116[Zephyr OpenAMP samples](https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/ipc)
117for examples and [Zephyr documentation](https://docs.zephyrproject.org/latest/) for the build
118process.
119
120### Example to compile OpenAMP for communication between Linux processes:
121* Install libsysfs devel and libhugetlbfs devel packages on your Linux host.
122* build libmetal library on your host as follows:
123  ```
124  $ mkdir -p build-libmetal
125  $ cd build-libmetal
126  $ cmake <libmetal_source>
127  $ make VERBOSE=1 DESTDIR=<libmetal_install> install
128  ```
129
130* build OpenAMP library on your host as follows:
131   ```
132  $ mkdir -p build-openamp
133  $ cd build-openamp
134  $ cmake <openamp_source> -DCMAKE_INCLUDE_PATH=<libmetal_built_include_dir> \
135              -DCMAKE_LIBRARY_PATH=<libmetal_built_lib_dir> [-DWITH_APPS=ON]
136  $ make VERBOSE=1 DESTDIR=$(pwd) install
137  ```
138
139The OpenAMP library will be generated to `build/usr/local/lib` directory,
140headers will be generated to `build/usr/local/include` directory, and the
141applications executable will be generated to `build/usr/local/bin`
142directory.
143
144* cmake option `-DWITH_APPS=ON` is to build the demonstration applications.
145* If you have used `-DWITH_APPS=ON` to build the demos, you can try them on
146  your Linux host as follows:
147
148  * rpmsg echo demo:
149  ```
150  # Start echo test server to wait for message to echo
151  $ sudo LD_LIBRARY_PATH=<openamp_built>/usr/local/lib:<libmetal_built>/usr/local/lib \
152     build/usr/local/bin/rpmsg-echo-shared
153  # Run echo test to send message to echo test server
154  $ sudo LD_LIBRARY_PATH=<openamp_built>/usr/local/lib:<libmetal_built>/usr/local/lib \
155     build/usr/local/bin/rpmsg-echo-ping-shared 1
156  ```
157
158  * rpmsg echo demo with the nocopy API:
159  ```
160  # Start echo test server to wait for message to echo
161  $ sudo LD_LIBRARY_PATH=<openamp_built>/usr/local/lib:<libmetal_built>/usr/local/lib \
162     build/usr/local/bin/rpmsg-nocopy-echo-shared
163  # Run echo test to send message to echo test server
164  $ sudo LD_LIBRARY_PATH=<openamp_built>/usr/local/lib:<libmetal_built>/usr/local/lib \
165     build/usr/local/bin/rpmsg-nocopy-ping-shared 1
166  ```
167
168###  Example to compile Zynq UltraScale+ MPSoC R5 generic(baremetal) remote:
169* build libmetal library on your host as follows:
170  * Create your on cmake toolchain file to compile libmetal for your generic
171    (baremetal) platform. Here is the example of the toolchain file:
172  ```
173  set (CMAKE_SYSTEM_PROCESSOR "arm"              CACHE STRING "")
174  set (MACHINE "zynqmp_r5" CACHE STRING "")
175
176  set (CROSS_PREFIX           "armr5-none-eabi-" CACHE STRING "")
177  set (CMAKE_C_FLAGS          "-mfloat-abi=soft -mcpu=cortex-r5 -Wall -Werror -Wextra \
178         -flto -Os -I/ws/xsdk/r5_0_bsp/psu_cortexr5_0/include" CACHE STRING "")
179
180  SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
181  SET(CMAKE_AR  "gcc-ar" CACHE STRING "")
182  SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
183  SET(CMAKE_C_ARCHIVE_FINISH   true)
184
185  include (cross-generic-gcc)
186  ```
187
188  * Compile libmetal library:
189  ```
190  $ mkdir -p build-libmetal
191  $ cd build-libmetal
192  $ cmake <libmetal_source> -DCMAKE_TOOLCHAIN_FILE=<toolchain_file>
193  $ make VERBOSE=1 DESTDIR=<libmetal_install> install
194  ```
195
196* build OpenAMP library on your host as follows:
197  * Create your on cmake toolchain file to compile openamp for your generic
198    (baremetal) platform. Here is the example of the toolchain file:
199  ```
200  set (CMAKE_SYSTEM_PROCESSOR "arm" CACHE STRING "")
201  set (MACHINE                "zynqmp_r5" CACHE STRING "")
202  set (CROSS_PREFIX           "armr5-none-eabi-" CACHE STRING "")
203  set (CMAKE_C_FLAGS          "-mfloat-abi=soft -mcpu=cortex-r5 -Os -flto \
204          -I/ws/libmetal-r5-generic/usr/local/include \
205          -I/ws/xsdk/r5_0_bsp/psu_cortexr5_0/include" CACHE STRING "")
206  set (CMAKE_ASM_FLAGS        "-mfloat-abi=soft -mcpu=cortex-r5" CACHE STRING "")
207  set (PLATFORM_LIB_DEPS      "-lxil -lc -lm" CACHE STRING "")
208  SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
209  SET(CMAKE_AR  "gcc-ar" CACHE STRING "")
210  SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
211  SET(CMAKE_C_ARCHIVE_FINISH   true)
212  set (CMAKE_FIND_ROOT_PATH /ws/libmetal-r5-generic/usr/local/lib \
213            /ws/xsdk/r5_bsp/psu_cortexr5_0/lib )
214
215  include (cross_generic_gcc)
216  ```
217
218  * We use cmake `find_path` and `find_library` to check if libmetal includes
219    and libmetal library is in the includes and library search paths. However,
220    for non-linux system, it doesn't work with `CMAKE_INCLUDE_PATH` and
221    `CMAKE_LIBRARY_PATH` variables, and thus, we need to specify those paths
222    in the toolchain file with `CMAKE_C_FLAGS` and `CMAKE_FIND_ROOT_PATH`.
223* Compile the OpenAMP library:
224  ```
225  $ mkdir -p build-openamp
226  $ cd build-openamp
227  $ cmake <openamp_source> -DCMAKE_TOOLCHAIN_FILE=<toolchain_file>
228  $ make VERBOSE=1 DESTDIR=$(pwd) install
229  ```
230
231The OpenAMP library will be generated to `build/usr/local/lib` directory,
232headers will be generated to `build/usr/local/include` directory, and the
233applications executable will be generated to `build/usr/local/bin`
234directory.
235
236
237### Example to compile OpenAMP Linux Userspace for Zynq UltraScale+ MPSoC
238We can use yocto to build the OpenAMP Linux userspace library and application.
239open-amp and libmetal recipes are in this yocto layer:
240https://github.com/OpenAMP/meta-openamp
241* Add the `meta-openamp` layer to your layers in your yocto build project's `bblayers.conf` file.
242* Add `libmetal` and `open-amp` to your packages list. E.g. add `libmetal` and `open-amp` to the
243  `IMAGE_INSTALL_append` in the `local.conf` file.
244* You can also add OpenAMP demos Linux applications packages to your yocto packages list. OpenAMP
245  demo examples recipes are also in `meta-openamp`:
246  https://github.com/OpenAMP/meta-openamp/tree/master/recipes-openamp/rpmsg-examples
247
248In order to user OpenAMP(RPMsg) in Linux userspace, you will need to have put the IPI device,
249  vring memory and shared buffer memory to your Linux kernel device tree. The device tree example
250  can be found here:
251  https://github.com/OpenAMP/open-amp/blob/main/apps/machine/zynqmp/openamp-linux-userspace.dtsi
252
253## Version
254The OpenAMP version follows the set of rule proposed in
255[Semantic Versioning specification](https://semver.org/).
256
257## Supported System and Machines
258For now, it supports:
259* Zynq generic remote
260* Zynq UltraScale+ MPSoC R5 generic remote
261* Linux host OpenAMP between Linux userspace processes
262* Linux userspace OpenAMP RPMsg host
263* Linux userspace OpenAMP RPMsg remote
264* Linux userspace OpenAMP RPMsg and MicroBlaze bare metal remote
265
266## Known Limitations:
2671. In case of OpenAMP on Linux userspace for inter processors communication,
268   it only supports static vrings and shared buffers.
2692. `sudo` is required to run the OpenAMP demos between Linux processes, as
270   it doesn't work on some systems if you are normal users.
271
272## How to contribute:
273As an open-source project, we welcome and encourage the community to submit patches directly to the
274project. As a contributor you  should be familiar with common developer tools such as Git and CMake,
275and platforms such as GitHub.
276Then following points should be rescpected to facilitate the review process.
277
278### Licencing
279Code is contributed to the Linux kernel under a number of licenses, but all code must be compatible
280with version the [BSD License](https://github.com/OpenAMP/open-amp/blob/main/LICENSE.md), which is
281the license covering the OpenAMP distribution as a whole. In practice, use the following tag
282instead of the full license text in the individual files:
283  ```
284  SPDX-License-Identifier:    BSD-3-Clause
285  SPDX-License-Identifier:    BSD-2-Clause
286  ```
287### Signed-off-by
288Commit message must contain Signed-off-by: line and your email must match the change authorship
289information. Make sure your .gitconfig is set up correctly:
290  ```
291  git config --global user.name "first-name Last-Namer"
292  git config --global user.email "yourmail@company.com"
293  ```
294### gitlint
295Before you submit a pull request to the project, verify your commit messages meet the requirements.
296The check can be  performed locally using the the gitlint command.
297
298Run gitlint locally in your tree and branch where your patches have been committed:
299  ```
300  gitlint
301  ```
302Note, gitlint only checks HEAD (the most recent commit), so you should run it after each commit, or
303use the --commits option to specify a commit range covering all the development patches to be
304submitted.
305
306### Code style
307In general, follow the Linux kernel coding style, with the following exceptions:
308
309* Use /**  */ for doxygen comments that need to appear in the documentation.
310
311The Linux kernel GPL-licensed tool checkpatch is used to check coding style conformity.Checkpatch is
312available in the scripts directory.
313
314To check your \<n\> commits in your git branch:
315  ```
316  ./scripts/checkpatch.pl --strict  -g HEAD-<n>
317  ```
318### Send a pull request
319We use standard github mechanism for pull request. Please refer to github documentation for help.
320
321## Communication and Collaboration
322[Subscribe](https://lists.openampproject.org/mailman3/lists/openamp-rp.lists.openampproject.org/) to
323the OpenAMP mailing list(openamp-rp@lists.openampproject.org).
324
325For more details on the framework please refer to the
326[OpenAMP Docs](https://openamp.readthedocs.io/en/latest/).
327