AlexR 0 Posted March 19, 2012 Report Share Posted March 19, 2012 I am trying to port code that was originally written for a PIC18F2525 chip over to a PIC18F1320 chip. The code worked fine with the original 18F2525 but with the 18F1320 I keep getting a linker error saying : "Error: Failed to resolve external:eeadrh" , even though the PIC18F1320 chip does not have a EEADRH register. In fact from my limited tests, this error seems to occur on all PIC18F chips that have 256 bytes or less of EEprom and hence no EEADRH. Full compiler/linker dialog below; Building... "C:\Program Files\SourceBoost\boostc++_pic18.exe" ow_comms1320.c ow_temp1320.c -t PIC18F1320 -idx 1 -obj Release -d _RELEASE BoostC++ Optimizing C++ Compiler Version 7.05 (for PIC18 architecture) http://www.sourceboost.com Copyright© 2004-2011 Pavel Baranov Copyright© 2004-2011 David Hobday Licensed to ############### under Single user Full License for 1 node(s) Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited, Non commercial use only ow_comms1320.c ow_temp1320.c success "C:\Program Files\SourceBoost\boostlink_pic.exe" -idx 1 /ld "C:\Program Files\SourceBoost\lib" libc.pic18.lib Release\ow_comms1320.obj Release\ow_temp1320.obj "C:\Program Files\SourceBoost\Lib\eeprom.pic18.lib" /t PIC18F1320 /d "Release" /p temprature Caution: argument of 'delay_us' calls must have a value of 1 or more Error: Failed to resolve external:eeadrh BoostLink Optimizing Linker Version 7.05 http://www.sourceboost.com Copyright© 2004-2011 Pavel Baranov Copyright© 2004-2011 David Hobday failure error: failed Failed to locate output file 'Release\temprature.hex' Done Failed Quote Link to post Share on other sites
Reynard 0 Posted March 19, 2012 Report Share Posted March 19, 2012 Hi Alex, There was a problem with something like this a couple of years ago but it was resolved with some additions to the eeprom.h file. Check your eeprom.h file that it does include the conditional test and you have the latest lib files which you should have with V7.05. #ifdef EEADRH I have done a quick test (V7.05.1) using your PIC and eeprom_read(x) and have no problems. Cheers Reynard Quote Link to post Share on other sites
AlexR 0 Posted March 19, 2012 Author Report Share Posted March 19, 2012 The eeprom.h looks fine to me and it does contain the statement #ifdef EEADRH It would seem that something somewhere is telling the linker that EEADRH is infact defined. Just to be on the safe side I have done a complete un-install, deleted all files and directories and did a fresh install of Sourceboost 7.05.1. but the problem still persists! Quote Link to post Share on other sites
Reynard 0 Posted March 19, 2012 Report Share Posted March 19, 2012 Hmmmmm. Not so good Alex. You could just define this register and see what part the linker brings in from the eeprom library by looking at the assembly code. I still find the workspace and project file a little flakey at times. Sometime it is best to delete them and rebuild them. My test program project file (.__c) says I have a count=2 but there are 3 files listed (2 of them the eeprom.pic18.lib). Why should that be I ask myself. I wish you luck. Reynard Quote Link to post Share on other sites
anothermort 0 Posted March 19, 2012 Report Share Posted March 19, 2012 (edited) Hi dont you need volatile char eeadrh; //dummy variable that is needed to link to eeprom library for PIC18s that don't have EEARDH register For pics that do not have the EEARDH register Edited March 19, 2012 by anothermort Quote Link to post Share on other sites
Reynard 0 Posted March 19, 2012 Report Share Posted March 19, 2012 You don't need it if the PIC doesn't support it. Quote Link to post Share on other sites
AlexR 0 Posted March 19, 2012 Author Report Share Posted March 19, 2012 (edited) Hi dont you need volatile char eeadrh; //dummy variable that is needed to link to eeprom library for PIC18s that don't have EEARDH register For pics that do not have teh EEARDH register Yep, that fixed it! But it sill is a bug that should addressed since I'm sure that by the time I next use EEprom on a small PIC18 chip I will have forgotten about both the problem and the fix. Edited March 19, 2012 by AlexR Quote Link to post Share on other sites
Reynard 0 Posted March 19, 2012 Report Share Posted March 19, 2012 The problem lies in the eeprom.c source file. void eeprom_write(unsigned char address, unsigned char data) ... // eeadrh = address >> 8; Comment out this line. ... Comment out the offending line and remake the library if you have the Goodies stuff. The problem didn't show in my test because I only used eeprom_read() which is OK. To be fixed in the next release no doubt. Cheers Reynard Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.