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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

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

1,548 次查看
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

标签 (1)
标记 (1)
1 回复

850 次查看
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