Table of Contents
Microchip XC16 compiler
This is a C compiler for the dsPIC and PIC24 24-bit address word PICMicros.
Installation is comprised of two steps. The first step installs the commercial compiler and the include files. The second step is used to replace the compiler with the free edition. The support files are needed in step 2 from step 1.
Commercial edition
The commercial edition has optimisation limitations unless a license is bought.
Initialise
mkdir -p /opt/microchip cd /opt/microchip
Fetch and install
wget "http://ww1.microchip.com/downloads/en/DeviceDoc/xc16-v1.30-full-install-linux-installer.run" chmod +x *.run ./xc16-v1.30-full-install-linux-installer.run
Include files
Peripheral include files need to be fetched and installed separately.
Fetch and install
wget "http://ww1.microchip.com/downloads/en//softwarelibrary/pic24 mcu dspic peripheral lib/peripheral-libraries-for-pic24-and-dspic-v2.00-linux-installer.run" chmod +x *.run ./peripheral-libraries-for-pic24-and-dspic-v2.00-linux-installer.run
Use /opt/microchip/xc16/v1.30 as the install directory.
Free edition
The free edition utilises header files and libraries from the commercial edition so perform the installation steps given above first. The free edition has no limitations and does not require a license for optimisations.
The source code for the compiler needs a number of patches to build and operate. Patches were sourced from patches from the older c30 compiler and others created for XC16. The resultant build has proven to produce binary objects that work on the target devices.
Initialise
cd /var/tmp apt-get install build-essential flex bison unzip mercurial zlib1g-dev hg clone http://hg.kewl.org/pub/pic30 cd pic30
The install process will apply a number of patches, build the compiler and tools and install everything in /opt/pic30-tools.
Fetch and install
wget "http://ww1.microchip.com/downloads/en/DeviceDoc/v1.30.src.zip" ./install
The install script expects the commercial compiler and includes files to be installed so it may copy the support files to the build directory.
The final output of this process is not elegant and can do with more work but this is not a high priority.
Raspberry Pi
This also depends on the commercial edition which must be installed as given above.
Install emulator
Initialise
mkdir -p /embedded/raspbian/opt/microchip/xc16/v1.30/ cd /embedded/raspbian/opt/microchip/xc16/v1.30/ cp -Rp /opt/microchip/xc16/v1.30/* . mkdir -p /embedded/raspbian/var/tmp/ cd /embedded/raspbian/var/tmp hg clone http://hg.kewl.org/pub/pic30 cd pic30
Fetch
wget "http://ww1.microchip.com/downloads/en/DeviceDoc/v1.30.src.zip"
Enter emulator
Install in emulator
apt-get install build-essential flex bison unzip zlib1g-dev cd /var/tmp/pic30 ./install exit
Mount emulator directory in RPi
Install on RPi
cd /opt cp -Rpa /embedded/raspbian/opt/pic30-tools .