lv_port_esp32: LVGL does not build for ESP32-S2

We use GitHub issues for development related discussions. Please use the forum to ask questions.

Describe the issue

When compiling the build fails: (see below).

I made a fix at https://github.com/cmumford/lv_port_esp32/commit/8697e2cdd05ba3d49393a52f43959cdb92c178a9. However, I don’t yet have an attached screen, so it is untested - it only compiles. I will create a PR for that commit when I have a chance to test the change. (maybe this weekend 🤞)

Code to reproduce the issue

Follow getting started guide: https://github.com/lvgl/lv_port_esp32#get-started except specify the esp32s2 target:

idf.py set-target esp32s2
idf.py menuconfig

Expected Results

Successful build

Actual Results

Failure as shown below

ESP32 Chip version

ESP32-S2

ESP-IDF version

ESP-IDF v4.3-dev-1901-g178b122c1

Development kit used

Cucumber R ESP32-S2 (but never ran on it)

Development machine OS

macOS: 10.15.7

Compilation warnings/errors (if available)

../components/lv_port_esp32/components/lvgl_esp32_drivers/lvgl_helpers.c: In function 'lvgl_spi_driver_init':
../components/lv_port_esp32/components/lvgl_esp32_drivers/lvgl_helpers.c:204:35: error: 'VSPI_HOST' undeclared (first use in this function); did you mean 'FSPI_HOST'?
     assert((SPI_HOST <= host) && (VSPI_HOST >= host));
                                   ^~~~~~~~~
~/esp/esp-idf/components/esp_common/include/esp_compiler.h:29:25: note: in definition of macro 'likely'
 #define likely(x)      (x)
                         ^
../components/lv_port_esp32/components/lvgl_esp32_drivers/lvgl_helpers.c:204:5: note: in expansion of macro 'assert'
     assert((SPI_HOST <= host) && (VSPI_HOST >= host));
     ^~~~~~
../components/lv_port_esp32/components/lvgl_esp32_drivers/lvgl_helpers.c:204:35: note: each undeclared identifier is reported only once for each function it appears in
     assert((SPI_HOST <= host) && (VSPI_HOST >= host));
                                   ^~~~~~~~~
~/esp/esp-idf/components/esp_common/include/esp_compiler.h:29:25: note: in definition of macro 'likely'
 #define likely(x)      (x)
                         ^
../components/lv_port_esp32/components/lvgl_esp32_drivers/lvgl_helpers.c:204:5: note: in expansion of macro 'assert'
     assert((SPI_HOST <= host) && (VSPI_HOST >= host));

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Hi @cmumford, thanks for the report. I don’t have any ESP32-S2 at hand, but if I remember correctly it doesn’t have the same SPI master ports as the ESP32, let me check it’s documentation and we can try figure out a way to make it work.

I will try to update the LVGL submodule as the Kconfig file now is available on the main repo, but before that I will create a release with the current state of the repo.

EDIT: The SPI Master ports are renamed for the ESP32-S2 (and S3): https://github.com/espressif/esp-idf/blob/357a2776032299b8bc4044900a8f1d6950d7ce89/components/hal/include/hal/spi_types.h#L47-L57

#ifdef CONFIG_IDF_TARGET_ESP32
#define SPI_HOST    SPI1_HOST
#define HSPI_HOST   SPI2_HOST
#define VSPI_HOST   SPI3_HOST
#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
// SPI_HOST (SPI1_HOST) is not supported by the SPI Master and SPI Slave driver on ESP32-S2
#define SPI_HOST    SPI1_HOST
#define FSPI_HOST   SPI2_HOST
#define HSPI_HOST   SPI3_HOST
#endif