硬汉嵌入式论坛

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

[有问必答] GD32F407ZG系列内存问题

[复制链接]

42

主题

81

回帖

207

积分

高级会员

积分
207
发表于 2022-11-9 15:50:16 | 显示全部楼层 |阅读模式
问题:
GD32F407ZG系列内存问题,本来是192K的,但是我程序内存用到128K左右,继续申请就报错了。
手册写的:
          GD32F407 - ARM Cortex-M4 Core
          Frequency up to 200 MHz
          Flash access zero wait state
          Single-cycle multiplier and hardware divider

        Memories
          Flash size from 512KB to 3072 KB
          SRAM size is 192 KB with HW parity checking
          30KB ISP loader ROM
在keilMDK里面,我编译后
[C] 纯文本查看 复制代码
==============================================================================





      Code (inc. data)   RO Data    RW Data    ZI Data      Debug   



    168012      10078     193368       3376     127656    1056552   Grand Totals

    168012      10078     193368        632     127656    1056552   ELF Image Totals (compressed)

    168012      10078     193368        632          0          0   ROM Totals



==============================================================================



    Total RO  Size (Code + RO Data)               361380 ( 352.91kB)

    Total RW  Size (RW Data + ZI Data)            131032 ( 127.96kB)

    Total ROM Size (Code + RO Data + RW Data)     362012 ( 353.53kB)



==============================================================================

最大只能到128K左右吗?
我在程序中多加1K的数组就报内存不足了,想问下剩下的内存去哪了??
[C] 纯文本查看 复制代码
compiling VariableBox.c...
compiling ParaSave.c...
linking...
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching list.o(.bss).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching libspace.o(.bss).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching camera.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching notice.o(.bss).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching text.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching store.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching timer.o(.bss).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching localtime.o(.bss).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching store.o(.bss).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching config.o(.bss).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching demoproc.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching basic.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching notice.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching system_stm32f4xx.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching malloc.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching timer.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching stm32f4xx_rcc.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching cpu_core.o(.bss).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching main.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching sensor.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching cjson.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching rtc.o(.bss).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching ff.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching delay.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching lora.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching usart.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching os_prio.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching mycc936.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching trigger_flags.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching config.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching rtc.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching uart4.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching uart6.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching usart2.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching usart3.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching uart5.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching cpu_core.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching lib_mem.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching os_cpu_c.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching diskio.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching hmi_engine.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching wkup.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching w25qxx.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching key.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching mmc_sd.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching lcd12864.o(.data).
..\OBJ\Template.axf: Error: L6406E: No space in execution regions with .ANY selector matching sgui_basic.o(.data).
..\OBJ\Template.axf: Error: L6407E: Sections of aggregate size 0x43c 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 48 error messages.
"..\OBJ\Template.axf" - 48 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed:  00:00:07


回复

使用道具 举报

42

主题

81

回帖

207

积分

高级会员

积分
207
 楼主| 发表于 2022-11-9 15:51:29 | 显示全部楼层
image.png ,解决了 ,发现这个勾选上就行了,这个勾选会影响功耗吗?为什么作为一个可选项呢?
回复

使用道具 举报

42

主题

81

回帖

207

积分

高级会员

积分
207
 楼主| 发表于 2022-11-9 16:02:39 | 显示全部楼层
勾选之后程序不跑了??
回复

使用道具 举报

42

主题

81

回帖

207

积分

高级会员

积分
207
 楼主| 发表于 2022-11-9 17:19:03 | 显示全部楼层
justdying 发表于 2022-11-9 16:02
勾选之后程序不跑了??

是呢
回复

使用道具 举报

3

主题

1233

回帖

1242

积分

至尊会员

积分
1242
发表于 2022-11-9 17:34:14 | 显示全部楼层
这个和ST的一样的哈,多看看硬汉大哥的相关帖子哈。
回复

使用道具 举报

42

主题

81

回帖

207

积分

高级会员

积分
207
 楼主| 发表于 2022-11-9 17:35:42 | 显示全部楼层
justdying 发表于 2022-11-9 16:02
勾选之后程序不跑了??

跑进  
[C] 纯文本查看 复制代码
void HardFault_Handler(void)
{
  /* Go to infinite loop when Hard Fault exception occurs */
  while (1)
  {
  }
}
回复

使用道具 举报

42

主题

81

回帖

207

积分

高级会员

积分
207
 楼主| 发表于 2022-11-9 17:59:53 | 显示全部楼层
大概知道了  是CCM内存
回复

使用道具 举报

2

主题

73

回帖

84

积分

初级会员

积分
84
发表于 2022-11-9 19:09:27 | 显示全部楼层
64K 部分不能用 DMA,只允许 D-BUS 访问
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107128
QQ
发表于 2022-11-10 09:11:16 | 显示全部楼层
justdying 发表于 2022-11-9 17:59
大概知道了  是CCM内存

ST是这样的,GD也是这样的?
回复

使用道具 举报

19

主题

72

回帖

129

积分

初级会员

积分
129
发表于 2022-11-10 09:40:56 | 显示全部楼层
对于这种不连续的多块内存,我一般都直接分配给操作系统(比如使用FreeRTOS的heap5,ThreadX的块内存等等)。
回复

使用道具 举报

42

主题

81

回帖

207

积分

高级会员

积分
207
 楼主| 发表于 2022-11-10 16:37:54 | 显示全部楼层
eric2013 发表于 2022-11-10 09:11
ST是这样的,GD也是这样的?

IRAM2 没勾选
内存池定义的时候增加__attribute__((at(0X10000000)) 字段说明就正常了
[C] 纯文本查看 复制代码
//内存池(32字节对齐)
__align(32) u8 mem1base[MEM1_MAX_SIZE];													//内部SRAM内存池
//内存管理表
u16 mem1mapbase[MEM1_ALLOC_TABLE_SIZE] __attribute__((at(0X10000000)));					//内部CCM内存池;		

GD也是一样的
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107128
QQ
发表于 2022-11-10 17:00:02 | 显示全部楼层
justdying 发表于 2022-11-10 16:37
IRAM2 没勾选
内存池定义的时候增加__attribute__((at(0X10000000)) 字段说明就正常了
[mw_shl_code=c, ...

这种骚操作,我觉得GD真没必要也去兼容ST,客户经常在这里入坑。
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
107128
QQ
发表于 2022-11-10 17:00:52 | 显示全部楼层
分享个玩法,方便大家使用

像使用内部SRAM一样定义使用SDRAM和CCM RAM,可以随意定义到指定的RAM区域且无需具体地址
https://www.armbbs.cn/forum.php? ... 9275&fromuid=58
(出处: 硬汉嵌入式论坛)
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-19 18:46 , Processed in 0.322349 second(s), 28 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

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