How to specify a non-initialised memory area in a LCF file

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

How to specify a non-initialised memory area in a LCF file

1,545 Views
powerNZ
Contributor III

Hello all,

As my previous threads have indicated I am in the process of migrating an application from the HiCross compiler environment to the Metrowerks/CodeWarrior environment.

 

The application consists of a number memory areas:

 - SRAM - memory inside the MCU (68332)

 - APP_ROM - the application resides in Flash

 - NVRAM - non-volatile battery backed SRAM

 

I understand the MEMORY {} section and the flags for SRAM are set (RW) and APP_ROM to (R)

 

The question I have is how to specify the flags for the NVRAM area?

 

To mimic the non-volatile behaviour of this memory area I don't want it initialised, which I suspect setting the flags to (RW) will cause.

 

Any suggestions or comments?

Graham

Labels (1)
1 Reply

847 Views
stanish
NXP Employee
NXP Employee

Hello powerNZ,

 

I would suggest you to try specify NVRAM seciton as (RW). I assume the uninitialized C variables placed into a custom section should not be touched by startup in contrast to initialized. According to CodeWarrior for ColdFire startup source the only uninitialized sections that are zero initialized are .bss and .sbss. Unfortunately, I cannot test it in CW for 68K. See the example below:

 

.lcf file:
----------
MEMORY{
...
 NVRAM      (RW)  : ORIGIN = 0x00802000, LENGTH = 0x00002000
}
SECTIONS{
...
  .mydata : {
   *(.mydata)
  } > NVRAM
...
}

source file:
-------------
#pragma define_section my ".mydata" ".mydata"
__declspec(my) volatile int NVvariable; //uninitialized variable
...

 

 

 

stanish

Message Edited by stanish on 2009-05-21 06:25 PM