AnsweredAssumed Answered

assign predefined data to the FLASH arrey and put values STM32F207

Question asked by strauss.bar on Dec 23, 2012
Latest reply on Dec 23, 2012 by strauss.bar
Hello.
I try to put a 32 bit word in the FLASH section which need to get know value at programming and during the program it can be modify. In this way I can know next time I power up that this varible has beed update.
I use the IAR ARM 6.4.
I modify the link icf file this way:

/*###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_CONSTANT_start__ = 0x08004000;// change by Bar for placing constant in the FLASH
define symbol __ICFEDIT_region_CONSTANT_end__ = 0x0800BFFF; // change by Bar for placing constant in the FLASH
define symbol __ICFEDIT_region_ROM1_start__ = 0x08000000;  // for BOOTLOADER
define symbol __ICFEDIT_region_ROM1_end__   = 0x08003FFF;  // for BOOTLOADER
define symbol __ICFEDIT_region_ROM2_start__ = 0x0800C000;
define symbol __ICFEDIT_region_ROM2_end__   = 0x080FFFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__   = 0x20020000;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x400;
define symbol __ICFEDIT_size_heap__   = 0x200;
/**** End of ICF editor section. ###ICF###*/




define memory mem with size = 4G;
define region ROM1_region   = mem:[from __ICFEDIT_region_ROM2_start__   to __ICFEDIT_region_ROM2_end__] ;  //-mem:[from __ICFEDIT_region_ROM1_start__   to __ICFEDIT_region_ROM1_end__];
define region VECTOR_region   =mem:[from __ICFEDIT_region_ROM1_start__   to __ICFEDIT_region_ROM1_end__];
define region RAM_region   = mem:[from __ICFEDIT_region_RAM_start__   to __ICFEDIT_region_RAM_end__];
define region CONSTANT = mem:[from __ICFEDIT_region_CONSTANT_start__ to __ICFEDIT_region_CONSTANT_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 CONSTANT      {section .noinit};
place in ROM1_region   { readonly };
place in VECTOR_region { readonly section .intvec };
place in RAM_region    { readwrite, block CSTACK, block HEAP };

The idea is to leave the first section for startup and the bootloader, the second one for modify variable , the third for fix data like version ect. and from the 4th to the code.

And in the main file I write at the top before the main this:

             /* Sector 1, 16 Kbytes */
         /* the last know MCU Baud Rate */
#pragma location=0x08004000
__no_init volatile uint32_t Baud_Rate_USART=0;

I have 2 problems about it.
I can't see in the memory windows the FLASH area. Is it possible from the view menu?
I see that for FLASH assign I need to write no_init. SO how I can give it perleminary values because i see it doesn't?
Regards
Bar.

Outcomes