OpenAMP remoteproc interface
OCaml 62.0%
Standard ML 29.4%
Dune 2.5%
Other 6.1%
18 1 0

Clone this repository

https://tangled.org/gazagnaire.org/ocaml-openamp https://tangled.org/did:plc:jhift2vwcxhou52p3sewcrpx/ocaml-openamp
git@git.recoil.org:gazagnaire.org/ocaml-openamp git@git.recoil.org:did:plc:jhift2vwcxhou52p3sewcrpx/ocaml-openamp

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

openamp#

OCaml bindings to the OpenAMP remoteproc sysfs interface.

OCaml bindings to the Linux remoteproc sysfs interface for managing remote processors via OpenAMP. Designed for Zynq UltraScale+ (K26) where the A53 application processor needs to load firmware and start/stop the R5 real-time co-processor. On macOS, all operations are no-ops.

All filesystem operations take an Eio path parameter for testability.

Installation#

opam install openamp

Usage#

Eio_main.run @@ fun env ->
let fs = Eio.Stdenv.fs env in
match Openamp.Remoteproc.find ~fs () with
| None -> Fmt.pr "No remote processor found@."
| Some rp ->
    Openamp.Remoteproc.set_firmware ~fs rp "my-firmware.elf";
    match Openamp.Remoteproc.start ~fs rp with
    | Ok () -> Fmt.pr "Started %s@." (Openamp.Remoteproc.name ~fs rp)
    | Error e -> Fmt.epr "Error: %s@." e

API#

  • Remoteproc -- Remote processor control via sysfs. find locates a processor by index, find_all lists all available processors. state reads the current state (Offline, Running, Crashed, Suspended). set_firmware sets the firmware filename, start and stop control the processor lifecycle.
  • Firmware -- Firmware file management under /lib/firmware. exists checks for a firmware file, install copies a file into the firmware directory.
  • For_testing -- Overrides for sysfs and firmware base paths to enable unit testing without real hardware.

References#