Skip to main content
Visitor II
August 8, 2007
Question

(HIWARE)const in ROM: problem!

  • August 8, 2007
  • 3 replies
  • 863 views
Posted on August 08, 2007 at 08:46

(HIWARE)const in ROM: problem!

    This topic has been closed for replies.

    3 replies

    Visitor II
    August 8, 2007
    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! ;)

    Visitor II
    August 8, 2007
    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

    Visitor II
    August 8, 2007
    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