IAR_STM32_CCM内存使用
Posted qqff
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了IAR_STM32_CCM内存使用相关的知识,希望对你有一定的参考价值。
在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内存使用的主要内容,如果未能解决你的问题,请参考以下文章