diff --git a/stm32-toolchain.cmake b/stm32-toolchain.cmake index 81c9ba0..b85c8ce 100644 --- a/stm32-toolchain.cmake +++ b/stm32-toolchain.cmake @@ -57,6 +57,12 @@ set(LINKER_SCRIPT linker.ld) #------------------- # General Flags #------------------- + +# "-fno-builtin":: +# "-Wall":: Enables all warnings man page line:4385 +# "-ffunction-sections":: Puts each function into it's own section +# "-fdata-sections":: Puts each data chunk into it's own section. +# "-fomit-frame-pointer":: set(OBJECT_GEN_FLAGS " \ -fno-builtin \ -Wall \ @@ -80,6 +86,10 @@ set(CMAKE_ASM_FLAGS " \ #------------------- # LFLAGS for cross #------------------- + +# "-Wl":: Pass option as option to the linker. +# "-Map":: Map file passed to linker(an output?) +# "--gc-sections":: linkage garbage collector, part of shrinking size. set(CMAKE_EXE_LINKER_FLAGS " \ -Wl,-Map=${PROJECT_NAME}.map \ -Wl,--print-memory-usage \ @@ -92,7 +102,8 @@ set(CMAKE_EXE_LINKER_FLAGS " \ # "-Og":: Optimizes for debugging expirence. # "-g":: Debugging options -# "-gdwarf-3":: +# "-gdwarf-3":: Selection of the format version 3 +# "-gstrict-dwarf":: Disallow using extensions of later dwarf standards. set(CMAKE_C_FLAGS_DEBUG "-Og -g -gdwarf-3 -gstrict-dwarf " CACHE INTERNAL "C Compiler options for debug build type") set(CMAKE_CXX_FLAGS_DEBUG "-Og -g -gdwarf-3 -gstrict-dwarf " CACHE INTERNAL "C++ Compiler options for debug build type") set(CMAKE_ASM_FLAGS_DEBUG "-Og -g -gdwarf-3 -gstrict-dwarf " CACHE INTERNAL "ASM Compiler options for debug build type") @@ -101,6 +112,9 @@ set(CMAKE_EXE_LINKER_FLAGS_DEBUG "" CACHE INTERNAL "Linker options for debug bui #------------------ # Release Flags #----------------- + +# "-Os":: Optimizes for space. +# "-flto":: Link Time Optimization set(CMAKE_C_FLAGS_RELEASE "-Os -flto " CACHE INTERNAL "C Compiler options for release build type") set(CMAKE_CXX_FLAGS_RELEASE "-Os -flto " CACHE INTERNAL "C++ Compiler options for release build type") set(CMAKE_ASM_FLAGS_RELEASE "" CACHE INTERNAL "ASM Compiler options for release build type")