# Copyright (c) 2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

menuconfig LLEXT
	bool "Linkable loadable extensions"
	select CACHE_MANAGEMENT if DCACHE
	help
	  Enable the linkable loadable extension subsystem

if LLEXT

choice LLEXT_BINARY_TYPE
	prompt "Binary object type for llext"
	default LLEXT_TYPE_ELF_OBJECT if ARM
	default LLEXT_TYPE_ELF_SHAREDLIB if XTENSA
	help
	  Object type for llext

config LLEXT_TYPE_ELF_OBJECT
	bool "Single object ELF file"
	help
	  Build and expect object files as binary object type for the
	  llext subsystem. A single compiler invocation is used to
	  generate the object file.

config LLEXT_TYPE_ELF_RELOCATABLE
	bool "Relocatable ELF file"
	help
	  Build and expect relocatable (partially linked )files as the
	  binary object type for the llext subsystem. These object files
	  are generated by the linker by combining multiple object files
	  into a single one.

config LLEXT_TYPE_ELF_SHAREDLIB
	bool "Shared library ELF file"
	help
	  Build and expect shared libraries as binary object type for
	  the llext subsystem. The usual linking process is used to
	  generate the shared library from multiple object files.

endchoice

config LLEXT_HEAP_SIZE
	int "llext heap memory size in kilobytes"
	default 8
	help
	  Heap size in kilobytes available to llext for dynamic allocation

config LLEXT_SHELL
	bool "llext shell commands"
	depends on SHELL
	help
	  Manage llext with shell commands for loading, unloading, and introspection

config LLEXT_SHELL_MAX_SIZE
	int "Maximum size of llext in bytes"
	depends on LLEXT_SHELL
	default 8192
	help
	  When loading llext with shell it is stored in a temporary buffer of this size

config LLEXT_STORAGE_WRITABLE
	bool "llext storage is writable"
	help
	  Select if LLEXT storage is writable, i.e. if extensions are stored in
	  RAM and can be modified in place

module = LLEXT
module-str = llext
source "subsys/logging/Kconfig.template.log_config"

endif
