Files
mkrtos-real/mkrtos_bootstrap/CMakeLists.txt

46 lines
1.2 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.13)
2023-08-20 20:52:23 +08:00
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
-Werror \
2023-09-18 22:49:53 +08:00
-DUSE_STDPERIPH_DRIVER=1 \
2023-08-20 20:52:23 +08:00
-DSMP=1 \
-Wno-unused-parameter \
-Wno-unused-function \
-Wno-unused-variable \
2023-08-23 00:42:36 +08:00
-Wno-deprecated \
2023-08-20 20:52:23 +08:00
")
2023-09-18 22:49:53 +08:00
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)
2023-09-18 22:49:53 +08:00
file(GLOB_RECURSE deps *.c *.S)
2023-08-20 20:52:23 +08:00
add_executable(bootstrap.elf
${deps}
)
2023-08-20 20:52:23 +08:00
set_target_properties(bootstrap.elf PROPERTIES LINK_FLAGS
2023-09-18 22:49:53 +08:00
"-T ${CMAKE_CURRENT_SOURCE_DIR}/stm32f205rft6_link.lds --gc-section ")
2023-08-20 20:52:23 +08:00
2023-09-18 22:49:53 +08:00
# TARGET_LINK_LIBRARIES(bootstrap.elf
# boot_src
# )
2023-08-20 20:52:23 +08:00
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
2023-09-18 22:49:53 +08:00
COMMAND
${CMAKE_SIZE} bootstrap.elf
2023-08-20 20:52:23 +08:00
)
add_dependencies(bootstrap_dump bootstrap.elf)