mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03: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:
@ -1634,11 +1634,11 @@ public class Sketch {
|
|||||||
if(dataSize >= 0) {
|
if(dataSize >= 0) {
|
||||||
if(maxDataSize > 0) {
|
if(maxDataSize > 0) {
|
||||||
System.out.println(I18n
|
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));
|
dataSize, maxDataSize, dataSize * 100 / maxDataSize));
|
||||||
} else {
|
} else {
|
||||||
System.out.println(I18n
|
System.out.println(I18n
|
||||||
.format(_("Memory usage: {0} bytes"),
|
.format(_("Minimum Memory usage: {0} bytes"),
|
||||||
dataSize));
|
dataSize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1647,11 +1647,17 @@ public class Sketch {
|
|||||||
e.getMessage()));
|
e.getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* At least 10% of RAM should be reserved for stack/heap usage */
|
if (textSize > maxTextSize)
|
||||||
if (textSize > maxTextSize ||
|
|
||||||
(maxDataSize > 0 && dataSize > maxDataSize*9/10))
|
|
||||||
throw new RunnerException(
|
throw new RunnerException(
|
||||||
_("Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it."));
|
_("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)
|
protected String upload(String buildPath, String suggestedClassName, boolean usingProgrammer)
|
||||||
|
@ -246,6 +246,8 @@ target_package = arduino
|
|||||||
target_platform = avr
|
target_platform = avr
|
||||||
board = uno
|
board = uno
|
||||||
software=ARDUINO
|
software=ARDUINO
|
||||||
|
# Warn when data segment uses greater than this percentage
|
||||||
|
build.warn_data_percentage = 75
|
||||||
|
|
||||||
programmer = arduino:avrispmkii
|
programmer = arduino:avrispmkii
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user