Hi Raphael, thanks for the answer.

However the linker still can`t find the script. I have also tried to call gplink alone with the -s argument and it doens`t find the file:

C:\>gplink -m -s 16f916.lkr
16f916.lkr: No such file or directory

The default linker script path C:\Program Files\gputils\lkr and i`m sure the file is in there.

Thanks in advance.

2009/5/31 Raphael Neider <rneider@web.de>
Hi Marcelo,

> I`m trying to compile the pic16F916 but it has a strange problem when it
> calls the linker.
> 1) with this compilation command, without specifying the lkr file, it
> calls the default linker:
> C:\>sdcc -mpic16 --out-fmt-ihx test.c
> message: using default linker script "C:\Program
> Files\gputils\lkr\18f452.lkr"
> It`s ok.
> 2) if I try to specify a lkr file, it doesn`t accept and calls the
> default:
> C:\>sdcc -mpic16 -l 16f916.lkr --out-fmt-ihx test.c
> error: "C:\Program Files\gputils\lkr\16f916.lkr" is not a valid coff
> object or archive
> message: using default linker script "C:\Program
> Files\gputils\lkr\18f452.lkr"
> I can`t realize where is the error, because the file 16f916.lkr exists in
> the folder.

You cannot use the -l switch to sdcc to specify a linker script;
that switch is used to add libraries to the linker files. You
should be fine by using -Wl,-s,16f916.lkr
(that is: -Wl to tell sdcc to pass the comma-separated list of options
immediately following to the linker, -s to tell gplink that you want
to specify a linker script of your own and 16f916.lkr being the name
of the linker script to use). Be careful if you need to include any
whitespace in the options - you'll have to quote properly.
Also note that
is equivalent to
-Wl,-s -Wl,pic16f916.lkr
so you can split up the arguments to be passed to the linker.

BUT: You probably want to use to the pic14 port (not pic16) and specify
the target device using -mpic14 -p16f916 (instead of -mpic16). The pic16
backend is used for the 16-bit PICs (typically 18fxxx), pic14 is the
backend for the 14-bit PICs (16fxxx and similar).

Good luck,

Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
Sdcc-user mailing list

Marcelo dos Santos Rodrigues