Saturday, April 28, 2012

Installing MPLAB X IDE on Linux




MPLABX Integrated Development Environment (IDE) is a free, integrated toolset for the development of embedded applications on Microchip's PIC and dsPIC microcontrollers.

MPLAB X is not a new version of the current MPLAB IDE v8 framework but is instead based on Oracle's open-source NetBeans platform. In addition to its predecessor's functionalities and compatibility with Microchip's existing development tools, the new IDE utilises many NetBeans features allowing for user-interface improvements and performance upgrades[1]

Presumption

System: Fedora Core 16 - x64

Downloading


download IDE and your favorite compiler
http://ww1.microchip.com/downloads/mplab/X/index.html

OR using wget
wget http://ww1.microchip.com/downloads/mplab/X/mplabx-ide-v1.10-linux-installer.run # mplab X IDE
wget http://ww1.microchip.com/downloads/mplab/X/mplabc18-v3.40-linux-full-installer.run # C18 Compiler

Since IDE written in Java we need java run time if you already them installed go to next step if you dont, following the link below

http://www.java.com/en/download/help/linux_install.xml

Installing

$ chmod 755 mplabx-ide-v1.10-linux-installer.run
$ chmod 755 mplabc18-v3.40-linux-full-installer.run

$ ./mplabx-ide-v1.10-linux-installer.run
$ ./mplabc18-v3.40-linux-full-installer.run

$ reboot

Configuring

now we should configure the IDE before we start compiling codes

Run mplabx

$ mplab_ide

from "run" menu --> Set Project Configuration --> customize...

In left-most click on mcc18 then in right-most scroll down and double-click on "Include directories", a new dialog will be opened,double-click on it and change the default path for header file directories to "/opt/microchip/mplabc18/v3.40/h".

Compiler Configuration

Click ok.

In left-most click on MPLINK then in right-most scroll down and double-click on 'Library directories',a new dialog will be opened, double-click on it and change the default path for header file directories to "/opt/microchip/mplabc18/v3.40/lib/".

Linker Configuration


Click ok.

Apply then ok.

Case-Sensitive Problem


i have notice a small problem when i tried to compile an old project. the error was "Error - could not find file 'LibName.lib'.

this problem happen because lib names are written as high-letter on hard disk whereas MPLINK looking for low-letter names. eg ( on disk p18F4550.lib and MPLINK looking for p18f4550.lib).

to solve this problem we will make all of them low-letter


$ su -  # be root
# cd /opt/microchip/mplabc18/v3.40/lib
# for f in `find`; do mv -v $f `echo $f | tr '[A-Z]' '[a-z]'`; done


Known Bug in Oracle Java JDK 1.6.x



Bug Description

incorrect mouse pointer position on java menus when running the application
maximized under gnome-shell.

1. If I single-click a menu in the menu bar, the menu will flash
briefly and disappears (instead of staying opened).
2. If I click and hold on a menu in the menu bar, the menu stays
opened, but the selection is vertically displaced (I have to move the
mouse to the third menu item to select the first one, for example).
3. If I right-click to access a context-menu, the selection is
displaced as described in the previous case).


The problem is that when the window is maximized java was not updating the
 window position properly. If the window was at pixel (100,100) then it was
 maximized, AWT thinks that it is still at pixel (100,100) instead of close to
(0,0). This causes it to miscalculate mouse pointer positions relative to the
window. [2]

Solution for this bug

remove old packages
# yum remove java-1.6.0-openjdk-1.6.0.0-65.1.11.1.fc16.x86_64 java-1.6.0-openjdk-devel-1.6.0.0-65.1.11.1.fc16.x86_64

*this could be vary from system to another, to know yours
$ rpm -qa|grep java

install new packages
# yum install java-1.7.0-openjdk
# yum install java-1.7.0-openjdk-devel

Set default Java version to mplabx_ide
# cp  /opt/microchip/mplabx/mplab_ide/etc/mplab_ide.conf  /opt/microchip/mplabx/mplab_ide/etc/mplab_ide.conf.bk
# gedit /opt/microchip/mplabx/mplab_ide/etc/mplab_ide.conf

search for jdkhome="/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.3.x86_64/" and replace it with jdkhome="/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.3.x86_64/"

*this could be vary from system to another, to know yours
$ ls /usr/lib/jvm/

References

[1] http://en.wikipedia.org/wiki/MPLAB
[2] https://bugzilla.redhat.com/show_bug.cgi?id=698295

1 comment: