diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index beb6bfe3e9..784002c769 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -37,11 +37,12 @@ #define FORCE_INLINE __attribute__((always_inline)) inline #define NO_INLINE __attribute__((noinline)) #define _UNUSED __attribute__((unused)) -#define __O0 __attribute__((optimize("O0"))) -#define __Os __attribute__((optimize("Os"))) -#define __O1 __attribute__((optimize("O1"))) -#define __O2 __attribute__((optimize("O2"))) -#define __O3 __attribute__((optimize("O3"))) +#define __O0 __attribute__((optimize("O0"))) // No optimization and less debug info +#define __Og __attribute__((optimize("Og"))) // Optimize the debugging experience +#define __Os __attribute__((optimize("Os"))) // Optimize for size +#define __O1 __attribute__((optimize("O1"))) // Try to reduce size and cycles; nothing that takes a lot of time to compile +#define __O2 __attribute__((optimize("O2"))) // Optimize even more +#define __O3 __attribute__((optimize("O3"))) // Optimize yet more #define IS_CONSTEXPR(...) __builtin_constant_p(__VA_ARGS__) // Only valid solution with C++14. Should use std::is_constant_evaluated() in C++20 instead diff --git a/ini/avr.ini b/ini/avr.ini index 7c5f369dc6..f2f0658d84 100644 --- a/ini/avr.ini +++ b/ini/avr.ini @@ -14,8 +14,8 @@ # [common_avr8] platform = atmelavr@~4.0.1 -build_flags = ${common.build_flags} -Wl,--relax -build_src_flags = -std=gnu++1z +build_flags = ${common.build_flags} -std=gnu++1z -Wl,--relax +build_unflags = -std=gnu++11 board_build.f_cpu = 16000000L build_src_filter = ${common.default_src_filter} + diff --git a/ini/stm32f1-maple.ini b/ini/stm32f1-maple.ini index a113d1a7b1..16563fcc91 100644 --- a/ini/stm32f1-maple.ini +++ b/ini/stm32f1-maple.ini @@ -326,7 +326,7 @@ extends = STM32F1_maple board = marlin_malyanM200 build_flags = ${STM32F1_maple.build_flags} -DMCU_STM32F103CB -D__STM32F1__=1 -std=c++1y -DSERIAL_USB -ffunction-sections -fdata-sections - -Wl,--gc-sections -DDEBUG_LEVEL=0 -D__MARLIN_FIRMWARE__ + -Wl,--gc-sections -DDEBUG_LEVEL=0 lib_ignore = ${STM32F1_maple.lib_ignore} SoftwareSerialM