I use v6 and v7 to compare the code size in this git repository.
In this git repository, I placed my modified lv_port_stm32f429_disco v6 and v7 versions of the project.
My modifications are:
In lv_conf.h, the animation, anti-aliasing, shadow, group, file system are turned off.
In main.c Some examples are called, including btn/dropdown/win/btnmatrix/cont/img/imgbtn/page/roller/slider/line objects.
The size of V6 is 66kbyte, and the size of V7 is 88k, a difference of 22k.
What MCU/Processor/Board and compiler are you using?
STM32F429
What do you want to achieve?
Is there any way to optimize the v7 version so that its code size is approximately equal to V6?
What have you tried so far?
I try to check the macros that can be disabled in lv_confg.h as much as possible to ensure that it is not the difference in code size between v6 and v7 caused by my improper configuration
I think the new style system is expected to increase the code size somewhat. We were optimizing more for RAM usage and performance, since flash space is usually less of a concern.
However, it would be nice to shrink that difference between the two. Can you run arm-none-eabi-nm --print-size --size-sort on your program file and put the results here? That lets us see what the largest functions are. It seems that the vX_function.txt file doesn’t sort the size of the functions.
Another thing to try is disabling extra fonts that you aren’t using.
Can you run arm-none-eabi-nm --print-size --size-sort on your program file and put the results here?
OK. I added these files:
vX_function_size_sort_without_grep.txt is the original output.
vX_function_size_sort.txt is to filter the output of littlevgl independent functions
In addition, I have uploaded the elf files of these two projects.
Another thing to try is disabling extra fonts that you aren’t using.
In my project, the code rom is only 128k, and the constant data including fonts and pictures are stored in external FLASH.
So here I am not concerned about the size of constant data.
In the previous project, I have configured -Os, gc-sections and -ffunction-sections.
Now I added -fdata-sections to the project, the size of the text section is slightly increased.
By checking the makefiles of the projects I couldn’t find Os flag. Maybe I was looking in the wrong place, so just to be sure, are you using Os is case of the v7 project too, right?
Could you attach a line from both compiler outputs where all the flags can be seen?
I have not added the relevant files in the Debug directory before.
Now I add these files and push them.
In addition, the reason for not using Release is that the compilation is wrong.
I think the difference between Debug and Release is more in predefined macros.
After I confirmed that there was no macro like -DDEBUG in Debug, I compared the size based on it.