Jump to content

Porting energia sketch to CCS

Recommended Posts

I am doing a college project, I am responsible for the operation of some sensors and what not using the msp430. 


using CCS is a pain in the.. behind. so when I found energia, it was a godsend. I got everything work in a matter of hours. 


When I handed off the project to the next team, they were less than happy about my code being in energia. They also have little experience with CCS and couldn't program their way out of a paper bag, however, they insist on doing the project in CCS. I really don't understand what their hang up is, everything works, energia provides all the nessasry libraries to get the project done in a hurry. our code is not part of the project, only the end result.. 


but whatever. 


I have tried re-writing the code function by function by looking at the required header and library files, but this has proven to be very inefficient and I have not yet successfully gotten the code to work using CCS.


Is there an easier way? Does energia generate a real main.c file that I can just load into CCS? I have looked through the temp files but I can't seem to find anything. I read a post about using eclipse to code arduino, and something about a core.a file that needs to be moved, but I can't seem to find the same information for energia. 


any help would be GREATLY appreciated :)

Link to post
Share on other sites



I am not expert on this matter, some people on the forum will have a more complete answer to your question.

Also, I am not in front of my "development" computer and have no access to Energia right now.

However I will give you a few tips to pursue your goal :

- try to access Energia "preferences" or "settings" and enable the verbose compiler output,

- this output will give you the exact compiler/linker commands Energia is actually caling, and the files it generates

- looking at the temporary file names, try to access them with an editor.


I am not sure you will be able to port the generated code straight to CCS since :

- Energia is using MSPGCC and it is somewhat different to CCS C compiler,

- Energia relies on several libraries you may need to port.



Link to post
Share on other sites

It's a bit over a quarter of a century since I was at uni. I did a couple of units on embedded systems, and in those days it was with Z80s & 6502s which we programmed in assembly because Rom & Ram were very limited, typically less than 1k of each. In other units where we were programming for desktop systems, we used various high level languages because the development cycle was quicker.


The point I am trying to make, and that was drummed into us, was that in the real world, development time and debugging ability are more important than being a purist, so as long as the resulting code would run on the target system, the best tool was the one that got the job done the quickest. You can program for Windows in Assembly, but why would you when development in a high level language is much faster, the CPU is fast enough that execution speeds are rarely an issue, and you have Ram to burn.


Now I have been away from embedded system development for a long time, but getting back into it as a hobbyist and I find the 430's are a breath of fresh air. The 2553 with 16k of flash & 512b of Ram, 16 bit operation at 16MHz, in a single chip solution that can be bought for loose change is horsepower we wouldn't have even dreamed possible back then. It means that high level programming is possible for all but the most demanding of tasks. So getting back to the philosophy we were taught way back when, if the best tool for development is the one that gets the job done quickest so long as the code runs on the target hardware, then I would have to say in many cases Energia will be the best tool for most 430 projects.


Yes it has code bloat, so if you are targeting one of the more basic processors with an advanced project, you may be best to use CCS or Assembly. Your control of timing and low power aren't as fine as in CCS or Assembly, so that may rule out Energia. But if you have written code that works, and compiles small enough to fit onto the processor I see no reason to change.


I know I haven't answered your question about how to port code from Energia to CCS, but if I were in your shoes I would be strongly questioning their reasons for changing to CCS.

Link to post
Share on other sites

Amen Graham,<br />Even more, most MCU now are somewhat "optimized" for C and compilers do a very good job. Of course you can still get a little improvement with assembler if you are good at it, but at what cost. By the way, modern assemblers relies on a lot of macros and pre-processor directives that make them somewhere in the middle between low-level and hi-level.<br />I think one reason for discarding Energia in front of CCS is that Energia is not an "industry standard" as may be CCS. Professional developer could prefer CCS because it has a better "project management".<br />Two arguments to this :<br />- Energia is free and open-source so to no entry cost for a company,<br />- Energia relies on GCC that is an industry standard,<br />- You can use embedXcode and XCode if you'd like a better Project manager and Editor. XCode is an industry standard for those who want to develop on iPad and iPhones terminals...<br /><br />Yan.

Link to post
Share on other sites
  • 6 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...