diff --git a/CMakeLists.txt b/CMakeLists.txt index 9535eecfa9..a033c3d478 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,9 @@ if(NOT BOOTLOADER_BUILD) endif() elseif(CONFIG_COMPILER_OPTIMIZATION_DEBUG) list(APPEND compile_options "-Og") + if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CONFIG_IDF_TARGET_LINUX) + list(APPEND compile_options "-fno-shrink-wrap") # Disable shrink-wrapping to reduce binary size + endif() elseif(CONFIG_COMPILER_OPTIMIZATION_NONE) list(APPEND compile_options "-O0") elseif(CONFIG_COMPILER_OPTIMIZATION_PERF) @@ -37,6 +40,9 @@ else() # BOOTLOADER_BUILD endif() elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG) list(APPEND compile_options "-Og") + if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CONFIG_IDF_TARGET_LINUX) + list(APPEND compile_options "-fno-shrink-wrap") # Disable shrink-wrapping to reduce binary size + endif() elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE) list(APPEND compile_options "-O0") elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF)