Using Eclipse for PIC development
November 2, 2008
I’m a fan of the Eclipse environment and I try to use it as much as possible for as many programming languages as possible. There’s the default JAVA environment, but you can also download the CDT plug-in to handle your C / C++ needs, PDT for writing PHP, Aptana for Javascript and so on.. But I hadn’t used it before to write code for my PIC microcontroller. I liked the idea though, because the MPLAB environment of Eclipse (in which you normally write the code) is a bit old-fashioned..
This site contains a short step-by-step plan that explains how to use Eclipse to program PIC processors (18F series). The CDT plugin has changed a bit since the article was written so some of the terms on the site are not used anymore. These are the steps I followed to open and compile an existing project (created in MPLAB) in Eclipse.
- Go to the download section of http://www.mingw.org and download the GNU make utility. Extract it to a suitable location and add its bin folder to your environment’s PATH variable.
- Go to http://www.eclipse.org/downloads and download Eclipse IDE for C/C++ Developers. This is the newest Eclipse version including the CDT plugin. This plugin is necessary for programming in C (instead of Java).
- Start Eclipse, close the welcoming screen. Go to the menu File>New>C Project. Select Makefile project and select Other Toolchain. Give your baby a name, you should see something like the image below. Click Next and then Finish.
- Right click on your project in the Project Explorer and select Import. Now import (via the option Filesystem) all the .c and .h files and the linker file (.lkr).
- Now we’ll create a makefile. The previously mentioned site provides a handy example of a makefile. Do not forget to set the type of your PIC. You can drop the “FRC_library.lib” and the DEFINEs. Also change the name of the project to the name of your Eclipse project. If your MCC18 folder is not installed under program files then you should adjust this too.
- Also import this makefile in Eclipse, then you can edit it from there. At the bottom of this post you can download the makefile of my project for your reference.
- Go back to the project properties and go to C/C++ build. In the “build command” field specify mingw32-make, as this is the name of the executable in the bin folder of the GNU make utility we downloaded in step1. Go to the Discovery Options tab. At the bottom right you see Compiler Invocation Command. Browse to mcc18.exe in the bin folder of your MCC18 folder. Also go to C/C++ General and in the tab Library Paths add a reference to MCC18\lib. In the tab Includes you should add the folder MCC18/h under GNU C, so you can jump from within Eclipse to the library header files.
- If all went well you can build the project with CTRL+B so a hex file is created. Via Run -> External Tools you can run tools from within Eclipse which comes in handy to call the program to program your PIC.
One of the advantages of Eclipse over MPLAB is that you can click a function call in your code and by pressing F3 you can jump to the declaration of the function.
[ makefile of my project ] 2kB
Entry Filed under: Uncategorized. Tags: CDT, eclipse, embedded, PIC, PIC18F, PIC18F4455, programming.
3 Comments Add your own
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed


1. Using Eclipse for PIC development | PHP-Blog.com | November 2, 2008 at 1:40 pm
[...] more here: Using Eclipse for PIC development Related ArticlesBookmarksTags PHP Development Tools – Keeping it Simple and Mostly Fre If [...]
2. PIC servocontroller (in C) « Kr3l’s Turf | May 2, 2009 at 4:38 pm
[...] can download the complete code here. This is an Eclipse project (see my other article on how to use Eclipse for PIC development), but you can import the .c and .h files into MPlab if [...]
3. Distance scanner using servomotor and distance sensor « Kr3l’s Turf | May 9, 2009 at 6:10 pm
[...] can download the complete code here. This is an Eclipse project (see my other article on how to use Eclipse for PIC development), but you can import the .c and .h files into MPlab if [...]