STM32F103C8T6移植UCOS-Ⅲ内存报错

项目场景:

移植UCOS到stm32f103c8t6时BUG日志

问题描述:

c8t6移植ucos中报错内存溢出
报错代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
.\Objects\ISO-STM32.axf: Error: L6406E: No space in execution regions with .ANY selector matching lib_mem.o(.bss).
.\Objects\ISO-STM32.axf: Error: L6406E: No space in execution regions with .ANY selector matching os_cfg_app.o(.bss).
.\Objects\ISO-STM32.axf: Error: L6406E: No space in execution regions with .ANY selector matching os_var.o(.bss).
.\Objects\ISO-STM32.axf: Error: L6406E: No space in execution regions with .ANY selector matching startup_stm32f10x_md.o(STACK).
.\Objects\ISO-STM32.axf: Error: L6406E: No space in execution regions with .ANY selector matching app.o(.bss).
.\Objects\ISO-STM32.axf: Error: L6406E: No space in execution regions with .ANY selector matching startup_stm32f10x_md.o(HEAP).
.\Objects\ISO-STM32.axf: Error: L6406E: No space in execution regions with .ANY selector matching os_var.o(.data).
.\Objects\ISO-STM32.axf: Error: L6406E: No space in execution regions with .ANY selector matching usart.o(.bss).
.\Objects\ISO-STM32.axf: Error: L6406E: No space in execution regions with .ANY selector matching libspace.o(.bss).
.\Objects\ISO-STM32.axf: Error: L6406E: No space in execution regions with .ANY selector matching cpu_core.o(.data).
.\Objects\ISO-STM32.axf: Error: L6406E: No space in execution regions with .ANY selector matching stm32f10x_rcc.o(.data).
.\Objects\ISO-STM32.axf: Error: L6406E: No space in execution regions with .ANY selector matching cpu_core.o(.bss).
.\Objects\ISO-STM32.axf: Error: L6406E: No space in execution regions with .ANY selector matching usart.o(.data).
.\Objects\ISO-STM32.axf: Error: L6406E: No space in execution regions with .ANY selector matching lib_mem.o(.data).
.\Objects\ISO-STM32.axf: Error: L6406E: No space in execution regions with .ANY selector matching os_prio.o(.data).
.\Objects\ISO-STM32.axf: Error: L6406E: No space in execution regions with .ANY selector matching os_cpu_c.o(.data).
.\Objects\ISO-STM32.axf: Error: L6407E: Sections of aggregate size 0x8960 bytes could not fit into .ANY selector(s).

原因分析:

此处报错:无空间在执行lib_mem之后的程序,说明内存不够,之前的程序有使用到大量内存,占据了之后程序的空间,根据源码的配置,在lib_cfg.h里面配置了内存池的大小,此处占用内存较大,源码移植默认配置了27k,而c8t6的sram只有20k,故严重超出内存


解决方案:

直接修改内存池大小,我这里配置为5K,即把27改为5就可以
改变后编译效果如下:

改变之后无报错,移植成功!