next up previous contents index
Next: 4.5.5 Command-Line Options Up: 4.5 The PIC14 port Previous: 4.5.3 Interrupt Code   Contents   Index

4.5.4 Linking and Assembling

For assembling you can use either GPUTILS' gpasm.exe or MPLAB's mpasmwin.exe. GPUTILS are available from http://sourceforge.net/projects/gputils. For linking you can use either GPUTILS' gplink or MPLAB's mplink.exe. If you use MPLAB and an interrupt function then the linker script file vectors section will need to be enlarged to link with mplink.

Pic device specific header and c source files are automatically generated from MPLAB include files, which are published by Microchip with a special requirement that they are only to be used with authentic Microchip devices. This reqirement prevents to publish generated header and c source files under the GPL compatible license, so they are located in non-free directory (see section 2.3). In order to include them in include and library search paths, the --use-non-free command line option should be defined.

NOTE: the compiled code, which use non-free pic device specific libraries, is not GPL compatible!

Here is a Makefile using GPUTILS:

.c.o: 
        sdcc -V -non-free -mpic14 -p16f877 -c $<  
 
$(PRJ).hex: $(OBJS)  
        gplink -m -s $(PRJ).lkr -o $(PRJ).hex $(OBJS) libsdcc.lib
Here is a Makefile using MPLAB:
.c.o:  
        sdcc -S -V -non-free -mpic14 -p16f877 $<  
        mpasmwin /q /o $*.asm 
 
$(PRJ).hex: $(OBJS)  
        mplink /v $(PRJ).lkr /m $(PRJ).map /o $(PRJ).hex $(OBJS) libsdcc.lib
Please note that indentations within a Makefile have to be done with a tabulator character.


next up previous contents index
Next: 4.5.5 Command-Line Options Up: 4.5 The PIC14 port Previous: 4.5.3 Interrupt Code   Contents   Index
2012-03-07