We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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)
I think you probably need to re-read the section on Memory-Specific Pointers in the C51 Manual
extern uchar idata * p_idata; // p_idata points to contents of addr // ( 0x80 ) // we want to print the contents of 0x80.
PUBLIC addr PUBLIC p_idata addr: DS 2 p_idata: DS 2 ;pointer to idata