Mplab and XC8 Install on Linux
Preface
One of the reasons that I chose to use the MPLAB X IDE is that it is
available as a free download allowing student to use it on their own
computers. This supports an important
pillar of my teaching philosophy; to enable students to work
independently to explore and solve interesting problems. Unfortunately,
many engineering programs are PC only, leaving Linux users with awkward
solutions to work off campus. Fortunately with a little work, Linux users
can install and use the MPLAB X IDE + XC8. What follows are some guidelines
and a short walkthrough to help you through the process.
As a PC user I have not tested these guides! I would, however, be more than
happy to improve the quality. Just send me
an email at coulston@mines.edu with concrete suggestions on how to improve
them. Support your fellow and future Linux users. That said, thanks to
Connor for providing these.
These installation guides for MPLAB and XC8 were used to install the
software on a Debian based system. The only issue is that the installer
doesn't create a launcher, so you will have to make one yourself. Follow
the linked guide below for that. One tricky part is finding the
actual application in their file folders - it is
/microchip/mplabx/v5.25/mplab_platform/bin/mplab_ide
These links are for the guides:
- https://microchipdeveloper.com/mplabx:installation
- https://microchipdeveloper.com/xc8:installation
- http://xmodulo.com/create-desktop-shortcut-launcher-linux.html
A short walkthrough by Nolan Pratt (
nolanpratt@mines.edu) is written below:
Preliminaries
Make sure you have the following:
- A working desktop environment (likely with X.Org support)
- A .tar file archive tool
- Permissions to run files as root
The following instructions were used to install MPLAB X on a
Fedora Linux system using the KDE Plasma Desktop environment
(using MPLAB v6.25).
Download the Linux version of MPLAB X IDE from the following link:
https://www.microchip.com/en-us/tools-resources/develop/mplab-x-ide#tabs
Then you need to extract the archive file, which can be done with the
following command:
$ tar -xvf MPLABX-v*-linux-installer.tar
This uses a wildcard to ignore the version of MPLAB you are using.
Installing MPLAB X IDE
You will then need to run the installer as root (using sudo as necessary):
# ./MPLABX-v*-linux-installer.sh
After you run this command, you should see the installation wizard pop up
graphically. Accept the license agreement and choose the installation
directory. The default installation directory is in "/opt", which is
usually used for
optional software that is not managed by the
system (so this is where we'd want to install MPLAB in most cases).
To get a functional installation for the purposes of EENG 383, you only
need the following applications:
- MPLAB X IDE (Integrated Development Environment)
- 8-bit MCUs (2.7GB)
You can safely uncheck all other options. You might get a warning
about udev rules being changed during installation—this is normal.
Installing XC8 Compiler
When you click finish for the MPLAB installation, make sure the checkbox
to install the XC8 compiler is still checked. You should see another
installation wizard pop up. Accept the license for this one too.
You only need the "Free" version of XC8, and you don't need to check
the box for the dongle license. The default directory for this
installation should be good as well. I would check the box for the
PATH environment variable, as this allows you to invoke the compiler
from the command line without using the full path. Skip the section
about licensing and then hit finish.
Using MPLAB X IDE
I was able to run MPLAB through my default application launcher, as
it correctly added the desktop file to "/usr/share/applications".
You will also need a way to communicate with the microcontroller over
serial. I installed PuTTY from the
fedora package repository.
Other users have had success using
screen.
On my system, the microcontroller binds to "/dev/ttyUSB0" by default, and if this is the case for you, make sure to use that instead of "COM#" for any labs.