硬汉嵌入式论坛

 找回密码
 立即注册
查看: 4688|回复: 8
收起左侧

[SRAM] 关于stm32h7内部ram使用问题

[复制链接]

11

主题

91

回帖

124

积分

初级会员

积分
124
发表于 2018-9-23 08:19:42 | 显示全部楼层 |阅读模式
我在工程中设了一个大的内存
u8        tttt[1024*512];
这时编译是没有问题的

当我数组再扩大到
u8        tttt[1024*513];
这时编译就通不过了,报错如下:
*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'D:\Program Files\Keil_v5\ARM\ARMCC\Bin'
Build target 'UART'
compiling main.c...
linking...
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching main.o(.bss).
..\OBJ\Template.axf: Error: L6407E: Sections of aggregate size 0x8000c bytes could not fit into .ANY selector(s).
Not enough information to list image symbols.
Not enough information to list load addresses in the image map.
Finished: 2 information, 0 warning and 2 error messages.
"..\OBJ\Template.axf" - 2 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed:  00:00:09


这个芯片不是有1M的ram吗,为什么到512K左右时后面的ram就不能用了?
444.png
工程中这里默认是这样设的,
请问要怎么设置才能用到512K后的ram呢?
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107034
QQ
发表于 2018-9-23 10:27:53 | 显示全部楼层
两块地址不连续,无法一次分配这么大,你分两块没问题的
回复

使用道具 举报

11

主题

91

回帖

124

积分

初级会员

积分
124
 楼主| 发表于 2018-9-23 22:08:03 | 显示全部楼层
eric2013 发表于 2018-9-23 10:27
两块地址不连续,无法一次分配这么大,你分两块没问题的

试过了,分两块也编译通不过的
u8        tttt[1024*512];
u8        tttt1[9];
我增了一个9字节的数组,编译报错如下:

*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'D:\Program Files\Keil_v5\ARM\ARMCC\Bin'
Build target 'UART'
linking...
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching main.o(.bss).
..\OBJ\Template.axf: Error: L6407E: Sections of aggregate size 0x8000c bytes could not fit into .ANY selector(s).
Not enough information to list image symbols.
Not enough information to list load addresses in the image map.
Finished: 2 information, 0 warning and 2 error messages.
"..\OBJ\Template.axf" - 2 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed:  00:00:01
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107034
QQ
发表于 2018-9-24 00:26:50 | 显示全部楼层
帮你测了,的确不行,看来MDK不够智能,不能有效的自动分配。

采用这个帖子的方案吧,以后定义到不同地址RAM区,比较省事。
http://www.armbbs.cn/forum.php?m ... 5&highlight=CCM
回复

使用道具 举报

32

主题

262

回帖

363

积分

高级会员

积分
363
发表于 2018-9-24 10:19:51 | 显示全部楼层
我记得 看map文件,他会默认使用IRAM2 不会使用1
回复

使用道具 举报

11

主题

91

回帖

124

积分

初级会员

积分
124
 楼主| 发表于 2018-9-24 11:52:33 | 显示全部楼层
eric2013 发表于 2018-9-24 00:26
帮你测了,的确不行,看来MDK不够智能,不能有效的自动分配。

采用这个帖子的方案吧,以后定义到不同地 ...

这个方法试过了,确实可行
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107034
QQ
发表于 2018-9-25 01:30:22 | 显示全部楼层
yuangt 发表于 2018-9-24 11:52
这个方法试过了,确实可行

回复

使用道具 举报

0

主题

105

回帖

105

积分

初级会员

积分
105
发表于 2018-9-26 09:22:28 | 显示全部楼层
0x80000=524288Byte=512KB,
第一块是128KB,第二块也才512Kb,你的堆栈或者变量稍微占用一点点第二块,就分配不了512K了,这不是很合理的事么
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107034
QQ
发表于 2018-9-26 09:27:11 | 显示全部楼层
barryxiao 发表于 2018-9-26 09:22
0x80000=524288Byte=512KB,
第一块是128KB,第二块也才512Kb,你的堆栈或者变量稍微占用一点点第二块,就 ...

他这里有个问题是直接定义512KB后,第1块还有很大的空间没用完,定义一个小的数值也通不过。无法有效分配。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-5-15 08:02 , Processed in 0.190970 second(s), 28 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表