Proper component setup with esp-idf

kyrpav
Posts: 37
Joined: Wed Jan 29, 2020 8:27 am

Proper component setup with esp-idf

Postby kyrpav » Sat Mar 04, 2023 3:32 pm

I am trying to make an lvgl project with esp32. I have started with the
https://docs.lvgl.io/master/get-started ... essif.html
that guides you to include in component folder the lvgl and lvgl_esp32_drivers as git submodules. The drivers project is needed for the displays but on build there are several problems.

I am using esp 5.0.1 stable release and release/v8.3 of lvgl also master branch of lvgl_esp32_drivers cause there is no release branch there.

All included headers from esp-idf framework in lvgl_esp32_drivers can not be identified like "driver/gpio.h" etc... Relative picture is
attached
Screenshot 2023-03-03 at 23.40.33.png
Screenshot 2023-03-03 at 23.40.33.png (281.4 KiB) Viewed 22937 times
I do not know what is the proper way to fix this. the c_cpp_properties.json is the next

Code: Select all

{
    "configurations": [
        {
            "name": "ESP-IDF",
            "compilerPath": "/Users/kyrpav/.espressif/tools/xtensa-esp32-elf/esp-2022r1-11.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc",
            "cStandard": "c11",
            "cppStandard": "c++17", 
            "includePath": [
                "${config:idf.espIdfPath}/components/**",
                "${config:idf.espIdfPathWin}/components/**",
                "${config:idf.espAdfPath}/components/**",
                "${config:idf.espAdfPathWin}/components/**",
                "${workspaceFolder}/**"
            ],
            "browse": {
                "path": [
                    "${config:idf.espIdfPath}/components",
                    "${config:idf.espIdfPathWin}/components",
                    "${config:idf.espAdfPath}/components/**",
                    "${config:idf.espAdfPathWin}/components/**",
                    "${workspaceFolder}"
                ],
                "limitSymbolsToIncludedHeaders": false
            },
            "compileCommands": "${workspaceFolder}/build/compile_commands.json"
        }
    ],
    "version": 4
}
The CMakeList.txt file in the lvgl_esp32_drivers project has almost at the end this code.

Code: Select all

idf_component_register(SRCS ${SOURCES}
                       INCLUDE_DIRS ${LVGL_INCLUDE_DIRS}
                       REQUIRES lvgl)
Which i changes to

Code: Select all

idf_component_register(SRCS ${SOURCES}
                       INCLUDE_DIRS ${LVGL_INCLUDE_DIRS}
                       REQUIRES lvgl driver esp_common log freertos)
And fixed the issues of include.

Next problem was that in specific .c for ili9341.c ( sdkconfig by default has this as selected screen controller) i was getting error that
portTick_RATE_MS can not be identified and probably i need to change to portTick_PERIOD_MS. Since the first is defined to be the second i made the changes to the complete .c file and the problem was resolved.

After this next error i do not really know how to resolve :
1.
components/lvgl_esp32_drivers/lvgl_tft/ili9341.c:84:5: error: implicit declaration of function 'gpio_pad_select_gpio'; did you mean 'esp_rom_gpio_pad_select_gpio'? [-Werror=implicit-function-declaration]
84 | gpio_pad_select_gpio(ILI9341_DC);
| ^~~~~~~~~~~~~~~~~~~~
| esp_rom_gpio_pad_select_gpio
Though "driver/gpio.h" is included properly the gpio function can not be identified. Which seems that what i ded with component register maybe is not enough

2.
components/lvgl_esp32_drivers/lvgl_tft/esp_lcd_backlight.c:52:14: error: 'ledc_timer_config_t' has no member named 'bit_num'
52 | .bit_num = LEDC_TIMER_10_BIT,
3.
components/lvgl_esp32_drivers/lvgl_tft/esp_lcd_backlight.c:67:43: error: 'SIG_GPIO_OUT_IDX' undeclared (first use in this function)
67 | gpio_matrix_out(config->gpio_num, SIG_GPIO_OUT_IDX, config->output_invert, false);

kyrpav
Posts: 37
Joined: Wed Jan 29, 2020 8:27 am

Re: Proper component setup with esp-idf

Postby kyrpav » Sun Mar 05, 2023 1:12 pm

In the link

https://forum.lvgl.io/t/implicit-declar ... -gpio/8177

shows to include rom/gpio.h to driver/gpio.h to solve the issues with esp-idf and esp_lvgl_drivers after this

And
viewtopic.php?t=18861

Shows that the .bit_num is changed to .duty_resolution


CMakeList.txt is changed to
  1. idf_component_register(SRCS ${SOURCES}
  2.                        INCLUDE_DIRS ${LVGL_INCLUDE_DIRS}
  3.                        REQUIRES lvgl driver esp_common log freertos esp_rom soc)

Soc was supposed to solve the #define SIG_GPIO_OUT_IDX 128 that exists in components but it does not fix it so i had to included in the
esp_lcd_backlight.c that had the issue. after this all issues are fixed.

StarterKit
Posts: 2
Joined: Thu Nov 14, 2019 8:24 am

Re: Proper component setup with esp-idf

Postby StarterKit » Tue Nov 21, 2023 3:31 pm

kyrpav wrote: ..
Thank you very much for your comments. I used your fixes and it saved me a lot of time. It works :)

FrankJensen
Posts: 49
Joined: Sun Mar 10, 2024 9:34 pm

Re: Proper component setup with esp-idf

Postby FrankJensen » Thu Jun 13, 2024 6:50 pm

Hi kyrpav.

I have tried your aproach multiple times, cause I have the exact same errors, with same missing components and unknown types. However, following your fixes doesnt change anything. I use platformio esp-idf 5.2.1, latest lgvl_esp32_driver and a checkedout version of lgvl to version 8.3.0.

Do you happen to have a complete working example, that I can download? I must have missed something.

Hope you can give me a hint :-)

Br. Frank.

Who is online

Users browsing this forum: No registered users and 9 guests