next up previous contents index
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. Set up the I/O library by doing one of the following:

    1. Adjust /path/to/sdcc/device/lib/pic16/libio/*.ignore
      Add your DEVICE if it does not compile in adc, i2c, or usart.
    2. Adjust /path/to/sdcc/device/include/pic16/adc.h 
      Add the new devices to the correct ADC style class.
  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/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).
  8. Recompile the pic16 libraries.



2009-02-24