lovyan03 / LovyanGFX

SPI LCD graphics library for ESP32 (ESP-IDF/ArduinoESP32) / ESP8266 (ArduinoESP8266) / SAMD51(Seeed ArduinoSAMD51)
Other
1.03k stars 189 forks source link

The path to ESP-IDF version 5 #282

Closed martinberlin closed 1 year ago

martinberlin commented 1 year ago

It seems the nice people from Espressif has made our lives miserable with some breaking changes:

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/migration-guides/release-5.x/index.html

Most importantly is that the previous GCC version was GCC 8.4.0 (IDF ver < 5). This has now been upgraded to GCC 11.2.0 on all targets.

So far I had also trouble adapting my (mostly SPI) epaper component to build in this new version of IDF.

This is the list that I get so far when trying to compile Lovyan GFX in develop branch and I can help with ideas / testing so it will build also in this version:

113 |     calcClockDiv((size_t*)&div_a,(size_t*) &div_b, (size_t*)&div_n, &clkcnt, 240*1000*1000, _cfg.freq_write);
      |                                                                     ^~~~~~~
      |                                                                     |
      |                                                                     uint32_t* {aka long unsigned int*}
#if __has_include(<esp_private/spi_common_internal.h>)
  #include <esp_private/spi_common_internal.h>
#endif
// Not sure if both are needed but otherwise GPIO is not found
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
  #include "hal/gpio_ll.h"
  #include "soc/gpio_struct.h"
#endif

Other than that in order to keep on finding out what else needs to be updated I had to add some function aliases in platforms/esp32/common.hpp (Note I tried so far only in esp32 platform)

// Function aliases
auto& ets_delay_us = esp_rom_delay_us;
auto& gpio_pad_select_gpio = esp_rom_gpio_pad_select_gpio;
// auto& gpio_matrix_out = gpio_iomux_out; // Not correct since gpio_matrix_out has an additional 4th param: bool oen_inv

Still in the latest GPIO & RTC documentation only gpio_iomux_in / gpio_iomux_out seem to be there, but no **gpiomatrix*** functions. Or I'm missing something and gpio_matrix_in / out are declared somewhere else ?

Why they changed this knowing it will break most existing code, no idea...

This seems to be the last one when compiling my IT8951 example. Will go through it later.

Will be updating this with new findings soon. Like always very grateful to have this component. And I would like to make it build and flash also in this new version of IDF.

martinberlin commented 1 year ago

Impressive update @lovyan03 thanks a lot!

Only remaining thing that I had to comment in order to get it built was:

../components/lovyanGFX/src/lgfx/v1/lgfx_filesystem_support.hpp: At global scope:
../components/lovyanGFX/src/lgfx/v1/lgfx_filesystem_support.hpp:60:13: error: template-id not allowed for destructor
   60 |     virtual ~LGFX_FILESYSTEM_Support<Base>()

I don't get it, now then on GCC 11, you can't add a destructor in a Template? How to do it then?

UPDATE: Latest version on develop is working correctly and already flashed in my wall clock with IT8951. Works perfectly at least with this Panel settings. Great work.

lovyan03 commented 1 year ago

@martinberlin Thanks for letting me know!

I removed the destructor from the template class. Let me know if you still have problems.

martinberlin commented 1 year ago

Hi @lovyan03 Now it builds correctly without any problem in IDF v5. Good work!

dizcza commented 1 year ago

I'm facing the same issue. LGFX is a dependency for https://github.com/sukesh-ak/LVGL8-WT32-SC01-IDF and my hands are dirty fixing the LGFX issues regarding ESP-IDF v5.x. I've already fixed the abovementioned problem with miniz.c, missing required components, missing esp_timer.h includes, but still don't see light at the end of the tunnel.

Should I switch to the develop branch? It looks broken according to CI.

lovyan03 commented 1 year ago

@dizcza I have just readjusted the develop branch. I think it should build now. There seems to be a build error in IDFv4.3.1 of ESP32-S2, but this should not affect this case.

dizcza commented 1 year ago

@lovyan03 thanks! The developer branch works now with ESP-IDF v5.1-dev-96-gafc6fba7f5-dirty. Tested on the WT32-SC01 v3.3 board.

