4.5.2 Adding New Devices to the Port

Next: 4.5.3 Interrupt Code Up: 4.5 The PIC14 port Previous: 4.5.1 PIC Code Pages Contents Index

## 4.5.2 Adding New Devices to the Port

Adding support for a new 14bit PIC MCU requires the following steps:

1. Create a new device description.
   Each device is described in two files: pic16f*.h and pic16f*.c. These files primarily define SFRs, structs to access their bits, and symbolic configuration options. Both files can be generated from gputils' .inc files using the perl script `support/scripts/inc2h.pl`. This file also contains further instructions on how to proceed.
2. Copy the .h file into SDCC's include path and either add the .c file to your project or copy it to `device/lib/pic/libdev`. Afterwards, rebuild and install the libraries.
3. Edit pic14devices.txt in SDCC's include path (`device/include/pic/` in the source tree or `/usr/local/share/sdcc/include/pic` after installation).
   You need to add a device specification here to make the memory layout (code banks, RAM, aliased memory regions, ...) known to the compiler. Probably you can copy and modify an existing entry. The file format is documented at the top of the file.

Next: 4.5.3 Interrupt Code Up: 4.5 The PIC14 port Previous: 4.5.1 PIC Code Pages Contents Index