Using LVGL on Arduino

I am trying to write lvgl code to run on an ESP32 S3 on the CrowPanel 7" display. I modified one of the official demos. The code is as follows:


/*Using LVGL with Arduino requires some extra steps:
 *Be sure to read the docs here: https://docs.lvgl.io/master/integration/framework/arduino.html  */
#include <lvgl.h>

/*Set to your screen resolution and rotation*/
#define TFT_HOR_RES 800
#define TFT_VER_RES 480
#define TFT_ROTATION LV_DISPLAY_ROTATION_0

/*LVGL draw into this buffer, 1/10 screen size usually works well. The size is in bytes*/
#define DRAW_BUF_SIZE (TFT_HOR_RES * TFT_VER_RES / 10 * (LV_COLOR_DEPTH / 8))
uint32_t draw_buf[DRAW_BUF_SIZE / 4];

/* LVGL calls it when a rendered image needs to copied to the display*/
void my_disp_flush(lv_display_t *disp, const lv_area_t *area, uint8_t *px_map) {
  /*Copy `px map` to the `area`*/

  /*For example ("my_..." functions needs to be implemented by you)
    uint32_t w = lv_area_get_width(area);
    uint32_t h = lv_area_get_height(area);

    my_set_window(area->x1, area->y1, w, h);
    my_draw_bitmaps(px_map, w * h);
     */

  /*Call it to tell LVGL you are ready*/
  lv_display_flush_ready(disp);
}

/*Read the touchpad*/
void my_touchpad_read(lv_indev_t *indev, lv_indev_data_t *data) {
  /*For example  ("my_..." functions needs to be implemented by you)
    int32_t x, y;
    bool touched = my_get_touch( &x, &y );

    if(!touched) {
        data->state = LV_INDEV_STATE_RELEASED;
    } else {
        data->state = LV_INDEV_STATE_PRESSED;

        data->point.x = x;
        data->point.y = y;
    }
     */
}

/*use Arduinos millis() as tick source*/
static uint32_t my_tick(void) {
  return millis();
}

void setup() {
  String LVGL_Arduino = "Hello Arduino! ";
  LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();

  Serial.begin(115200);
  Serial.println(LVGL_Arduino);

  lv_init();

  /*Set a tick source so that LVGL will know how much time elapsed. */
  lv_tick_set_cb(my_tick);

  lv_display_t *disp;

  /*Else create a display yourself*/
  disp = lv_display_create(TFT_HOR_RES, TFT_VER_RES);
  lv_display_set_flush_cb(disp, my_disp_flush);
  lv_display_set_buffers(disp, draw_buf, NULL, sizeof(draw_buf), LV_DISPLAY_RENDER_MODE_PARTIAL);


  /*Initialize the (dummy) input device driver*/
  lv_indev_t *indev = lv_indev_create();
  lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER); /*Touchpad should have POINTER type*/
  lv_indev_set_read_cb(indev, my_touchpad_read);

  lv_obj_t *label = lv_label_create(lv_screen_active());
  lv_label_set_text(label, "Hello Arduino, I'm LVGL!");
  lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);

  Serial.println("Setup done");
}

void loop() {
  lv_timer_handler(); /* let the GUI do its work */
  delay(5);           /* let this time pass */
}

And here are the error messages I get when I try to compile:

/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h: Assembler messages:
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:41: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:43: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:55: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:57: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:77: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:79: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:103: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:105: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:134: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:136: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:160: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:162: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:182: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:184: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:200: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:202: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:214: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:222: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:230: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:232: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:20: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:24: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:32: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:36: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:44: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:48: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:56: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:60: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:67: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:72: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:77: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:82: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:21: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:22: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:27: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:28: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:33: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:34: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:39: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:40: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:51: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:52: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:61: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:62: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:71: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:72: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:81: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:82: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h: Assembler messages:
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:41: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:43: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:55: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:57: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:77: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:79: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:103: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:105: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:134: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:136: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:160: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:162: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:182: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:184: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:200: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:202: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:214: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:222: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:230: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/machine/_default_types.h:232: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:20: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:24: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:32: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:36: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:44: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:48: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:56: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:60: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:67: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:72: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:77: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/sys/_stdint.h:82: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:21: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:22: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:27: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:28: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:33: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:34: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:39: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:40: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:51: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:52: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:61: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:62: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:71: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:72: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:81: Error: unknown opcode or format name ‘typedef’
/Users/craiglindley/Library/Arduino15/packages/esp32/tools/esp-xs3/2302/xtensa-esp32s3-elf/sys-include/stdint.h:82: Error: unknown opcode or format name ‘typedef’

exit status 1

Compilation error: exit status 1

Please tell me what I am doing wrong.

Thank You

Hey, can you try the solution in this issue on github?

You may forgot to enable the lv_conf.h or using incorrect version of lv_conf.h from v8.x into this v9.x.