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

L102: with public in a51, referenced by C.

Getting L102 when referencing an idata public from a C module.

// We want a routine to examine idata memory.
// The user types a two-byte address, followed by cr or lf,
// at hyperterminal.
// The first  byte will be the more sig digit,
// the second byte will be the less sig digit.

// There is a C file with:

extern  uchar   idata   addr;    // when msb is received
                                 // addr = 0x00-0x0f (after stripping)
                                 // when lsb is received
                                 // addr = ( 16 x addr ) + stripped lsb
                                 // e.g.:
                                 // input 0x38, 0x30, 0x0a from uart
                                 // becomes 0x80.

extern  uchar   idata * p_idata; // p_idata points to contents of addr
                                 // ( 0x80 )
                                 // we want to print the contents of 0x80.

void    printf_02x
        (
        unsigned char c
        );

// The snippet to print is:

    p_idata =   ( unsigned char *)addr;  // example, p_idata is 0x80
    printf_02x( *p_idata );              // printf_02x should print
                                         // the contents of idata 0x80.

;;  There is an A51 with:

PUBLIC  addr
PUBLIC  p_idata

addr:    DS  2
p_idata: DS  2       ;pointer to idata

;;
;; The linker gives:

*** ERROR L102: EXTERNAL ATTRIBUTE MISMATCH
    SYMBOL:  P_IDATA
    MODULE:  app.obj (APP)
QUESTION:
(1) how to fix this?
(2) is there a better way to do this?

0