I am getting the following error messages when compiling. I want to programm a can bus for the c167 using the service routines from the infineon homepage. Can anyone help me to solve the L127 & L128 errors. It would be nice if i get a detailed solution, because a im a novice. assembling START167.A66... compiling prakt2.c... compiling CHKBO16X.C... compiling CHKMO16X.C... compiling CHM1516X.C... compiling CISR16X1.C... compiling DEFMO16X.C... DEFMO16X.C(78): warning C192: '=': value truncated compiling INCAN16X.C... INCAN16X.C(29): warning C2: 'GLOBAL': unknown #pragma/control, line ignored INCAN16X.C(40): warning C2: 'PUBLIC': unknown #pragma/control, line ignored INCAN16X.C(51): warning C140: '_bfld' undefined; assuming 'extern int _bfld()' INCAN16X.C(114): warning C192: '=': value truncated compiling LDMOD16X.C... compiling RDM1516X.C... compiling RDMOD16X.C... compiling SNDMO16X.C... linking... *** ERROR L127: UNRESOLVED EXTERNAL SYMBOL SYMBOL: _bfld MODULE: INCAN16X.obj (INCAN16X) *** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _bfld MODULE: INCAN16X.obj (INCAN16X) ADDRESS: 00CCH *** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _bfld MODULE: INCAN16X.obj (INCAN16X) ADDRESS: 00DCH Program Size: data=694(near=692) const=44(near=44) code=1806 Target not created
_bfld looks like a typo in your source code. Maybe you wanted to use _bfld_ (see: http://www.keil.com/support/man/docs/c166/c166__bfld_.htm) Reinhard
Markus, Can you post contents on INCAN16X.C and INCAN16X.h (is this header included in files where functions from INCAN16X.C are called?)? Looks like the source of your errors (as well as some of the warnings) are in there somewhere. Dont know about C166 compiler (I only used C51 so far), but if I remember right, using _ before variable names can cause problems (I think because it's ignored but that's relying on my own memory banks). If that is part of your code, you may want to changed it. If it's part of a CANned routine though, I don't know Andy
/* ----------------------------------------- header: ----------------*/ /********************************************************************* * Program name: "INCAN16X.C" * * Compiler used: BSO/Tasking C166 * * Task: Source File for procedure can_init_16x * * belonging to Siemens ApNote AP2922 * * "'C' CAN Driver Routines for the C166 family"* * * * Last modifications: April 28nd 1997 * * Version: 1.0 * * Authors: Axel Wolf, SCI Cupertino * * Dr. Jens Barrenscheen, HL MC PD, Munich * *********************************************************************/ /* ----------------------------------- include files: -------------- */ #include <REG167.H> /* register definitions C167 */ #include <CANR_16X.H> /* CAN control register definitions */ #define BTR_VALUE_50KBAUD 0x7aC9 #define BTR_VALUE_125KBAUD 0x7aC3 #define BTR_VALUE_250KBAUD 0x7aC1 #define BTR_VALUE_500KBAUD 0x7aC0 #define BTR_VALUE_1MBAUD 0x25c0 /* ----------------------------------- externals, prototypes: ------ */ void init_can_16x(unsigned int baud_rate, unsigned char eie, unsigned char sie, unsigned char ie); /* Initialization of CAN-Module: (baud_rate, eie, sie, ie) */ /* ----------------------------------- PEC, Register: -------------- */ /* ----------------------------------- global bit/byte/word data: -- */ #pragma global /* C167CR variables: */ unsigned int *id_ptr_16x[16]; /* pointer to message id's (UAReg) */ unsigned char *db0_ptr_16x[16]; /* pointer to 'databyte 0's */ unsigned int *msgctrl_ptr_16x[16]; /* pointer to msg. contrl. regs */ unsigned char *msgconf_ptr_16x[16]; /* pointer to msg. conf. regs */ unsigned char dir_bit_16x[16]; /* DIR bits MO 1...15 */ unsigned char xtd_bit_16x[16]; /* XTD bits MO 1...15 */ unsigned char dlc_16x[16]; /* data byte lengths MO 1...15 */ #pragma public /* ----------------------------------- code ------------------------ */ void init_can_16x(unsigned int baud_rate, unsigned char eie, unsigned char sie, unsigned char ie) /* Initialization of CAN-Module: (baud rate, eie, sie, ie) */ { /* -------------------------------- local byte/word/bit data: -- */ unsigned char i, n; unsigned char *dummy_dbptr; /* -------------------------------- program: -------------------- */ /* Initialization PORT4 (CAN) (P4.6 to output; P4.5 to input): */ _bfld (P4, 0x0060, 0x0060); _bfld (DP4, 0x0060, 0x0040); /* Load C167 pointers: */ for (i=1;i<16;i++) { db0_ptr_16x[i] = (unsigned char *)(0xef07+i*16); /* set pointers to data bytes 0 of MO 1..15 */ id_ptr_16x[i] = (unsigned int *)(0xef02+i*16); /* set pointers to id's of MO 1..15 (UARs) */ msgconf_ptr_16x[i] = (unsigned char *)(0xef06+i*16); /* set pointers to Message Conf. Registers of MO 1..15 */ msgctrl_ptr_16x[i] = (unsigned int *)(0xef00+i*16); /* set pointers to Message Control Registers of MO 1..15 */ dir_bit_16x[i] = 0; /* clear DIR bit array */ xtd_bit_16x[i] = 0; /* clear XTD bit array */ dlc_16x[i] = 0; /* clear data length code array */ } /* Load General CAN-Registers: */ CR=0x41; /* set CCE and INIT in Control Register (EF00h) */ SR=0x00; /* Clear Status Partition (EF01h) */ switch (baud_rate) { case 50: BTR=BTR_VALUE_50KBAUD; break; case 125: BTR=BTR_VALUE_125KBAUD; break; case 250: BTR=BTR_VALUE_250KBAUD; break; case 500: BTR=BTR_VALUE_500KBAUD; break; case 1000: BTR=BTR_VALUE_1MBAUD; break; default: BTR=BTR_VALUE_500KBAUD; break; /* 0 1 1 1 1 0 1 0 1 1 0 0 0 0 0 0 = 500 kBit/s @ 20MHz */ /* - TSEG2 TSEG1 SJW|<-- BRP -->| */ } GMS=0xe0ff; /* Global Mask Short (EF06h) */ /* each bit of standard ID must match to store mess. */ UGML=0xffff; /* Upper Global Mask Long (EF08h) */ LGML=0xf8ff; /* Lower Global Mask Long (EF0Ah) */ /* each bit of extended ID must match to store mess. */ UMLM=0x0000; /* Upper Mask of Last Message (EF0Ch) */ LMLM=0x0000; /* Lower Mask of Last Message (EF0Eh) */ /* every message into MO 15 (Basic CAN Feature)*/ /* reset all elements incl MSGVAL in all Message Object Ctrl. Reg.: */ for (i=1;i<16;i++) *msgctrl_ptr_16x[i] = 0x5555; /* reset all data bytes in all Message Objects: */ for (i=1;i<16;i++) { dummy_dbptr=db0_ptr_16x[i]; for (n=0;n<8;n++) *dummy_dbptr++ = 0x00; } /* end initialization (CCE=0, INIT=0); Interrupts EIE, SIE, IE=user: */ CR = (0x00 | (eie<<3) | (sie<<2) | (ie<<1)); }
OK, so how about instead of just throwing it blindly at whoever might be prepared to catch it, actually read that file? You might come across this line:
* Compiler used: BSO/Tasking C166 *
INCAN16X.C(29): warning C2: 'GLOBAL': unknown #pragma/control, line ignored INCAN16X.C(40): warning C2: 'PUBLIC': unknown #pragma/control, line ignored INCAN16X.C(51): warning C140: '_bfld' undefined; assuming 'extern int _bfld()'
thanks for the information i solved my problems by changing the _blfd syntax into _blfd_ and including the intrins.h into my c file. today i tested my own file with Canalyser and it works.