chipKIT® Development Platform

Inspired by Arduino™

Using Eclipse IDE... !

Created Sun, 12 Jun 2011 13:07:07 +0000 by flios


flios

Sun, 12 Jun 2011 13:07:07 +0000

Hi everyone,

I know, this section concerns the modded version of the Arduino IDE, but I think this could be also the right place for this subject.

I used to work with my little Arduino Uno, which I programmed in C++ with Eclipse (there are a lot of threads explaining how to configure Eclipse for this, even at arduino's...

I've just bought a new ChipKIT Max32, and I'd like go on with Eclipse... I've been trying, but without success. This is where I am :

  • all the compilation stuff is OK (headers, avr-g++ configuration etc. ...)
  • when linking, I receive a "skipping incompatible" error message, which seems to be a problem between the satatic library (that I picked from the modded arduino IDE) and the target definition given to the linker. I can beleive it, because this target definition is still here "atmega328p".

My question is : how can I change the target definition in Eclipse ?

There is il my project [settings]/[AVR]/[Target hardware] a list that seems to be what I'm looking for, but even if my avrdude.conf is up to date (it contains the 32MXxxx definitions), I can't find my PIC32 in the list.

Sorry if I'm quite vague, but it's hard to explain the problem in its globality !

But something is sure : if I can configure Eclipse to work with the ChipKit, many people will be interrested...

Thx for your help !


Jacob Christ

Mon, 13 Jun 2011 03:03:13 +0000

I've been using QT Creator as an editor and keep mpide open with the project to compile. Only down side is that is seems to complies the project from the code in memory but the libraries it seems to pick up from the hard drive.

I'm semi interested is seeing it work in Eclipse. Eclipse is better that mpide (which just blows, IMHO, as far as an editor goes). I'd rather see it made to work with QT Creator, but I haven't the time to figure this magic out now.

Jacob

My two axioms of embedded development First Axiom: If the tools work, then your job is easy. Second Axiom: The tools never work.


caroper

Sat, 23 Jul 2011 23:36:22 +0000

@Jacob

I don't use QT but I do use notepad++ as an Editor and the IDE to build. Just select File> Preferences > Use External Editor. It will then reread the source along with the Libs. Just be sure your editor saves before you build.


ron.dunn

Sat, 23 Jul 2011 23:45:30 +0000

I don't use Eclipse, but perhaps telling you how I use Code::Blocks will help you through the problem.

Firstly, I compile the libraries into one object file. Here's the batch file I use for Arduino, I've got a similar one for Pic32.

set AVR_BIN=C:\chipkit\hardware\tools\avr\bin
set AVR_INC=C:\chipkit\hardware\arduino\cores\arduino\

%AVR_BIN%\avr-gcc -c -g -Os -w -ffunction-sections -fdata-sections -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=22 -I%AVR_INC% *.c
%AVR_BIN%\avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=22 -I%AVR_INC% *.cpp
%AVR_BIN%\avr-ar rcs arduino.a *.o

That creates a single library file named "arduino.a", which I add to the library section of my compiler settings.

I then create compiler and linker settings for the AVR and PIC32 tool chains. This is done through Code::Blocks dialogs. I can't figure out how to attach screenshots to this message, but I'll email them to anyone who asks.

I then have the ability to switch between AVR and PIC32 targets, compiling, optimising and linking as I wish :)


BillT

Mon, 22 Aug 2011 09:32:48 +0000

@filos

I would also like to use Eclipse as a development environment to compile build and upload code to my new ChipKIT Uno32. I have successfully done this kind of thing in the past with an Arduino Duemilanove using the WinAvr toolset with Eclipse.

I wonder if you (or anyone else) post (or send me) a sample Eclipse project to get me started please? (A write-up / walkthrough or some other input would be greatefully appreciated.)

Regards Bill


vejobrolis

Tue, 30 Aug 2011 21:45:09 +0000

While it will not provide the same quality of experience as using Eclipse CDT with AVR Eclipse Plugin, you can use just the Eclipse CDT and Makefile Project to develop for the chipkit. Obviously, you will have to do your compilation through the makefiles. And you will have to write those makefiles yourself.

I have attached an archive which contains the folder layout and the makefiles for the project I develop. These will work under Linux only. I use C++ and code goes into the folder /src. The compilation is done by using the tools provided with mpide, so you will need to download and install one. The paths to the tools are specified in /build/paths.mk .

Also, the build is currently designed for chipkit-max. If you are using chipkit-uno, you will have to acquire your own core library (/lib/libCoreChipkitMax.a). This is done by launching mpide, setting it up for the board you have and compiling some example project. Then go to the system temporary files folder, find the sub-folder that contains temporary files of compilation and you will find core library in a file core.a . Also you will have to specify a suitable linker script in toolchain.mk, variable ldScript together with a suitable processor and board type in variables gccOpts, ldOpts and avrDudeOpts.

Oh, and make can only work with source files that have no spaces in the path.


BillT

Mon, 05 Sep 2011 15:00:20 +0000

@vejobrolis

Thanks mate, been away from this site for a week or so and I missed your post but I'll get back into it now. I just needed a few hints and the samples you provided should be more than enough to get me going. I am using a Eclipse CDT in a Windows VM and from browsing your examples I can see how to get my stuff working.

Regards Bill :D


Give a man a fire and he's warm for the day. But set him on fire and he's warm for the rest of his life.