Files
mkrtos-real/mkrtos_bootstrap/CMakeLists.txt

57 lines
1.6 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)
file(GLOB deps *.c)
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
"-T ${CMAKE_CURRENT_LIST_DIR}/stm32f205rft6_link.lds --gc-section ")
2023-08-20 20:52:23 +08:00
if (${BOARD_NAME} STREQUAL "STM32F1x")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSTM32F10X_XL ")
include_directories(${CMAKE_SOURCE_DIR}/mkrtos_bootstrap/inc/STM32F1x)
include_directories(${CMAKE_SOURCE_DIR}/mkrtos_bootstrap/inc/STM32F1x/lib)
add_subdirectory(bsp/STM32F1x)
elseif(${BOARD_NAME} STREQUAL "STM32F2x" )
include_directories(${CMAKE_SOURCE_DIR}/mkrtos_bootstrap/inc/stm32f205rft6)
include_directories(${CMAKE_SOURCE_DIR}/mkrtos_bootstrap/inc/stm32f205rft6/lib)
add_subdirectory(bsp/STM32F2x)
endif()
TARGET_LINK_LIBRARIES(bootstrap.elf
bsp
)
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)