mirror of
https://github.com/armel/uv-k1-k5v3-firmware-custom.git
synced 2026-10-02 03:15:37 +00:00
build: enable LTO by default
LTO saves ~4K in Flash and ~300 Bytes in RAM
Disable LTO
```
Memory region Used Size Region Size %age Used
RAM: 12256 B 16 KB 74.80%
FLASH: 84304 B 118 KB 69.77%
```
Enable LTO
```
[82/82] Linking C executable f4hwn.fusion.elf
Memory region Used Size Region Size %age Used
RAM: 11904 B 16 KB 72.66%
FLASH: 80820 B 118 KB 66.89%
```
This commit is contained in:
1 parent
d3b985c5ad
commit
164a72738a
2 files changed
+5
No files matched your search
@@ -70,6 +70,10 @@ target_link_libraries(${EXE_NAME} Core App)
|
||||
target_compile_definitions(${EXE_NAME} PRIVATE $<$<CONFIG:Debug>:DEBUG>)
|
||||
target_link_libraries(${EXE_NAME} ${TOOLCHAIN_LINK_LIBRARIES})
|
||||
|
||||
if(ENABLE_LTO)
|
||||
target_compile_options(${EXE_NAME} PRIVATE -flto=auto)
|
||||
endif()
|
||||
|
||||
# Generate map file
|
||||
target_link_options(${EXE_NAME} PRIVATE "-Wl,-Map=${EXE_NAME}.map")
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
"toolchainFile": "${sourceDir}/cmake/gcc-arm-none-eabi.cmake",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"ENABLE_LTO": true,
|
||||
"ENABLE_FMRADIO": false,
|
||||
"ENABLE_UART": true,
|
||||
"ENABLE_USB": true,
|
||||
|
||||
Reference in new issue
Block a user