Next: 4.6.10 Memory Models Up: 4.6 The PIC16 port Previous: 4.6.8 Libraries Contents Index

## 4.6.9 Adding New Devices to the Port

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

1. 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`
2. `mv picDEVICE.h /path/to/sdcc/device/include/pic16`
3. `mv picDEVICE.c /path/to/sdcc/device/lib/pic16/libdev`
4. Add DEVICE to `/path/to/sdcc/device/lib/pic16/pics.all` (and `.build`).
   Note: No 18f prefix here!
5. Adjust `/path/to/sdcc/device/lib/pic16/libio/*.ignore`
   Add your DEVICE if it does not compile in `adc`, `i2c`, or `usart`.
6. 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 it sorted).
7. Edit `/path/to/sdcc/src/pic16/devices.inc`. Copy and modify an existing entry and insert it at the correct place (keep the file sorted). The file is hardly documented, look at the entries for the 18f2221...
8. Recompile SDCC, including the pic16 libraries.