AnsweredAssumed Answered

LPC1788 and external SDRAM zeros initialization

Question asked by Nico Aprile on Mar 6, 2019
Latest reply on Mar 13, 2019 by Alice_Yang

Hi all,

 

In my project, I'm using the LPC1788 device and an external 32 bit SDRAM connected to it.

I modified the IAR configuration file (".icf" file) to create a region named EXT_SDRAM, in the external SDRAM space address, where store some variables (variable1, variable2, ....) used in the code. These variables have been declared as follows:   

 

#pragma default_variable_attributes = @ "EXT_SDRAM"
   variable1

   variable2

   .......

#pragma default_variable_attributes =

 

The code works fine but the variables of the EXT_SDRAM region ("variable1", "variable2", ...) are not initiallized to zero value. Why do this happen? How do I have to do to initialize all EXT_SDRAM variables to zero value? Below there is the IAR configuration file that I modified.  Many thanks. Regards.     

 

 

/*###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__ = 0x00018000;

/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x00018000;
define symbol __ICFEDIT_region_ROM_end__ = 0x0007FFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x10000000;
define symbol __ICFEDIT_region_RAM_end__ = 0x1000FFFF;

/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x800;
define symbol __ICFEDIT_size_heap__ = 0x000; /*0x1000;*/
/**** 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 symbol _SRAM_region_start__ = 0x20000000;
define symbol _SRAM_region_end__ = 0x20007FFF;
define region SRAM_region = mem:[from _SRAM_region_start__ to _SRAM_region_end__];

define symbol _AHB_RAM_start__ = 0x20080000;
define symbol _AHB_RAM_end__ = 0x200BFFFF;
define region AHB_RAM_region = mem:[from _AHB_RAM_start__ to _AHB_RAM_end__];

define symbol _EXT_SDRAM_start__ = 0xA0B26A40 /*0xA0000000*/;
define symbol _EXT_SDRAM_end__ = 0xA0C1AC80 /*0xAFFFFFFF*/;
define region EXT_SDRAM_region = mem:[from _EXT_SDRAM_start__ to _EXT_SDRAM_end__];

define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };

 

initialize by copy with packing = zeros { readwrite };
do not initialize { section .noinit };

 

place at address mem:__ICFEDIT_intvec_start__ { section .intvec };
place at address mem:0x2FC { section CRPKEY };
place in ROM_region { readonly };
place in RAM_region { readwrite, block CSTACK, block HEAP };
place in SRAM_region { section USB_RAM };
place in EXT_SDRAM_region { readwrite section EXT_SDRAM };

Outcomes