Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
 4.1.99
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages

Data Structures

struct  llext_buf_loader
 Implementation of llext_loader that reads from a memory buffer. More...
 
struct  llext_fs_loader
 Implementation of llext_loader that reads from a filesystem. More...
 
struct  llext_loader
 Linkable loadable extension loader context. More...
 

Macros

#define LLEXT_BUF_LOADER(_buf, _buf_len)
 Initializer for an llext_buf_loader structure.
 
#define LLEXT_TEMPORARY_BUF_LOADER(_buf, _buf_len)
 
#define LLEXT_PERSISTENT_BUF_LOADER(_buf, _buf_len)
 Initialize an llext_buf_loader structure for a persistent, read-only buffer.
 
#define LLEXT_WRITABLE_BUF_LOADER(_buf, _buf_len)
 Initialize an llext_buf_loader structure for a persistent, writable buffer.
 
#define LLEXT_FS_LOADER(_filename)
 Initializer for an llext_fs_loader structure.
 

Enumerations

enum  llext_storage_type { LLEXT_STORAGE_TEMPORARY , LLEXT_STORAGE_PERSISTENT , LLEXT_STORAGE_WRITABLE }
 Storage type for the ELF data to be loaded. More...
 

Detailed Description

Macro Definition Documentation

◆ LLEXT_BUF_LOADER

#define LLEXT_BUF_LOADER ( _buf,
_buf_len )

#include <zephyr/llext/buf_loader.h>

Value:
Z_LLEXT_BUF_LOADER(_buf, _buf_len, \
IS_ENABLED(CONFIG_LLEXT_STORAGE_WRITABLE) ? \
@ LLEXT_STORAGE_WRITABLE
ELF data is stored in a writable memory buffer that is guaranteed to be always accessible for as long...
Definition loader.h:70
@ LLEXT_STORAGE_PERSISTENT
ELF data is stored in a read-only buffer that is guaranteed to be always accessible for as long as th...
Definition loader.h:62
#define IS_ENABLED(config_macro)
Check for macro definition in compiler-visible expressions.
Definition util_macro.h:148

Initializer for an llext_buf_loader structure.

The storage type for the provided buffer depends on the value of the CONFIG_LLEXT_STORAGE_WRITABLE option: if it is defined, the buffer is assumed to be writable; otherwise it is assumed to be persistent.

Consider using one of the alternative macros instead.

See also
LLEXT_TEMPORARY_BUF_LOADER
LLEXT_PERSISTENT_BUF_LOADER
LLEXT_WRITABLE_BUF_LOADER
Parameters
_bufBuffer containing the ELF binary
_buf_lenBuffer length in bytes

◆ LLEXT_FS_LOADER

#define LLEXT_FS_LOADER ( _filename)

#include <zephyr/llext/fs_loader.h>

Value:
{ \
.loader = \
{ \
.prepare = llext_fs_prepare, \
.read = llext_fs_read, \
.seek = llext_fs_seek, \
.peek = NULL, \
.finalize = llext_fs_finalize, \
}, \
.is_open = false, \
.name = (_filename), \
}
@ LLEXT_STORAGE_TEMPORARY
ELF data is only available during llext_load(); even if the loader supports directly accessing the me...
Definition loader.h:55
#define NULL
Definition iar_missing_defs.h:20

Initializer for an llext_fs_loader structure.

Parameters
_filenameAbsolute path to the extension file.

◆ LLEXT_PERSISTENT_BUF_LOADER

#define LLEXT_PERSISTENT_BUF_LOADER ( _buf,
_buf_len )

#include <zephyr/llext/buf_loader.h>

Value:
Z_LLEXT_BUF_LOADER(_buf, _buf_len, LLEXT_STORAGE_PERSISTENT)

Initialize an llext_buf_loader structure for a persistent, read-only buffer.

ELF data from the specified buffer is guaranteed to be accessible for as long as the extension is loaded. The LLEXT subsystem may directly access the ELF data, as long as no modification is required during loading.

Parameters
_bufBuffer containing the ELF binary
_buf_lenBuffer length in bytes

◆ LLEXT_TEMPORARY_BUF_LOADER

#define LLEXT_TEMPORARY_BUF_LOADER ( _buf,
_buf_len )

#include <zephyr/llext/buf_loader.h>

Value:
Z_LLEXT_BUF_LOADER(_buf, _buf_len, LLEXT_STORAGE_TEMPORARY)

◆ LLEXT_WRITABLE_BUF_LOADER

#define LLEXT_WRITABLE_BUF_LOADER ( _buf,
_buf_len )

#include <zephyr/llext/buf_loader.h>

Value:
Z_LLEXT_BUF_LOADER(_buf, _buf_len, LLEXT_STORAGE_WRITABLE)

Initialize an llext_buf_loader structure for a persistent, writable buffer.

ELF data from the specified buffer is guaranteed to be accessible for as long as the extension is loaded. The LLEXT subsystem may directly access and modify the ELF data.

Parameters
_bufBuffer containing the ELF binary
_buf_lenBuffer length in bytes

Enumeration Type Documentation

◆ llext_storage_type

#include <zephyr/llext/loader.h>

Storage type for the ELF data to be loaded.

This enum defines the storage type of the ELF data that will be loaded. The storage type determines which memory optimizations can be tried by the LLEXT subsystem during the load process.

Note
Even with the most permissive option, LLEXT might still have to copy ELF data into a separate memory region to comply with other restrictions, such as hardware memory protection and/or alignment rules. Sections such as BSS that have no space in the file will also be allocated in the LLEXT heap.
Enumerator
LLEXT_STORAGE_TEMPORARY 

ELF data is only available during llext_load(); even if the loader supports directly accessing the memory via llext_peek(), the buffer contents will be discarded afterwards.

LLEXT will allocate copies of all required data into its heap.

LLEXT_STORAGE_PERSISTENT 

ELF data is stored in a read-only buffer that is guaranteed to be always accessible for as long as the extension is loaded.

LLEXT may directly reuse constant data from the buffer, but may still allocate copies if relocations need to be applied.

LLEXT_STORAGE_WRITABLE 

ELF data is stored in a writable memory buffer that is guaranteed to be always accessible for as long as the extension is loaded.

LLEXT may freely modify and reuse data in the buffer; so, after the extension is unloaded, the contents should be re-initialized before a subsequent llext_load() call.