OpenAMP on i.MX8 – Yocto Linux with FreeRTOS #1
An asymmetric multiprocessing (AMP) system is a multiprocessor computer system where not all of the multiple interconnected central processing units (CPUs) are treated equally.
For example, a system might allow (either at the hardware or operating system level) only one CPU to execute operating system code or might allow only one CPU to perform I/O operations. Heterogeneity is the main requirement for a system to work as AMP.
What is Heterogeneous Multicore Processing Architecture?
The i.MX8M processors offer an MCU and a MPU in the same chip, this is called a Heterogeneous Multicore Processing Architecture. Heterogeneous multi-core systems have two or more cores that differ in architecture or micro-architecture. Example of heterogeneous multi-core systems is the combination of a microprocessor core with a micro-controller class core (e.g. a mix of Cortex-A, Cortex-M, or DSP cores.)
More details on Asymmetric multiprocessing (AMP) system
Usually, more than one OS is running on the system, which is separated per core or core architecture. For example, the Cortex-A core may run a rich OS, while the Cortex-M core may run simple code or an RTOS.
The first thing to know is that one of the cores is the “master”, meaning that it is in charge to boot the other core which otherwise will stay in reset.
The BootROM will always boot the Cortex-A core first. U-Boot is the bootloader used by your system. The reason is that U-Boot provides a bootaux command which allows to start the Cortex-M4.
Once started, both CPU are on their own, executing different instructions at different speeds.
What is Open-AMP?
The Open-AMP framework provides software components that enable development of software applications for Asymmetric Multiprocessing (AMP) systems.
The framework provides the following key capabilities.
- Provides Life Cycle Management, and Inter Processor Communication capabilities for management of remote compute resources and their associated software contexts.
- Provides a standalone library usable with RTOS and Baremetal software environments
- Compatibility with upstream Linux remoteproc and rpmsg components
- Following AMP configurations supported
- Linux master with Generic(Baremetal/RTOS) remote
- Generic (Baremetal/RTOS) master with Linux remote
- Proxy infrastructure and supplied demos showcase ability of proxy on master to handle printf, scanf, open, close, read, write calls from bare metal based remote contexts.
- The Open-AMP Framework uses libmetal to provide abstractions that allow for porting of the Open-AMP Framework to various software environments (operating systems and bare metal environments) and machines (processors/platforms).
The key components provided by the OpenAMP Framework is as below:
- Life Cycle Management (LCM) of remote processors from software running on a master processor is handled by remoteproc. The remoteproc API provided by the
- OpenAMP Framework is compliant with the remoteproc infrastructurepresent in upstream Lin
ux 3.4.x kernel onward.
- The RPMsg driver infra enables Inter Processor Communications (IPC) between independent software contexts running on homogeneous or heterogeneous cores present in an AMP system. RPMsg protocol structure is as below:
The Linux remoteproc and RPMsg infrastructure was first implemented by Texas Instruments. These are available in the upstream Linux kernel today which enable the Linux applications running on a master processor to manage the life cycle of remote processor/firmware and perform IPC with them.
The OpenAMP Framework provides the required LCM and IPC infrastructure from the RTOS and bare metal environments with the API conformity and functional symmetry available in the upstream Linux kernel. As in upstream Linux, the OpenAMP Framework’s remoteproc and RPMsg infrastructure uses virtio as the transport layer/abstraction.
The following figure shows the various software environments/configurations supported by the OpenAMP Framework. As shown in this illustration, the OpenAMP Framework can be used with RTOS or bare metal contexts on a remote processor to communicate with Linux applications (in kernel space or user space) or other RTOS/bare metal-based applications running on the master processor through the remoteproc and RPMsg Components.
The OpenAMP Framework also serves as a stand-alone library that enables RTOS and bare metal applications on a master processor to manage the life cycle of remote processor/firmware and communicate with them using RPMsg.
The OpenAMP Framework supplies a proxy infrastructure that provides a transparent interface to remote contexts from Linux user space applications running on the master processor. The proxy application hides all the logistics involved in bringing-up the remote software context and its shutdown sequence. In addition, it supports RPMsg-based Remote Procedure Calls (RPCs) from remote context. A retargeting API available from the remote context allows C library system calls such as “_open”, “_close”, “_read”, and “_write” to be forwarded to the proxy application on the master for service.