Using Eclipse for PIC development

November 2, 2008 at 1:23 pm 7 comments

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. 

  1. Go to the download section of and download the GNU make utility.  Extract it to a suitable location and add its bin folder to your environment’s PATH variable.
  2. Go to 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). 
  3. 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.

    New PIC Project using Eclipse

    New PIC Project using Eclipse

  4. 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).
  5. 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. 
  6. 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. 
  7. 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. 
  8. 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.  


Developping for PIC uC in Eclipse

Developping for PIC uC in Eclipse

Entry filed under: Uncategorized. Tags: , , , , , , .

Repair boot.ini with a network boot PIC18F4455 USB Bootloader

7 Comments Add your own

  • 1. Using Eclipse for PIC development |  |  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 […]

  • […] 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 […]

  • 4. Lio  |  August 21, 2011 at 11:57 pm

    I am sorry for the stupid question in advance…:)

    Can I use commands such as “wildcard” & “patsubst” in Windows eclipse Makefile?
    It can’t seem to manage to find the *.c / *.o files as per your examples, because of the following makefile line:

    #make a list of object files that match all C files
    OBJFILES := $(patsubst %.c,%.o,$(wildcard *.c))

    Are you sure there is nothing more to modify?

    Please, I would be very grateful if someone is willing to help…


  • 5. Lio  |  September 24, 2011 at 1:05 pm


    What is the meaning of

    $< -fo=$@

    in the makefile?


  • […] ja, inspiriert hat mich vor allem die Seite von Krl3 und HJFs […]

  • 7. Rakshana.C  |  January 20, 2021 at 7:46 am

    Hey, how to import .c and .h files? I am stuck in that step itself.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Articles to be written…

Twitter – kr3l


RSS Google Reader Shared Stuff

  • An error has occurred; the feed is probably down. Try again later.

RSS Listening to..

  • An error has occurred; the feed is probably down. Try again later.

%d bloggers like this: