Files
mkrtos-real/mkrtos_bootstrap/CMakeLists.txt
2023-09-18 22:49:53 +08:00

46 lines
1.2 KiB
CMake
Executable File

cmake_minimum_required(VERSION 3.13)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
-Werror \
-DUSE_STDPERIPH_DRIVER=1 \
-DSMP=1 \
-Wno-unused-parameter \
-Wno-unused-function \
-Wno-unused-variable \
-Wno-deprecated \
")
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)
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 --gc-section ")
# TARGET_LINK_LIBRARIES(bootstrap.elf
# boot_src
# )
add_custom_target(
bootstrap_dump ALL
COMMAND
${CMAKE_OBJCOPY} -O binary -S bootstrap.elf bootstrap.bin
COMMAND
mkdir -p ${CMAKE_SOURCE_DIR}/build/output
COMMAND
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)