Jump to content
Rei Vilo

Energia framework on Eclipse?

Recommended Posts

Energia brings the ease of use of Arduino to the MSP430 and the Stellaris / Tiva.

 

Actually, under one single name, Energia packs different elements:

  • a bundle with IDE, libraries and tools-chains (MSP430 and LM4F) for an easy installation
  • a more than basic IDE based on Processing
  • a framework based on Wiring initially and modified by Arduino

I'm presently using the Energia libraries, framework and MSP430 and LM4F tools-chains with Xcode, thank to the embedXcode template I've developed.

 

However, the main critical missing feature is debugging.

 

How to use the Energia framework on Eclipse to enjoy the debugging facilities?

 

Thank you for your help.

 

Share this post


Link to post
Share on other sites

I might regret saying this one day :-): But I think it should be quite straight forward. We just need a user friendly way if pointing both the Eclipse IDE itself and the compiler towards the header / libraries included by Energia.

I'll look into this when I get some time on my hands. 

 

/Paul

Share this post


Link to post
Share on other sites

this might be a problem because energia isn't using the same compiler as CCS but maybe it can be done if the core is compatible (CCS must compile the sources in \hardware\msp430\cores\msp430 successfully)

Share this post


Link to post
Share on other sites

That's not quite what Rei has in mind, he wants to be able to add the arduino core to a CCS project to be able to use the IDE (debugger and all)

The makefile probably uses the energia compiler/linker, but it may be a start to see if the Ti toolchain is compatible.

Share this post


Link to post
Share on other sites

You don't have to use CCS or TI's compiler to use Eclipse, you can just get the original version of Eclipse and import an existing external makefile project. Eclipse will use all the settings in the makefile and still allow you to use other eclipse facilities including debug.

 

post-190-0-24250500-1371336645_thumb.png

Note: the picture shows Eclipse Juno IDE using debugging to

run the Energia ASCIITable.ino example. It is using the

external makefile from github I mentioned in my previous post.

Share this post


Link to post
Share on other sites

Thanks for your answers.

 

As @@semicolo rightly pointed out, I'd like to use the Energia framework and the hardware debugger built in the LaunchPads.

 

I've been using the external tools-chain with makefiles for a long time with my embedXcode project based on Xcode.

 

I'll try @@xpg and @@Rickta59 recommendations and keep you posted.

Share this post


Link to post
Share on other sites

I've started installing the tools and everything on Eclipse and Win8 and here's the initial guide for beginners like me:

- install Eclipse Juno CDT or you can add the CDT/gcc/C++ stuff into your existing Java Eclipse (like I did)

- install MingW and add it to the environment path (c:\MinGW\bin\). Required for make

- [optional] create a new workspace (I used the existing one) and copy your old energia sketch folder into the workspace

- find the energia.mk in a post above, copy it to your project folder, rename it to Makefile

- run the eclipse wizard to create a new project from makefile and specify the project/sketch folder

 

The "Problems" tab should show that gcc and g++ are not found.

 

- rightclick on project properties, C/C++ build, Discovery options and rename gcc with msp430-gcc and g++ with msp430-g++

- on the environment tab append the ..energia\hardware\tools\msp430\bin\ folder to PATH; this is msp430, adjust for stellaris

 

The "Problems" tab should not show zero errors now.

 

Right click, project properties, C/C++ build, Environment: add the ENERGIADIR variable !VERY IMPORTANT! replace c:\ with /c/ and backslashes with slashes. It should point to your energia installation folder.

 

Open the Make targets view and add "all", "boards" and "clean" targets while leaving everything in place.

Double-click on "boards" and you should have the output in the console.

 

make boards 
Available values for BOARD:
lpmsp430g2231  LaunchPad w/ msp430g2231 (1MHz)
lpmsp430g2231f LaunchPad w/ msp430g2231 (16MHz)
lpmsp430g2452  LaunchPad w/ msp430g2452 (16MHz)
lpmsp430g2553  LaunchPad w/ msp430g2553 (16MHz)
lpmsp430fr5739 FraunchPad w/ msp430fr5739

Add the ENERGIABOARD env variable (e.g. lpmsp430g2231f) to the project.

 

Do a clean build and then "all" and the project should compile to an .elf file.

It's late and I don't have any more time today but the objcopy command is missing, it should compile to a .hex file.

 

I haven't tried debugging and uploading, maybe someone can continue the 'tutorial'.

 

Share this post


Link to post
Share on other sites

You don't have to use CCS or TI's compiler to use Eclipse, you can just get the original version of Eclipse and import an existing external makefile project. Eclipse will use all the settings in the makefile and still allow you to use other eclipse facilities including debug.

 

attachicon.gifeclipse.png

Note: the picture shows Eclipse Juno IDE using debugging to

run the Energia ASCIITable.ino example. It is using the

external makefile from github I mentioned in my previous post.

 

Just a question, were you able to debug using the Launchpad as is or by a 3rd party tool (FET, ezMSP, ...)?

Share this post


Link to post
Share on other sites

I was just using the launchpad as is.  I use mspdebug rf2500 as the gdb server.  On windows you will probably have better luck using mspdebug tilib .. or whatever it is called to use the ti msp430 dll.

 

-rick

Share this post


Link to post
Share on other sites
I added the "hex" target to the included Makefile and also some small modifications. The "all" target also compiles the hex file. Added my name and a new version number there to avoid confusion with the original attachment.

 

Window/Preferences search for "File Types" and add .ino as C++ source file.

 

I added another environment variable called ENERGIADOSDIR=c:\Programs\energia-0101E0009. This is because Eclipse cannot recognize MinGW paths, AFAIK.

Go to project properties, C/C++ General, Paths and symbols and add the following items:



${ENERGIADOSDIR}\hardware\msp430\variants\launchpad
${ENERGIADOSDIR}\hardware\msp430\cores\msp430\Arduino.h
${ENERGIADOSDIR}\hardware\msp430\cores\msp430\


Make sure your '.ino' files have the following include: #include <Energia.h>

After these steps your autocomplete should work in Eclipse.

 

I appended ....\energia-0101E0009\hardware\tools\msp430\mspdebug to the existing PATH variable, perhaps there is some way to do this better. This is needed in order for the "upload" target to work.

The Makefile now treats Windows and *unix machines differently because at least on my machine the mspdebug is not listing any USB devices in its default configuration. Anyway it is recommended to use the 'tilib' option.

 

Next stop would be debugging, if I'm able to figure it out. Sorry if I did some stupid things, I have zero programming experience with C++ and makefiles.

 

Edit: I don't know why the stupid uploader won't let me upload almost any file extension. Security through obscurity.

Makefile.txt

Share this post


Link to post
Share on other sites

For debugging, you need to start mspdebug in gdb mode. On windows you can do this:

mspdebug.exe tilib -j -d USB "gdb"

The parameters for a debugging session:

GDB Hardware debugging

Standard GDB Hardware Debugging Launcher (not DSF)

Command set: standard (windows), Protocol: mi

 

That should be just about everything required. I don't know how to sync the source files with the binary, I get messages like "No source available for "analogRead() "" but I can see the stack just fine. Breakpoints also seem to work.

 

Perhaps I'll try the same things using xpg's Eclipse plugin, it should take some tedium off the steps. I just haven't manage to get it working with Energia.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×