I have only read the GNU make manual up to section 4.5, but I think I have
read enough of the manual to realize that the tab character is required
between all commands. So I have fixed that, but have received the following
error the first time through:
[Makefile script]
# change this to your program name
PROG_NAME = LED_toggle.hex
# list your object files
OBJS = main.o
DEBUG = #-DUSB_USE_UART #-DDEBUG_UART -DDEBUG -DDEBUG_PRINT
PIC_TYPE = PIC18F2620
sdcc_PIC_TYPE = 18f2620
lkr_PIC_TYPE = 18f2620
TOOLSDIR = /usr/local/
CC = $(TOOLSDIR)/bin/sdcc
CFLAGS = -mpic16 -V -p$(sdcc_PIC_TYPE) $(DEBUG) --denable-peeps
--opt-code-size --optimize-cmp --optimize-df --fstack
LNK = $(TOOLSDIR)/bin/sdcc
INC = -I.
LDFLAGS = -L/usr/local/share/sdcc/lib/pic16/
CRT = --use-crt=crt0.o -V
#DEBUG = --denable-peeps --obanksel=9 --opt-code-size --optimize-cmp
--optimize-df --fstack
all: $(PROG_NAME)
.c.o:
$(CC) $(CFLAGS) $(INC) -c $<
#rule to link the final executable
$(PROG_NAME): $(OBJS)
$(LNK) $(DEBUG) $(LDFLAGS) $(CRT) -Wl-s$(lkr_PIC_TYPE).lkr,-m -mpic16
-p$(sdcc_PIC_TYPE) $+ -o $(@) -llibio$(sdcc_PIC_TYPE).lib -llibc18f.lib
#
#prog: $(PROG_NAME)
# piklab-prog --programmer=direct --port=/dev/parport0
--device=$(sdcc_PIC_TYPE) --command=program $(PROG_NAME)
clean:
rm -f *.o *.rel *.lst *.cod *.hex *.map *.asm# change this to your
program name
[end of Makefile script]
[error message]
[EMAIL PROTECTED]:/media/sda5/Dairy Cow Research/datalogging
scale/software/LED_toggle$ make
/usr/local//bin/sdcc -L/usr/local/share/sdcc/lib/pic16/ --use-crt=crt0.o -V
-Wl-s18f2620.lkr,-m -mpic16 -p18f2620 main.o -o LED_toggle.hex -
llibio18f2620.lib -llibc18f.lib
+ "/usr/local//bin/gplink" -I"/usr/local//bin/../share/sdcc/lib/pic16"
-I"/usr/local/share/sdcc/lib/pic16" -I"/usr/local/share/sdcc/lib/pic16/" -
s18f2620.lkr -m -w -r -o LED_toggle.hex main.o crt0.o libio18f2620.lib
libc18f.lib pic18f2620.lib libsdcc.lib
18f2620.lkr: No such file or directory
make: *** [LED_toggle.hex] Error 1
[end of error message]
I have inferred that the linker path LNK is in the wrong directory. So I
changed to LNK = $(TOOLSDIR)/share/gputils/lkr/ for the microcontroller
linker path b/c the linker file is found in that respective path, but
instead got a permission error message.
[error message]
[EMAIL PROTECTED]:/media/sda5/Dairy Cow Research/datalogging
scale/software/LED_toggle$ make
/usr/local//share/gputils/lkr/ -L/usr/local/share/sdcc/lib/pic16/
--use-crt=crt0.o -V -Wl-s18f2620.lkr,-m -mpic16 -p18f2620 main.o -o
LED_toggle.hex -llibio18f2620.lib -llibc18f.lib
make: execvp: /usr/local//share/gputils/lkr/: Permission denied
make: *** [LED_toggle.hex] Error 127
[end of error message]
Does anyone have any idea on how to get around that? I have a feeling that
it has something to do with 18f2620.lkr file.
Thanks,
Stanley
On 9/30/07, Xiaofan Chen <[EMAIL PROTECTED]> wrote:
>
> On 9/30/07, Stanley Lee <[EMAIL PROTECTED]> wrote:
> > Sorry for the additional spam, but I have a few more questions about the
> > Makefile as I am on the way of switching away from using piklab ide
>
> I think Piklab should work fine. If you have Piklab related problem,
> try ask in gnupic mailing list. The author Nicolas monitors
> gnupic mailing list.
>
> >
> > piklab-prog --programmer=direct --port=/dev/parport0
> > --device=$(sdcc_PIC_TYPE) --command=program $(PROG_NAME)
> >
> > #would the prog directive be telling the makefile to flash the hexfile
> to
> > the microcontroller? if I am using PICKIT2 programmer, would I be
> commanding
> > the programmer to look in /dev/usbxxx, x being number?
>
> http://piklab.sourceforge.net/wiki/index.php/Command-line_Utility
> piklab-prog -p pickit2 -d 18f2620 -c program $(PROG_NAME)
>
> Take note that Piklab only supports PICkit 2 V1.x firmware.
> For PICkit 2 Linux related issues, please go to pickit-devel mailing
> list or gnupic list. Thanks.
>
> Xiaofan
> http://mcuee.blogspot.com
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Sdcc-user mailing list
> Sdcc-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sdcc-user
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user