zephyr/samples/subsys/llext/modules
Luca Burelli cec4be3a84 llext: rework test and sample coverage
This patch reworks the testcase.yaml and sample.yaml files for the llext
subsystem to further reduce the number of tests performed by CI while
improving overall coverage.

The following changes are introduced by this commit:

- Remove the arch_allow field from the common section to allow any arch
  to be tested in the build_only test. All other tests explicitly narrow
  down the arches they are applicable to.
- In addition to platforms with active issues, also exclude a number of
  platforms that are always skipped by the runtime filter due to
  RAM/Flash limitations.
- Add integration_platforms to limit the test count to a few selected
  platforms which are representative of the different arches.
- Remove a number of duplicate SLID tests and group them into a single
  test that covers both ARM and Xtensa architectures.
- Test the relocatable case on ARM as well.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-06-25 21:25:33 -04:00
..
src
CMakeLists.txt
Kconfig
README.rst
prj.conf
sample.yaml

README.rst

.. zephyr:code-sample:: llext-modules
   :name: Linkable loadable extensions "module" sample
   :relevant-api: llext

    Call a function in a loadable extension module,
    either built-in or loaded at runtime.

Overview
********

This sample demonstrates the use of the :ref:`llext` subsystem in Zephyr. The
llext subsystem allows for the loading of relocatable ELF files at runtime;
their symbols can be accessed and functions called.

Specifically, this shows how to call a simple "hello world" function,
implemented in :zephyr_file:`samples/subsys/llext/modules/src/hello_world_ext.c`.
This is achieved in two different ways, depending on the value of the Kconfig
symbol ``CONFIG_HELLO_WORLD_MODE``:

- if it is ``y``, the function is directly compiled and called by the Zephyr
  application. The caller code used in this case is in
  :zephyr_file:`samples/subsys/llext/modules/src/main_builtin.c`.

- if it is ``m``, the function is compiled as an llext and it is included in
  the application as a binary blob. At runtime, the llext subsystem is used to
  load the extension and call the function. The caller code is in
  :zephyr_file:`samples/subsys/llext/modules/src/main_module.c`.

Requirements
************

A board with a supported llext architecture and console. This can also be
executed in QEMU emulation on the :ref:`qemu_xtensa <qemu_xtensa>` or
:ref:`qemu_cortex_r5 <qemu_cortex_r5>` virtual boards.

Building and running
********************

- The following commands build and run the sample so that the files are linked
  together in the same binary:

  .. zephyr-app-commands::
     :zephyr-app: samples/subsys/llext/modules
     :board: qemu_xtensa
     :goals: build run
     :west-args: -T sample.llext.modules.builtin_build
     :compact:

- The following commands build and run the sample so that the extension code is
  compiled separately and included in the Zephyr image as a binary blob:

  .. zephyr-app-commands::
     :zephyr-app: samples/subsys/llext/modules
     :board: qemu_xtensa
     :goals: build run
     :west-args: -T sample.llext.modules.module_build
     :compact:

  Take a look at :zephyr_file:`samples/subsys/llext/modules/sample.yaml` for the
  additional architecture-specific configurations required in this case.

To build for a different board, replace ``qemu_xtensa`` in the commands above
with the desired board name.