Is it not possible to build the Unix port with `LV_COLOR_DEPTH=1`?

I have LVGL running on my hardware using the Micropython version and now I am now trying to make LVGL work in my device simulator. The simulator already works with the Micropython Unix port from before I was using LVGL.

Now I am trying to get LVGL working in the simulator, building with -DLV_COLOR_DEPTH=1 to simulate my device’s monochrome screen, but I get build errors that I haven’t been able to track down yet.

CC build-standard/lvgl/lv_mpy.c
CC ../../lib/lv_bindings/driver/png/mp_lodepng.c
build-standard/lvgl/lv_mpy.c: In function ‘mp_funcptr_lv_color_filter_cb_t’:
build-standard/lvgl/lv_mpy.c:5309:43: error: invalid initializer
 #define mp_write_lv_color32_t(struct_obj) *mp_write_ptr_lv_color32_t(struct_obj)
                                           ^
build-standard/lvgl/lv_mpy.c:5382:23: note: in expansion of macro ‘mp_write_lv_color32_t’
     lv_color_t arg1 = mp_write_lv_color32_t(mp_args[1]);
                       ^~~~~~~~~~~~~~~~~~~~~
build-standard/lvgl/lv_mpy.c: In function ‘mp_funcptr_flush_cb’:
build-standard/lvgl/lv_mpy.c:6996:27: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     lv_color_t *color_p = mp_write_ptr_lv_color32_t(mp_args[2]);

Is this supported in the Unix port?

Thanks!

I just tried it now and it builds without errors. It even somehow runs with the SDL driver.
I’m not sure why you are getting errors on your side.

Some ideas:

  • Make sure you are using the latest lv_micropython version
  • Make sure you update git submodules recursively
  • Run make clean and try again
  • Change LV_COLOR_DEPTH in lv_conf.h instead of passing -DLV_COLOR_DEPTH=1.
    This may be important because lv_conf.h is being used in different contexts and I’m not sure your -D reached all of them.
1 Like

Thanks, adding it to lv_conf.h was the fix!

I was trying to keep everything on the command line as I have a couple of variants with slightly different configurations to build for, but I can just have two config files and rename the one for the current build to lv_conf.h.

It should be possible to configure this on the command line.
Did you try LV_CFLAGS?

make -C ports/unix LV_CFLAGS="-DLV_COLOR_DEPTH=1"

Ugh…I had put it in CFLAGS, not LV_CFLAGS. Makes sense now why it didn’t work.

This is working perfectly now.

Thanks again!