ARM Technical Support Knowledge Articles

ACCESSING ASSEMBLY ECODE VARIABLES FROM C

Applies to: C251 C Compiler

Answer


Information in this article applies to:


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);
}

Article last edited on: 2001-01-11 00:00:00

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential