What happen at compile time

Post Reply
FredCailloux
Posts: 69
Joined: Sat Mar 28, 2015 4:45 am
Location: Quebec - Canada

What happen at compile time

Post by FredCailloux » Sun Mar 13, 2016 1:07 pm

Hello Majenko, Some time ago you provided this answer (part of it anyway) to a question related to compiling headers.
Compilation is made up of a number of compilation units where each is completely separate. At the end of compilation they are linked together to form the resultant hex file. Simply put, you get (amongst other things):
Sketch INO + Header = Sketch.o
Library CPP + Header = Library.o
Sketch.o + Library.o = HEX file
For sake of better understanding of what happen at compile time please explain more accurately how UECIDE process a sketch at compile time. ei: what about specific board parameters ?
What if I was to use a plain text editor to build my code. And then, compile it manually with command prompts. What exe file would have to be called ? And since a board like to chipKit proMX7 as some specific parameters, I assume that some header files and or perhaps some cpp files are added silently in the background to make the board "Arduino like" or some other files perhaps.
How exactly this is done ? What would I have to had to my plain text file in order to have it properly compile to render my code functional to a board such as proMX7? In other words, what exactly is happening in the background ?
Thank for your help...
Prashant Tripathi :idea: Knowing is to the Self what knowledge is to the ego

User avatar
majenko
Site Admin
Posts: 2165
Joined: Wed Nov 09, 2011 7:51 pm
Location: UK
Contact:

Re: What happen at compile time

Post by majenko » Sun Mar 13, 2016 1:23 pm

The simplest wau to explain is to tell you to turn in verbose command execution in UECIDE's preferences. And compile something by shift-clicking on the compile button. You will then see all the commands that get run to compile a sketch.

As you can see it's not a trivial task, especially all the files that make up the core. It is those files that make it Arduino-like.

Sent from my SM-T555 using Tapatalk
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".

Post Reply