STM8S编译错误unable to allocate space for sections/blocks with a total

STM8S编译错误unable to allocate space for sections/blocks with a total # 欢迎使用Markdown编辑器

笔者用IAR for STM8 开发碰到很多奇怪的问题,都是因为优化等级引起的
首先看这个用dubug编译错误提示:
unable to allocate space for sections/blocks with a total estimated minimum size of 0x1fdf bytes (max align 0x1) in <[0x008000-0x009fff]> (total uncommitted space 0x1f80).
在这里插入图片描述

翻译:
无法为 [0x008000-0x009fff](总未提交空间 0x1f80) 中的总最小空间为 0x1fdf 字节(最大对齐 0x1)的节/块分配空间。

总体来说就是Flash Rom程序空间不足

查看配置:
右键工程 -> option -> static analse -> C\C++ complier -> optimization
在这里插入图片描述

看到编译器没有做任何优化的, 编译出来的目标文件是非常大的, 把优化等级调到中,就可以编译过了, 把优化等级调到高当然可以的,但是优化的程序,是不能用的,功能丢失

在这里插入图片描述

在这里插入图片描述

原创作品, 转载注明出处:http://bbs.sunsili.com/embedded/202005/00000172.html 版权原作者所有.