Skip to content

Commit 49a82cd

Browse files
committed
cmake: enable -mcall-prologues
Reduces flash memory usage by ~300B The CMake build outputs an ASM file for the firmware image and is human readable. To see the impacted functions, look for these routines: __prologue_saves__ __epilogue_restores__ They should come in pairs. For more info about this option, see: https://gcc.gnu.org/onlinedocs/gcc-7.3.0/gcc/AVR-Options.html#AVR-Options
1 parent 75570a8 commit 49a82cd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ if(CMAKE_CROSSCOMPILING)
127127
# split and gc sections
128128
add_compile_options(-ffunction-sections -fdata-sections)
129129
add_link_options(-ffunction-sections -fdata-sections -Wl,--gc-sections)
130+
131+
# Call Prologues/Epilogues to reduce code size
132+
add_compile_options(-mcall-prologues)
130133
else()
131134
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
132135
add_compile_options(-O0)

0 commit comments

Comments
 (0)