cancel
Showing results for 
Search instead for 
Did you mean: 

(HIWARE)const in ROM: problem!

marcosarti29
Associate II
Posted on August 08, 2007 at 08:46

(HIWARE)const in ROM: problem!

3 REPLIES 3
marcosarti29
Associate II
Posted on August 08, 2007 at 05:36

Hi, I use Hiware compiler for program st7LITE19.

I have declared:

const unsigned char far TAB_SENS[4];

and in my .prm file:

FLAGS = -Ms -Cc -Cq -Lasm=%n.lst

I compiled it but when I go to see the .map file I found:

TAB_SENS ( 12) DEFAULT_RAM

and a WARNING message:

''WARNING L2208: No copydown created for initialized object ''_TAB_SENS''. Initialization data lost''.

Why? Why my const TAB is insert in RAM? :o

Thanks for your help! ;)

wolfgang2399
Associate II
Posted on August 08, 2007 at 07:52

Hi Marco,

you should use the line ''const unsigned ...'' strictly outside of subroutines (don't ask me, why!! perhaps because otherwise it will get a local) or you have to define it as ''static const unsigned ...''.

I usually use the pragma CONST_SEG e.g.

#pragma CONST_SEG NEAR TAB_ROM

prior to the definition - also at declarations in include-files.

By the way: What is the sense of a const array whithout assigning any values??

Regards,

WoRo

marcosarti29
Associate II
Posted on August 08, 2007 at 08:46

Thanks! :-]

I have cut the post: in the real code I have assigned the value:

const unsigned char far TAB_SENS[4] =

{

0x00, 0x02, 0x03, 0x01

};

Now work!

I have used #pragma directive before the define:

#pragma INTO_ROM

const unsigned char far TAB_SENS[4] =

{

0x00, 0x02, 0x03, 0x01

};

Thanks again