-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Open
Labels
area: LVGLLight and Versatile Graphics Library SupportLight and Versatile Graphics Library SupportbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bug
Description
Describe the bug
It seems LVGL by default ships with its own version of sprintf
, overwriting the picolibc one via linker order priority.
This is a problem because the one provided by LVGL does not support floating point formatting.
Reproduce
Replace the code in samples/hello_world/src/main.c
with:
#include <stdio.h>
int main(void)
{
printf("Hello World! %s\n", CONFIG_BOARD_TARGET);
double pi = 355.0 / 113.0;
char data[20];
snprintf(data, sizeof(data), "snprintf: %f", pi);
printf("%s\n", data);
printf("printf: %f\n", pi);
return 0;
}
west build -b qemu_cortex_a53 samples/hello_world -t run -- \
-DCONFIG_LVGL=y \
-DCONFIG_DISPLAY=y \
-DCONFIG_DUMMY_DISPLAY=y \
-DDTC_OVERLAY_FILE=../drivers/display/dummy_dc.overlay \
-DCONFIG_MAIN_STACK_SIZE=8192 \
-DCONFIG_HEAP_MEM_POOL_SIZE=8192 \
-DCONFIG_LV_Z_MEM_POOL_SIZE=65536
Result:
*** Booting Zephyr OS build v4.2.1 ***
Hello World! qemu_cortex_a53/qemu_cortex_a53
snprintf: f
printf: 3.141593
When I add -DCONFIG_LV_USE_CUSTOM_SPRINTF=y
, then I get:
*** Booting Zephyr OS build v4.2.1 ***
Hello World! qemu_cortex_a53/qemu_cortex_a53
snprintf: 3.141593
printf: 3.141593
Fixing the problem.
Regression
- This is a regression.
Impact
Functional Limitation – Some features not working as expected, but system usable.
Environment
- Windows
- Zephyr 4.2.1
- Zephyr SDK 0.17.4
Additional Context
No response
Metadata
Metadata
Assignees
Labels
area: LVGLLight and Versatile Graphics Library SupportLight and Versatile Graphics Library SupportbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bug