Sdcc and linking problem - libsdcc.lib or any library I create!

Jun 24, 2006 3 Replies

Hello All,



Problem: I cannot compile and link libsdcc.lib or my own created library to my program.



Background details: I am trying to write a program to target for the pic16f628 chip. I am using to compile the program prog1.c I am using SDCC under cygwin. I am using the latest nightly build 24 June 2006.



Progress so far:


  1. The basic program works and compiles properly using sdcc.

'sdcc -mpic14 -p16f628 prog1.c'



Works fine!!!!


  1. I try to enhance the program by adding an array. To compile the program, sdcc now require _mulint.o to link it.

'sdcc -mpic14 -p16f628 prog1.c'



This returns: warning: processor mismatch in "_mulint.o"


  1. After some research I find that it is available in libsdcc.lib.



  1. I attempt to compile using this and it comes up with



warning: processor mismatch in "_mulint.o"


  1. Fine, so I know that the default libsdcc.lib is targetted for a different processor. I attempt to include a library path pointing to the correct lib file.

On my system it's



'sdcc -mpic14 -p16f628 prog1.c libsdcc.lib



-L/usr/local/share/sdcc/lib/pic'



It returns with the same error message.


  1. I attempt to try again using the absolute path:

'sdcc -mpic14 -p16f628 prog1.c /usr/local/share/sdcc/lib/pic/libsdcc'



&

'sdcc -mpic14 -p16f628 prog1.c /usr/local/share/sdcc/lib/pic/libsdcc



-L/usr/local/share/sdcc/lib/pic'



Still returns processor mismatch!!!!


  1. RTFM TIME!!!!! Okay, I read the manual and it describes a way to build a library. I find the correct source of the code for the pic and build a new library using

'sdcc -c _xxx.c'



and adding it to the libray



'libint.lib' (used to differentiate from the exisiting library).


I now get the error - error: "/usr/local/share/sdcc/lib/src/pic/libsdcc/libint.lib" is not a valid coff object or archive


Looking at the asm, it has not generated the right code so I comple and add to the library again now compiling with 'sdcc -c -mpic14 _xxx.c'



I get the same error.....


  1. RTFM TIME!!!!! Okay, I read the manual and it describes a way to build a library. I find the correct source of the code for the pic and build a new library using

'sdcc -c _xxx.c'



and adding it to the libray



'libint.lib' (used to differentiate from the exisiting library).


I now get the error - error: "/usr/local/share/sdcc/lib/src/pic/libsdcc/libint.lib" is not a valid coff object or archive


I'm at the end of my tether on this, this is basic!



Can anyone help me with how to compile and link using either libsdcc.lib or my own library? This is basic and I'm having so many problems. I have tried almost everything, but this is not working. I'm sure that it is something simple to solve.



Many thanks in advance,



Richard



Sorry, I can't help you with your problem, but I am wondering why on earth you'd choose to run SDCC under cygwin??? There is a native windows version available...

Regards,

Mark McDougall, Engineer Virtual Logic Pty Ltd, 21-25 King St, Rockdale, 2216 Ph: +612-9599-3255 Fax: +612-9599-3266

Hello Mark,

Thanks for the response. I am using cygwin because I enjoy using a Linux interface under Windows. I will and install sdcc under Windows, but cannot see how helps to solve the problem.

Regards,

Richard

Mark McDougall wrote:

If you prefer using a *nix environment, you might also look at mingw/msys. They don't implement as much of posix as cygwin, but on the other hand they play better with windows and native windows programs, and avoid the infamous cygwin1.dll issues. By using mingw and the native sdcc, you will at least be confident that there are no problems regarding paths (which can sometimes be an issue under cygwin). Whether that helps or not with your problem, I've no idea.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required