1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-07 01:54:26 +01:00

Quick hack to allow bigger code on the atmega168 (if build.mcu == atmega168, the upload.maximum_size gets doubled).

This commit is contained in:
David A. Mellis 2006-08-30 11:47:34 +00:00
parent 70b2be7831
commit 7fe87fe724

View File

@ -1652,16 +1652,19 @@ public class Sketch {
protected void size(String buildPath, String suggestedClassName) protected void size(String buildPath, String suggestedClassName)
throws RunnerException { throws RunnerException {
long size = 0; long size = 0;
long maxsize = Preferences.getInteger("upload.maximum_size");
if (Preferences.get("build.mcu").equals("atmega168"))
maxsize *= 2;
Sizer sizer = new Sizer(buildPath, suggestedClassName); Sizer sizer = new Sizer(buildPath, suggestedClassName);
try { try {
size = sizer.computeSize(); size = sizer.computeSize();
System.out.println("Binary sketch size: " + size + " bytes (of a " + System.out.println("Binary sketch size: " + size + " bytes (of a " +
Preferences.get("upload.maximum_size") + " byte maximum)"); maxsize + " byte maximum)");
} catch (RunnerException e) { } catch (RunnerException e) {
System.err.println("Couldn't determine program size: " + e.getMessage()); System.err.println("Couldn't determine program size: " + e.getMessage());
} }
if (size > Preferences.getInteger("upload.maximum_size")) if (size > maxsize)
throw new RunnerException( throw new RunnerException(
"Sketch too big; try deleting code, removing floats, or see " + "Sketch too big; try deleting code, removing floats, or see " +
"http://www.arduino.cc/en/Main/FAQ for more advice."); "http://www.arduino.cc/en/Main/FAQ for more advice.");