problem with .ICF FILE of IAR EWARM 5.4

Started by zied130187 September 16, 2010
I begin to develop a program for LPC2129 with IAR EWARM 5.4
I found that there is a file. ICF when I must to configure for that the linker to the IAR generates. hex specific to my application.
i have problem to understand how i can configure its parameters.

i found an example of file .ICF in an example of project with IAR.

program_in_flash.icf file in leds example provided with iar contains these details.

/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x00000044;
define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x40000040;
define symbol __ICFEDIT_region_RAM_end__ = 0x40003FFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x200;
define symbol __ICFEDIT_size_svcstack__ = 0x0;
define symbol __ICFEDIT_size_irqstack__ = 0x100;
define symbol __ICFEDIT_size_fiqstack__ = 0x0;
define symbol __ICFEDIT_size_undstack__ = 0x0;
define symbol __ICFEDIT_size_abtstack__ = 0x0;
define symbol __ICFEDIT_size_heap__ = 0x200;

according datasheet ROM_start = 0x00000000. why is declared 0x00000044 ?
same RAM_start = 0x40000000. I don't understand why is declared 0x40000040 ?

and how to initialize the sizes of the stacks?
what criteria of choice are initialized these stacks?
I find in other examples:

they are different parameters of the first example

/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x2000;
define symbol __ICFEDIT_size_svcstack__ = 0x100;
define symbol __ICFEDIT_size_irqstack__ = 0x100;
define symbol __ICFEDIT_size_fiqstack__ = 0x100;
define symbol __ICFEDIT_size_undstack__ = 0x100;
define symbol __ICFEDIT_size_abtstack__ = 0x100;
define symbol __ICFEDIT_size_heap__ = 0x8000;

I do not understand what I put as the size for each stack

An Engineer's Guide to the LPC2100 Series

The RAM region starting at 0x40000040 is used when you have to remap exception vectors to RAM (when using a secondary booloader for example). Otherwise it usually starts at 0x40000000.
The ROM region starting at 0x00000044 doesn't make sense. The compiler places exception vectors starting at 0 unless instructed differently by the .intvec section.
The size of stacks is your responsability depending on how you make your program and how much memory do you need in those stacks.If you have a debugger it will give you error messages if your program exceeds the size you specified in the ICF. Still you must be aware that it's not 100% reliable and improper dimensioned stacks WILL lead to crashes.
A good starting point in making an adequate ICF file is to take one from the IAR examples. Something similar with what you want to do.

--- In l..., "zied130187" wrote:
>
> I begin to develop a program for LPC2129 with IAR EWARM 5.4
> I found that there is a file. ICF when I must to configure for that the linker to the IAR generates. hex specific to my application.
> i have problem to understand how i can configure its parameters.
>
> i found an example of file .ICF in an example of project with IAR.
>
> program_in_flash.icf file in leds example provided with iar contains these details.
>
> /*-Memory Regions-*/
> define symbol __ICFEDIT_region_ROM_start__ = 0x00000044;
> define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;
> define symbol __ICFEDIT_region_RAM_start__ = 0x40000040;
> define symbol __ICFEDIT_region_RAM_end__ = 0x40003FFF;
> /*-Sizes-*/
> define symbol __ICFEDIT_size_cstack__ = 0x200;
> define symbol __ICFEDIT_size_svcstack__ = 0x0;
> define symbol __ICFEDIT_size_irqstack__ = 0x100;
> define symbol __ICFEDIT_size_fiqstack__ = 0x0;
> define symbol __ICFEDIT_size_undstack__ = 0x0;
> define symbol __ICFEDIT_size_abtstack__ = 0x0;
> define symbol __ICFEDIT_size_heap__ = 0x200;
>
> according datasheet ROM_start = 0x00000000. why is declared 0x00000044 ?
> same RAM_start = 0x40000000. I don't understand why is declared 0x40000040 ?
>
> and how to initialize the sizes of the stacks?
> what criteria of choice are initialized these stacks?
> I find in other examples:
>
> they are different parameters of the first example
>
> /*-Sizes-*/
> define symbol __ICFEDIT_size_cstack__ = 0x2000;
> define symbol __ICFEDIT_size_svcstack__ = 0x100;
> define symbol __ICFEDIT_size_irqstack__ = 0x100;
> define symbol __ICFEDIT_size_fiqstack__ = 0x100;
> define symbol __ICFEDIT_size_undstack__ = 0x100;
> define symbol __ICFEDIT_size_abtstack__ = 0x100;
> define symbol __ICFEDIT_size_heap__ = 0x8000;
>
> I do not understand what I put as the size for each stack
>