dizcza commented 1 year ago

It outputs a number of annoying warnings though:

In file included from /home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v0/panel/Panel_GDEW0154M09.cpp:4:
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v0/panel/Panel_GDEW0154M09.hpp: In constructor 'lgfx::v0::Panel_GDEW0154M09::Panel_GDEW0154M09()':
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v0/panel/Panel_GDEW0154M09.hpp:52:20: warning: implicitly-declared 'constexpr lgfx::v0::range_rect_t& lgfx::v0::range_rect_t::operator=(const lgfx::v0::range_rect_t&)' is deprecated [-Wdeprecated-copy]
   52 |       _range_new = _range_old;
      |                    ^~~~~~~~~~
In file included from /home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v0/panel/Panel_GDEW0154M09.cpp:1:
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v0/panel/../lgfx_common.hpp:1634:5: note: because 'lgfx::v0::range_rect_t' has user-provided 'lgfx::v0::range_rect_t::range_rect_t(const lgfx::v0::range_rect_t&)'
 1634 |     range_rect_t(const range_rect_t& rhs) : horizon(rhs.horizon), vertical(rhs.vertical) {}
      |     ^~~~~~~~~~~~
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v0/panel/Panel_GDEW0154M09.cpp: In member function 'virtual void lgfx::v0::Panel_GDEW0154M09::post_init(lgfx::v0::LGFX_Device*, bool)':
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v0/panel/Panel_GDEW0154M09.cpp:26:18: warning: implicitly-declared 'constexpr lgfx::v0::range_rect_t& lgfx::v0::range_rect_t::operator=(const lgfx::v0::range_rect_t&)' is deprecated [-Wdeprecated-copy]
   26 |     _range_new = _range_old;
      |                  ^~~~~~~~~~
In file included from /home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v0/panel/Panel_GDEW0154M09.cpp:1:
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v0/panel/../lgfx_common.hpp:1634:5: note: because 'lgfx::v0::range_rect_t' has user-provided 'lgfx::v0::range_rect_t::range_rect_t(const lgfx::v0::range_rect_t&)'
 1634 |     range_rect_t(const range_rect_t& rhs) : horizon(rhs.horizon), vertical(rhs.vertical) {}
      |     ^~~~~~~~~~~~
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v0/panel/Panel_GDEW0154M09.cpp: In static member function 'static void lgfx::v0::Panel_GDEW0154M09::display(lgfx::v0::PanelCommon*, lgfx::v0::LGFX_Device*, int32_t, int32_t, int32_t, int32_t)':
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v0/panel/Panel_GDEW0154M09.cpp:302:26: warning: implicitly-declared 'constexpr lgfx::v0::range_rect_t& lgfx::v0::range_rect_t::operator=(const lgfx::v0::range_rect_t&)' is deprecated [-Wdeprecated-copy]
  302 |     me->_range_old = me->_range_new;
      |                          ^~~~~~~~~~
In file included from /home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v0/panel/Panel_GDEW0154M09.cpp:1:
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v0/panel/../lgfx_common.hpp:1634:5: note: because 'lgfx::v0::range_rect_t' has user-provided 'lgfx::v0::range_rect_t::range_rect_t(const lgfx::v0::range_rect_t&)'
 1634 |     range_rect_t(const range_rect_t& rhs) : horizon(rhs.horizon), vertical(rhs.vertical) {}
      |     ^~~~~~~~~~~~
[850/1071] Building CXX object esp-idf/LovyanGFX/CMakeF...df_LovyanGFX.dir/src/lgfx/v0/panel/Panel_IT8951.cpp.obj/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v0/panel/Panel_IT8951.cpp: In static member function 'static void lgfx::v0::Panel_IT8951::display(lgfx::v0::PanelCommon*, lgfx::v0::LGFX_Device*, int32_t, int32_t, int32_t, int32_t)':
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v0/panel/Panel_IT8951.cpp:672:26: warning: implicitly-declared 'constexpr lgfx::v0::range_rect_t& lgfx::v0::range_rect_t::operator=(const lgfx::v0::range_rect_t&)' is deprecated [-Wdeprecated-copy]
  672 |     me->_range_old = me->_range_new;
      |                          ^~~~~~~~~~
