FW

IAR Heap Stack size 조절

잉규 2021. 9. 19. 12:33

메모리(고작해야 200Kb지만...)를 동적할당을 하다보니 메모리가 터졌다.

 

그리하여 동적할당을 하게되면 Heap에 저장을 하게 되니 Heap Size를 조절했다.

 

아래와 같이 .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__       = 0x081FFFFF;
define symbol __ICFEDIT_region_RAM_start__     = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__       = 0x2007FFFF;
define symbol __ICFEDIT_region_ITCMRAM_start__ = 0x00000000;
define symbol __ICFEDIT_region_ITCMRAM_end__   = 0x00003FFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x4000;
define symbol __ICFEDIT_size_heap__   = 0x3FFFF;
/**** 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 ITCMRAM_region  = mem:[from __ICFEDIT_region_ITCMRAM_start__ to __ICFEDIT_region_ITCMRAM_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 };

define symbol __ICFEDIT_size_cstack__ = 0x4000; // stack size

define symbol __ICFEDIT_size_heap__ = 0x3FFFF; // heap size

 

이 두부분을 조절하여 stack 과heap 크기를 조절할 수 있다.

'FW' 카테고리의 다른 글

stm32 HAL timer(2)  (0) 2021.12.04
stm32 HAL timer(1)  (0) 2021.10.30
Hanning window  (0) 2021.09.19
FFT C code 구현 및 excel로 확인  (0) 2021.08.28
IAR CMSIS DSP Library사용  (0) 2021.08.21