I am trying to compile the following code, but i get the error *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _HALSETPORTBIT MODULE: program1.obj (PROGRAM1) ADDRESS: 0822H this is just for one function i am using i get the for all the function in the code. The sample programs work just fine, and i have included all the header files needed.
#include <chipcon/hal.h> #include <stdio.h> main() { halSetPortBitDir(1, 2, POUT); while (TRUE) { halSetPortBit(0, 2, TRUE); halWait(200, 14746); halSetPortBit(1, 2, FALSE); } }
thanks for replying Dan. Yes i have included the CHIPCON header files needed. In this case all the functions are defind in the hal.h header file. I wrote the program again including all the header files available i still get the same warnings.
#include <chipcon/hal.h> #include <chipcon/cc1010eb.h> #include <chipcon/reg1010.h> #include <stdio.h> main() { halSetPortBitDir(1, 2, POUT); while (TRUE) { halSetPortBit(0, 2, TRUE); halWait(200, 14746); halSetPortBit(1, 2, FALSE); } }
#include <chipcon/reg1010.h> #include <chipcon/hal.h> #include <chipcon/cc1010eb.h> #define WAIT_TIME 200 // ms #define RLED_MASK 0x01 #define YLED_MASK 0x02 #define GLED_MASK 0x04 #define BLED_MASK 0x08 //---------------------------------------------------------------------------- // MAIN PROGRAM //---------------------------------------------------------------------------- void main() { byte randomNumber; // Output enable RLED_OE(TRUE); YLED_OE(TRUE); GLED_OE(TRUE); BLED_OE(TRUE); // Set optimum settings for speed and low power consumption MEM_NO_WAIT_STATES(); FLASH_SET_POWER_MODE(FLASH_STANDBY_BETWEEN_READS); // Loop forever while (TRUE) { // Generate a random number halRandomNumberGen(&randomNumber, 1); // Change LEDs RLED = randomNumber & RLED_MASK; YLED = randomNumber & YLED_MASK; GLED = randomNumber & GLED_MASK; BLED = randomNumber & BLED_MASK; // Wait halWait(WAIT_TIME, CC1010EB_CLKFREQ); } } // main
"Yes i have included the CHIPCON header files needed." I know, but I was asking about whether or not you had incorporated the appropriate Chipcon library files in your build, not the header files. "In this case all the functions are defind in the hal.h header file." Not exactly. The macros are defined, whereas the external functions are declared in the header file. That means that the actual functions are defined elsewhere. Those functions are defined in separate C source files, which you must explicitly compile and link in with your project, or simply include the appropriate library in your project to link against (e.g., halLib_small.LIB or halLib_small.LIB). Including hal.h in program1.c only publishes the function names and interfaces. The actual implementation of those functions is in the libraries.
Hi Dan thanks a million for helping. You are right i hadnt included the C files which actually take care of the functions. i included all the C files for each function and now i am able to compile the program with out any warnings. Thanks a lot for bailing me out