gnupic@linuxhacker.org
gnupic@linuxhacker.org
Craig Franklin has made tremendous progress with gputils adding
compatibility with Microchip's MPLINK. This means that gpasm supports
relocatable .asm files and that there's a gplink to take advantage of
linking object files together. Craig also started a patch to SDCC that
introduced object files to the PIC Port of SDCC. I finished it up and have
got it to the point that all of the PIC regression tests pass.
Here's a really quick summary of how to generate a .hex file now:
1) Install the latest version of gputils and SDCC
2) Create your source. Here's one called test.c:
#define __16F873
#include "p16f873.h"
typedef unsigned int word;
word at 0x2007 CONFIG = _WDT_OFF & _PWRTE_ON;
void main()
{
}
3) compile the source
$ sdcc -mpic14 -c -pp16f873 test.c
the -m option selects the PIC port of SDCC
the -c means compile only, but don't assemble or link
the -p option selects a particular processor in the pic port
This will create several files:
$ ls test.*
test.asm test.c test.d test.lst test.o test.p
The .o file is the only important one. The .asm file is what's created by
sdcc. However, sdcc automatically invokes gpasm to create a .o and .lst
file. (The .d and .p files are debug files). If you want, you can
re-assemble the .asm file to re-create the .o and .lst files.
4) Link the source. In a few days (or maybe even now?) sdcc will support
several .o files. But for the time being the .hex and .cod files are
created by:
$ gplink --map -c -s 16f873.lkr -o test.o test.o
The file 16f873.lkr is part of the gputils package. (You'll either need to
copy it to the same directory as your source or you'll need to specify the
path to it.)
The --map options tells gplink to output a .map file. This shows the
absolute address and types of all objects.
The -c option specifies that an executable (.hex) file should be produced.
The -s 16f873.lkr selects the linker script (which is processor
dependent).
The -o test.o says that gplink should produce an alternate output file.
Without this option, gplink will produce files named a.map, a.cod, and
a.hex.
---
Again, this is just a quick summary. Expect more enhancements soon!
Scott
gnupic@linuxhacker.org