0
Offline
Faraday Member
Karma: 12
Posts: 2857
ruggedcircuits.com
|
 |
« Reply #15 on: September 08, 2010, 07:41:07 pm » |
Hmm, I don't know exactly what Eclipse is doing but it looks like it is precompiling the entire Arduino library. If so, it's likely compiling in all the floating-point support routines just in case they're needed, whereas the Arduino IDE only compiles in what a particular sketch needs. -- The Quick Shield: breakout all 28 pins to quick-connect terminals
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 14
Arduino rocks
|
 |
« Reply #16 on: September 08, 2010, 07:48:18 pm » |
That could make sense I'll do some testing around it and will include all files direct into a project w/o using a lib. Keep you posted about the outcome (after my beauty sleep) I am still wondering if I am the only guy using Eclipse and sees that something is wrong.
|
|
|
|
|
Logged
|
|
|
|
|
Portugal
Offline
God Member
Karma: 5
Posts: 962
|
 |
« Reply #17 on: September 08, 2010, 08:27:40 pm » |
Its really touching a lot of files.
|
|
|
|
|
Logged
|
|
|
|
|
Kentucky, US
Offline
Full Member
Karma: 1
Posts: 193
|
 |
« Reply #18 on: September 08, 2010, 09:22:19 pm » |
I'm seeing the same problem with my shiny new Eclipse/WinAVR installation. I was going to start a similar thread, and then I saw this one. I'm anxious to find a solution since I like using the Eclipse environment.
Jim
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 14
Arduino rocks
|
 |
« Reply #19 on: September 09, 2010, 05:27:41 am » |
Results of the test: Included the Arduino lib files into an Eclipse project. Added main.h and main.cpp as above. Project properties according to the cook book (see post 1) And voila: the HEX file size increased to 17kB. I opened a thread in SourceForge to see if they have an idea which switches to set: https://sourceforge.net/projects/avr-eclipse/forums/forum/664382/topic/3844152In between I tested a good concept idea (but far way to call it beta release) from this gentleman: http://code.google.com/p/avr-project-ide/wiki/Help. Same code, same compilers generate the expected 2.6kB like Arduino IDE. Keep you posted and still happy for receiving any advice.
|
|
|
|
|
Logged
|
|
|
|
|
SF Bay Area (USA)
Offline
Faraday Member
Karma: 78
Posts: 5453
Strongly opinionated, but not official!
|
 |
« Reply #20 on: September 10, 2010, 08:29:57 pm » |
Try adding -ffunction-sections and -fdata-sections to the compile flags. I think this was the right idea, but there's a match set of options that you need to add to the link command. Ummm: "-Wl,--gc-sections" or "--gc-sections" (depending on whether it uses some version of gcc as the linker command, or uses "ld" directly.) the quoted compiler options cause each function and piece of data to be put in its own linker section. The linker option causes any sections that aren't reference from some other section to be omitted. Or something like that.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 14
Arduino rocks
|
 |
« Reply #21 on: September 11, 2010, 07:31:35 am » |
Thanks, case closed  the a.m. compiler options sorted it out. Robert
|
|
|
|
|
Logged
|
|
|
|
|
Kentucky, US
Offline
Full Member
Karma: 1
Posts: 193
|
 |
« Reply #22 on: September 11, 2010, 01:18:36 pm » |
Robert -
Can you post the compiler and linker options that finally solved the problem for you?
Thanks.
Jim
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 14
Arduino rocks
|
 |
« Reply #23 on: September 12, 2010, 12:47:47 am » |
Here are the compiler/linker settings in a nutshell. If that is too short then give a shout:
AVR Compiler * Debugging: Generate Debugging Info: No debugging info * Optimization: Optimization Level: to Size Optimizations Other Optimization: -ffunction-sections -fdata-sections * All options: --I"...\Arduino-0019\hardware\arduino\cores\arduino" -Wall -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega328p -DF_CPU=16000000UL AVR C++ Compiler * Debugging: Generate Debugging Info: No debugging info. * Optimization: Optimization Level: Size Optimizations Other Optimization: -ffunction-sections -fdata-sections * All options: -I"...\Arduino-0019\hardware\arduino\cores\arduino" -Wall -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -funsigned-char -funsigned-bitfields -fno-exceptions -mmcu=atmega328p -DF_CPU=16000000UL AVR C++ Linker * Command: avr-gcc * General: Other Arguments: -Wl,--gc-sections * Command line pattern: ${COMMAND} --cref -s -Os ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} -lm ${FLAGS} * All options: -Wl,-Map,<your *.map file>,--cref -Wl,--gc-sections -L"<your library path>" -mmcu=atmega328p
|
|
|
|
|
Logged
|
|
|
|
|
Kentucky, US
Offline
Full Member
Karma: 1
Posts: 193
|
 |
« Reply #24 on: September 12, 2010, 07:29:24 pm » |
Thanks, Robert. Very much appreciated. I'll give it a try and see if it also fixes my problem.
Jim
|
|
|
|
|
Logged
|
|
|
|
|
Kentucky, US
Offline
Full Member
Karma: 1
Posts: 193
|
 |
« Reply #25 on: September 13, 2010, 11:53:16 pm » |
Those settings worked for me as well, but....
I also had to compile/archive a new Arduino libcore.a that had the same optimizations (-ffunction-sections -fdata-sections). After making a new core library using Eclipse/WinAVR, the HEX file from Eclipse for my sample was actually a few bytes smaller than that created using the Arduino IDE.
I will also pass along a particularly helpful (at least with regard to getting the Eclipse command line settings right) feature of the Arduino IDE: if you hold the shift key while compiling, the IDE will create a command line listing in the console window. Using this listing you can duplicate the Arduino environment as closely as you'd like in Eclipse.
Jim
|
|
|
|
« Last Edit: September 13, 2010, 11:54:25 pm by JimG »
|
Logged
|
|
|
|
|
SF Bay Area (USA)
Offline
Faraday Member
Karma: 78
Posts: 5453
Strongly opinionated, but not official!
|
 |
« Reply #26 on: September 14, 2010, 01:56:34 am » |
I also had to compile/archive a new Arduino libcore.a that had the same optimizations yeah; seems that very few "make" based compile environments remember to include the makefile itself in the dependency list for targets (is Eclipse actually Make based? The principle still holds..) The Arduino IDE rebuilds everything (libraries) whenever you switch boards, and nearly everything (core) for every build. This is liable to get annoying as there is more to compile, but at least it's "safe." You can also set "build.verbose" to true in your arduino preferences file, and you'll see the build command listing in your console window all the time...
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 1
Arduino rocks
|
 |
« Reply #27 on: December 10, 2010, 10:50:06 am » |
Hi all, I have the similar problem: I tried to setup eclipse to compile arduino project and it's working, but blink sketch built with eclipse is about 10k... a little too big  I used the core.a from an arduino ide compilation, is it sufficient or do I have to recompile a new one from eclipse with the same configuration ? Thanks a lot. Btw, why are you using eclipse ? Apart from code completion ? 
|
|
|
|
|
Logged
|
|
|
|
|
|