优化可执行文件大小
This commit is contained in:
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
|
||||
-Werror \
|
||||
-D__MPU_PRESENT=1 -DUSE_STDPERIPH_DRIVER=1 \
|
||||
-DUSE_STDPERIPH_DRIVER=1 \
|
||||
-DSMP=1 \
|
||||
-Wno-unused-parameter \
|
||||
-Wno-unused-function \
|
||||
@@ -10,29 +10,25 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
|
||||
-Wno-deprecated \
|
||||
")
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc/cortex-m3)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc/stm32f205rft6)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc/stm32f205rft6/lib)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc/dietlibc)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc/dietlibc/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/mkrtos_bootstrap/core/cortex-m3)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/mkrtos_bootstrap/inc/lib)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/mkrtos_bootstrap/inc/stm32f205rft6)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/mkrtos_bootstrap/inc/stm32f205rft6/lib)
|
||||
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
file(GLOB deps *.c *.S)
|
||||
file(GLOB_RECURSE deps *.c *.S)
|
||||
|
||||
add_executable(bootstrap.elf
|
||||
${deps}
|
||||
)
|
||||
|
||||
set_target_properties(bootstrap.elf PROPERTIES LINK_FLAGS
|
||||
"-T ${CMAKE_CURRENT_SOURCE_DIR}/stm32f205rft6_link.lds")
|
||||
"-T ${CMAKE_CURRENT_SOURCE_DIR}/stm32f205rft6_link.lds --gc-section ")
|
||||
|
||||
TARGET_LINK_LIBRARIES(bootstrap.elf
|
||||
boot_src
|
||||
)
|
||||
# TARGET_LINK_LIBRARIES(bootstrap.elf
|
||||
# boot_src
|
||||
# )
|
||||
|
||||
add_custom_target(
|
||||
bootstrap_dump ALL
|
||||
@@ -44,5 +40,7 @@ add_custom_target(
|
||||
cp bootstrap.bin ${CMAKE_SOURCE_DIR}/build/output/bootstrap
|
||||
COMMAND
|
||||
cp bootstrap.elf ${CMAKE_SOURCE_DIR}/build/output/bootstrap.elf
|
||||
COMMAND
|
||||
${CMAKE_SIZE} bootstrap.elf
|
||||
)
|
||||
add_dependencies(bootstrap_dump bootstrap.elf)
|
||||
Reference in New Issue
Block a user