Commit graph

10 commits

Author SHA1 Message Date
Tom Burdick 84e883b611 llext: Support memory protection
Sets up memory partitions and allows for the partitions to be added to a
memory domain after loading an extension. This allows for applying
memory protection attributes to all of the needed memory regions an
extension requires to execute code correctly.

Currently only works when usermode is enabled as otherwise memory
protection APIs are unavailable.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2024-02-02 13:06:28 -05:00
Tom Burdick 34f39800cf llext: Extend test coverage
The platform key using arch + simulation better provides coverage of
unique architectures. Adds a testcase for writable module builds and
loading which was uncovered previously and would've led to a failure on
xtensa as xtensa currently requires writable storage.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2024-01-30 15:08:22 -05:00
Luca Burelli 938d3547d0 llext: move current test to a hello_world subdir
In preparation for multiple tests, move the current hello_world test
to its own subdirectory. Also, merge the llext compilation in the
parent CMakeLists.txt.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-01-24 10:44:48 +01:00
Luca Burelli 5697d25901 llext: fix test Kconfig module conditions
Make it so LLEXT_TEST_HELLO is enabled by default, and it is actually
compiled only when the config is enabled.

The check for MODULES==y and LLEXT_TEST_HELLO!=m is redundant, as the
Twister machinery already causes an error when Kconfig flags specified
in the YAML file are coerced to different values.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-01-24 10:44:48 +01:00
Luca Burelli 0747cd3358 llext: define add_llext_target() for llext compilation
This patch defines a generic function that encapsulates all the
architecture-specific machinery needed to compile llexts from source
files. Current tests are updated to use this function.

Output and source files must be specified using the OUTPUT and SOURCES
arguments. Only one source file is currently supported.

Arch-specific flags will be added automatically. The C_FLAGS argument
can be used to pass additional compiler flags to the compilation of
the source file.

Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
2024-01-21 10:59:49 +01:00
Guennadi Liakhovetski aee2d1a677 llext: provide an example of tristate Kconfig option
Add a tristate Kconfig option to the llext hello-world twister test.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2024-01-11 10:26:04 -05:00
Guennadi Liakhovetski b9bdae8c07 llext: add support for exporting symbols from extensions
Extensions should be able to selectively export their global symbols.
Add a LL_EXTENSION_SYMBOL() macro for that. Change the present
.sym_tab to be a temporary symbol table of all global symbols in an
extensions, used only during linking for internal purposes. Add a new
.exp_tab symbol table to store symbols, exported by an extension
permanently.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-12-01 10:08:12 -05:00
Guennadi Liakhovetski e5c8d181d4 llext: add Xtensa test support
Add support for running a modular "Hello world" example on Xtensa.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2023-12-01 10:08:12 -05:00
Tom Burdick c678f25bc1 llext: Fix a bug in section linking
When relocating section symbol addresses the value where the
relocation is to be written is an offset into the section to load.

Simply rewriting it with the section address is not enough, we need
to write the address of the section with the offset into it.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-10-13 16:47:02 +01:00
Tom Burdick b7f3182f79 llext: Simple hello world test case
Adds a very simple hello world test case for llext. The loadable
extension is built and then included as a binary array into the test
making it very easy to load, debug, and inspect. The extension is
built using the same toolchain as the base image by default.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2023-09-29 20:50:38 -04:00