Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error in esp32 (use esp-idf v4.3) #3

Closed
geekheart opened this issue Jun 9, 2021 · 70 comments
Closed

Compile error in esp32 (use esp-idf v4.3) #3

geekheart opened this issue Jun 9, 2021 · 70 comments
Labels

Comments

@geekheart
Copy link

When I added it to the project, the following error occurred
image

@kisvegabor
Copy link
Member

The problem should be this: https://stackoverflow.com/questions/38131127/cmake-error-command-add-definitions-is-not-scriptable

It seems it's specific to how ESP runs CMake.

I'm not a CMake expert and I have no idea how to solve it. 🙁

@geekheart
Copy link
Author

问题应该是这样的:https : //stackoverflow.com/questions/38131127/cmake-error-command-add-definitions-is-not-scriptable

这似乎特定于 ESP 运行 CMake 的方式。

我不是 CMake 专家,也不知道如何解决。 🙁

Thanks for your reply

@geekheart
Copy link
Author

Hello, I would like to ask if there is a complete routine for esp-idf

@geekheart
Copy link
Author

Fortunately, I have made a little progress. We need to add the “cmake_minimum_required” command before “add_subdirectory” or “add_library” so that no error will be reported. However, new mistakes followed
image

@kisvegabor
Copy link
Member

Maybe @tore-espressif has some ideas.

@tore-espressif
Copy link

Hello @geekheart ,

  1. esp-idf is rather complex build system, but it provides 'boilerplate' functions to make it easier to integrate user's code with idf. Usually you would register your SW component with idf_component_register, see documentation here.
    idf_component_register command replaces (wraps) CMake's add_library and add_subdirectory, thus preventing errors you posted in the beginning.
  2. In order to export a CMake target you have to export all its dependencies. CMake tells you that the target you want to export (rlottie) depends on multiple IDF components, which are not exported. You'd have to export them manually, see this stackoverflow issue for more detail: https://stackoverflow.com/questions/5378528/install-export-problem-for-shared-lib-with-dependencies
  3. Could you share your intentions with exporting the rlottie target? IDF doesn't export its components because we haven't found it useful, so any feedback is appreciated

@geekheart
Copy link
Author

Hello @geekheart ,

  1. esp-idf is rather complex build system, but it provides 'boilerplate' functions to make it easier to integrate user's code with idf. Usually you would register your SW component with idf_component_register, see documentation here.
    idf_component_register command replaces (wraps) CMake's add_library and add_subdirectory, thus preventing errors you posted in the beginning.
  2. In order to export a CMake target you have to export all its dependencies. CMake tells you that the target you want to export (rlottie) depends on multiple IDF components, which are not exported. You'd have to export them manually, see this stackoverflow issue for more detail: https://stackoverflow.com/questions/5378528/install-export-problem-for-shared-lib-with-dependencies
  3. Could you share your intentions with exporting the rlottie target? IDF doesn't export its components because we haven't found it useful, so any feedback is appreciated

Hello, I am trying to compile the lv_lib_rlottie library. I added it to my project compilation, and there were many errors in the process. I have a general understanding of cmake, but I am not very familiar with it, so I want to ask the reason for the question. Glad you can answer me, i think i need to try again

@tore-espressif
Copy link

It seems that you have no need to export the target, so just don't :)
If you need any more help, please share relevant CMakeLists.txt too

@geekheart
Copy link
Author

Hello, I am sorry that there is a time difference between my place and you, so the reply may be slower.
image
This is my project

@tore-espressif
Copy link

tore-espressif commented Jun 14, 2021

Hello,
I went a little further to understand your problem, I could compile and link simple project based on ESP-IDF and rlottie:

This is my project folder tree:

esp-rlottie.
├───components
│   ├───lvgl
│   └───lv_lib_rlottie
└───main

This is my components/lv_lib_rlottie/CMakeLists.txt:
It overrides install and export functions because rlottie developers don't provide option to disable exporting/installing.

cmake_minimum_required(VERSION 3.14)

### Espressif specific
idf_component_register(
    SRCS "lv_rlottie.c"
    INCLUDE_DIRS "." "rlottie_lib/rlottie/inc"
    REQUIRES lvgl)

option(LOTTIE_MODULE OFF)
option(LOTTIE_THREAD OFF)
option(BUILD_SHARED_LIBS OFF)
function(install)
endfunction()

