Get the FilesBefore we do anything we'll need the files from Microchip. Go to http://ww1.microchip.com/downloads/mplab/X_Beta/index.html and accept the license agreement and you'll be taken to the download page.
- Select the platform of Linux
- Select the items you want to download and install. I chose:
- MPLAB IDE X
- MPLAB C18 Lite Compiler for PIC18 MCUs
- HI-TECH C Lite Compiler for PIC18 MCUs
- HI-TECH C Lite Compiler for PIC10/12/18 MCUs
Install JavaMPLAB X requires Java to be installed in order to run. To install Java in my Ubuntu environment I ran the following commands from a terminal window. You can find the full instructions at http://www.multimediaboom.com/how-to-install-java-in-ubuntu-11-04-natty-narwhal-ppa/
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
With java installed we can begin installing pieces of MPLAB. I decided to install the compilers first but don't know if that's required.
Open a terminal window and browse to the folder where you downloaded the MPLAB files. Before you can run any of the installers you will need to verify that they have execute permissions. Execute the following commands in the terminal window:
chmod 755 mplabc18.bin
chmod 755 mplabx-ide-beta60-linux-32-bit-installer.bin
chmod 755 picc-18-pro-linux.run
chmod 755 picc-pro-linux.run
Install the Compilers
C18Enter the following command:
An installer will launch. Follow the prompts through. Nothing special here.
HI-TECH for PIC18sudo ./picc-18-pro-linux.run
This is a more traditional linux install script and will have you read the license agreement in the terminal window. Hit enter to scroll down through that and accept it at the end.
After the license agreement it will ask you where you want to install the compiler and suggests a path of /usr/hitech/picc-18/pro/9.63PL3. I didn't feel like I needed the pro layer in there so I just used /usr/hitech/picc-18/9.63PL3. It will then prompt you to enter the serial number, "demo", or "lite". Type "lite" and hit Enter. The install will finish.
HI-TECH for other PICssudo ./picc-pro-linux.run
This install is practically identical to the one for PIC18 devices. The only thing different is the install path. I used /usr/hitech/picc/9.80a. You're free to use whatever you want. Now that the compilers are installed we're ready to install MPLABX.
Installing MPLABXFrom the terminal window run:
An installer will launch. I accepted all of the defaults and let it install. When it's done you will get a message saying you will need to reboot your system for the changes to take affect. In reading the Microchip forums this was suggested because certain USB programmers may not work until you do so. However, I was able to do:
sudo restart udev
and have MPLABX correctly recognize my Pickit 3. You may or may not need a reboot.
With MPLABX installed we need to make it aware of the HI-TECH compilers. For some reason it recognizes C18 right out of the box but not the HI-TECH ones.
- Launch MPLABX
- Go to Tools->Options
- On the Build Tools tab click Add under the Toolchain box.
- Browse to the path of the compilers and MPLABX should detect them. I was not able to get it to recognize the PICC-18 compiler. If anyone has any luck with that let me know.
If you don't have git installed I suggest you do that now. I won't cover the instructions for that here because there is no lack of documentation for it online. Just google "install git on Ubuntu."
Compile EmbeddedFunThe EmbeddedFun project uses the C18 compiler so we can use it to test whether everything is set up properly. Pull that project down from github into a directory of your choosing.
git clone firstname.lastname@example.org:<username>/EmbeddedFun.git
I've already updated the project to follow the new MPLABX layout of files. There are no longer .mcp files with MPLABX and builds are done with makefiles.
- Launch MPLABX.
- Go to File->Open Project
- Browse to the firmware folder of the EmbeddedFun project and select the make object and click Open Project
- Test your installation by performing a "Clean and Build" action.
Compile FMBombThe EmbeddedFun project uses the C18 compiler so we've tested the installation of that but we haven't tested the installation of the HI-TECH compiler. Well, we're in luck because that's what the FMBomb project uses so let's pull that project down.
git clone email@example.com:<username>/FMBomb.git
Open the FMBomb project in MPLABX.
One thing I had to change in the Project Properties to make the HITECH compiler work was to remove the PRO option. To do so select your project in MPLABX and go to File->Project Properties. Expand the Conf: [default] section and the HI-TECH PICC section and select Compiler. Select Operation from the dropdown and change the Operation Mode to "Lite".
Now try to build the project. Everything should be working and you should be all set to create your own projects.