Skip to content

Commit fa4ab4f

Browse files
committed
Adding --relax flag for linking of ATmega2560 code. (arducopter)
http://code.google.com/p/arduino/issues/detail?id=729
1 parent 10aba52 commit fa4ab4f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: app/src/processing/app/debug/Compiler.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,18 @@ public boolean compile(Sketch sketch,
183183
}
184184

185185
// 4. link it all together into the .elf file
186-
186+
// For atmega2560, need --relax linker option to link larger
187+
// programs correctly.
188+
String optRelax = "";
189+
String atmega2560 = new String ("atmega2560");
190+
if ( atmega2560.equals(boardPreferences.get("build.mcu")) ) {
191+
optRelax = new String(",--relax");
192+
}
187193
sketch.setCompilingProgress(60);
188194
List baseCommandLinker = new ArrayList(Arrays.asList(new String[] {
189195
avrBasePath + "avr-gcc",
190196
"-Os",
191-
"-Wl,--gc-sections",
197+
"-Wl,--gc-sections"+optRelax,
192198
"-mmcu=" + boardPreferences.get("build.mcu"),
193199
"-o",
194200
buildPath + File.separator + primaryClassName + ".elf"

0 commit comments

Comments
 (0)