Skip to content

Commit 1a97ec4

Browse files
committed
Remove sketch size calculation from Java IDE
It is now performed by arduino-builder (>= 1.3.22)
1 parent df00096 commit 1a97ec4

File tree

1 file changed

+0
-52
lines changed

1 file changed

+0
-52
lines changed

Diff for: arduino-core/src/cc/arduino/Compiler.java

-52
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ public String build(CompilerProgressListener progListener, boolean exportHex) th
156156
runActions("hooks.savehex.postsavehex", prefs);
157157
}
158158

159-
size(prefs);
160-
161159
return sketch.getPrimaryFile().getFileName();
162160
}
163161

@@ -296,56 +294,6 @@ private void callArduinoBuilder(TargetBoard board, TargetPlatform platform, Targ
296294
}
297295
}
298296

299-
private void size(PreferencesMap prefs) throws RunnerException {
300-
String maxTextSizeString = prefs.get("upload.maximum_size");
301-
String maxDataSizeString = prefs.get("upload.maximum_data_size");
302-
303-
if (maxTextSizeString == null) {
304-
return;
305-
}
306-
307-
long maxTextSize = Integer.parseInt(maxTextSizeString);
308-
long maxDataSize = -1;
309-
310-
if (maxDataSizeString != null) {
311-
maxDataSize = Integer.parseInt(maxDataSizeString);
312-
}
313-
314-
Sizer sizer = new Sizer(prefs);
315-
long[] sizes;
316-
try {
317-
sizes = sizer.computeSize();
318-
} catch (RunnerException e) {
319-
System.err.println(I18n.format(tr("Couldn't determine program size: {0}"), e.getMessage()));
320-
return;
321-
}
322-
323-
long textSize = sizes[0];
324-
long dataSize = sizes[1];
325-
System.out.println();
326-
System.out.println(I18n.format(tr("Sketch uses {0} bytes ({2}%%) of program storage space. Maximum is {1} bytes."), textSize, maxTextSize, textSize * 100 / maxTextSize));
327-
if (dataSize >= 0) {
328-
if (maxDataSize > 0) {
329-
System.out.println(I18n.format(tr("Global variables use {0} bytes ({2}%%) of dynamic memory, leaving {3} bytes for local variables. Maximum is {1} bytes."), dataSize, maxDataSize, dataSize * 100 / maxDataSize, maxDataSize - dataSize));
330-
} else {
331-
System.out.println(I18n.format(tr("Global variables use {0} bytes of dynamic memory."), dataSize));
332-
}
333-
}
334-
335-
if (textSize > maxTextSize) {
336-
throw new RunnerException(tr("Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it."));
337-
}
338-
339-
if (maxDataSize > 0 && dataSize > maxDataSize) {
340-
throw new RunnerException(tr("Not enough memory; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing your footprint."));
341-
}
342-
343-
int warnDataPercentage = Integer.parseInt(prefs.get("build.warn_data_percentage"));
344-
if (maxDataSize > 0 && dataSize > maxDataSize * warnDataPercentage / 100) {
345-
System.err.println(tr("Low memory available, stability problems may occur."));
346-
}
347-
}
348-
349297
private void saveHex(PreferencesMap prefs) throws RunnerException {
350298
List<String> compiledSketches = new ArrayList<>(prefs.subTree("recipe.output.tmp_file", 1).values());
351299
List<String> copyOfCompiledSketches = new ArrayList<>(prefs.subTree("recipe.output.save_file", 1).values());

0 commit comments

Comments
 (0)