項目場景:
移植UCOS到stm32f103c8t6時BUG日誌app
問題描述:
c8t6移植ucos中報錯內存溢出
報錯代碼以下:
spa
.\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,故嚴重超出內存
3d
解決方案:
直接修改內存池大小,我這裏配置爲5K,即把27改成5就能夠
改變後編譯效果以下:
日誌
改變以後無報錯,移植成功!code