Pages: [1]   Go Down
Author Topic: Open Hardware Platform Blog  (Read 1196 times)
0 Members and 1 Guest are viewing this topic.
USA
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino Rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Everyone,

I just started a new blog on Open Hardware Platforms in general and the Arduino in specific. My first posting is a more in depth walkthrough of the Arduino IDE Build process (http://openhardwareplatform.blogspot.com/). I would love to get your feedback on the blog posting as well as your ideas for future topics. Please keep in mind that I am better and the hard stuff than the easy stuff, but will try my hand at both.

My goal is to post to the blog each week (fingers crossed).

Thx, Leland
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8494
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for that description Leland, I like the way you've laid out the command line options, very clear.

I'm reasonably happy with makefiles and don't use the IDE much but I still like to know more about how it works.

Quote
the .o files of the core are merged into a single archive (core.a) file using AVR-AR.
Every time or just after a new install?

Quote
After adding the #include, the Arduino preprocessor creates a function prototype for each functions defined within the {sketchName}.cpp file.
Coding Badly mentioned this the other day in another thread. This would explain why my 3000-line program that compiles in seconds outside the IDE takes (and I kid you not) 2-3 minutes or longer when compiled with the IDE. I looked at the processes with task manager and it's all Java (the IDE I assume) then 2 seconds of the compiler.

Is there any way to turn that feature off?

Quote
-mmcu={boardPreferences.get("build.mcu")}
This and similar constructs I don't understand. Does this cause AVR-xxx to read the "boards.txt" file to get the parameter. If so where does the program get the filename from. Or is this parsed by the IDE and the correct value inserted in the command line?

______
Rob
 
Logged

Rob Gray aka the GRAYnomad www.robgray.com

USA
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino Rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Rob,

Quote
Quote
the .o files of the core are merged into a single archive (core.a) file using AVR-AR.
Every time or just after a new install?
Yes...Each time you perform a compile from the IDE the core.a is recompiled. Technically this could be changed to "cache" the core.a and only recompile when you have changed your board/target (i.e. changed from ATmega1280 to ATmega328 for example).

Quote
Coding Badly mentioned this the other day in another thread. This would explain why my 3000-line program that compiles in seconds outside the IDE takes (and I kid you not) 2-3 minutes or longer when compiled with the IDE. I looked at the processes with task manager and it's all Java (the IDE I assume) then 2 seconds of the compiler.

Is there any way to turn that feature off?
There is a way for you to eliminate, actually only minimize, the impact of the Arduino IDE creating the function prototypes. If you move all of your code to .c or .cpp files instead of .pde files, the IDE will have less work to perform during preprocessing. This is because the IDE doesn't really do anything to .c or .cpp files - except compile and link them.

Quote
Quote
-mmcu={boardPreferences.get("build.mcu")}

This and similar constructs I don't understand. Does this cause AVR-xxx to read the "boards.txt" file to get the parameter. If so where does the program get the filename from. Or is this parsed by the IDE and the correct value inserted in the command line?

The actual "{boardPreferences.get("build.mcu")}" function call within the Arduino IDE Java code only returns the values that where previousely read from the boards.txt file at startup. The boards.txt file contains the setting for every board the Arduino IDE knows about. The values returned are based on that file and the board you selected within the "Tools | Board" menu options of the Arduino IDE.

In the case of the build.mcu option ("{boardPreferences.get("build.mcu")}"), the valued used for the ATmega328 is "atmega328p". The following is a snippet from the boards.txt file.

     ##############################################################

uno.name=Arduino Uno
uno.upload.protocol=stk500
uno.upload.maximum_size=32256
uno.upload.speed=115200
uno.bootloader.low_fuses=0xff
uno.bootloader.high_fuses=0xde
uno.bootloader.extended_fuses=0x05
uno.bootloader.path=optiboot
uno.bootloader.file=optiboot_atmega328.hex
uno.bootloader.unlock_bits=0x3F
uno.bootloader.lock_bits=0x0F
uno.build.mcu=atmega328p
uno.build.f_cpu=16000000L
uno.build.core=arduino

##############################################################

atmega328.name=Arduino Duemilanove or Nano w/ ATmega328

atmega328.upload.protocol=stk500
atmega328.upload.maximum_size=30720
atmega328.upload.speed=57600

atmega328.bootloader.low_fuses=0xFF
atmega328.bootloader.high_fuses=0xDA
atmega328.bootloader.extended_fuses=0x05
atmega328.bootloader.path=atmega
atmega328.bootloader.file=ATmegaBOOT_168_atmega328.hex
atmega328.bootloader.unlock_bits=0x3F
atmega328.bootloader.lock_bits=0x0F

atmega328.build.mcu=atmega328p
atmega328.build.f_cpu=16000000L
atmega328.build.core=arduino

##############################################################
.
.
.
##############################################################

Notice the line that reads "atmega328.build.mcu=atmega328p". The IDE uses the board selected "atmega328" plus the value it is looking for "build.mcu" to get the value "atmega328.build.mcu" from the values read from this file.

I hope this helps...
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8494
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yep got that, thanks.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Pages: [1]   Go Up
Jump to: