版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/p1279030826/article/details/83747953
环境:
编译环境:IAR 选择芯片:STM8L052RB、RAM:4K、FLASH:64K
报错:
unable to allocate space for sections/blocks with a total estimated minimum size of 0x84e0 bytes (max align 0x1) in <[0x008000-0x00ffff]> (total uncommitted space 0x7f80).
代码量:0x84e0=34016 bytes
[0x008000-0x00ffff]=32767 bytes
0x7f80=32640 bytes
显示超过FLASH空间(32K)。
.map文件信息:
33 211 bytes of readonly code memory
933 bytes of readonly data memory
1 799 bytes of readwrite data memory
FLASH = readonly code memory + readonly data memory
RAM = readwrite data memory
FLASH使用量: 33 211+933=34144 bytes
RAM使用量:1799 bytes
原因分析及解决:
1、IAR破解不完全或者有些版本破解后仍有32K限制。更换新版本后应该重新建立工程、旧工程会有标记(另找目录重建workplace和project,只copy源程序,所有的中间文件都不要)。
2、定义变量前加 _far
可参考文章: