menu "Memory and Standard Library"

config LV_STDLIB_BUILTIN
	int
	default 0

config LV_STDLIB_CLIB
	int
	default 1

config LV_STDLIB_MICROPYTHON
	int
	default 2

config LV_STDLIB_RTTHREAD
	int
	default 3

config LV_STDLIB_CUSTOM
	int
	default 255

choice
	prompt "Malloc functions source"
	default LV_USE_BUILTIN_MALLOC

config LV_USE_BUILTIN_MALLOC
	select LV_USE_TLSF
	bool "LVGL built-in"

config LV_USE_CLIB_MALLOC
	bool "C standard library (malloc/realloc/free)"

config LV_USE_MICROPYTHON_MALLOC
	bool "MicroPython"

config LV_USE_RTTHREAD_MALLOC
	bool "RT-Thread"

config LV_USE_CUSTOM_MALLOC
	bool "Custom (implemented externally)"

endchoice # "Malloc functions"

config LV_USE_STDLIB_MALLOC
	int
	default LV_STDLIB_BUILTIN 	if LV_USE_BUILTIN_MALLOC
	default LV_STDLIB_CLIB 		if LV_USE_CLIB_MALLOC
	default LV_STDLIB_MICROPYTHON 	if LV_USE_MICROPYTHON_MALLOC
	default LV_STDLIB_RTTHREAD 	if LV_USE_RTTHREAD_MALLOC
	default LV_STDLIB_CUSTOM 	if LV_USE_CUSTOM_MALLOC

choice
	prompt "String functions source"
	default LV_USE_BUILTIN_STRING

config LV_USE_BUILTIN_STRING
	bool "LVGL built-in"

config LV_USE_CLIB_STRING
	bool "C standard library (memcpy/memset/strlen/strcpy)"

config LV_USE_RTTHREAD_STRING
	bool "RT-Thread (rt_memcpy/rt_memset/rt_strlen/rt_strcpy)"

config LV_USE_CUSTOM_STRING
	bool "Custom (implemented externally)"

endchoice

config LV_USE_STDLIB_STRING
	int
	default LV_STDLIB_BUILTIN 	if LV_USE_BUILTIN_STRING
	default LV_STDLIB_CLIB 		if LV_USE_CLIB_STRING
	default LV_STDLIB_RTTHREAD 	if LV_USE_RTTHREAD_STRING
	default LV_STDLIB_CUSTOM 	if LV_USE_CUSTOM_STRING

choice
	prompt "Sprintf functions source"
	default LV_USE_BUILTIN_SPRINTF

config LV_USE_BUILTIN_SPRINTF
	bool "LVGL built-in"

config LV_USE_CLIB_SPRINTF
	bool "C standard library (vsnprintf)"

config LV_USE_RTTHREAD_SPRINTF
	bool "RT-Thread (rt_vsnprintf)"

config LV_USE_CUSTOM_SPRINTF
	bool "Custom (implemented externally)"

endchoice # "Sprintf functions"

config LV_USE_STDLIB_SPRINTF
	int
	default LV_STDLIB_BUILTIN 	if LV_USE_BUILTIN_SPRINTF
	default LV_STDLIB_CLIB 		if LV_USE_CLIB_SPRINTF
	default LV_STDLIB_RTTHREAD 	if LV_USE_RTTHREAD_SPRINTF
	default LV_STDLIB_CUSTOM 	if LV_USE_CUSTOM_SPRINTF

if LV_USE_BUILTIN_MALLOC

menu "Builtin Malloc Settings"

config LV_MEM_SIZE
	int "Memory size (bytes)"
	default 65536
	help
	  Size of the pool `lv_malloc()` allocates from. Needs to be at least 2kB (2048).

config LV_MEM_SIZE_KILOBYTES
	int "Memory size (KB) [DEPRECATED: use LV_MEM_SIZE]"
	default 0
	help
	  Deprecated. Use LV_MEM_SIZE (in bytes) instead.

config LV_MEM_POOL_EXPAND_SIZE_KILOBYTES
	int "Memory pool expand size (KB) [DEPRECATED: use LV_MEM_SIZE directly]"
	default 0
	help
	  Deprecated. Modify LV_MEM_SIZE (in bytes) directly instead.

config LV_MEM_ADR
	hex "Memory pool address"
	default 0x0
	help
	  Place the pool at a fixed address instead of allocating it as a normal array.
	  0: unused.
endmenu

endif #LV_USE_BUILTIN_MALLOC

# Emitted verbatim (unquoted) as the #include argument.
config LV_STDINT_INCLUDE
	string "Header for integer types (stdint)"
	default "stdint.h"

config LV_STDDEF_INCLUDE
	string "Header for standard definitions (stddef)"
	default "stddef.h"

config LV_STDBOOL_INCLUDE
	string "Header for boolean types (stdbool)"
	default "stdbool.h"

config LV_INTTYPES_INCLUDE
	string "Header for fixed-width integer format macros (inttypes)"
	default "inttypes.h"

config LV_LIMITS_INCLUDE
	string "Header for implementation limits (limits)"
	default "limits.h"

config LV_STDARG_INCLUDE
	string "Header for variadic argument handling (stdarg)"
	default "stdarg.h"

config LV_USE_TLSF
	bool
	default n
endmenu
