关于STM32F103VET6移植LVGL问题记录

发布时间 2023-05-17 09:16:55作者: 外道筱

MCU : STM32F103VET6
编译器:Keil5
前言: 打算学习一下LVGL,因此在自己打样的开发板上移植LVGL源码,其中出现了几种错误情况,在此记录一下,也可以提供给各位参考。

 一、编译空间不足

........

.\Objects\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching lv_txt.o(.data).
.\Objects\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching lv_txt.o(.data).
.\Objects\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching lv_txt.o(.data).
.\Objects\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching lv_txt.o(.data).
.\Objects\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching lv_textarea.o(.data).
.\Objects\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching stdout.o(.data).
.\Objects\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching lv_win.o(.data).
.\Objects\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching lv_port_disp.o(.data).
.\Objects\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching lv_obj_style.o(.data).
.\Objects\Template.axf: Error: L6407E: Sections of aggregate size 0x2944 bytes could not fit into .ANY selector(s).
Not enough information to list image symbols.
Not enough information to list the image map.
Finished: 2 information, 0 warning and 63 error messages.
".\Objects\Template.axf" - 63 Error(s), 0 Warning(s).

上面是我编译后的结果,我在别人的经验哪里看了很多,包括但不限于:

1.修改lv_cong.h文件里面的#define LV_MEM_SIZE (128U * 1024U),将128U改小

2.勾选Use MicroLIB

3.修改优化等级为Level 3

4.勾选C99 Mode

5.删除一部分代码

等等

上面的所以操作,对我来说都无效。后来在https://blog.csdn.net/qq_40604538/article/details/100046411这个讲FreeRTOS的帖子发现了RTOS本身也是有提前分配堆空间的,因此修改#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 32 * 1024 ) )的32为24,就解决问题了。

解释一下,我上面的那些无效操作,都是别人没有跑RTOS的情况下,又或者用的芯片RAM足够大的情况下才有用,而我用的F103VET6,RAM空间只有64K,之前FreeRTOS配置了32KB,LVGL配置了32KB,一下子就把RASM用完了,难怪会一直编译空间不足

最终通过修改使FreeRTOS和LVGL的空间分配不超过64K,编译通过。