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
Comments
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. 🙁 |
Thanks for your reply |
Hello, I would like to ask if there is a complete routine for esp-idf |
Maybe @tore-espressif has some ideas. |
Hello @geekheart ,
|
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 |
It seems that you have no need to export the target, so just don't :) |
Hello, I am sorry that there is a time difference between my place and you, so the reply may be slower. |
Hello, This is my project folder tree:
This is my
I also had to comment out these two lines: https://github.com/Samsung/rlottie/blob/bd4c4e1f844c3c54378eada915f1d6e851ed39d2/src/vector/vimageloader.cpp#L9 Let me know if it works for you. |
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. |
Hello, my project needs this library very much, if you see this problem, please reply as soon as possible |
You get a C++ exception in operator new. |
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 |
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. |
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 |
@geekheart check the allocation size request. Seems, I've received bas_alloc exception. |
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: 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 |
So, is it possible now to display the animation? |
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. |
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 will continue trying to pinpoint whats causing the renderer to have issues here |
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: 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 Removing d->task()... and updateRequest() prevents the crash below 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? |
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:
|
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 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) |
The issues could be related to lottie running in ARGB32 color instead of 16 bit color required for this display driver? |
awesome, bro. can you share your project |
@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 In order to assign the color, I referenced some of the LV_COLOR_SET functions in lv_color.h 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 1st line results in above gif with a duplicated animation and junk data |
IMO the color format conversation should be handled in rlottie. 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.
Have a nice holiday 🙂 |
@tvanfossen it seems so cool. Thank you. Awaiting for the video too! |
wow,it seems like incredible , Awaiting for the video too! |
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. |
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. |
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. |
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? |
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.
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. |
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? |
Disregard that, I see the updated documentation in LVGL now: https://docs.lvgl.io/master/libs/rlottie.html |
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 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? |
Yes, i can add notes for that |
Great, thank you! 🙂 |
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. |
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 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? |
@EnterTang |
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 |
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 |
@puddletowntom |
@puddletowntom |
@puddletowntom |
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
ESP-IDF v4.4.6 |
@puddletowntom |
@puddletowntom idf_component_register(SRCS ${SOURCES} set(LOTTIE_MODULE OFF) function(install) function(export) add_subdirectory(rlottie) |
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. |
When I added it to the project, the following error occurred
The text was updated successfully, but these errors were encountered: