#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

config INTERPRETERS_WAMR
	tristate "Webassembly Micro Runtime"
	default n

if INTERPRETERS_WAMR

config INTERPRETERS_WAMR_VERSION
	string "WAMR Version"
	default "WAMR-2.1.0"
	---help---
		Version WAMR-09-29-2020 and later (include main) supported.

config INTERPRETERS_IWASM_TASK
	bool "Webassembly iwasm task"
	default y

if INTERPRETERS_IWASM_TASK

config INTERPRETERS_WAMR_PRIORITY
	int "Webassembly Micro Runtime priority"
	default 100

config INTERPRETERS_WAMR_STACKSIZE
	int "Webassembly Micro Runtime stack size"
	default 8192

endif # INTERPRETERS_IWASM_TASK

config INTERPRETERS_WAMR_AOT
	bool "Enable AOT"
	select ARCH_USE_TEXT_HEAP if ARCH_HAVE_TEXT_HEAP
	default n

config INTERPRETERS_WAMR_AOT_QUICK_ENTRY
	bool "Enable AOT quick entry"
	default n
	depends on INTERPRETERS_WAMR_AOT
	---help---
		Note: This option only works with WAMR 1.3.1 or later.
		Enable AOT quick entry to improve performance for call
		AOTed function from host side in some cases with simple
		signature.
		Enable this option will increase the size of runtime, ~8KB.

config INTERPRETERS_WAMR_AOT_STACK_FRAME
	bool "Enable AOT stack frame"
	default n
	depends on INTERPRETERS_WAMR_AOT

config INTERPRETERS_WAMR_AOT_WORD_ALIGN_READ
	bool "Make WAMR AOT loader use word-aligned read"
	default y if ARCH_HAVE_TEXT_HEAP_WORD_ALIGNED_READ
	default n

config INTERPRETERS_WAMR_MEM_DUAL_BUS_MIRROR
	bool "Make WAMR AOT loader aware of separate instruction/data memory mapping"
	default y if ARCH_HAVE_TEXT_HEAP_SEPARATE_DATA_ADDRESS
	default n

choice
	prompt "Enable interpreter"
	default INTERPRETERS_NONE

config INTERPRETERS_WAMR_FAST
	bool "Enable fast interpreter"

config INTERPRETERS_WAMR_CLASSIC
	bool "Enable classic interpreter"

config INTERPRETERS_NONE
	bool "Disable interpreter"

endchoice # Enable interpreter

config INTERPRETERS_WAMR_DEBUG_AOT
	bool "Enable debugger support for AOT modules"
	default n
	depends on INTERPRETERS_WAMR_AOT

config INTERPRETERS_WAMR_DEBUG_INTERP
	bool "Enable debugger support in the interpreter"
	default n
	# Note: It only works with the classic interpreter
	depends on INTERPRETERS_WAMR_CLASSIC
	# Note: It uses thread-manager internally
	depends on INTERPRETERS_WAMR_THREAD_MGR
	# Note: It sets up the listening socket with SO_LINGER
	depends on NET_TCP
	depends on NET_SOLINGER

config INTERPRETERS_WAMR_LOG
	bool "Enable log"
	default n

config INTERPRETERS_WAMR_LIBC_BUILTIN
	bool "Enable built-in libc"
	default n

config INTERPRETERS_WAMR_BUILD_MODULES_FOR_NUTTX
	bool "Build WASM modules for NuttX system interface (Experimental)"
	default n
	depends on INTERPRETERS_WAMR_LIBC_BUILTIN

config INTERPRETERS_WAMR_LIBC_WASI
	bool "Enable WASI libc"
	select PSEUDOFS_SOFTLINKS
	default n
	---help---
		Note: As of writing this, this works only with main branch of
		wasm-micro-runtime.
		I.e. INTERPRETERS_WAMR_VERSION="main"

		Note: As of writing this, most of the filesystem operations are
		not implemented. (Mainly because of lack of openat family of
		the API in NuttX.)

config INTERPRETERS_WAMR_MULTI_MODULE
	bool "Enable multi module support"
	default n

config INTERPRETERS_WAMR_MINILOADER
	bool "Enable mini-loader"
	default n
	---help---
		Mini-loader don't check the integrity of wasm module

config INTERPRETERS_WAMR_REF_TYPES
	bool "Enable reference types support"
	default n

config INTERPRETERS_WAMR_GC
	bool "Enable GC support"
	default n

config INTERPRETERS_WAMR_ENABLE_SPEC_TEST
	bool "Enable spectest support"
	default n

config INTERPRETERS_WAMR_TAIL_CALL
	bool "Enable tail call support"
	default n
	---help---
		This only available for WAMR 1.3.0 later (don't include 1.3.0)

config INTERPRETERS_WAMR_STACK_GUARD_SIZE
	int "Custom stack guard size"
	default 1024
	---help---
		Reserve some space in stack as guard to detect stack overflow.

		Please consider this extra stack consumption when deciding the stack
		size of your NuttX task on which you run WAMR.

		The default value here (1024) was chosen to match the default value on
		the majority of other platforms, including Linux. It also matches
		the expections in the WAMR AoT compiler.
		On the other hand, it might be a bit larger than what's strictly
		necessary, especially for typical NuttX targets.

config INTERPRETERS_WAMR_THREAD_MGR
	bool "Enable thread manager"
	default n

config INTERPRETERS_WAMR_LIB_WASI_THREADS
	bool "Enable wasi-threads"
	default n
	---help---
		See https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/pthread_impls.md

config INTERPRETERS_WAMR_LIB_PTHREAD
	bool "Enable lib pthread (legacy)"
	default n
	---help---
		See https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/pthread_impls.md

config INTERPRETERS_WAMR_LIB_PTHREAD_SEMAPHORE
	bool "Enable semaphore"
	depends on INTERPRETERS_WAMR_LIB_PTHREAD
	default n

config INTERPRETERS_WAMR_SHARED_MEMORY
	bool "Enable shared memory"
	default n

config INTERPRETERS_WAMR_BULK_MEMORY
	bool "Enable bluk memory"
	default n

config INTERPRETERS_WAMR_ENABLE_EXCE_HANDLING
	bool "Enable exception-handling"
	default n

config INTERPRETERS_WAMR_PERF_PROFILING
	bool "Enable performance profiling"
	default n

config INTERPRETERS_WAMR_MEMORY_PROFILING
	bool "Enable memory profiling"
	default n

config INTERPRETERS_WAMR_MEMORY_TRACING
	bool "Enable memory tracing"
	default n

config INTERPRETERS_WAMR_DUMP_CALL_STACK
	bool "Enable dump call stack (on exception)"
	default n

config INTERPRETERS_WAMR_DISABLE_HW_BOUND_CHECK
	bool "Disable hardware bound check"
	default y
	---help---
		This option is currently a no-op because
		NuttX doesn't have necessary functionalities.
		That is, regardless of this setting, WAMR's HW bounds
		check is not available for NuttX.

config INTERPRETERS_WAMR_LOAD_CUSTOM_SECTIONS
	bool "Enable load custom section support"
	default n

config INTERPRETERS_WAMR_CUSTOM_NAME_SECTIONS
	bool "Enable custom name section support"
	default n

config INTERPRETERS_WAMR_GLOBAL_HEAP_POOL
	bool "Enable global heap pool"
	default n

if INTERPRETERS_WAMR_GLOBAL_HEAP_POOL

config INTERPRETERS_WAMR_GLOBAL_HEAP_POOL_SIZE
	int "Global heap pool size (in KB)"
	default 128

endif # INTERPRETERS_WAMR_GLOBAL_HEAP_POOL

config INTERPRETERS_WAMR_CONFIGUABLE_BOUNDS_CHECKS
	bool "Configuable bounds checks"
	default n
	---help---
		Bounds checks enabled by default. With this option, you can
		disable bounds checks passing --disable-bounds-checks to
		iwasm.

config INTERPRETERS_WAMR_EXTERNAL_MODULE_REGISTRY
	bool "Enable external module registry"
	default n
	---help---
		This option enables the support for loading WASM modules from
		external libraries, which is useful when you want to extend the
		functionality of WAMR without modifying its source code.

endif
