Skip to content

Commit 47c4e3d

Browse files
faxe1008nashif
authored andcommitted
modules: lvgl: Use Zephyr builtins instead of LVGL stdlib/string impls
Previously LVGL added its own version of several stdlib functions. Replace them with the Zephyr provided functions instead. Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
1 parent 9007a4f commit 47c4e3d

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

modules/lvgl/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,14 +306,8 @@ zephyr_library_sources(
306306
${LVGL_DIR}/src/others/xml/parsers/lv_xml_tabview_parser.c
307307
${LVGL_DIR}/src/others/xml/parsers/lv_xml_textarea_parser.c
308308

309-
${LVGL_DIR}/src/stdlib/builtin/lv_sprintf_builtin.c
310-
${LVGL_DIR}/src/stdlib/builtin/lv_string_builtin.c
311309
${LVGL_DIR}/src/stdlib/builtin/lv_tlsf.c
312310

313-
${LVGL_DIR}/src/stdlib/clib/lv_mem_core_clib.c
314-
${LVGL_DIR}/src/stdlib/clib/lv_sprintf_clib.c
315-
${LVGL_DIR}/src/stdlib/clib/lv_string_clib.c
316-
317311
${LVGL_DIR}/src/stdlib/lv_mem.c
318312

319313
${LVGL_DIR}/src/themes/default/lv_theme_default.c

modules/lvgl/include/lv_conf.h

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#define ZEPHYR_MODULES_LVGL_LV_CONF_H_
1010

1111
#include <zephyr/toolchain.h>
12+
#include <string.h>
13+
#include <stdint.h>
1214

1315
/* Memory manager settings */
1416

@@ -26,9 +28,32 @@
2628
#define lv_free_core lvgl_free
2729
#endif
2830

29-
/* Misc settings */
31+
/* Stdlib wrappers */
32+
33+
/* Needed because parameter types are not compatible */
34+
static __always_inline void zmemset(void *dst, uint8_t v, size_t len)
35+
{
36+
memset(dst, v, len);
37+
}
38+
3039
#define lv_snprintf snprintf
3140
#define lv_vsnprintf vsnprintf
41+
#define lv_memcpy memcpy
42+
#define lv_memmove memmove
43+
#define lv_memset zmemset
44+
#define lv_memcmp memcmp
45+
#define lv_strdup strdup
46+
#define lv_strndup strndup
47+
#define lv_strlen strlen
48+
#define lv_strnlen strnlen
49+
#define lv_strcmp strcmp
50+
#define lv_strncmp strncmp
51+
#define lv_strcpy strcpy
52+
#define lv_strncpy strncpy
53+
#define lv_strlcpy strlcpy
54+
#define lv_strcat strcat
55+
#define lv_strncat strncat
56+
#define lv_strchr strchr
3257
#define LV_ASSERT_HANDLER __ASSERT_NO_MSG(false);
3358
#define LV_ASSERT_HANDLER_INCLUDE "zephyr/sys/__assert.h"
3459

0 commit comments

Comments
 (0)