From 8fa817b957bd10f48f1d17751068dd63ea5ca3d2 Mon Sep 17 00:00:00 2001 From: Mysteo91 Date: Thu, 20 Jul 2023 15:20:42 +0300 Subject: [PATCH] --good --- Boot/CMakeLists.txt | 17 ----------------- CMakeLists.txt | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Boot/CMakeLists.txt b/Boot/CMakeLists.txt index 116bf56..48bd3df 100644 --- a/Boot/CMakeLists.txt +++ b/Boot/CMakeLists.txt @@ -24,23 +24,6 @@ -if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release") - message(STATUS "Maximum optimization for speed") - add_definitions(-DRELEASE_BUILD) - add_definitions(-DWATCHDOG_IWDG) - add_compile_options(-Ofast) -elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") - add_definitions(-DWATCHDOG_IWDG) - message(STATUS "Maximum optimization for speed, debug info included") - add_compile_options(-Ofast -g) -elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel") - message(STATUS "Maximum optimization for size") - add_compile_options(-Os) -else () - message(STATUS "Minimal optimization, debug info included") - add_compile_options(-Og -g) -endif () - file(GLOB_RECURSE SOURCES "Core/*.*" "App/*.*" "loader/*.*" "../ARMCM0_STM32G0/*.*") list(FILTER SOURCES EXCLUDE REGEX "IAR\\/.*.[c|h]$") list(FILTER SOURCES EXCLUDE REGEX "Keil\\/.*.[c|h]$") diff --git a/CMakeLists.txt b/CMakeLists.txt index 14be743..2c842a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,6 +121,29 @@ else() endif() set(ENV{COMPILE_OPTIONS} "${COMPILE_OPTIONS}") set(ENV{COMPILE_DEF} "${COMPILE_DEF}") + + if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release") + message(STATUS "Maximum optimization for speed") + add_definitions(-DWATCHDOG_IWDG) + if (BOOT) + add_compile_options(-Os -g) + else() + add_compile_options(-Ofast -g) + endif() + + elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") + message(STATUS "Maximum optimization for speed, debug info included") + add_compile_options(-Ofast -g) + + elseif ("${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel") + message(STATUS "Maximum optimization for size") + add_compile_options(-Os) + else () + message(STATUS "Minimal optimization, debug info included") + add_definitions(-DWATCHDOG_IWDG) + add_compile_options(-Os -g) + endif () + if (BOOT) set (ENV{HAL_DRIVER_CONFIG} ${CMAKE_CURRENT_SOURCE_DIR}/Boot/Core/Inc/stm32g0xx_hal_conf.h) FUNC_CREATE_MEMORY_MAP("${MEM_MAP_FILE}" "128" "8" "4" )