1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-17 06:52:18 +01:00

Clarified error messages and added a configurable warning level

Changed memory usage check to only fail build on 100%+ usage and added a
configurable warning level for memory usage defaulting to 75%.

Clarified error and warning messages related to memory usage to specify
that this is the minimum memory usage.
This commit is contained in:
Loren M. Lang 2013-05-02 13:10:02 -07:00
parent c35e57ab4e
commit 090f721606
2 changed files with 13 additions and 5 deletions

View File

@ -1634,11 +1634,11 @@ public class Sketch {
if(dataSize >= 0) {
if(maxDataSize > 0) {
System.out.println(I18n
.format(_("Memory usage: {0} bytes (of a {1} byte maximum) - {2}% used"),
.format(_("Minimum Memory usage: {0} bytes (of a {1} byte maximum) - {2}% used"),
dataSize, maxDataSize, dataSize * 100 / maxDataSize));
} else {
System.out.println(I18n
.format(_("Memory usage: {0} bytes"),
.format(_("Minimum Memory usage: {0} bytes"),
dataSize));
}
}
@ -1647,11 +1647,17 @@ public class Sketch {
e.getMessage()));
}
/* At least 10% of RAM should be reserved for stack/heap usage */
if (textSize > maxTextSize ||
(maxDataSize > 0 && dataSize > maxDataSize*9/10))
if (textSize > maxTextSize)
throw new RunnerException(
_("Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it."));
if (maxDataSize > 0 && dataSize > maxDataSize)
throw new RunnerException(
_("Not enough memory; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing your footprint."));
int warnDataPercentage = Integer.parseInt(prefs.get("build.warn_data_percentage"));
if (maxDataSize > 0 && dataSize > maxDataSize*warnDataPercentage/100)
System.out.println(_("Low memory available, stability problems may occur"));
}
protected String upload(String buildPath, String suggestedClassName, boolean usingProgrammer)

View File

@ -246,6 +246,8 @@ target_package = arduino
target_platform = avr
board = uno
software=ARDUINO
# Warn when data segment uses greater than this percentage
build.warn_data_percentage = 75
programmer = arduino:avrispmkii