I can compile lvgl as interface lib, but as static lib I have the problem that lvgl uses a default config when lv_conf.h is not present.
I’ve tried to add the project include (where lv_conf.h is located) to the lvgl build:
I can add the settings as defines to the compiler options, but that is a terrible long list and not conveniant as the header file with commented defines.
Is there a way to add the lv_conf.h to the static library build?
thanks for your help.
Yes, it compiles, but the size of the resulting binary is much larger than when I use lvgl as interface lib, about 60k to 130k for the lvgl module.
My first thought was that lv_conf.h is not used, but it is found. I have put a #error in it and I see its emitted when compiling lvgl/src files.
So I understand now that the lvgl build can be modified by the main project. I will check if it is a linker optimization problem or it is in the lvgl sources that unused features are build althoug they should be disabled.
and this relies on the position of lvgl to lvglDriver, I’m not sure if this a good practice. Maybe a little bit beter with some find function?
Thank you guys for the help. I have managed to install CLI2 to my Ubuntu 18.04 and it works. However only when I compile against the mbed-os library located in the same directory as the program.
How can CLI2 projects share the same mbed-os library?
settings depend more on the project, and how much resources my MCU has. So I want to keep the config in the main project.
I will try now to find the reason for the different sizes, but this looks more like it is the way how the config is used.
For the Mbed component libs I see no big issue using interface libs. Usually, they are compiled once in a project and then the obj files are linked. The same with a static lib, difference is that the obj files are packed into an archive file. I’m also using a project structure where many components, mbed-os and custom_targets are commonly used. Its driving me nuts when I have many versions of same libs. Ok, that can be more relaxing with git and always pushing a new version to the git server. But I see that cmake is so powerful to get it working with different project structures.
It is not yet a working example, main needs to call a lv_task_handler cyclic. One goal was to check what the min size for a lvgl project and if it can fit into a BluePill or Nucleo_F103RB, lvgl says minimum 64k.
With MCUs with more flash/ram it works very well. The drivers for the F7 or F4 targets work, but you see they are not yet integrated in the lvglDriver/CMakeLists.txt.
I will update it when it is working.
great, I see there is also an option for the custom_targets path. Instructions from Jeroumes Repo suggest to copy the custom_targets.json to the project root, but a copy of that file is not nice,.
You’re welcome, great that somebody more enters CLI2
And I think using libs with Mbed components that need mbed-os is a very common task. Mbed Team is very focused on compiling Mbed and tests, but in real projects its necessary to have a documented project structure. And for now, it looks like it makes sense only with interface libs.
it looks like the link time optimization is not working with static libs. I have renamed the map file to map.old, then the diff is shown after building as with CLI1. It shows that lvgl.a is 137678 bytes, and lvgl/src only 62330 Bytes.
I will try now with some real hardware if the optimized version is working.
CMake Error at CMakeLists.txt:10 (include):
include could not find requested file:
/.../prog01/mbed-os/tools/cmake/app.cmake
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:14 (add_subdirectory):
add_subdirectory given source
"/.../prog01/mbed-os" which is not an existing
directory.
CMake Error at CMakeLists.txt:22 (mbed_set_post_build):
Unknown CMake command "mbed_set_post_build".
-- Configuring incomplete, errors occurred!
See also "/.../prog01/cmake_build/LPC1768/develop/GCC_ARM/CMakeFiles/CMakeOutput.log".
ERROR: CMake invocation failed!
More information may be available by using the command line option '-v'.
Build the project with CMake (advanced)
We’ll show how to build your project using CMake directly, which provides you with the full capabilities of CMake. You are no longer limited by what Mbed CLI 2 has to offer.
…
Translate from the Mbed configuration system to a form CMake can understand: mbed-tools configure -m LPC1768 -t GCC_ARM ...
This will create a build folder at …
Set the build parameters: cmake -S . -B cmake_build/LPC1768/develop/GCC_ARM -GNinja
No. Neither the mbed-tools configure nor the mbed-tools compile command changes the MBED_PATH in that file when the --mbed-os-path option is used. I have tried to set it manually by editing the CMakeList.txt file, but still no joy.
I have tested the interface lib and it works. It looks like the linker optimization for static libs is not used.
At first, it did not work. My driver is using SPI and I switch between 8 and 16 bit format for perfomance reasons. That did work well, but latest changes in SPI may have broken that.
Glad it works. But as I said, this is not standard CMake practice. INTERFACE is used for mbed os because of the way it is structured and how things depend on each other.
In reality, you want to use STATIC, though that might not be possible for the moment.