Adding support for a new 16 bit PIC MCU requires the following steps:
- Create picDEVICE.c and picDEVICE.h from pDEVICE.inc using
perl /path/to/sdcc/support/scripts/inc2h-pic16.pl \
/path/to/gputils/header/pDEVICE.inc
- mv picDEVICE.h /path/to/sdcc/device/non-free/include/pic16
- mv picDEVICE.c /path/to/sdcc/device/non-free/lib/pic16/libdev
- Either
- add the new device to /path/to/sdcc/device/lib/pic16/libio/*.ignore
to suppress building any of the I/O libraries for the new devicetypeset@protect
@@footnote
SF@gobble@opt
In fact, the .ignore files are only used when auto-generating
Makefile.am using the .../libio/mkmk.sh script., or
- add the device (family) to /path/to/sdcc/support/scripts/pic18fam-h-gen.pl
to assign I/O styles, run the pic18fam-h-gen.pl script to
generate pic18fam.h.gen, replace your existing pic18fam.h
with the generated file, and (if required) implement new I/O styles
in /path/to/sdcc/device/include/pic16/{adc,i2c,usart}.h
and /path/to/sdcc/device/lib/pic16/libio/*/*.
- Edit /path/to/sdcc/device/include/pic16/pic18fregs.h
The file format is self-explanatory, just add
#elif defined(picDEVICE)
# include <picDEVICE.h>
at the right place (keep the file sorted, please).
- Edit /path/to/sdcc/device/include/pic16devices.txt
Copy and modify an existing entry or create a new one and insert it
at the correct place (keep the file sorted, please).
- ( cd /path/to/sdcc/device/non-free/lib/pic16 && sh update.sh
)
- Recompile the pic16 libraries as described in
or just configure and build sdcc again from scratch (recommended).