Reputation: 71
I've been trying to resolve an issue all evening and I just can't seem to get through to it. I have a problem very similar to this one : Receiving "undefined symbols" error with XC8 concerning plib I2C functions
The thing is, the recommended action for the previous post was to change to a PIC18 in order to resolve the problem... I'm already working with a PIC18!
My setup is as follows:
MPLAB: Product Version: MPLAB X IDE v3.50 Java: 1.8.0_91; Java HotSpot(TM) 64-Bit Server VM 25.91-b14 Runtime: Java(TM) SE Runtime Environment 1.8.0_91-b14 System: Windows 7 version 6.1 running on amd64; Cp1252; en_CA (mplab)
XC8: Version 1.40
Also installed : peripheral-libraries-for-pic18-v2.00rc3-windows-installer.exe
Here is the "offending code"... note that this does not generate any errors in my main.c file (no functions underlined in red). At first the I2C functions were underlined in red, but when I added the #define I2C_V1 at the beginning of my code, that worked itself out... however I do keep getting the following error :
:0: error: (499) undefined symbol: _OpenI2C(dist/default/production\Lab2.X.production.obj)
Here's the code :
void readTemp()
{
int TEMP = 0;
char temp2= 0;
// code pour le i2c
unsigned char temperature, addr, cmd_byte, status;
TRISBbits.RB0 =1;
TRISBbits.RB1 =1;
SSPADD = 0x31; // 100KHz Fosc = ?? Mhz
OpenI2C(MASTER,SLEW_OFF);
cmd_byte=1; //start with measure
StartI2C();
// while ( SSPCON2bits.SEN ); // wait until start condition is over
// already included in StartI2C()
addr = 0x90; // adresse du TC74 modèle A0 en écriture
status = WriteI2C(addr);
while (SSPCON2bits.ACKSTAT); //Bit 6 (I2C_V4 routine does not ackn.
IdleI2C(); // while ( ( SSPCON & 0x1F ) || ( SSPSTATbits.R_W ) )
WriteI2C(0x00);
while (SSPCON2bits.ACKSTAT); // wait for the acknowledge from slave
IdleI2C();
RestartI2C(); // keep the line and avoid others to grab the line
while ( SSPCON2bits.RSEN ); // wait until re-start condition is over
IdleI2C();
addr = 0x91; // adresse du TC74 modèle A0 en lecture
WriteI2C(addr);
while (SSPCON2bits.ACKSTAT);
IdleI2C();
temperature = getcI2C();
IdleI2C();
RestartI2C();
addr = 0x91; // adresse du TC74 modèle A0 en lecture
WriteI2C(addr);
while (SSPCON2bits.ACKSTAT);
IdleI2C();
temperature = getcI2C();
IdleI2C();
StopI2C();
CloseI2C();
temp2 = temperature;
//return temperature;
TXREG = temp2;
LATDbits.LATD4 = 0;
}
And here is the log (verbose) :
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/Users/Marchear/MPLABXProjects/Lab2.X'
make -f nbproject/Makefile-default.mk dist/default/production/Lab2.X.production.hex
make[2]: Entering directory 'C:/Users/Marchear/MPLABXProjects/Lab2.X'
"C:\Program Files (x86)\Microchip\xc8\v1.40\bin\xc8.exe" --pass1 --chip=18LF4550 -Q -G --double=24 --float=24 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 -I"../../../../Program Files (x86)/Microchip/xc8/v1.40/include/plib" -V --warn=-3 --asmlist -DXPRJ_default=default --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,+plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -obuild/default/production/config_bits.p1 config_bits.c
"C:\Program Files (x86)\Microchip\xc8\v1.40\bin\xc8.exe" --pass1 --chip=18LF4550 -Q -G --double=24 --float=24 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 -I"../../../../Program Files (x86)/Microchip/xc8/v1.40/include/plib" -V --warn=-3 --asmlist -DXPRJ_default=default --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,+plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -obuild/default/production/main.p1 main.c
:: warning: (1370) peripheral library support is not available for the 18LF4550
C:\Program Files (x86)\Microchip\xc8\v1.40\bin\cpp.exe @C:\Users\Marchear\AppData\Local\Temp\cpp_sdm0.cmd [ -W-3 "--edf=C:\Program Files (x86)\Microchip\xc8\v1.40\dat\en_msgs.txt" -SP3,3,3,3,3,3,3 -DXPRJ_default=default "-I../../../../Program Files (x86)/Microchip/xc8/v1.40/include/plib" "-IC:\Program Files (x86)\Microchip\xc8\v1.40\include" -E1 -D_OMNI_CODE_ -D__STACK_COMPILED=1 -D__STACK_HYBRID=2 -D__STACK_REENTRANT=4 -D__STACK=__STACK_COMPILED -D__XC -D__XC8 -D__XC__ -D__XC8__ -D__XC8_VERSION=1400 -DHI_TECH_C -D_HTC_VER_MAJOR_=10 -D_HTC_VER_MINOR_=40 -D_HTC_VER_PLVL_=0 -D_HTC_VER_PATCH_=48 -D_HTC_EDITION_=0 -D__OPTIMIZE_SIZE__ -D__OPTIMIZE_SPACE__ -D__OPTIM_FLAGS=0x3 -D__OPTIM_NONE=0x0 -D__OPTIM_ASM=0x1 -D__OPTIM_ASMFILE=0x2 -D__OPTIM_SPEED=0x20000 -D__OPTIM_SPACE=0x40000 -D__OPTIM_SIZE=0x40000 -D__OPTIM_DEBUG=0x80000 -D__OPTIM_INVARIANT=0x100000 -N255 -D__18LF4550 -D__18LF4550__ -D_18LF4550 -D__XC -D__XC8 -S1,2,2,3,4,3,3 -D_ROMSIZE=32768 -D_RAMSIZE=2048 -D_EEPROMSIZE=256 -D_FLASH_ERASE_SIZE=64 -D_FLASH_WRITE_SIZE=32 -D_ERRATA_TYPES=0 -D_18F4550_FAMILY_ -D__TRADITIONAL18__=1 -D__PICC18__ -D_MPC_ -D_PIC18 config_bits.c build/default/production\config_bits.pre ]
C:\Program Files (x86)\Microchip\xc8\v1.40\bin\cpp.exe @C:\Users\Marchear\AppData\Local\Temp\cpp_sdm0.cmd [ -W-3 "--edf=C:\Program Files (x86)\Microchip\xc8\v1.40\dat\en_msgs.txt" -SP3,3,3,3,3,3,3 -DXPRJ_default=default "-I../../../../Program Files (x86)/Microchip/xc8/v1.40/include/plib" "-IC:\Program Files (x86)\Microchip\xc8\v1.40\include" -Lgcc -E1 --dep_nosys -D_OMNI_CODE_ -D__STACK_COMPILED=1 -D__STACK_HYBRID=2 -D__STACK_REENTRANT=4 -D__STACK=__STACK_COMPILED -D__XC -D__XC8 -D__XC__ -D__XC8__ -D__XC8_VERSION=1400 -DHI_TECH_C -D_HTC_VER_MAJOR_=10 -D_HTC_VER_MINOR_=40 -D_HTC_VER_PLVL_=0 -D_HTC_VER_PATCH_=48 -D_HTC_EDITION_=0 -D__OPTIMIZE_SIZE__ -D__OPTIMIZE_SPACE__ -D__OPTIM_FLAGS=0x3 -D__OPTIM_NONE=0x0 -D__OPTIM_ASM=0x1 -D__OPTIM_ASMFILE=0x2 -D__OPTIM_SPEED=0x20000 -D__OPTIM_SPACE=0x40000 -D__OPTIM_SIZE=0x40000 -D__OPTIM_DEBUG=0x80000 -D__OPTIM_INVARIANT=0x100000 -N255 -D__18LF4550 -D__18LF4550__ -D_18LF4550 -D__XC -D__XC8 -S1,2,2,3,4,3,3 -D_ROMSIZE=32768 -D_RAMSIZE=2048 -D_EEPROMSIZE=256 -D_FLASH_ERASE_SIZE=64 -D_FLASH_WRITE_SIZE=32 -D_ERRATA_TYPES=0 -D_18F4550_FAMILY_ -D__TRADITIONAL18__=1 -D__PICC18__ -D_MPC_ -D_PIC18 config_bits.c build/default/production\config_bits.d ]
:: warning: (1370) peripheral library support is not available for the 18LF4550
C:\Program Files (x86)\Microchip\xc8\v1.40\bin\cpp.exe @C:\Users\Marchear\AppData\Local\Temp\cpp_scbg.cmd [ -W-3 "--edf=C:\Program Files (x86)\Microchip\xc8\v1.40\dat\en_msgs.txt" -SP3,3,3,3,3,3,3 -DXPRJ_default=default "-I../../../../Program Files (x86)/Microchip/xc8/v1.40/include/plib" "-IC:\Program Files (x86)\Microchip\xc8\v1.40\include" -E1 -D_OMNI_CODE_ -D__STACK_COMPILED=1 -D__STACK_HYBRID=2 -D__STACK_REENTRANT=4 -D__STACK=__STACK_COMPILED -D__XC -D__XC8 -D__XC__ -D__XC8__ -D__XC8_VERSION=1400 -DHI_TECH_C -D_HTC_VER_MAJOR_=10 -D_HTC_VER_MINOR_=40 -D_HTC_VER_PLVL_=0 -D_HTC_VER_PATCH_=48 -D_HTC_EDITION_=0 -D__OPTIMIZE_SIZE__ -D__OPTIMIZE_SPACE__ -D__OPTIM_FLAGS=0x3 -D__OPTIM_NONE=0x0 -D__OPTIM_ASM=0x1 -D__OPTIM_ASMFILE=0x2 -D__OPTIM_SPEED=0x20000 -D__OPTIM_SPACE=0x40000 -D__OPTIM_SIZE=0x40000 -D__OPTIM_DEBUG=0x80000 -D__OPTIM_INVARIANT=0x100000 -N255 -D__18LF4550 -D__18LF4550__ -D_18LF4550 -D__XC -D__XC8 -S1,2,2,3,4,3,3 -D_ROMSIZE=32768 -D_RAMSIZE=2048 -D_EEPROMSIZE=256 -D_FLASH_ERASE_SIZE=64 -D_FLASH_WRITE_SIZE=32 -D_ERRATA_TYPES=0 -D_18F4550_FAMILY_ -D__TRADITIONAL18__=1 -D__PICC18__ -D_MPC_ -D_PIC18 main.c build/default/production\main.pre ]
C:\Program Files (x86)\Microchip\xc8\v1.40\bin\p1.exe @C:\Users\Marchear\AppData\Local\Temp\p1_sdm0.cmd [ -W-3 "--edf=C:\Program Files (x86)\Microchip\xc8\v1.40\dat\en_msgs.txt" --cmode=htc -Tunsupported,s -Tdeprecated -Taddress,i -QCu,0,const -QN_,0,near -QI_,0,interrupt -QS_,0,persistent -QT_,0,inline -QQ,0,__pack -QR_,0,reentrant -QR_,0,software -QJ_,0,nonreentrant -QJ_,0,compiled -QU,0,__discrete -Q00,1512,__invariant -Q00,1512,__stable -QE_,0,eeprom -QL_,0,low_priority -QH_,0,high_priority -QW_s,0,bank0 -QX_s,0,bank1 -QY_s,0,bank2 -QZ_s,0,bank3 -QB_,0,bdata -QFu_,0,far -v -N255 -E1 -S -u -fp "--cfgdata=C:\Program Files (x86)\Microchip\xc8\v1.40\dat\cfgdata\18lf4550.cfgdata" "--cfgmap=C:\Program Files (x86)\Microchip\xc8\v1.40\dat\cfgmap\18lf4550.cfgmap" -Gstrings,const -M -B -Y -r -J build/default/production\config_bits.pre build/default/production\config_bits.p1 C:\Users\Marchear\AppData\Local\Temp\sdm0.5 ]
C:\Program Files (x86)\Microchip\xc8\v1.40\bin\cpp.exe @C:\Users\Marchear\AppData\Local\Temp\cpp_scbg.cmd [ -W-3 "--edf=C:\Program Files (x86)\Microchip\xc8\v1.40\dat\en_msgs.txt" -SP3,3,3,3,3,3,3 -DXPRJ_default=default "-I../../../../Program Files (x86)/Microchip/xc8/v1.40/include/plib" "-IC:\Program Files (x86)\Microchip\xc8\v1.40\include" -Lgcc -E1 --dep_nosys -D_OMNI_CODE_ -D__STACK_COMPILED=1 -D__STACK_HYBRID=2 -D__STACK_REENTRANT=4 -D__STACK=__STACK_COMPILED -D__XC -D__XC8 -D__XC__ -D__XC8__ -D__XC8_VERSION=1400 -DHI_TECH_C -D_HTC_VER_MAJOR_=10 -D_HTC_VER_MINOR_=40 -D_HTC_VER_PLVL_=0 -D_HTC_VER_PATCH_=48 -D_HTC_EDITION_=0 -D__OPTIMIZE_SIZE__ -D__OPTIMIZE_SPACE__ -D__OPTIM_FLAGS=0x3 -D__OPTIM_NONE=0x0 -D__OPTIM_ASM=0x1 -D__OPTIM_ASMFILE=0x2 -D__OPTIM_SPEED=0x20000 -D__OPTIM_SPACE=0x40000 -D__OPTIM_SIZE=0x40000 -D__OPTIM_DEBUG=0x80000 -D__OPTIM_INVARIANT=0x100000 -N255 -D__18LF4550 -D__18LF4550__ -D_18LF4550 -D__XC -D__XC8 -S1,2,2,3,4,3,3 -D_ROMSIZE=32768 -D_RAMSIZE=2048 -D_EEPROMSIZE=256 -D_FLASH_ERASE_SIZE=64 -D_FLASH_WRITE_SIZE=32 -D_ERRATA_TYPES=0 -D_18F4550_FAMILY_ -D__TRADITIONAL18__=1 -D__PICC18__ -D_MPC_ -D_PIC18 main.c build/default/production\main.d ]
del C:\Users\Marchear\AppData\Local\Temp\cpp_sdm0.cmd
del C:\Users\Marchear\AppData\Local\Temp\p1_sdm0.cmd
C:\Program Files (x86)\Microchip\xc8\v1.40\bin\p1.exe @C:\Users\Marchear\AppData\Local\Temp\p1_scbg.cmd [ -W-3 "--edf=C:\Program Files (x86)\Microchip\xc8\v1.40\dat\en_msgs.txt" --cmode=htc -Tunsupported,s -Tdeprecated -Taddress,i -QCu,0,const -QN_,0,near -QI_,0,interrupt -QS_,0,persistent -QT_,0,inline -QQ,0,__pack -QR_,0,reentrant -QR_,0,software -QJ_,0,nonreentrant -QJ_,0,compiled -QU,0,__discrete -Q00,1512,__invariant -Q00,1512,__stable -QE_,0,eeprom -QL_,0,low_priority -QH_,0,high_priority -QW_s,0,bank0 -QX_s,0,bank1 -QY_s,0,bank2 -QZ_s,0,bank3 -QB_,0,bdata -QFu_,0,far -v -N255 -E1 -S -u -fp "--cfgdata=C:\Program Files (x86)\Microchip\xc8\v1.40\dat\cfgdata\18lf4550.cfgdata" "--cfgmap=C:\Program Files (x86)\Microchip\xc8\v1.40\dat\cfgmap\18lf4550.cfgmap" -Gstrings,const -M -B -Y -r -J build/default/production\main.pre build/default/production\main.p1 C:\Users\Marchear\AppData\Local\Temp\scbg.5 ]
del C:\Users\Marchear\AppData\Local\Temp\cpp_scbg.cmd
del C:\Users\Marchear\AppData\Local\Temp\p1_scbg.cmd
"C:\Program Files (x86)\Microchip\xc8\v1.40\bin\xc8.exe" --chip=18LF4550 -G -mdist/default/production/Lab2.X.production.map --double=24 --float=24 --emi=wordwrite --opt=+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 -I"../../../../Program Files (x86)/Microchip/xc8/v1.40/include/plib" -V --warn=-3 --asmlist -DXPRJ_default=default --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,+plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" --memorysummary dist/default/production/memoryfile.xml -odist/default/production/Lab2.X.production.elf build/default/production/config_bits.p1 build/default/production/main.p1
Microchip MPLAB XC8 C Compiler (Free Mode) V1.40
Build date: Nov 30 2016
Part Support Version: 1.40
Copyright (C) 2016 Microchip Technology Inc.
License type: Node Configuration
:: warning: (1370) peripheral library support is not available for the 18LF4550
:: warning: (1273) Omniscient Code Generation not available in Free mode
C:\Program Files (x86)\Microchip\xc8\v1.40\bin\cgpic18.exe @C:\Users\Marchear\AppData\Local\Temp\cgpic18_sa1k.cmd [ -W-3 "--edf=C:\Program Files (x86)\Microchip\xc8\v1.40\dat\en_msgs.txt" --cmode=htc -Og9 -q -E1 -w9 --ivtinit=none "-CC:\Program Files (x86)\Microchip\xc8\v1.40\dat\picc-18.ini" -PPIC18LF4550 -PMS0:code:0@CODE=00h-07FFFh -PMS0:code:0@CONST=00h-07FFFh -PMS0:code:0@SMALLCONST=0800h-08FFhx120 -PMS0:code:0@MEDIUMCONST=0800h-07FFFh -PMS1:data:8@COMRAM=01h-05Fh -PMS1:data:0@ABS1=00h-07FFh -PMS1:data:0@BIGRAM=01h-07FFh -PMS1:data:0@RAM=060h-0FFh,0100h-01FFhx7 -PMS1:data:8000@BANK0=060h-0FFh -PMS1:data:10000@BANK1=0100h-01FFh -PMS1:data:20000@BANK2=0200h-02FFh -PMS1:data:40000@BANK3=0300h-03FFh -PMS1:data:0@BANK4=0400h-04FFh -PMS1:data:0@BANK5=0500h-05FFh -PMS1:data:0@BANK6=0600h-06FFh -PMS1:data:0@BANK7=0700h-07FFh -PMS1:data:0@SFR=0F60h-0FFFh -PMS4:config:0@CONFIG=0300000h-030000Dh -PMS3:eedata:0@EEDATA=0F00000h-0F000FFh -PMS5:idloc:0@IDLOC=0200000h-0200007h "--cfgdata=C:\Program Files (x86)\Microchip\xc8\v1.40\dat\cfgdata\18lf4550.cfgdata" --cfgprefix=__CFG_ --stack=compiled -MLFSROK -MEMI_WORD -Pcp=2 -Perrata=0x0 -Pramsize=0x7FF -fp -AC:\Users\Marchear\AppData\Local\Temp\sa1k. --funcdat=C:\Users\Marchear\AppData\Local\Temp\sa1k.1 --addrqual=ignore --runtime=init --runtime=clear --undefints=ignore build/default/production/config_bits.p1 build/default/production/main.p1 "C:\Program Files (x86)\Microchip\xc8\v1.40\lib\pic18-stdlib-htc-d24-f24-sz.lpp" "C:\Program Files (x86)\Microchip\xc8\v1.40\lib\pic18-setjmp.lpp" ]
C:\Program Files (x86)\Microchip\xc8\v1.40\bin\cgpic18.exe @C:\Users\Marchear\AppData\Local\Temp\cgpic18_sa1k.cmd [ -W-3 "--edf=C:\Program Files (x86)\Microchip\xc8\v1.40\dat\en_msgs.txt" --cmode=htc -q -E1 -Ddist/default/production\Lab2.X.production.sdb --interrupts=6 --ivtinit=none "-CC:\Program Files (x86)\Microchip\xc8\v1.40\dat\picc-18.ini" -PPIC18LF4550 -PMS0:code:0@CODE=00h-07FFFh -PMS0:code:0@CONST=00h-07FFFh -PMS0:code:0@SMALLCONST=0800h-08FFhx120 -PMS0:code:0@MEDIUMCONST=0800h-07FFFh -PMS1:data:8@COMRAM=01h-05Fh -PMS1:data:0@ABS1=00h-07FFh -PMS1:data:0@BIGRAM=01h-07FFh -PMS1:data:0@RAM=060h-0FFh,0100h-01FFhx7 -PMS1:data:8000@BANK0=060h-0FFh -PMS1:data:10000@BANK1=0100h-01FFh -PMS1:data:20000@BANK2=0200h-02FFh -PMS1:data:40000@BANK3=0300h-03FFh -PMS1:data:0@BANK4=0400h-04FFh -PMS1:data:0@BANK5=0500h-05FFh -PMS1:data:0@BANK6=0600h-06FFh -PMS1:data:0@BANK7=0700h-07FFh -PMS1:data:0@SFR=0F60h-0FFFh -PMS4:config:0@CONFIG=0300000h-030000Dh -PMS3:eedata:0@EEDATA=0F00000h-0F000FFh -PMS5:idloc:0@IDLOC=0200000h-0200007h "--cfgdata=C:\Program Files (x86)\Microchip\xc8\v1.40\dat\cfgdata\18lf4550.cfgdata" --cfgprefix=__CFG_ --stack=compiled -MLFSROK -MEMI_WORD -Pcp=2 -Perrata=0x0 -Pramsize=0x7FF -AC:\Users\Marchear\AppData\Local\Temp\sa1k. --funcdat=C:\Users\Marchear\AppData\Local\Temp\sa1k.1 --addrqual=ignore --runtime=init --runtime=clear --undefints=ignore build/default/production/config_bits.p1 build/default/production/main.p1 "C:\Program Files (x86)\Microchip\xc8\v1.40\lib\pic18-stdlib-htc-d24-f24-sz.lpp" "C:\Program Files (x86)\Microchip\xc8\v1.40\lib\pic18-setjmp.lpp" ]
C:\Program Files (x86)\Microchip\xc8\v1.40\bin\aspic18.exe @C:\Users\Marchear\AppData\Local\Temp\aspic18_sa1k.cmd [ -W-3 "--edf=C:\Program Files (x86)\Microchip\xc8\v1.40\dat\en_msgs.txt" --cmode=htc -E1 -o "-CC:\Program Files (x86)\Microchip\xc8\v1.40\dat\picc-18.ini" -ver=V1.40 -ldist/default/production\Lab2.X.production.lst --opt= -18LF4550 --errata=0 --comdiv=95 -no_pa -odist/default/production\Lab2.X.production.obj C:\Users\Marchear\AppData\Local\Temp\sa1k. ]
C:\Program Files (x86)\Microchip\xc8\v1.40\bin\aspic18.exe @C:\Users\Marchear\AppData\Local\Temp\aspic18_sa1k.cmd [ -W-3 "--edf=C:\Program Files (x86)\Microchip\xc8\v1.40\dat\en_msgs.txt" --cmode=htc -E1 "-CC:\Program Files (x86)\Microchip\xc8\v1.40\dat\picc-18.ini" -ver=V1.40 --opt= -18LF4550 --errata=0 --comdiv=95 -no_pa -oC:\Users\Marchear\AppData\Local\Temp\sa1k.obj C:\Users\Marchear\AppData\Local\Temp\sa1k.as ]
C:\Program Files (x86)\Microchip\xc8\v1.40\bin\hlink.exe @C:\Users\Marchear\AppData\Local\Temp\hlink_sa1k.cmd [ -W-3 "--edf=C:\Program Files (x86)\Microchip\xc8\v1.40\dat\en_msgs.txt" -cs -h+dist/default/production\Lab2.X.production.sym --cmf=dist/default/production\Lab2.X.production.cmf -z -w9 --norlf -Q18LF4550 -oC:\Users\Marchear\AppData\Local\Temp\sa1k.2 -Mdist/default/production/Lab2.X.production.map -E1 -ver=XC8#PRO##V1.40 -ACODE=00h-07FFFh -ACONST=00h-07FFFh -ASMALLCONST=0800h-08FFhx120 -AMEDIUMCONST=0800h-07FFFh -ACOMRAM=01h-05Fh -AABS1=00h-07FFh -ABIGRAM=01h-07FFh -ARAM=060h-0FFh,0100h-01FFhx7 -ABANK0=060h-0FFh -ABANK1=0100h-01FFh -ABANK2=0200h-02FFh -ABANK3=0300h-03FFh -ABANK4=0400h-04FFh -ABANK5=0500h-05FFh -ABANK6=0600h-06FFh -ABANK7=0700h-07FFh -ASFR=0F60h-0FFFh -preset_vec=00h,intcode,intcodelo,powerup,init -pramtop=0800h -psmallconst=SMALLCONST -pmediumconst=MEDIUMCONST -pconst=CONST -AFARRAM=00h-00h -ACONFIG=0300000h-030000Dh -pconfig=CONFIG -AIDLOC=0200000h-0200007h -pidloc=IDLOC -AEEDATA=0F00000h-0F000FFh -peeprom_data=EEDATA -prdata=COMRAM,nvrram=COMRAM,nvbit=COMRAM,rbss=COMRAM,rbit=COMRAM -pfarbss=FARRAM,fardata=FARRAM,nvFARRAM=FARRAM -pintsave_regs=BIGRAM,bigbss=BIGRAM,bigdata=BIGRAM -pbss=RAM -pidata=CODE,irdata=CODE,ibigdata=CODE,ifardata=CODE C:\Users\Marchear\AppData\Local\Temp\sa1k.obj dist/default/production\Lab2.X.production.obj ]
:0: error: (499) undefined symbol:
_OpenI2C(dist/default/production\Lab2.X.production.obj)
del C:\Users\Marchear\AppData\Local\Temp\sa1k.
del C:\Users\Marchear\AppData\Local\Temp\sa1k.1
del C:\Users\Marchear\AppData\Local\Temp\sa1k.2
del C:\Users\Marchear\AppData\Local\Temp\cgpic18_sa1k.cmd
del C:\Users\Marchear\AppData\Local\Temp\aspic18_sa1k.cmd
del C:\Users\Marchear\AppData\Local\Temp\sa1k.as
del C:\Users\Marchear\AppData\Local\Temp\sa1k.obj
del C:\Users\Marchear\AppData\Local\Temp\hlink_sa1k.cmd
(908) exit status = 1
nbproject/Makefile-default.mk:141: recipe for target 'dist/default/production/Lab2.X.production.hex' failed
make[2]: Leaving directory 'C:/Users/Marchear/MPLABXProjects/Lab2.X'
nbproject/Makefile-default.mk:84: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Users/Marchear/MPLABXProjects/Lab2.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make[2]: *** [dist/default/production/Lab2.X.production.hex] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
I have checked the "Link in peripheral library" box in the linker options. Also, in case it got lost in the whole log somewhere, there's the following warning that I'm getting :
:: warning: (1370) peripheral library support is not available for the 18LF4550
I've looked into it but couldn't find any information as to what I might be missing/doing wrong.
As for a little extra context, I'm teaching a course on microprocessors and PIC programming and I'm picking up everything from someone else who was giving the course last year. Apparently the I2C module worked last year... I'm checking with my colleague to see what's changed since then. Maybe the compiler version.
Come to think of it, I didn't restart my computer after I installed the library... don't think it should make a difference but I'll try anyways.
Thank you for your help :)
Upvotes: 0
Views: 1777
Reputation: 71
Ok, so after searching forever, my colleague notified me that the libraries don't work if you set the device as PIC18LF4550. You absolutely have to set the device as a PIC18F4550 in the project options, otherwise it will not work with the I2C peripheral library (and possibly others, haven't tested).
Upvotes: 2