Need to understand how the Arduino IDE works.

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
thedocgeek
 
Posts: 7
Joined: Fri Jun 19, 2015 7:19 pm

Need to understand how the Arduino IDE works.

Post by thedocgeek »

I know how to use the IDE and in fact I have used the Arduino IDE and others like it to write a program that compiled to 32KB. My problem is that C++ books all just refer to Libraries of classes and how to use them in your programs. C++ for inbedded systems requires libraries written for the hardware you want to use by the people who designed it. I want to understand how the IDE is writing the code for the chip that I have selected vs the code it would write for an UNO so I know if my 32 bit chip is being used correctly. I also need an easy way to trace a program command thru all the layers of .h and .cpp files to see how it is optimized for speed or code size. In general, I want to see what the IDE is doing and the code that the preprocessor produces. The Arduino site says to see the gcc site which is a mess and is no real help at all.

User avatar
adafruit_support_bill
 
Posts: 88136
Joined: Sat Feb 07, 2009 10:11 am

Re: Need to understand how the Arduino IDE works.

Post by adafruit_support_bill »

The IDE invokes the GCC compiler to generate the code. If you really want to get down the the code-generation/code-optimization level, the GCC site is the place to go.

User avatar
dhalbert
 
Posts: 401
Joined: Tue Feb 17, 2015 6:18 pm

Re: Need to understand how the Arduino IDE works.

Post by dhalbert »

If you go to File -> Preferences... in the Arduino IDE and turn on verbose output for compilation, you can see all the steps the IDE goes through to build your program, including the files it compiles.

Here's some documentation about how a program gets built: https://www.arduino.cc/en/Hacking/BuildProcess .

If you want to see the assembly output (I'm not sure that's what you want), you can find the gcc lines and invoke them again by hand with the "-S" flag which will output readable assembly code. See the gcc documentation for the details.

There is some discussion in https://forum.arduino.cc/ about the details of compilation. That would also be a good place to ask more detailed questions about the build process.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”