Compiler Errors

When I try to compile 2.77, the arduino compiler says the sketch is too large (263,640 / 258,048). Anyone know how to fix this?

Also, when I try to compile 2.75 I get one compiler error:

‘ifupda’ was not declared in this scope…

Its in the main loop.

@Mohrad,
Are you using this compiler: http://ardupilot.com/downloads/?did=45
Also, have you picked the correct Atmel processor which should be the Mega (2560)?
Regards,
TCIII GM

Yeah I have the new Arduino IDE and the correct board chosen. Still getting the same binary sketch size error. Does it matter that I’m on a Mac?

Is the “new Arduino IDE” the stock one from arduino.cc/ ? If so, you need to replace it with the compiler that is adapted to compile the Ardupilot projects. As TCIII mentioned before, it can be downloaded at http://ardupilot.com/downloads/?did=45

Success, Sinan

Hi Mohrad,
You need avr gcc version 4.7.2 or later. The earlier versions produce code that is too large for the board.
I’m not sure where you get 4.7.2 avr gcc for MacOS though - if you find it can you post a link?
Cheers, Tridge

Here are the directions I followed to download the new gcc compiler:

superuser.com/questions/517218/h … -os-x-10-8

Worked without any hitches.

I just wiped and loaded the AP patched version of Arduino just to make sure I had the right one and I am still getting compile size errors. Does this mean Arduino is still using the Apple compiler? and if so, how do I force it to use gcc 4.7.2?

[quote=“Mohrad”]
I just wiped and loaded the AP patched version of Arduino just to make sure I had the right one and I am still getting compile size errors. Does this mean Arduino is still using the Apple compiler? and if so, how do I force it to use gcc 4.7.2?[/quote]

That is quite tricky unfortunately. I think that on MacOS you will find it easier to build using the commandline. Try “make configure” followed by “make apm2” in the ArduPlane directory.
Cheers, Tridge

i’m also experience with Arduino build sketch too large error. i’m on windows 7 32bit, with ArduPilot-Arduino-1.0.3-windows. i can do make with cygwin but when upload to apm2, avrdude say address is out of range.

Hi Vincent,
For building on windows you can follow this guide, which shows you how to install a newer compiler version that gives smaller binaries.
We really are running out of space on the APM2 :slight_smile:
Cheers, Tridge

Thank Tridge.
now i can build with both make and arduino.

[quote=“tridge”]Hi Mohrad,
You need avr gcc version 4.7.2 or later. The earlier versions produce code that is too large for the board.
I’m not sure where you get 4.7.2 avr gcc for MacOS though - if you find it can you post a link?
Cheers, Tridge[/quote]

Same problem. Moving my (minor) modifications from 2.73 to 2.78 resulted in the code being too large using the standard “APM Arduino” compilers from the Eclipse IDE - even the standard 2.78 was too big. My solution was to download the Crosspack AVR toolchain (using avr-gcc version 4.8.1) for MacOS from
http://www.obdev.at/products/crosspack/index.html
and copy the tools installed in /usr/local/CrossPack-AVR to Arduino.app/Contents/Resources/Java/hardware/tools/avr

This resulted in an ArduPlane.hex file almost 100K smaller, which uploads to APM2.6 and works fine :sunglasses: