Background
I have used LVGL for about 2 days and I created a very simple UI via the preview editor integrated in VSCode. It properly compiles and displays there. The project format is identical to that of the XML hello world example found here except the ui folder is located within an overarching src folder which contains other application code.
Target application
- 2.8" TFT LCD (ILI9341) driven with DRM
- Beaglebone Black
- Buildroot
I am now trying to integrate this application into a broader embedded linux project which is built & configured with buildroot. I have already confirmed that I can write properly to the display so now itās just a matter of getting the graphics deployed.
My project is separated into two distinct repos:
- An āapplicationā where LVGL UI resides along with other application code
- A āplatformā where buildroot resides and integrates all necessary packages
Errors seen
Iām missing functions which are enabled in the preview environment. In the code itself I use a find_by_name function to obtain lv_obj_t for named XML items at runtime to make a grid. I also register a font at runtime as I couldnāt figure out how to do it properly in XML yet.
error: implicit declaration of function ālv_obj_set_name_staticā; did you mean ālv_obj_set_stateā? [-Wimplicit-function-declaration]
49 | lv_obj_set_name_static(lv_obj_0, "screen_secondary_#");
error: implicit declaration of function ālv_obj_get_nameā; did you mean ālv_obj_get_stateā? [-Wimplicit-function-declaration]
16 | const char *n = lv_obj_get_name(root); /* LVGL 9 */
error: implicit declaration of function ālv_xml_register_fontā; did you mean ālv_style_register_propā? [-Wimplicit-function-declaration]
116 | lv_xml_register_font(NULL, "plex_sans_12", plex_sans_12);
error: implicit declaration of function ālv_obj_set_name_staticā; did you mean ālv_obj_set_stateā? [-Wimplicit-function-declaration]
69 | lv_obj_set_name_static(lv_obj_0, "screen_main_#");
error: implicit declaration of function ālv_obj_set_nameā; did you mean ālv_obj_set_stateā? [-Wimplicit-function-declaration]
80 | lv_obj_set_name(time, "time");
Code to reproduce
This is the lvgl-graphics.mk I am using in a buildroot external tree to install LVGL on the target. The lv_conf.h is located within this external tree.
LVGL_GRAPHICS_VERSION = 4170bcb1ee04719a8e27dd6f7c64d30ba88ead18
LVGL_GRAPHICS_SITE = https://github.com/lvgl/lvgl.git
LVGL_GRAPHICS_SITE_METHOD = git
LVGL_GRAPHICS_INSTALL_STAGING = YES
LVGL_GRAPHICS_DEPENDENCIES = libdrm
LVGL_GRAPHICS_CONF_OPTS = \
-DBUILD_SHARED_LIBS=OFF \
-DCONFIG_LV_BUILD_EXAMPLES=OFF \
-DCONFIG_LV_BUILD_DEMOS=OFF \
-DLV_BUILD_CONF_DIR=$(@D) \
-DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/libdrm" \
-DCMAKE_CXX_FLAGS="$(TARGET_CXXFLAGS) -I$(STAGING_DIR)/usr/include/libdrm"
define LVGL_GRAPHICS_PRE_CONFIGURE_HOOK
cp $(LVGL_GRAPHICS_PKGDIR)/lv_conf.h $(@D)/lv_conf.h
endef
LVGL_GRAPHICS_PRE_CONFIGURE_HOOKS += LVGL_GRAPHICS_PRE_CONFIGURE_HOOK
define LVGL_GRAPHICS_INSTALL_STAGING_CMDS
$(TARGET_MAKE_ENV) $(BR2_CMAKE) --install $(@D) --prefix $(STAGING_DIR)/usr
$(INSTALL) -D -m 0644 $(LVGL_GRAPHICS_PKGDIR)/lv_conf.h \
$(STAGING_DIR)/usr/include/lvgl/lv_conf.h
endef
define LVGL_GRAPHICS_INSTALL_TARGET_CMDS
true
endef
$(eval $(cmake-package))
Questions
- How do I enable these missing functions in my target application?
- What is the best way to reference XML objects in code? Better way than obtaining by name at runtime?
- How do I register custom font so itās recognized within XML?

