Add device deffinition

  • Mihai Rainer
    Mihai Rainer


    I found piklab could be a good replacement for my usual text editor for my Microchip projects with Jalv2 and SDCC.
    I am wondering if I can myself add new device deffinitions to enhance this great too to comply to my needs.
    For other things, I found that I can add custom compiler and programmer settings and is working great
    with jalv2 and jallib and with SDCC, but for project there are limited device definitions.
    Of course, if I set the proper parameter for command line is working, but I think I also can help with this.

    Thank you very  much,

  • Hi Mihai,

    which device do you want to add? It is pretty simple if you can compile from source. In directory piklab/src/devices/pic/xml_data, there are xml files that describe all supported devices. You can find the closest supported device to the one want to add. Copy the xml file and edit it to match the datasheet.
    When you are done, just recompile the project and the device should appear.

    Don't hesitate to ask me if you have any problem following these steps.


  • hi azhyd. i followed ur instructions and compiled piklab. ./configure works fine. make stops at certain point.

    Parsing XML file "cmacros/cmacros_16X.xml"…
    Warning : Different number of config names (1 != 0) for WRT/0000:0FFF
    Warning : Different number of config names (1 != 0) for WRT/0000:07FF
    Warning : Different number of config names (1 != 0) for WRT/0000:00FF
    Warning : Different first config name _WRT_OFF for WRT/Off
    Fatal : stop

  • Hi,

    support for 16F727 was added to Piklab at version 0.15.9 released June 2010. You should upgrade Piklab to a more recent version.


  • thanks for the quick reply. i found piklab 0.15.9(ubuntu ) and 16f727 is supported in it. but i dont know how to compile it under debian using cmake. there is no config file. so i simply tried cd into the source and

    but cmake prints a long list of options.  pls advice how to compile. i am using debian lenny.

  • Richard Bown
    Richard Bown

    The current version of piklab is available on Debian Squeeze, However they who must be obeyed have decided to drop piklab on wheezy when released as it uses qt3.
    If you are using wheezy, (testing), enable the squeeze repos and download piklab, It works without a problem.
    No need to compile.


  • hey guys. now compilation works. i just added a  path infront of cmake. all the manulas simply mentioned cmake. now i have piklab 0.15.9_1 installed in debian lenny.


  • but sdcc doesnt support pic16f727. any idea how to do this

  • Well you can bug the SDCC developper to suppotr this device or you can use another compiler (for example there is a lite version of the picc compiler).

  • Abhijit Biswas
    Abhijit Biswas


    I have successfully created / updated  PIC16F1509, PIC16F1508, PIC16F707 device information file and compiled the piklab source code including them. I have just added these xml files in the "./piklab-0.16.2/src/devices/pic/xml_data/ " directory
    compiled with the instruction <cmake .> and then <make>
    However neede to install few more qt and kde development packages before successful compilation.

    Here I have added the code for 16F1509.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <!--* Copyright (C) 2011 Gal Zsolt                                         *-->
    <!--* Updated by Abhijit Biswas                                            *-->
    <!--*!                                                                     *-->
    <!--* This program is free software; you can redistribute it and/or modify *-->
    <!--* it under the terms of the GNU General Public License as published by *-->
    <!--* the Free Software Foundation; either version 2 of the License, or    *-->
    <!--* (at your option) any later version.                                  *-->
    <device name="16F1509" status="IP" memory_technology="FLASH" self_write="yes"
            architecture="emidrange" id="0x2D40" id_low_power="0x2E00"
    <!--* Documents ************************************************************-->
      <documents webpage="553474" datasheet="41609" progsheet="41573" erratas="80536" />
    <!--* Checksums ************************************************************-->
    <!--* Operating characteristics ********************************************-->
      <frequency_range name="extended" >
        <frequency start="0"  end="16" vdd_min="2.3" vdd_max="5.5" />
        <frequency start="16" end="32" vdd_min="2.5" vdd_max="5.5" />
      <frequency_range name="extended" special="low_power" >
        <frequency start="0"  end="16" vdd_min="1.8" vdd_max="3.6" />
        <frequency start="16" end="32" vdd_min="2.5" vdd_max="3.6" />
      <voltages name="vpp"            min="8.0" max="9.0" nominal="9.0" />
      <voltages name="vdd_prog"       min="2.7" max="5.5" nominal="5.0"  />
      <voltages name="vdd_prog_write" min="2.7" max="5.5" nominal="5.0"  />
    <!--* Memory ***************************************************************-->
      <memory name="code"         start="0x0000" end="0x17FF" />
      <memory name="user_ids"     start="0x8000" end="0x8003" rmask="0x3FFF"          />
      <memory name="debug_vector" start="0x8004" end="0x8004" />
      <memory name="device_id"    start="0x8006" end="0x8006" />
      <memory name="config"       start="0x8007" end="0x8008" />
      <memory name="calibration"  start="0x8009" end="0x800A" cal_opmask="0x0000" cal_opcode="0x0000" />
    <!--* Configuration bits ***************************************************-->
      <config offset="0x0" name="CONFIG1" wmask="0x3FFF" bvalue="0x3FFF" >
        <mask name="FOSC"  value="0x0007" >
          <value value="0x0000" name="LP"       def="_FOSC_LP"     />
          <value value="0x0001" name="XT"       def="_FOSC_XT"     />
          <value value="0x0002" name="HS"       def="_FOSC_HS"     />
          <value value="0x0003" name="EXTRC"    def="_FOSC_EXTRC"  />
          <value value="0x0004" name="INTRC"    def="_FOSC_INTOSC"  />
          <value value="0x0005" name="EC"       def="_FOSC_ECL"  />
          <value value="0x0006" name="EC"       def="_FOSC_ECM"  />
          <value value="0x0007" name="EC"       def="_FOSC_ECH"  />
        <mask name="WDT"   value="0x0018" >
          <value value="0x0000" name="Off"      def="_WDTE_OFF"    />
          <value value="0x0008" name="Software" def="_WDTE_SWDTEN" />
          <value value="0x0010" name="On_run"   def="_WDTE_NSLEEP" />
          <value value="0x0018" name="On"       def="_WDTE_ON"     />
        <mask name="PWRTE" value="0x0020" >
          <value value="0x0000" name="On"  def="_PWRTE_ON"  />
          <value value="0x0020" name="Off" def="_PWRTE_OFF" />
        <mask name="MCLRE" value="0x0040" >
          <value value="0x0000" name="Internal" def="_MCLRE_OFF" />
          <value value="0x0040" name="External" def="_MCLRE_ON"  />
        <mask name="CP"    value="0x0080" >
          <value value="0x0000" name="All" def="_CP_ON"  />
          <value value="0x0080" name="Off" def="_CP_OFF" />
        <mask name="BODEN" value="0x0600" >
          <value value="0x0000" name="Off"      def="_BOREN_OFF"    />
          <value value="0x0200" name="Software" def="_BOREN_SBODEN" />
          <value value="0x0400" name="On_run"   def="_BOREN_NSLEEP" />
          <value value="0x0600" name="On"       def="_BOREN_ON"     />
        <mask name="CLKOUTEN"  value="0x0800" >
          <value value="0x0000" name="On"   def="_CLKOUTEN_ON"  />
          <value value="0x0800" name="Off"  def="_CLKOUTEN_OFF" />
         <mask name="IESO"  value="0x1000" >
          <value value="0x0000" name="Off"   def="_IESO_OFF"  />
          <value value="0x1000" name="On"  def="_IESO_ON" />
        <mask name="FCMEN"  value="0x2000" >
          <value value="0x0000" name="Off"   def="_FCMEN_OFF"  />
          <value value="0x2000" name="On"  def="_FCMEN_ON" />
      <config offset="0x1" name="CONFIG2" wmask="0x3FFF" bvalue="0x2E03" >
        <mask name="WRT"  value="0x0003" >
          <value value="0x0000" name="0000:07FF" def="_WRT_ALL"  />
          <value value="0x0001" name="0000:03FF" def="_WRT_HALF" />
          <value value="0x0002" name="0000:01FF" def="_WRT_BOOT" />
          <value value="0x0003" name="Off"       def="_WRT_OFF"  />
        <mask name="STVREN"   value="0x0200" >
          <value value="0x0000" name="Off" def="_STVREN_OFF" />
          <value value="0x0200" name="On"  def="_STVREN_ON"  />
        <mask name="BORV" value="0x0400" >
            <value value="0x0000" name="2.5" def="_BORV_HI" />
        <value value="0x0400" name="1.9" def="_BORV_LO" />
        <mask name="LPBOR" value="0x0800" >
          <value value="0x0000" name="On"  def="_LPBOR_ON" />
          <value value="0x0800" name="Off" def="_LPBOR_OFF" />
        <mask name="DEBUG" value="0x1000" >
          <value value="0x0000" name="On"  def="_DEBUG_ON"  />
          <value value="0x1000" name="Off" def="_DEBUG_OFF" />
        <mask name="LVP"   value="0x2000" >
          <value value="0x0000" name="Off" def="_LVP_OFF" />
          <value value="0x2000" name="On"  def="_LVP_ON"  />
    <!--* Packages *************************************************************-->
      <package types="pdip ssop soic" nb_pins="20" >
        <pin index="1"  name="VDD" />
        <pin index="2"  name="RA5/SOSCI/T1CKI/NCO1CLK/IOC5/IPU5/CLKIN/OSC1" />
        <pin index="3"  name="RA4/AN3/SOSCO/T1G(1)/IOC4/IPU4/CLKOUT/OSC2" />
        <pin index="4"  name="RA3/MCLR/VPP/T1G/SS/CLC1IN0/IOC3/IPU3" />
        <pin index="5"  name="RC5/CWG1A/CLC1(2)/PWM1" />
        <pin index="6"  name="RC4/C2OUT/CWG1B/CLC4/CLC2IN1" />
        <pin index="7"  name="RC3/AN7/C1IN3-/CLC2IN0/PWM2" />
        <pin index="8"  name="RC6/AN8/SS(1)/NCO1(2)/CLC3IN1" />
        <pin index="9"  name="RC7/AN9/CLC1IN1/SDO" />
        <pin index="10" name="RB7/TX/CLC3/IOC9/IPU9" />
        <pin index="11" name="RB6/SCL/SCK/IOC8/IPU8" />
        <pin index="12" name="RB5/AN11/RX/DT/CLC4IN0/IOC7/IPU7" />
        <pin index="13" name="RB4/AN10/SDA/SDI/CLC3IN0/IOC6/IPU6" />
        <pin index="14" name="RC2/AN6/C1IN2-/C2IN2-" />
        <pin index="15" name="RC1/AN5/C1IN1-/C2IN1-/NCO1/PWM4" />
        <pin index="16" name="RC0/AN4/C2IN+/CLC2" />
        <pin index="17" name="RA2/AN2/DACOUT2/C1OUT/T0CKI/CWG1FLT/CLC1(1)/PWM3/INT/IOC2/IPU2" />
        <pin index="18" name="RA1/AN1/VREF+/C1IN0-/C2IN0-/CLC4IN1/IOC1/IPU1/ICSPCLK/ICDCLK" />
        <pin index="19" name="RA0/AN0/DACOUT1/C1IN+/IOC0/IPU0/ICSPDAT/ICDDAT" />
        <pin index="20" name="VSS" />
      <package types="qfn" nb_pins="20" >
        <pin index="1"  name="RA3/MCLR/VPP/T1G/SS/CLC1IN0/IOC3/IPU3" />
        <pin index="2"  name="RC5/CWG1A/CLC1(2)/PWM1" />
        <pin index="3"  name="RC4/C2OUT/CWG1B/CLC4/CLC2IN1" />
        <pin index="4"  name="RC3/AN7/C1IN3-/CLC2IN0/PWM2" />
        <pin index="5"  name="RC6/AN8/SS(1)/NCO1(2)/CLC3IN1" />
        <pin index="6"  name="RC7/AN9/CLC1IN1/SDO" />
        <pin index="7"  name="RB7/TX/CLC3/IOC9/IPU9" />
        <pin index="8"  name="RB6/SCL/SCK/IOC8/IPU8" />
        <pin index="9"  name="RB5/AN11/RX/DT/CLC4IN0/IOC7/IPU7" />
        <pin index="10" name="RB4/AN10/SDA/SDI/CLC3IN0/IOC6/IPU6" />
        <pin index="11" name="RC2/AN6/C1IN2-/C2IN2-" />
        <pin index="12" name="RC1/AN5/C1IN1-/C2IN1-/NCO1/PWM4" />
        <pin index="13" name="RC0/AN4/C2IN+/CLC2" />
        <pin index="14" name="RA2/AN2/DACOUT2/C1OUT/T0CKI/CWG1FLT/CLC1(1)/PWM3/INT/IOC2/IPU2" />
        <pin index="15" name="RA1/AN1/VREF+/C1IN0-/C2IN0-/CLC4IN1/IOC1/IPU1/ICSPCLK/ICDCLK" />
        <pin index="16" name="RA0/AN0/DACOUT1/C1IN+/IOC0/IPU0/ICSPDAT/ICDDAT" />
        <pin index="17" name="VSS" />
        <pin index="18" name="VDD" />
        <pin index="19" name="RA5/SOSCI/T1CKI/NCO1CLK/IOC5/IPU5/CLKIN/OSC1" />
        <pin index="20" name="RA4/AN3/SOSCO/T1G(1)/IOC4/IPU4/CLKOUT/OSC2" />


  • Abhijit Biswas
    Abhijit Biswas


    The code for PIC16F1508 require a bit of modification on 16F1509.xml

    <device name="16F1508" status="IP" memory_technology="FLASH" self_write="yes"
            architecture="emidrange" id="0x2D20" id_low_power="0x2DE0"

    code for PIC16F707 can be created by modifying the 16F727.xml file

    <device name="16F707" status="IP" memory_technology="FLASH" self_write="no" 
            architecture="midrange" id="0x1AC0" id_low_power="0x1AE0"
    <!--* Documents ************************************************************-->
      <documents webpage="548149" datasheet="41418B" progsheet="41405A" erratas="" />