next up previous contents index
Next: 4.6.11 Memory Models Up: 4.6 The PIC16 port Previous: 4.6.9 Libraries   Contents   Index

4.6.10 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
    Note: No 18f prefix here!
  5. Either

    1. 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 device4.2, or
    2. 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/*/*.
  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 the file sorted, please).
  7. 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).
  8. Add the device to /path/to/sdcc/device/lib/pic16/libdev/Makefile.am
    Copy an existing entry and adjust the device name.
  9. Add the device to /path/to/sdcc/device/lib/pic16/libio/Makefile.am
    Copy the record from the 18f2220 and adjust the device name.
    If the new device does not offer ADC, I$^{\text{2}}$C, and/or (E)USART functionality as assumed by the library, or if you added the new device to .../libio/{adc,i2c,usart}.ignore, remove the lines with references to adc/*.c, i2c/*.c, or usart/*.c, respectively.
  10. Update libdev/Makefile.in and libio/Makefile.in using
    ./bootstrap.sh
    in /path/to/sdcc/device/lib/pic16.
  11. Recompile the pic16 libraries as described in 4.6.9.


next up previous contents index
Next: 4.6.11 Memory Models Up: 4.6 The PIC16 port Previous: 4.6.9 Libraries   Contents   Index
2012-03-07