[STM8] 超过32KB之后代码编译出错问题

[复制链接]
 楼主| chuxh 发表于 2017-2-25 21:03 | 显示全部楼层 |阅读模式
juventus9554 发表于 2017-2-25 21:05 | 显示全部楼层
还有什么现象?能再详细描述下吗?
 楼主| chuxh 发表于 2017-2-25 21:06 | 显示全部楼层
我在使用 STM8L152R8 做的一个项目,这颗芯片FLASH应该是 64KB,IAR查看 lnkstm8l152r8.icf 文件,有如下定义:
define region NearFuncCode = [from 0x8000 to 0xFFFF];
define region FarFuncCode = [from 0x8000 to 0xFFFF]
                          | [from 0x10000 to 0x17FFF];
define region HugeFuncCode = [from 0x8000 to 0x17FFF];

但是,我在程序中,如果编译代码超过 32KB,则编译出错
pengf 发表于 2017-2-25 21:07 | 显示全部楼层
提示什么
 楼主| chuxh 发表于 2017-2-25 21:08 | 显示全部楼层
Error[Lp011]: section placement failed
          unable to allocate space for sections/blocks with a total estimated minimum size of 0x8986 bytes in <[0x008000-0x00ffff]> (total uncommitted space 0x7f80).
yinxiangh 发表于 2017-2-25 21:09 | 显示全部楼层
调高优化级别?
 楼主| chuxh 发表于 2017-2-25 21:11 | 显示全部楼层
代码量控制在32KB以内,则可编译通过。
 楼主| chuxh 发表于 2017-2-25 21:12 | 显示全部楼层
在项目设置, Optione->Target->Device 选择 stm8l152r8; stm8l152.h 中,选择 #define STM8L15X_HD
不知道还有什么可能导致此错误?
morrisk 发表于 2017-2-25 21:13 | 显示全部楼层
会不会买到的芯片有问题
kangzj 发表于 2017-2-25 21:14 | 显示全部楼层
我遇到过程序里有数组类型定义小了时会出现这种情况,用了“__huge”就不会出错。
juventus9554 发表于 2017-2-25 21:18 | 显示全部楼层
[url=][/url]
dingy 发表于 2017-2-25 21:20 | 显示全部楼层
数组这么加可以,不过我用的数组比较少,函数就不知道怎么弄了:(
renyaq 发表于 2017-2-25 21:21 | 显示全部楼层
Error[Lp011]: section placement failed
          unable to allocate space for sections/blocks with a total estimated minimum size of 0x8986 bytes in <[0x008000-0x00ffff]> (total uncommitted space 0x7f80).
是不是没有**彻底。
supernan 发表于 2017-2-25 21:22 | 显示全部楼层
这个问题真的要考虑是不是没有**彻底,32k是没有**的使用大小
liuzaiy 发表于 2017-2-25 21:23 | 显示全部楼层
为什么会这样,是代码过长吗
 楼主| chuxh 发表于 2017-2-25 21:25 | 显示全部楼层
唉,还是没有什么结果,算了,先结贴吧,多谢大家啦
您需要登录后才可以回帖 登录 | 注册

本版积分规则

936

主题

11296

帖子

2

粉丝
快速回复 在线客服 返回列表 返回顶部