function(export)
endfunction()

add_subdirectory (rlottie_lib)

# Link rlottie to main component
target_link_libraries(${COMPONENT_LIB} PUBLIC rlottie)

I also had to comment out these two lines:
https://github.com/Samsung/rlottie/blob/bd4c4e1f844c3c54378eada915f1d6e851ed39d2/CMakeLists.txt#L136
(disable example build)

https://github.com/Samsung/rlottie/blob/bd4c4e1f844c3c54378eada915f1d6e851ed39d2/src/vector/vimageloader.cpp#L9
(we don't support dynamic linking)

Let me know if it works for you.

@geekheart
Copy link
Author

你好,
我进一步了解你的问题,我可以编译和链接基于 ESP-IDF 和 rlottie 的简单项目:

这是我的项目文件夹树:

esp-rlottie.
├───components
│   ├───lvgl
│   └───lv_lib_rlottie
└───main

这是我的components/lv_lib_rlottie/CMakeLists.txt
它覆盖installexport起作用,因为 rlottie 开发人员不提供禁用导出/安装的选项。

cmake_minimum_required(VERSION 3.14)

### Espressif specific
idf_component_register(
    SRCS "lv_rlottie.c"
    INCLUDE_DIRS "." "rlottie_lib/rlottie/inc"
    REQUIRES lvgl)

option(LOTTIE_MODULE OFF)
option(LOTTIE_THREAD OFF)
option(BUILD_SHARED_LIBS OFF)
function(install)
endfunction()

function(export)
endfunction()

add_subdirectory (rlottie_lib)

# Link rlottie to main component
target_link_libraries(${COMPONENT_LIB} PUBLIC rlottie)

我还必须注释掉这两行:
https : //github.com/Samsung/rlottie/blob/bd4c4e1f844c3c54378eada915f1d6e851ed39d2/CMakeLists.txt#L136
(禁用示例构建)

https://github.com/Samsung/rlottie/blob/bd4c4e1f844c3c54378eada915f1d6e851ed39d2/src/vector/vimageloader.cpp#L9
(我们不支持动态链接)

请让我知道这对你有没有用。

thank you for your reply. I can compile it now, but it will restart when I run it. The content displayed by the serial monitor is as follows.
image

@geekheart
Copy link
Author

Hello,
I went a little further to understand your problem, I could compile and link simple project based on ESP-IDF and rlottie:

This is my project folder tree:

esp-rlottie.
├───components
│   ├───lvgl
│   └───lv_lib_rlottie
└───main

This is my components/lv_lib_rlottie/CMakeLists.txt:
It overrides install and export functions because rlottie developers don't provide option to disable exporting/installing.

cmake_minimum_required(VERSION 3.14)

### Espressif specific
idf_component_register(
    SRCS "lv_rlottie.c"
    INCLUDE_DIRS "." "rlottie_lib/rlottie/inc"
    REQUIRES lvgl)

option(LOTTIE_MODULE OFF)
option(LOTTIE_THREAD OFF)
option(BUILD_SHARED_LIBS OFF)
function(install)
endfunction()

function(export)
endfunction()

add_subdirectory (rlottie_lib)

# Link rlottie to main component
target_link_libraries(${COMPONENT_LIB} PUBLIC rlottie)

I also had to comment out these two lines:
https://github.com/Samsung/rlottie/blob/bd4c4e1f844c3c54378eada915f1d6e851ed39d2/CMakeLists.txt#L136
(disable example build)

https://github.com/Samsung/rlottie/blob/bd4c4e1f844c3c54378eada915f1d6e851ed39d2/src/vector/vimageloader.cpp#L9
(we don't support dynamic linking)

Let me know if it works for you.

Hello, my project needs this library very much, if you see this problem, please reply as soon as possible

@tore-espressif
Copy link

You get a C++ exception in operator new.
But the log you provide is truncated, could you post it raw? (not a screen snip)

@geekheart
Copy link
Author

You get a C++ exception in operator new.
But the log you provide is truncated, could you post it raw? (not a screen snip)

This is the log printed by the serial port during operation. It restarts after it reaches the last line of words. I can provide a complete project for your analysis

@geekheart
Copy link
Author

my project:https://cowtransfer.com/s/495f7f9a217041 password:798074 This is my complete project. There is no error when compiling, and an error will be reported when running after burning.

@tore-espressif
Copy link

Do you have any news on this? I wanted to download the project but the link has expired...

@geekheart
Copy link
Author

Do you have any news on this? I wanted to download the project but the link has expired...

I'm very sorry, there were some personal matters to be dealt with before, so postpone it until now.

@geekheart
Copy link
Author

Do you have any news on this? I wanted to download the project but the link has expired...

I'm very sorry, there were some personal matters to be dealt with before, so postpone it until now.

this is my project: https://wwa.lanzoui.com/iyfuirb010j

@ValentiWorkLearning
Copy link
Collaborator

@geekheart check the allocation size request. Seems, I've received bas_alloc exception.

@tvanfossen
Copy link

tvanfossen commented Aug 10, 2021

Hi,

I am looking into this a bit further, I'd like to be able to display an animation on esp32 using lottie files, targetting lottie specifically to reduce memory usage/requirements on the esp.

Background:
Custom ESP32 w/ 240x320 LCD, ST7789 display driver
ESP-IDF @ 4.4-dev
LVGL @ release/v8.0
lvgl_esp32_drivers @ master
lv_lib_rlottie @ master

Started with just LVGL and lvgl_esp32_drivers to make the necessary tweaks for v8.0, once this was running I cloned lv_lib_rlottie into components.

I was able to get the project from @geekheart running, but noticed vimageloader.cpp is commented out entirely, rather than just #include <dlfcn.h> noted by @tore-espressif. While this seems to enable the project to build, I believe this is also preventing images from being able to be displayed, as I see an error in loading images and only see "No data" show on the screen.

In addition to commenting dlfcn.h out, rlottie_lib/rlottie/CMakeLists.txt @ lines 94:97 also needs to be commented to remove the -ldl flag in order to compile

@ValentiWorkLearning I was able to get past the alloc exception by enabling a custom buffer in idf.py menuconfig

@ValentiWorkLearning
Copy link
Collaborator

So, is it possible now to display the animation?

@tvanfossen
Copy link

It is not, still working on trying to get animations to display

Repo from geekheart seems to take a wildly different way of trying to load images than this repo

w/ Geekhearts repo, none of the imageLoad functions are loaded into vimageloader.cpp, thus "No data" getting displayed on the screen.

w/ the repo hosted here, I can get it compiled/flashed onto an esp32, but it gets caught in next_frame_task_cb when trying to render the animation. Specifically, it gets caught in rlottie/src/lottie/lottieitem.cpp @ line 251 and stops, havent quite determined the cause yet, seems like it gets stuck in an infinite loop.

For reference, I am using lv_rlottie_create_from_raw() with lv_rlottie_example_fingerprint.c.

@tvanfossen
Copy link

In lottieanimation.cpp @ comment out line 123 (mRenderer->render(surface)).

This allows next_frame_task_cb to continue as intended and displays animated junk data on the display, 200x280. Still pulled from lv_rlottie_example_fingerprint.c

MicrosoftTeams-image (3)

will continue trying to pinpoint whats causing the renderer to have issues here

@tvanfossen
Copy link

I have two versions at the same point, one with LVGL v8 and one with LVGL v7, both on an ESP32.

I can get two frames 1-2 frames in before a crash occurs on both. I believe at this point it is memory related, I may try running on a WROVER kit instead of the custom board to see if there is any improvement

Original assumption was that it was related to the renderer, but diving a bit deeper its tied to the preprocess call here:
image

Commenting this line out again allows animated junk data to render. Following deeper, eventually get to a couple functions in rlottie/src/vector/vraster.cpp

image

Removing d->task()... and updateRequest() prevents the crash below

image

It appears to pass next_frame_task_cb once, before crashing on the second frame while trying to preprocess Vrect used as a mask for rendering.

@tore-espressif @kisvegabor Any thoughts on what might be causing this?
@ValentiWorkLearning What steps did you take to produce the raw data file used in the lib from a lottie file? I noticed in the fingerprint.c reference was at 60fps for 800x600 image, while I am working with a 240x320 display, was thinking it might be worthwhile to make a new animation with this specific display in mind.

@kisvegabor
Copy link
Member

In project I also got a Guru mediation error without any obvious reason and couldn't find a real solution. Just adjusted the task until it started to work.

I suggest trying these:

  • lower the display buffer sized of LVGL to let more free RAM.
  • increase the stack of the UI related tasks.

@tvanfossen
Copy link

Progress! Thanks for the suggestion @kisvegabor!

100x100 animation displaying consistently at ~30fps, reference lottie https://lottiefiles.com/72599-loader, json data pulled out and added escapes per ReadMe, and replaced text inside string at lv_rlottie_example_fingerprint.c

ezgif com-gif-maker

2 issues yet, color and image distortion.

In order to get it to display as cleanly in the gif, I needed to change the color format in lv_rlottie.c @ line 131 from LV_IMG_CF_TRUE_COLOR_ALPHA to LV_IMG_CF_TRUE_COLOR.

The animation appears offset a bit, but only in width as the animation takes more of an elliptical path than a circular one, I believe this might be related to rlottie->scanline_width? Height looks as intended with no overflow.

Color depth on this display is 16, with the RGB565 swap enabled (SPI interface to display)

@tvanfossen
Copy link

The issues could be related to lottie running in ARGB32 color instead of 16 bit color required for this display driver?

@geekheart
Copy link
Author

进步!感谢@kisvegabor的建议!

100x100 动画始终以 ~30fps 显示,参考 lottie https://lottiefiles.com/72599-loader,根据自述文件提取 json 数据并添加转义符,并替换 lv_rlottie_example_fingerprint.c 处的字符串内的文本

ezgif com-gif-maker

还有2个问题,颜色和图像失真。

为了让它在 gif 中清晰地显示,我需要将 lv_rlottie.c @ line 131 中的颜色格式从 LV_IMG_CF_TRUE_COLOR_ALPHA 更改为 LV_IMG_CF_TRUE_COLOR。

动画看起来有点偏移,但只是在宽度上,因为动画采用的椭圆路径多于圆形路径,我相信这可能与 rlottie->scanline_width 相关?高度看起来符合预期,没有溢出。

此显示器上的色深为 16,启用 RGB565 交换(用于显示的 SPI 接口)

awesome, bro. can you share your project

@tvanfossen
Copy link

@geekheart I'll share at a later time, about to go on vacation.

I believe I have resolved the color distortion issues

Proper color format to assign in lv_rlottie.c is LV_IMG_CF_TRUE_COLOR_ALPHA, as lottie files use ARGB32.

In every available driver in lvgl_esp32_drivers, max supported is RGB565. As far as I can tell there is not an easy way to convert down from ARGB32 to RGB565 when color depth for the display is set to 16.

So in short, I needed to start making some changes in the LVGL code in order to handle this, starting at lv_draw_img.c @ line 337 (lv_draw_map)

lv_color_t is assigned based on color depth, which as defined by the sdkconfig is 16, but I know map_p (input to lv_draw_map) should be assigned specifically to lv_color32_t to see all the data.

px_size_byte is set to 3 per LV_COLOR_DEPTH 16, but should be set to 4 for ARGB32.

Similarily, px_opa is set using LV_IMG_PX_SIZE_ALPHA_BYTE, which at 16 color depth, is 3, but for this map it should be assigned to 4 instead.

I've separated map2 into two lv_color_t arrays, with specific assignments to lv_color16 and lv_color32
image

In order to assign the color, I referenced some of the LV_COLOR_SET functions in lv_color.h
image

ezgif com-gif-maker(1)

There is still some image distortion present that I am looking to solve, but the color looks much cleaner now.

@kisvegabor Starting to get a bit deeper into LVGL land, do you have any suggestions for a simpler ARGB32->RGB565 conversion, while color depth is set to 16? Or any thoughts on the image distortion I am seeing?

I believe the image distortion is related to _lv_blend_map

image

1st line results in above gif with a duplicated animation and junk data
2nd line (commented) results in a single animation with no junk data, but has color inversion and pixelation

@kisvegabor
Copy link
Member

IMO the color format conversation should be handled in rlottie.
E.g. in next_frame_task_cb the image can be converted in place.

I assume the image should be ~square but it seems the width is 2 times larger than the height. Probably the distribution comes from here.

I'll share at a later time, about to go on vacation.

Have a nice holiday 🙂

@ValentiWorkLearning
Copy link
Collaborator

@tvanfossen it seems so cool. Thank you. Awaiting for the video too!

@geekheart
Copy link
Author

We were able to get full size/screen animations running on a wrover kit using external sram, setting to 240mhz. Latest was 18-19fps for ~200x280 animation w/ lottie, along with previous changes needed to use stdlib malloc/free to get it working. CPU usage was sitting at 95%

wow,it seems like incredible , Awaiting for the video too!

@tvanfossen
Copy link

ezgif com-gif-maker(7)

So this is of course running a bit slow. Complexity of the animation is not so much the issue as the size of the buffer.

It may look like only a small portion of the screen is being animation, but the allocated buffer for the lottie takes the full 240x320. Running on an esp32 wrover, with external psram enabled. Needed to replace lv_mem_alloc with stdlib. Fps cap is set to 33 fps, I believe tick rate was 5ms for lv_tick_handler. Dropping fps cap to 20fps and increasing tick rate to 10ms should give back some of the cpu, but its still going to be HEAVILY constrained, setting cpu freq from 160->240mhz also gave back a bit of cpu

The limitation seems to be in a couple places.

rlottie is providing a buffer sized for 32bit color, which takes significantly more memory than 16bit. The conversion in place I added is doing this in LVGL when doing this in rlottie should allow the buffer to be significantly smaller. This is probably the lowest hanging fruit to running smoother in utilizing a smaller buffer.

Because of the memory limitations, the external psram was needed (would not compile without), but the spi interface is significantly slower, this also likely plays a large impact. A faster spi bus on the PSRAM may resolve this, or if there was a way of expanding the DRAM segment such that large buffers could be stored internally instead of externally

rlottie is also effectively providing a full bitmap which it is drawing over every iteration of the animation, which is eating significantly more CPU time. Lottie files in general seem to all have excess padding around the borders , removing this padding could be a hacky fix while preserving the same effective animation

I'd very much like to get this running more smoothly, but would love some advice on how to do so. One of the potential paths might be to use an esp32-s3 which has an octal spi interface to psram.

@X-Ryl669
Copy link

X-Ryl669 commented Nov 29, 2021

I don't think it's possible to implement a rasterizer in RGB565 in rlottie because such pixel format does not have alpha information and this is required for/by rlottie while it's drawing the scene. So, at best, a RGB24 format could be used (RGB565+8bit alpha), but anything below this would not work IMHO. Even a RGB(555+1) would not work (or will be very very raw with only 1 bit of transparency).

Once rlottie has computed its work, it does not need the alpha value of the accumulating buffer anymore, blending with LVGL's internal buffer in RGB565 is possible via some assembly code making use of MAC16 and MUL16 instruction (available on ESP32). Right now, the code is crude, but it can be highly optimized when processed (see page 625 of this document for an example implementation).

This does not solve the huge memory requirement of RGB32 for rlottie.

In order to solve this, maybe a patch to rlottie to set up a clip region for drawing (like it's done in LVGL) would be more efficient (for example, instead of allocating a 100x100x4 buffer for a 100x100 canvas, allocate only a 100x50x4 (or 100x25x4) buffer and call the rendering function twice (or 4 times), each time with the clip region updated.

@X-Ryl669
Copy link

See lvgl/lvgl#2856 for my take at fixing this. It works quite well and I think it's a good solution that does not imply modifying rlottie.

A better solution would be to either add a feature in rlottie to render to RGBA5658 mode (would gain 1/4 of the rlottie work buffer size) or to add an option for rlottie to support clip/region of interest when rendering and render in multiple pass. But it's a huge amount of work.

@tvanfossen
Copy link

Fix looks good! Having rlottie render to RGBA565 would be great, but is definitely non-trivial. The idea of doing clipping seems like a much lower hanging fruit.

In the case of clipping, this would be saving memory at the cost of additional CPU load? - where having rlottie render directly to a given color depth would be the optimal solution in regards to both memory and cpu usage?

@X-Ryl669
Copy link

X-Ryl669 commented Dec 1, 2021

In the case of clipping, this would be saving memory at the cost of additional CPU load?

A bit more yes. Depending on how smart is the rendering pipeline in rlottie, (if it's a rasterizer, then it's negligible, instead of rasterizing from line 1 to 128, it'll rasterize from line 1 to 63 and then from line 64 to 128, but to the same buffer). If it's not a rasterizer (like a canvas), then no the effect will be major as for every pixel output, an additional check for the rendering ROI must be performed. I don't know rlottie enough to say.

where having rlottie render directly to a given color depth would be the optimal solution in regards to both memory and cpu usage?

This is not possible. rlottie needs an alpha channel for intermediate blending and RGB565 does not have one. Adding a RGBA5658 in rlottie is probably possible, but it'll be a major implication in the rendering pipeline so a lot of work. The gain to expect is only 1/4th of the buffer size so I'm not sure it's worth the pain.

@tvanfossen
Copy link

@kisvegabor

espressif/esp-box#8

On ESP-IDF 4.4, with ESP32S3. Lottie library option in LVGL sdkconfig fails out on compile (cant find rlottie_capi.h). LVGL otherwise runs as intended.

Have a custom S3 board using the updated drivers from esp-box that I'm hoping to get running. 8mb of octal spi PSRAM should enable some larger lottie files to play at reasonable fps

Any thoughts?

@tvanfossen
Copy link

Disregard that, I see the updated documentation in LVGL now: https://docs.lvgl.io/master/libs/rlottie.html

@tvanfossen
Copy link

tvanfossen commented Dec 9, 2021

ezgif-2-8371cc15a483

ESP32S3 with 240x320 TFT SPI LCD, ST7789 display driver, using ESP-BOX drivers

240x320 Lottie asset (https://lottiefiles.com/88472-santa-pop-up), loaded as raw data!

CPU usage is high, but this is exceedingly better than on the ESP32

@tvanfossen
Copy link

ezgif-6-4ee95c73f50a

another example, again sized to 240x320

@kisvegabor
Copy link
Member

kisvegabor commented Dec 14, 2021

@tvanfossen Great news! Good to know that it's pretty usable on normal ESP32 and S3 too.

Would you be interested in adding a few notes to the rlottie lib's documentation about how to build on ESP?

@tvanfossen
Copy link

Yes, i can add notes for that

@kisvegabor
Copy link
Member

Great, thank you! 🙂

@stale
Copy link

stale bot commented Apr 17, 2022

This issue or pull request 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.

@stale stale bot added the stale label Apr 17, 2022
@stale stale bot closed this as completed Apr 27, 2022
@puddletowntom
Copy link

Hey, I was having difficulty setting up the rlottie component with lvgl. I get the "cant find rlottie_capi.h" problem. @tvanfossen says that you use the documentation to solve this. I tried following the documentation from the link https://docs.lvgl.io/master/libs/rlottie.html . I dont think i applied the patch file correctly. The documentation doesnt give enough information on how to do this. I downloaded the patch file directly from lvgl on github and then went to the directory components/rlottie/rlottie and tried applying it with "git apply 0001-changes-to-compile-with-esp-idf.patch" but I just get the error,

error: patch failed: CMakeLists.txt:95
error: CMakeLists.txt: patch does not apply

I dont understand how this patch file is applied. This is very confusing. I have spent quite a lot of time trying to get this component installed but it has been very frustrating. It should be a lot easier. The documentation should be better. Any help would be appreciated.

@EnterTang
Copy link

Hey, I was having difficulty setting up the rlottie component with lvgl. I get the "cant find rlottie_capi.h" problem. @tvanfossen says that you use the documentation to solve this. I tried following the documentation from the link https://docs.lvgl.io/master/libs/rlottie.html . I dont think i applied the patch file correctly. The documentation doesnt give enough information on how to do this. I downloaded the patch file directly from lvgl on github and then went to the directory components/rlottie/rlottie and tried applying it with "git apply 0001-changes-to-compile-with-esp-idf.patch" but I just get the error,嘿,我在使用 lvgl 设置 rlottie 组件时遇到了困难。我遇到“找不到rlottie_capi.h”的问题。说你使用文档来解决这个问题。我尝试按照链接中的文档进行操作 https://docs.lvgl.io/master/libs/rlottie.html .我认为我没有正确应用补丁文件。文档没有提供有关如何执行此操作的足够信息。我直接从 github 上的 lvgl 下载了补丁文件,然后转到目录 components/rlottie/rlottie 并尝试使用“git apply 0001-changes-to-compile-with-esp-idf.patch”应用它,但我只是收到错误,

error: patch failed: CMakeLists.txt:95错误:补丁失败:CMakeLists.txt:95 error: CMakeLists.txt: patch does not apply错误:CMakeLists.txt:修补程序不适用

I dont understand how this patch file is applied. This is very confusing. I have spent quite a lot of time trying to get this component installed but it has been very frustrating. It should be a lot easier. The documentation should be better. Any help would be appreciated.我不明白这个补丁文件是如何应用的。这是非常令人困惑的。我花了很多时间试图安装这个组件,但它非常令人沮丧。它应该容易得多。文档应该更好。任何帮助将不胜感激。

I Got same problem with you,did you fixed it?

@M-D-777
Copy link

M-D-777 commented Jan 9, 2024

@EnterTang
I think you can refer to this link. The author of the link also mentioned that he referred to the example of @tvanfossen and made some modifications to support ESP32 S3.
It seems that the Lottie on ESP32 S3 runs very smoothly.
【ESP32 S3 LVGL Lottie 示例程序及说明-哔哩哔哩】 https://b23.tv/NtmecOa

@EnterTang
Copy link

@EnterTang

I think you can refer to this link. The author of the link also mentioned that he referred to the example of @tvanfossen and made some modifications to support ESP32 S3.

It seems that the Lottie on ESP32 S3 runs very smoothly.

【ESP32 S3 LVGL Lottie 示例程序及说明-哔哩哔哩】 https://b23.tv/NtmecOa

Thank you so much for helping me with my code problem. I really appreciate it!

I solved it by use IDF v4.4.x,and this method can also be used with lvgl9

@puddletowntom
Copy link

@EnterTang

Hi,

I put aside my problem for a while but have come back to it. It seems you have a solution? Can you explain how you installed rlottie because the link by @M-D-777 is not working for me.

Thanks

@EnterTang
Copy link

@puddletowntom
Hi,
The key to this problem is to use IDF version under 5.0,IDF4.4.x is the best choice

@EnterTang
Copy link

@puddletowntom
now you can refer to my project to slove this problem, https://github.com/EnterTang/lvgl_rlottie_esp32

@EnterTang
Copy link

@puddletowntom
by the way, the file <lvgl/env_suppout/cmake/esp.cmake> should add requird libs rlottie, like this:
idf_component_register(SRCS ${SOURCES} ${EXAMPLE_SOURCES} ${DEMO_SOURCES}
INCLUDE_DIRS ${LVGL_ROOT_DIR} ${LVGL_ROOT_DIR}/src ${LVGL_ROOT_DIR}/../
${LVGL_ROOT_DIR}/examples ${LVGL_ROOT_DIR}/demos
REQUIRES esp_timer rlottie)
endif()

@puddletowntom
Copy link

I was using ESP-IDF v5.0.1 and i switched back to v4.4.6. I was able to compile your code but once i include rlottie functions there were problems. The error i am getting is lvgl/src/libs/rlottie/lv_rlottie.c:229: undefined reference to `lottie_animation_render' I made the changes from your README file. eg

components\lvgl\env_support\cmake\esp.cmake

and

idf.py menuconfig --> Component config --> LVGL configuration --> 3rd Party Libraries --> Lottie library

Do i need to make any other changes to the menconfig that have to do with rlottie?

Here is the code i am trying to compile

//#include "lvgl.h"
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "lvgl.h"

const uint8_t sampleTest[];

void testRlottie(void){
lv_obj_t *lottie = lv_rlottie_create_from_raw(lv_scr_act(), 100, 100, (const void *)sampleTest);
lv_obj_center(lottie);
}

void app_main() {
printf("helloworld!");
testRlottie();

for(;;){
// vTaskDelay(10/portTICK_PERIOD_MS);
}
}

ESP-IDF v4.4.6
LVGL v9.0

@EnterTang
Copy link

@puddletowntom
now i fix this problem,
modify CMakeList.txt in components/rlottie,

@EnterTang
Copy link

@puddletowntom
'''
cmake_minimum_required(VERSION 3.5)

idf_component_register(SRCS ${SOURCES}
INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/rlottie/inc"
)

set(LOTTIE_MODULE OFF)
set(LOTTIE_THREAD OFF)
set(BUILD_SHARED_LIBS OFF)
option(BUILD_TESTING OFF)

function(install)
endfunction()

function(export)
endfunction()

add_subdirectory(rlottie)
target_link_libraries(${COMPONENT_LIB} INTERFACE rlottie)
'''

@puddletowntom
Copy link

Great! that worked. Finally I can compile rlottie functions. I might also try this with later versions too. @tvanfossen should probably update the documentation because it seems broken. Thank you very much for your help. Much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants