|
4 | 4 | Porting GuideLine |
5 | 5 | ================= |
6 | 6 |
|
| 7 | +******** |
| 8 | +Hardware |
| 9 | +******** |
| 10 | + |
| 11 | +The porting of OpenAMP to a new :doc:`multicore system <../openamp/overview>` requires |
| 12 | +configuring the hardware on each core so it aligns with the OpenAMP architecture. |
| 13 | + |
| 14 | +This setup typically includes defining a shared memory region for |
| 15 | +:ref:`RPMsg<overview-rpmsg-work-label>` based |
| 16 | +:ref:`Interprocessor Communications (IPC)<ipc-work-label>`, with or without interrupts for |
| 17 | +asynchronous inter-core notification and defining the firmware execution flow either independently |
| 18 | +or with :ref:`Remoteproc<overview-Remoteproc-work-label>` and associated |
| 19 | +:ref:`Resource Table<resource-table>`. |
| 20 | + |
| 21 | +Memory and interrupt assignments are critical design choices for any port. For a broader overview, refer to |
| 22 | +:doc:`../protocol_details/system_considerations`. |
| 23 | + |
| 24 | + |
| 25 | +Shared Memory |
| 26 | +============= |
| 27 | + |
| 28 | +Shared memory forms the :ref:`physical layer<rpmsg-layers-work-label>` for |
| 29 | +:doc:`RPMsg <../docs/rpmsg_design>` protocol. |
| 30 | +The specific memory type and layout are implementation dependent, but should be a dedicated |
| 31 | +SRAM or DDR region accessible by both cores, with caching disabled. |
| 32 | + |
| 33 | +Memory requirements are generally modest because RPMsg is a control‑oriented protocol |
| 34 | +rather than a high‑bandwidth streaming channel. For example, using the Linux RPMsg packet |
| 35 | +size of 512 bytes, a 64kB shared memory region can hold roughly 128 messages — sufficient |
| 36 | +for most applications. Larger or smaller allocations can be chosen based on system needs. |
| 37 | + |
| 38 | +If the resource table is not embedded in the remote firmware image, additional shared memory |
| 39 | +may be required for a dynamic table. |
| 40 | + |
| 41 | +Remoteproc can also use shared memory for optional trace buffers. |
| 42 | + |
| 43 | + |
| 44 | +Memory Protection |
| 45 | +----------------- |
| 46 | + |
| 47 | +Because this is shared memory, appropriate hardware memory protection should be configured |
| 48 | +on both processors. |
| 49 | + |
| 50 | +Depending on the memory type, this may involve configuring the Memory Management Unit (MMU), |
| 51 | +Memory Protection Unit (MPU), or Input-Output Memory Management Unit (IOMMU) to enforce |
| 52 | +correct access permissions. |
| 53 | + |
| 54 | +On systems running an advanced OS — such as Linux on the main |
| 55 | +processor — these protections may be applied through OS mechanisms like the device tree or |
| 56 | +via the Remoteproc resource table. |
| 57 | + |
| 58 | + |
| 59 | +Notification |
| 60 | +------------ |
| 61 | + |
| 62 | +RPMsg uses :ref:`ring buffers<rpmsg-protocol-mac>` in shared memory, so either processor can |
| 63 | +poll for incoming messages. However, asynchronous notification via interrupts is recommended. |
| 64 | + |
| 65 | +Most heterogeneous SoCs include a built‑in inter‑core interrupt mechanism, often called a |
| 66 | +mailbox. These implementations typically combine shared memory with interrupt signaling and |
| 67 | +may be managed through an Inter‑Processor Communication Controller (IPCC). |
| 68 | + |
| 69 | +If no dedicated hardware is available — or it is reserved for other purposes — |
| 70 | +software‑generated interrupts can be used instead. |
| 71 | + |
| 72 | + |
| 73 | +*************** |
| 74 | +Porting Options |
| 75 | +*************** |
| 76 | + |
| 77 | +OpenAMP consists of two major components: Remoteproc and RPMsg. These can be ported |
| 78 | +independently or together, at either the driver level or the device level. |
| 79 | + |
| 80 | +Driver level ports integrate with an operating system’s existing frameworks, |
| 81 | +while device level ports implement the functionality directly on bare metal without |
| 82 | +leveraging OS‑provided drivers. |
| 83 | + |
| 84 | +libmetal provides the :ref:`hardware abstraction layer<hardware-abstraction>` for both. |
| 85 | + |
| 86 | +The main porting approaches include: |
| 87 | + |
| 88 | +- Remoteproc on the remote processor only, with the main processor using an existing |
| 89 | + Remoteproc implementation (e.g., Linux Remoteproc) and no IPC. |
| 90 | + |
| 91 | +- RPMsg on the remote processor only, with the main processor using an existing RPMsg |
| 92 | + stack (e.g., Linux RPMsg) and no remote firmware management. |
| 93 | + |
| 94 | +- Custom device‑level implementation of RPMsg for both processors. |
| 95 | + |
| 96 | + |
| 97 | +Driver Lifecycle Management via Remoteproc |
| 98 | +========================================== |
| 99 | + |
| 100 | +Some systems do not require IPC or use an alternative IPC mechanism. In these cases, only |
| 101 | +Remoteproc may be ported (or reused, as on Linux) on both the main and remote processors. |
| 102 | + |
| 103 | +The main processor uses driver level Remoteproc to load, start, stop, and manage remote |
| 104 | +firmware. |
| 105 | +This approach is useful when the remote firmware must be externally controlled or when |
| 106 | +multiple firmware images may be deployed depending on runtime needs. |
| 107 | +Thie configuration is common in custom or bare‑metal remote environments. |
| 108 | + |
| 109 | +- Pros: Full remote firmware management |
| 110 | +- Cons: No IPC. Larger software footprint |
| 111 | + |
| 112 | +Driver to Remote IPC via RPMsg |
| 113 | +============================== |
| 114 | + |
| 115 | +If the remote firmware is static and starts at boot, or if another framework manages |
| 116 | +firmware loading, only RPMsg needs to be ported. |
| 117 | +In this model, the remote processor runs its firmware autonomously, and the main processor |
| 118 | +interacts with it solely through the RPMsg communication channel, without any involvement |
| 119 | +in firmware lifecycle control. This approach suits systems where the remote environment is |
| 120 | +minimal or bare‑metal, and where the primary requirement is efficient message‑based |
| 121 | +IPC rather than external management of the remote core. |
| 122 | + |
| 123 | +- Pros: Lightweight. Provides IPC. |
| 124 | +- Cons: No remote firmware management. |
| 125 | + |
| 126 | +Device Level Custom RPMsg |
| 127 | +========================= |
| 128 | + |
| 129 | +In highly customized or bare‑metal only environments, a minimal port of just RPMsg may be |
| 130 | +required without any driver‑level abstraction. |
| 131 | +In this case, the full RPMsg mechanism must be implemented directly on both the main and |
| 132 | +remote processors, ensuring that each core provides the necessary messaging, shared‑memory |
| 133 | +handling, and notification logic without relying on OS‑level drivers or frameworks. |
| 134 | + |
| 135 | +- Pros: Lightweight. |
| 136 | +- Cons: Highly custom and less portable. |
| 137 | + |
| 138 | + |
| 139 | +.. _hardware-abstraction: |
| 140 | + |
| 141 | +******************** |
| 142 | +Hardware Abstraction |
| 143 | +******************** |
| 144 | + |
7 | 145 | The `OpenAMP Framework <https://github.com/OpenAMP/open-amp>`_ uses |
8 | 146 | `libmetal <https://github.com/OpenAMP/libmetal>`_ to provide abstractions that allows for porting |
9 | 147 | of the OpenAMP Framework to various software environments (operating systems and bare metal |
|
0 commit comments