LPC1788 and external SDRAM zeros initialization

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1788 and external SDRAM zeros initialization

945 Views
aut
Contributor I

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 };

Labels (1)
0 Kudos
5 Replies

749 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Nico Aprile ,

About " not initiallized to zero value", so what value it is ?

If variable not  declared with _ _no_init, neither no value is given, it is cleared to zero.

I use another board test the code, the variable is initialized to zero.


Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

749 Views
aut
Contributor I

Hi Alice_Yang

thanks for your answer.

In my case, after making the SDRAM hardware setting, most of the EXT_SDRAM byte region have value 0x3C. Only a very few byte have value different by 0x3C. 

Regards. 

0 Kudos

749 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi Nico,

Could you please send a simple whole project that I can reproduce your problem on my side?

BR

Alice

0 Kudos

749 Views
aut
Contributor I

Hi Alice,

I thank you for your support.

Honestly I don't know what I can send you to allow you to reproduce my problem. Attached you can find the SDRAM initialization code that I'm using. The EMCInit() routine (that performs the external SDRAM MT48LC4M32B2P initialization) is called at startup, before running the main loop. After the EMCInit() is run, most of the external SDRAM variables used in my code, have 0x3C value. 

Actually, I bypassed the problem, forcing (manually) to zero all external SDRAM variables before running the main loop. Even though in this way the code works fine, it doesn't seem to me to be a good solution. I can't understand if it is a compiler configuration problem or a SDRAM initializazion problem. 

Regards.  

0 Kudos

749 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Nico,

To begin use SDRAM, yes, we need manually initialize it to 0.

BR

Alice

0 Kudos