Jump to content

general guide on porting arduino libraries to energia

Recommended Posts



There used to be a document on this forum, or stellaristi forum, like general guidelines for porting from arduino to energia. It had explained all the caveats and includes you have to do and change, and was a nice document.


Unfortunately, i can not find it anymore. and it seems that stellaristi has been shut down.


Anyone remembers where I can find this document? I googled for a while, but failed.


Any ideas/help/recomendations greatly appreciated,





Link to post
Share on other sites

There is this one:  http://forum.43oh.com/topic/7511-howto-porting-libraries-some-help-needed/


But I also seem to remember another one and can't find it.


this one is good, but I think the other one is unfortunately lost, I wonder if we can fetch it from archive.org or google's cache. If we had the original url that would not be a problem.

Link to post
Share on other sites

@@Fmilburn @@bluehash hello, on the other forum that was closed there was a document, that collected those individual posts into a generalized howto. apparently it is lost, or my memory is failing me. But @@Rei Vilo remembers such document too.


anyway, what is lost, we can reconstruct. 



Was it on stellarisiti? Because those forum posts are on this forum now.

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

Hi @@theja2289

is it possible to build an automatic converter based on the first link contribution?

That would be nice wouldn't it? :)


I'm not the most qualified to answer, but here goes anyway. The short answer is that it isn't practical for a number of reasons but ultimately because the underlying hardware is different and Energia / Arduino / Wiring have diverged somewhat over time. When the authors of code and libraries stick to the common "language" and libraries then things pretty much work. But, there are a number of reasons they might not, and plenty of deviations. For example:

  • The pin functions vary
  • The software may access hardware features present in one microcontroller but not another
  • The software may directly accesses hardware, say to speed things up or reduce memory requirements (maybe even through assembly language)
  • The C++ compiler upon which Energia/Arduino are based differ somewhat
  • There are core features/libraries added to Arduino but not Energia (and vice versa). This even holds for different boards within Energia / Arduino.
  • The language evolves with time
  • Etc.

It is possible to write libraries and sketches that work with different underlying architecture but it requires more effort - basically the author needs to be familiar with and deal with the issues listed above. This isn't always possible.


Anyway, the further things get from the high level abstractions in Energia / Arduino, the harder it gets to directly port (and the harder it would be to write a universal translator). Sometimes it is easier just to start from scratch and write new code - hard to expect a compiler translator to do that


EDIT: This link has useful information also.

Link to post
Share on other sites

is it possible to build an automatic converter based on the first link contribution?


Many of the simpler changes mentioned in the howto thread can be handled automatically using macros, etc.

More recent versions of Energia include some macros which handle some of the changes mentioned in the thread.


Having standard, cross-platform libraries for some common functions (which are not currently abstracted) would help.  

(i.e. create a common abstraction layer for functions which are currently handled on a device specific basis).

For instance: a standard timer class.  I worked some on a cross-platform timer object which would work on MSP430, AVR, SAM, Tiva.

(Based on DueTimer, TimerOne, etc.)

But this would only help if it became widespread enough that the program writer happened to have used it.

(Though I suppose it might help if there was a simple enough way of translating timer access idioms on a particular machine

into uses of the standard library that it could be done automatically.)


Given that there are now Arduino environments used for many different processors (x86, STM32, etc.) it would probably help to have a more general guide to porting code/writing Arduino code that is easy to adapt to many different processors/families.

(Of course most writers of Arduino programs, being inexperienced, would probably not use it.  But it might help for those writing libraries.)

Link to post
Share on other sites

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...