Jump to content
AlexR

Pic18 Eeprom Linker Problem

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 by anothermort

Share this post


Link to post
Share on other sites

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 by AlexR

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoticons maximum are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×