chipKIT® Development Platform

Inspired by Arduino™

What happen at compile time

Created Sun, 13 Mar 2016 12:07:05 +0000 by FredCailloux


FredCailloux

Sun, 13 Mar 2016 12:07:05 +0000

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


majenko

Sun, 13 Mar 2016 12:23:48 +0000

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