How to add support for new PIC

  • Hi,

    I would like to use unsupported PIC with SDCC.

    I looked at the source kode and the devices are referenced at the following place:

    I guess that I would have to:
    - add the PIC number in pics.all and pic18fregs.h
    - create pic18fxxxx.h and pic18fxxxx.c
    - add description in devices.c

    The following is written in devices.c

    /* Device descriptions are now generated by scripts.
    * For simplicities sake we just include them here.
    * Manual overrides may be inserted on top of
    * or right here BEFORE inclusion of */

    I found the script that generate pic18fxxxx.h but have not found scripts for pic18fxxxx.c and

    Does anyone have information that may help me?

    • Raphael Neider
      Raphael Neider

      In recent SDCC snapshots (since r4603, 2007-01-28), support/scripts/ provides a script to create .h and .c files. The script also contains directions as to which files to edit in what ways to get you going. Alternatively you could simply post requested devices and I will add them to the official sources timely, assuming that gputils already support them...

      Here is a (despite the asterisks valid) link to the script, in case you do not want to/cannot upgrade:\*checkout*/sdcc/trunk/sdcc/support/scripts/


      • Baltazar


        I had exactly the same question : how to add unsupported PICs into SDCC. However, I think that it is also necessary to create the .lib file for the concerned device. Can anybody explain how to do this (on linux) ?


        • Raphael Neider
          Raphael Neider

          The procedure to add new devices is now documented in the script file (support/scripts/inc2h{,-pic16}.pl) and the manual. The .lib file will be created from the picXXXXX.c file, which needs to be copied into device/lib/pic{,16}/libdev, during regular build of the whole library (using make in device/lib/pic{,16}).

          1. Compile the generated picXXXX.c into picXXXX.o
          2. gplib -c picXXXX.lib picXXXX.o
          That's it.


    • jpremor


      i added new 18F67J60 pic just compiling for 18F6680 device (very similar to my pic) and the .h and .c is automatically generated by line command. It uses the mplab .inc file to create (with pearl) the .h and .c
      very interesting. The instruction can be found at the manual, "Create new device" item.

      best regards