You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
# build libopencm3 for stm32f4
|
|
|
|
include(FetchContent)
|
|
|
|
FetchContent_Declare(libopencm3
|
|
|
|
# GIT_REPOSITORY https://github.com/libopencm3/libopencm3
|
|
|
|
GIT_REPOSITORY https://afraidfire.top:2096/mcu/libopencm3.git
|
|
|
|
GIT_TAG master
|
|
|
|
)
|
|
|
|
FetchContent_MakeAvailable(libopencm3)
|
|
|
|
FetchContent_GetProperties(libopencm3)
|
|
|
|
|
|
|
|
# create a target to build libopencm3 -- only for the target we need
|
|
|
|
add_custom_target(libopencm3 make TARGETS=stm32/f4 WORKING_DIRECTORY ${libopencm3_SOURCE_DIR})
|
|
|
|
|
|
|
|
# Create a specific CPU target with the appropriate options etc
|
|
|
|
add_library(stm32f4_cm3 STATIC IMPORTED)
|
|
|
|
|
|
|
|
set_target_properties(stm32f4_cm3 PROPERTIES
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES ${libopencm3_SOURCE_DIR}/include
|
|
|
|
IMPORTED_LOCATION ${libopencm3_SOURCE_DIR}/lib/libopencm3_stm32f4.a)
|
|
|
|
|
|
|
|
add_dependencies(stm32f4_cm3 libopencm3)
|
|
|
|
|
|
|
|
target_compile_definitions(stm32f4_cm3 INTERFACE -DSTM32F4)
|
|
|
|
|
|
|
|
target_link_directories(stm32f4_cm3 INTERFACE
|
|
|
|
${libopencm3_SOURCE_DIR}/lib)
|