OpenAMP Documentation

repository·main·Indexed 21 days ago

https://github.com/openamp/open-amp

OpenAMP is a framework for Asymmetric Multiprocessing (AMP) providing life cycle management and inter-processor communication (IPC) components. It is compatible with Linux remoteproc and rpmsg, offering a standalone library for RTOS and Baremetal environments. The framework includes implementations for virtio, rpmsg, remoteproc, and a proxy infrastructure for file operations, relying on libmetal for hardware abstraction.

Tokens
1.1K
Snippets
0
Records
6
Agent score
25%

What's inside OpenAMP

  1. What is OpenAMP?

    main

    OpenAMP (Open Asymmetric Multi Processing) is a framework providing software components for developing applications on Asymmetric Multiprocessing (AMP) systems.

    Key capabilities include:

    • Life Cycle Management and Inter-Processor Communication (IPC) for remote compute resources.
    • A standalone library for RTOS and Baremetal environments.
    • Compatibility with upstream Linux remoteproc and rpmsg components.
    • Support for Linux host/Generic(Baremetal) remote and Generic(Baremetal) host/Linux remote configurations.
    • Proxy infrastructure to allow Baremetal remote contexts to perform file operations (e.g., printf, scanf, open, close, read, write) via the host.
  2. OpenAMP Source Structure

    main

    The OpenAMP library libopen_amp is organized into the following directories within lib/:

    • virtio/: Virtio implementation.
    • rpmsg/: RPMsg implementation.
    • remoteproc/: Remoteproc implementation.
    • proxy/: Implementation for accessing a device on another processor using file operations.

    Note: System and machine support has been moved to the libmetal library.

  3. Compile OpenAMP for communication between Linux processes

    main

    To build OpenAMP for communication between Linux processes, follow these steps:

    1. Install required packages:

      sudo apt-get install libsysfs-dev libhugetlbfs-dev
    2. Build libmetal:

      mkdir -p build-libmetal
      cd build-libmetal
      cmake <libmetal_source>
      make VERBOSE=1 DESTDIR=<libmetal_install> install
    3. Build OpenAMP:

      mkdir -p build-openamp
      cd build-openamp
      cmake <openamp_source> -DCMAKE_INCLUDE_PATH=<libmetal_built_include_dir> \
                  -DCMAKE_LIBRARY_PATH=<libmetal_built_lib_dir>
      make VERBOSE=1 DESTDIR=$(pwd) install

    After installation, headers are located in build/usr/local/include and libraries in build/usr/local/lib.

  4. Porting OpenAMP to a new system via libmetal

    main

    OpenAMP relies on libmetal for hardware abstraction. To port OpenAMP to a new system, you must implement the following libmetal APIs in your system's directory (lib/system/<SYS>):

    • alloc: Memory allocation and free.
    • cache: Cache flushing and invalidation.
    • io: Memory mapping (required for accessing vrings and carved-out memory).
    • irq: IRQ handler registration, IRQ disable/enable, and global IRQ handling.
    • mutex: Mutex implementation.
    • shmem: Shared memory (for RTOS, lib/system/generic/ can often be used).
    • sleep: Microsecond sleep (used when failing to acquire a buffer).
    • time: Timestamping.
    • init: Library initialization.
    • atomic: Atomic operations.

    If using a compiler other than GNU gcc, you must port libmetal for your compiler. OpenAMP specifically requires the atomic operations defined in lib/compiler/gcc/atomic.h.

  5. Compile OpenAMP using CMake

    main

    OpenAMP uses CMake for compilation and requires the libmetal library to be downloaded and compiled separately beforehand.

    CMake Configuration Options

    OptionDefaultDescription
    WITH_PROXYOFFInclude proxy support in the library.
    WITH_VIRTIO_DRIVERONBuild with virtio driver enabled. Set OFF if only remote mode is implemented.
    WITH_VIRTIO_DEVICEONBuild with virtio device enabled. Set OFF if only driver mode is implemented.
    WITH_VQ_RX_EMPTY_NOTIFYOFFNotify mode: ON notifies only when RX queue is empty; OFF notifies for each RX buffer released.
    WITH_STATIC_LIBONBuild a static library.
    WITH_SHARED_LIBONBuild a shared library.
    WITH_ZEPHYROFFBuild OpenAMP as a Zephyr library. Mandatory in Zephyr environments.
    WITH_DCACHEOFFEnable cache operations for vrings, buffers, and resource tables.
    RPMSG_BUFFER_SIZE512Adjust RPMsg buffer size. Do not use this if the configuration is Linux kernel host/OpenAMP remote, as it must match the Linux kernel's hardcoded value.