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

C51: Absolute address for constants in CODE-space

Does anyone knows a methode, to declare a const struct in code-space at a specific CODE address in C51?


Background:

I use a philips 87LPC767-MC and i want to store some code-revision-info in the 32Byte customer code space.
I will define a C-Structure like

typedef struct
{
unsigned char uc_software_code;
unsigned char uc_main_version;
unsigned char uc_sub_version;
unsigned long ul_checksum;
} CodeRefInfo_ts;

CodeRefInfo_ts tsCodeRefInfo=
{
0x04,
0x01,
0x01,
0x012345678
} at 0xFC0E;

But it seems it is not possible to use the at-Keyword to locate a struct in the codespace?!

Any suggestion?

Thanks
Markus

Parents
  • That's right, the _at_ directive cannot take initialized variables. E.g. you can place an object somewhere using the compiler (a weird concept since the linker is usually told to do such things) but you cannot assign the object an initial value. As previously noted, assembler is the way to do this.

    - Mark

Reply
  • That's right, the _at_ directive cannot take initialized variables. E.g. you can place an object somewhere using the compiler (a weird concept since the linker is usually told to do such things) but you cannot assign the object an initial value. As previously noted, assembler is the way to do this.

    - Mark

Children
No data