Skip to content

Commit ec7ab5a

Browse files
committed
🔨 Build flag tweaks
1 parent 2c5468c commit ec7ab5a

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

Marlin/src/core/macros.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@
3737
#define FORCE_INLINE __attribute__((always_inline)) inline
3838
#define NO_INLINE __attribute__((noinline))
3939
#define _UNUSED __attribute__((unused))
40-
#define __O0 __attribute__((optimize("O0")))
41-
#define __Os __attribute__((optimize("Os")))
42-
#define __O1 __attribute__((optimize("O1")))
43-
#define __O2 __attribute__((optimize("O2")))
44-
#define __O3 __attribute__((optimize("O3")))
40+
#define __O0 __attribute__((optimize("O0"))) // No optimization and less debug info
41+
#define __Og __attribute__((optimize("Og"))) // Optimize the debugging experience
42+
#define __Os __attribute__((optimize("Os"))) // Optimize for size
43+
#define __O1 __attribute__((optimize("O1"))) // Try to reduce size and cycles; nothing that takes a lot of time to compile
44+
#define __O2 __attribute__((optimize("O2"))) // Optimize even more
45+
#define __O3 __attribute__((optimize("O3"))) // Optimize yet more
4546

4647
#define IS_CONSTEXPR(...) __builtin_constant_p(__VA_ARGS__) // Only valid solution with C++14. Should use std::is_constant_evaluated() in C++20 instead
4748

ini/avr.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#
1515
[common_avr8]
1616
platform = atmelavr@~4.0.1
17-
build_flags = ${common.build_flags} -Wl,--relax
18-
build_src_flags = -std=gnu++1z
17+
build_flags = ${common.build_flags} -std=gnu++1z -Wl,--relax
18+
build_unflags = -std=gnu++11
1919
board_build.f_cpu = 16000000L
2020
build_src_filter = ${common.default_src_filter} +<src/HAL/AVR>
2121

ini/stm32f1-maple.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ extends = STM32F1_maple
326326
board = marlin_malyanM200
327327
build_flags = ${STM32F1_maple.build_flags}
328328
-DMCU_STM32F103CB -D__STM32F1__=1 -std=c++1y -DSERIAL_USB -ffunction-sections -fdata-sections
329-
-Wl,--gc-sections -DDEBUG_LEVEL=0 -D__MARLIN_FIRMWARE__
329+
-Wl,--gc-sections -DDEBUG_LEVEL=0
330330
lib_ignore = ${STM32F1_maple.lib_ignore}
331331
SoftwareSerialM
332332

0 commit comments

Comments
 (0)