IAR 下的ICF文件配置

硬件:STM32F103ZET6 + 512Kbyte 外扩的SRAM 

使用原子的内存管理函数给 EMWIN分配内存,分为内部RAM和外部RAM两个内存池

define region RAM_region   = mem:[from __ICFEDIT_region_RAM_start__   to __ICFEDIT_region_RAM_end__]

| mem:[from __ICFEDIT_region_EXTRAM_start__ to __ICFEDIT_region_EXTRAM_end__];

这里采用这种写法时,内外部RAM放在一起供编译器链接时自动分配,

编译器链接.data / .bss段时会自动给各个.o 文件中的对应段分配RAM,但是当内部RAM空进不足时编译器将内部RAM内存池或者EMWIN函数.o文件中的

.data、.bss分配到外部RAM时,刷屏就会变得很慢。


这里可以自行定义一个section ,将大数组,读取不太频繁的数据放进这个section,同时在ICF文件中将这个section放入外部RAM,仅让编译器自动分配内部RAM,手动指定

外部RAM的分配即可。

如下:

在 程序中:定义一个section :#pragma section = “MYSECTION”

定义变量或数组时:

#pragma location = "MYSECTION"
UartItem uart1;//定义的串口设备变量

或者

unsigned char buf [100]@"MYSECTION";

在ICF配置中:

define region EXRAM_region   = mem:[from __ICFEDIT_region_EXTRAM_start__ to __ICFEDIT_region_EXTRAM_end__];

place in EXRAM_region { readwrite section MYSECTION};

//

ICF配置

/*###ICF### Section handled by ICF editor, don't touch! ****/

/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__    = 0x08000000;
define symbol __ICFEDIT_region_ROM_end__      = 0x0807d800;
define symbol __ICFEDIT_region_EXTRAM_start__ = 0x60000000;
define symbol __ICFEDIT_region_EXTRAM_end__   = 0x60060000;
define symbol __ICFEDIT_region_RAM_start__    = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__      = 0x2000FFFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x800;
define symbol __ICFEDIT_size_heap__   = 0x800;
/**** End of ICF editor section. ###ICF###*/


define memory mem with size = 4G;
define region ROM_region   = mem:[from __ICFEDIT_region_ROM_start__   to __ICFEDIT_region_ROM_end__];
define region RAM_region   = mem:[from __ICFEDIT_region_RAM_start__   to __ICFEDIT_region_RAM_end__]; 
define region EXRAM_region   = mem:[from __ICFEDIT_region_EXTRAM_start__ to __ICFEDIT_region_EXTRAM_end__];


define block CSTACK    with alignment = 8, size = __ICFEDIT_size_cstack__   { };
define block HEAP      with alignment = 8, size = __ICFEDIT_size_heap__     { };


initialize by copy { readwrite };
do not initialize  { section .noinit };


place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };


place in ROM_region   { readonly };
place at address mem: __ICFEDIT_region_RAM_start__ { block CSTACK, block HEAP};
place in EXRAM_region { readwrite section MYSECTION};
place in RAM_region   { readwrite };
  • 0
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值