码迷,mamicode.com
首页 > 其他好文 > 详细

IAR_STM32_CCM内存使用

时间:2019-07-10 16:57:26      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:with   lock   修改   mic   iar   div   tar   文件中   from   

在IAR中,硬件环境为STM32F464单片机,额外的CCM不能用DMA访问,但可以作为内部额外扩充RAM使用

技术图片

修改文件中的内容为:

define symbol __ICFEDIT_region_ROM_start__    = 0x08000000;
define symbol __ICFEDIT_region_ROM_end__      = 0x080FFFFF;
define symbol __ICFEDIT_region_RAM_start__    = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__      = 0x2001FFFF;
define symbol __ICFEDIT_region_CCMRAM_start__ = 0x10000000;
define symbol __ICFEDIT_region_CCMRAM_end__   = 0x1000FFFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x400;
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 CCMRAM_region   = mem:[from __ICFEDIT_region_CCMRAM_start__   to  
__ICFEDIT_region_CCMRAM_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 in CCMRAM_region { readwrite };    //内存分配CCM优先(除堆栈)
place in RAM_region   { block CSTACK, block HEAP };  //堆区和栈区设置在SRAM

要具设置某个文件生成在CCM区,place in CCMRAM_region { readwrite };修改为:

place in CCMRAM_region {readwrite object tasks.o,

                           readwrite object heap_4.o };

 

或者具体到内存中分配的类型(具体查看生成的map文件)修改为:

place in CCMRAM_region {section .bss object tasks.o,

                           section .bss object heap_4.o };

内存灵活配置,当然也可配置为(注意CCM区不能使用DMA):

place in CCMRAM_region { block CSTACK, block HEAP };    //堆区和栈区设置在CCM

 place in RAM_region   { readwrite };  ///内存分配CCM优先(除堆栈)

/*###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__      = 0x080FFFFF;
define symbol __ICFEDIT_region_RAM_start__    = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__      = 0x2001FFFF;
define symbol __ICFEDIT_region_CCMRAM_start__ = 0x10000000;
define symbol __ICFEDIT_region_CCMRAM_end__   = 0x1000FFFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x800;
define symbol __ICFEDIT_size_heap__   = 0x18C00;
/**** 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 CCMRAM_region   = mem:[from __ICFEDIT_region_CCMRAM_start__   to __ICFEDIT_region_CCMRAM_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 in RAM_region   { readwrite,
                        block CSTACK, block HEAP };
place in CCMRAM_region{ readwrite  object heap_4.o,
                        readwrite  object tasks.o,
                        readwrite  object port.o,
                        readwrite  object cmsis_os.o,
                       };

 

IAR_STM32_CCM内存使用

标签:with   lock   修改   mic   iar   div   tar   文件中   from   

原文地址:https://www.cnblogs.com/qqff/p/11164546.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!