I try to define a separate RAM region/section in an IAR linker configuration file (.icf). The section should contain variables that are initialized like this:
#pragma default_variable_attributes = @ "MY_SECTION"
int a = 0;
int b = 666;
#pragma default_variable_attributes =
This is what I tried in the icf file:
define symbol MY_REG_START = PREVIOUS_REGION_END + 1;
define symbol MY_REG_END = MY_REG_START + SIZE_16K - 1;
define region MY_REGION = mem:[from MY_REG_START to MY_REG_END];
initialize by copy { section MY_SECTION };
place in MY_REGION { section MY_SECTION };
Without the initialize by copy line, everythings works fine. However I am forced to initialize all variables to 0. I want to freely choose the init value which is why I tried to use the copy ROM to RAM initialization.
With the above code I keep getting the warning:
Warning[Be006]: possible conflict for segment/section "MY_SECTION": "test.c"
variable "b @ "MY_SECTION"" (declared at line 13 of "test.c") is
an initialized variable
variable "a @ "MY_SECTION"" (declared at line 12 of "test.c") is a
zero-initialized variable (2 more variables like this)
What is wrong with my configuration?