Keil™, An ARM® Company

Technical Support

C251: ACCESSING ASSEMBLY ECODE VARIABLES FROM C


Information in this article applies to:

  • C251 Version 1.24
  • C251 Version 2.14
  • C251 Version 3.00

QUESTION

How do I create ECODE tables in assembly and access them from C?

ANSWER

The following assembly code defines a table named tab in ECODE (or far const) memory:

?HC?T_ASM  SEGMENT  HCONST
        RSEG       ?HC?T_ASM

tab:
        DB  001H
        DB  002H
        DB  003H
        DB  004H
        DB  005H

PUBLIC        tab

The following C code will read the contents of this table:

extern unsigned char const far tab [];

void main (void)
{
unsigned char tab_copy [5];
unsigned char i;

for (i = 0; i < 5; i++)
  tab_copy [i] = tab [i];

while (1);
}

Last Reviewed: Thursday, January 11, 2001


Did this article provide the answer you needed?
 
Yes
No
Not Sure