Jump to content
43oh

Help understanding the Energia build process?


Recommended Posts

Hello all,

 

A year or two ago I attempted to setup Code::Blocks with the arm-none-eabi toolchain so that I could compile and run my Energia projects without dealing with the idiosyncrasies of the Processing-based IDE. I did not much understand command-line tools or GCC and so my efforts were somewhat frustrated. I have picked it up again, and almost have it working. I have analyzed the verbose output from Energia to determine which compiler/linker flags are used, and set up Code::Blocks to do the exact same things as Energia during compilation (excepting one thing, which I will get to later).

 

My projects compile, and I am able to upload them to the device, but for some reason the behaviour is not quite the same. (Specifically, a function I wrote for projecting 3D triangles to a plane does not return the correct value. I initially suspected a problem with the FPU configuration, but I debunked that by trying some other math which compiled and ran correctly.) Also, the .bin file generated by Energia is a slightly different size than the one generated by Code::Blocks.

 

The only difference in the build processes between the two that I can see is that Energia uses arm-none-eabi-ar to roll an archive from the compiled "cores" code which the compiled application is then statically linked against, whereas my Code::Blocks setup compiles and then links everything together in one step. I do not think this is a significant difference, but I can try doing that if all else fails.

 

The build output from Energia and Code::Blocks is attached below, as well as the generated .bin files for each. The code which was compiled to produce the .bin files is identical.

 

If anyone can figure this one out, or help me understand better how Energia goes from code to executable, it would be much appreciated!

 

P.S.: I had to change the file extensions of the .bin's to .txt so that I could upload them.

CodeBlocksOutput.txt

EnergiaOutput.txt

CodeBlocksbin.txt

Energiabin.txt

Link to post
Share on other sites

 

P.S.: I had to change the file extensions of the .bin's to .txt so that I could upload them.

 

Another approach to that problem is to put your binaries in an archive (e.g. .zip).  Then you don't have to worry about any characters that may get messed up or misinterpreted as part of a text file (e.g. newline conversions, etc.).

 

I trust they are both using identical copies of the toolchain? (same path, include, etc.)

 

Have you tried fixing the source code to get rid of the warnings?  It would make it easier to compare the compiler output files.

Also, although I don't know the significance of the particular warnings you are getting, I would be suspicious that something that generates a warning might be more likely to cause trouble (be open to multiple interpretations, etc.).

Link to post
Share on other sites

Another approach to that problem is to put your binaries in an archive (e.g. .zip).  Then you don't have to worry about any characters that may get messed up or misinterpreted as part of a text file (e.g. newline conversions, etc.).

 

I trust they are both using identical copies of the toolchain? (same path, include, etc.)

 

Have you tried fixing the source code to get rid of the warnings?  It would make it easier to compare the compiler output files.

Also, although I don't know the significance of the particular warnings you are getting, I would be suspicious that something that generates a warning might be more likely to cause trouble (be open to multiple interpretations, etc.).

 

They are both using the same toolchain. I actually have Code::Blocks pointing to the /bin directory under Energia/hardware/tools/lm4f. As for include directories, I originally had added Energia/hardware/tools/lm4f/arm-none-eabi/include and Energia/hardware/tools/lm4f/arm-none-eabi/include/c++/4.7.1 to the build search paths in Code::Blocks, but I removed them later; that didn't seem to change anything...

 

I tried fixing the warnings about initializer lists by populating the arrays manually, but that didn't fix it; I also tried compiling with the C++11 option, but that didn't fix it either. (I was a little wary of the second option, because that would differ from the arguments to the toolchain from Energia.)

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.

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