This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

locate a code table at the end of ROM

How do I locate a constant variable at the end of code area using the Extended Linker ( LX51 ) ?

In myfile source, my constant table is declared as:
unsigned char code MyTable[10]=
{
...
}

I would like to locate this constant table (by the corresponding segment at the end of my ROM).

I use a Philips chip that provides 96kb of ROM mapped from 0x800000 to 0x817FFF. I use the ROM(HUGE) option in compiler and my application is not a banked one...

I try with:
- ?CO?myfile(0x817000), i have the L108 linker error
- ?CO?myfile(^0x817FFF), i have the L108 linker error

Could you help me?

  • With ?CO?myfile(C:0x817000), i have the following linker message:
    - ERROR L205: CONSTANT TOO LARGE?

    What does it means? I cannot locate a constant table outside 0XFFFF address, so only in the first 64kb of ROM? This a chip limitation?

    Fell free to challenge this!
    Thanks.

  • Tony,

    ?CO? stands for CODE segment/constant. It sounds like you have something declared in code, ex.:

    myfile.c
    char code dummy[4];
    ...

    • CODE is always 64Kbytes when using C51 compiler, or a 8051 based microcontroller ( or both :-). Consequently, an error will show up if you attempt to locate a ?CO? outside a 64K range.


    You may take a look at Application Notes #160. This App is going to give you detailed information about who is who and what is what over the Philips MX family.

    http://www.keil.com/appnotes/files/apnt_160.pdf.

    After reading that, you may notice that it is possible to locate your constant in that memory address, but you may need to declare and locate it in a different manner.

    One example would be to declare your constant stuff as const far exploring the called HCONST class, ex:

    myfile.c
    const far char dummy[4];
    ...

    looking at the map file, you are going to see ?FC? instead of ?CO?.

    80001BH   80001EH   000004H   BYTE   INSEG    HCONST         ?FC?MYFILE

    To locate it in that desired address, you may use for example LX51 Locate - User Segments ?FC?MYFILE (0X817000). Pronto!

    Now the map file should looks like.:

    817000H   817003H   000004H   BYTE   INSEG    HCONST         ?FC?MYFILE

    Hopefully it helps.

    Alex

  • Thank you Alex,

    It seems to be more clear for me!!

    But on my example i cannot use const far declaration but only far like this:

    myfile.c
    far char dummy[4];

    So, in map file i don't find ?FC?myfile segment but ?PR?myfile....Why doest it means? In spite of, could i locate the new ECODE segment at the end of my ROM? Why i cannot use HCONST classe?

    Thanks you,
    TONY.

  • In fact,
    i can use const far type by declaring my table in HCONST by the following way:

    const char far dummy[4];

    With this, i find a ?FC?myfile segment in map file and i can locate it at the end of ROM....OK for this step!

    But, what about a table of functions declared as below in a source file:
    code void (void * TableOfFunctions[])

    In the same way, i would like to locate also this table at the end of ROM?
    Can i consider this a table as CONSTANT table and could i move it in HCONST segment?

    Thank you for the application notes (160) that you send me!