diff --git a/platformio.ini b/platformio.ini
index ccc2d17e94fd8f2da404e9fcf82574a1f420451b..01f3bdb11da735d37a7a1a35b459a93c948752d1 100644
--- a/platformio.ini
+++ b/platformio.ini
@@ -10,6 +10,11 @@
# Automatic targets - enable auto-uploading
# targets = upload
+#
+# By default platformio build will abort after 5 errors.
+# Remove '-fmax-errors=5' from build_flags below to see all.
+#
+
[platformio]
src_dir = Marlin
envs_dir = .pioenvs
@@ -30,6 +35,8 @@ lib_deps =
default_src_filter = +<src/*> -<src/config>
+build_flags = -fmax-errors=5
+
#################################
# #
# Unique Core Architectures #
@@ -47,7 +54,7 @@ default_src_filter = +<src/*> -<src/config>
platform = atmelavr
framework = arduino
board = megaatmega2560
-build_flags = -I $BUILDSRC_DIR
+build_flags = ${common.build_flags} -I $BUILDSRC_DIR
board_f_cpu = 16000000L
lib_deps = ${common.lib_deps}
src_filter = ${common.default_src_filter}
@@ -59,7 +66,7 @@ src_filter = ${common.default_src_filter}
platform = atmelavr
framework = arduino
board = megaatmega1280
-build_flags = -I $BUILDSRC_DIR
+build_flags = ${common.build_flags} -I $BUILDSRC_DIR
board_f_cpu = 16000000L
lib_deps = ${common.lib_deps}
src_filter = ${common.default_src_filter}
@@ -71,6 +78,7 @@ src_filter = ${common.default_src_filter}
platform = atmelavr
framework = arduino
board = sanguino_atmega1284p
+build_flags = ${common.build_flags}
upload_speed = 57600
lib_deps = ${common.lib_deps}
src_filter = ${common.default_src_filter}
@@ -85,7 +93,7 @@ src_filter = ${common.default_src_filter}
platform = atmelsam
framework = arduino
board = due
-build_flags = -I $BUILDSRC_DIR
+build_flags = ${common.build_flags} -I $BUILDSRC_DIR
lib_deps = ${common.lib_deps}
src_filter = ${common.default_src_filter}
@@ -96,6 +104,7 @@ src_filter = ${common.default_src_filter}
platform = nxplpc
board_f_cpu = 100000000L
build_flags = !python Marlin/src/HAL/HAL_LPC1768/lpc1768_flag_script.py
+ ${common.build_flags}
-DU8G_HAL_LINKS
src_build_flags = -Wall
build_unflags = -Wall
@@ -116,6 +125,7 @@ platform = nxplpc
board = lpc1768
board_f_cpu = 100000000L
build_flags = !python Marlin/src/HAL/HAL_LPC1768/lpc1768_flag_script.py
+ ${common.build_flags}
-DU8G_HAL_LINKS
lib_ldf_mode = off
lib_extra_dirs = frameworks
@@ -145,7 +155,7 @@ debug_server =
platform = atmelavr
framework = arduino
board = reprap_rambo
-build_flags = -I $BUILDSRC_DIR
+build_flags = ${common.build_flags} -I $BUILDSRC_DIR
board_f_cpu = 16000000L
lib_deps = ${common.lib_deps}
src_filter = ${common.default_src_filter}
@@ -154,17 +164,19 @@ src_filter = ${common.default_src_filter}
# Sanguinololu (ATmega644p)
#
[env:sanguino_atmega644p]
-platform = atmelavr
-framework = arduino
-board = sanguino_atmega644p
-lib_deps = ${common.lib_deps}
-src_filter = ${common.default_src_filter}
+platform = atmelavr
+framework = arduino
+board = sanguino_atmega644p
+build_flags = ${common.build_flags}
+lib_deps = ${common.lib_deps}
+src_filter = ${common.default_src_filter}
[env:STM32F1]
platform = ststm32
framework = arduino
board = genericSTM32F103RE
build_flags = !python Marlin/src/HAL/HAL_STM32F1/stm32f1_flag_script.py
+ ${common.build_flags}
lib_deps = ${common.lib_deps}
src_filter = ${common.default_src_filter}
@@ -179,7 +191,7 @@ src_filter = ${common.default_src_filter}
platform = teensy
framework = arduino
board = teensy20pp
-build_flags = -I $BUILDSRC_DIR
+build_flags = ${common.build_flags} -I $BUILDSRC_DIR
#board_f_cpu = 20000000L ; Bug in Arduino framework disallows boards running at 20Mhz
lib_deps = ${common.lib_deps}
src_filter = ${common.default_src_filter}
@@ -191,7 +203,7 @@ src_filter = ${common.default_src_filter}
platform = teensy
framework = arduino
board = teensy35
-build_flags = -I $BUILDSRC_DIR
+build_flags = ${common.build_flags} -I $BUILDSRC_DIR
lib_deps = ${common.lib_deps}
lib_ignore = Adafruit NeoPixel
src_filter = ${common.default_src_filter}