In file included from /home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v0/panel/Panel_IT8951.cpp:1:
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v0/panel/../lgfx_common.hpp:1634:5: note: because 'lgfx::v0::range_rect_t' has user-provided 'lgfx::v0::range_rect_t::range_rect_t(const lgfx::v0::range_rect_t&)'
 1634 |     range_rect_t(const range_rect_t& rhs) : horizon(rhs.horizon), vertical(rhs.vertical) {}
      |     ^~~~~~~~~~~~
[1065/1071] Building CXX object esp-idf/main/CMakeFiles/__idf_main.dir/main.cpp.objIn file included from /home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/lvgl/src/core/lv_obj.h:140,
                 from /home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/lvgl/lvgl.h:35,
                 from /home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/main/main.cpp:21:
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/lvgl/src/core/lv_obj_style.h: In function 'void lv_obj_remove_style_all(_lv_obj_t*)':
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/lvgl/src/core/lv_obj_style.h:94:48: warning: bitwise operation between different enumeration types '<unnamed enum>' and '<unnamed enum>' is deprecated [-Wdeprecated-enum-enum-conversion]
   94 |     lv_obj_remove_style(obj, NULL, LV_PART_ANY | LV_STATE_ANY);
      |                                    ~~~~~~~~~~~~^~~~~~~~~~~~~~
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/main/main.cpp: In function 'void app_main()':
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/main/main.cpp:71:35: warning: missing initializer for member 'esp_timer_create_args_t::arg' [-Wmissing-field-initializers]
   71 |             .name = "periodic_gui"};
      |                                   ^
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/main/main.cpp:71:35: warning: missing initializer for member 'esp_timer_create_args_t::dispatch_method' [-Wmissing-field-initializers]
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/main/main.cpp:71:35: warning: missing initializer for member 'esp_timer_create_args_t::skip_unhandled_events' [-Wmissing-field-initializers]
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/main/main.cpp: In function 'void display_flush(lv_disp_drv_t*, const lv_area_t*, lv_color_t*)':
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/main/main.cpp:106:19: warning: 'void lgfx::v1::LGFXBase::pushColors(const uint16_t*, int32_t, bool)' is deprecated: use pushPixels [-Wdeprecated-declarations]
  106 |     lcd.pushColors((uint16_t *)&color_p->full, w * h, true);
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v1_init.hpp:25,
                 from /home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/LovyanGFX.hpp:31,
                 from /home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/LovyanGFX.h:5,
                 from /home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/main/main.cpp:16:
/home/dizcza/Projects/Embedded/eclipse-workspace/other/LVGL8-WT32-SC01-IDF/components/LovyanGFX/src/lgfx/v1/LGFXBase.hpp:766:43: note: declared here
  766 |     [[deprecated("use pushPixels")]] void pushColors(const uint16_t* data, int32_t len, bool swap) { startWrite(); writePixels(data, len, swap); endWrite(); }
      |                                           ^~~~~~~~~~

Something to be fixed on a rainy evening.

tobozo commented 1 year ago

lgfx::v0 should probably be filtered out with esp-idf 5.0, maybe with a conditional list(REMOVE_ITEM)in the CMakeLists.txt ?

lovyan03 commented 1 year ago

I have made the adjustment again. Perhaps this will eliminate the warning.

sukesh-ak commented 1 year ago

@lovyan03 Since IDF 5.0 just got released, do you have any timeline on these updates in release branch?

tobozo commented 1 year ago

workflow CI has been updated v5.0-beta1 => v5.0

image

sukesh-ak commented 1 year ago

@tobozo why does it say beta? IDF 5.0 was released few days ago.

tobozo commented 1 year ago

workflow CI has been updated v5.0-beta1 => v5.0

@sukesh-ak it says v5.0

sukesh-ak commented 1 year ago

workflow CI has been updated v5.0-beta1 => v5.0

@sukesh-ak it says v5.0

Sorry for the confusion :)

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 1 year ago

This issue has been automatically closed because it has not had recent activity. Thank you for your contributions.