-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
113 lines (85 loc) · 2.45 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
cmake_minimum_required(VERSION 3.16)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/modules/stm32-cmake/cmake/stm32_gcc.cmake)
project(zumo-controller C ASM)
set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
add_compile_options(-Wall -Wextra -Wpedantic -Werror)
set(OS_TRACE_ENABLED 0)
set(LINE_FOLLOW_TRACE_ENABLED 0)
set(DRIVE_CONTROL_LOOP_TRACE_ENABLED 0)
add_definitions(-DSTM32F401xE)
if(OS_TRACE_ENABLED)
message("enabled OS_TRACE")
add_definitions(-DOS_TRACE_ENABLED)
endif()
if(LINE_FOLLOW_TRACE_ENABLED)
message("enabled LINE_FOLLOW_TRACE")
add_definitions(-DLINE_FOLLOW_TRACE_ENABLED)
endif()
if(DRIVE_CONTROL_LOOP_TRACE_ENABLED)
message("enabled DRIVE_CONTROL_LOOP_TRACE")
add_definitions(-DDRIVE_CTL_TRACE_ENABLED)
endif()
stm32_fetch_cmsis(F4)
stm32_fetch_hal(F4)
find_package(CMSIS COMPONENTS STM32F401RE REQUIRED)
find_package(HAL COMPONENTS STM32F4 REQUIRED)
set(CMAKE_ASM_FLAGS -c)
set(PROJECT_SOURCES
src/app_defs.h
src/main.c
src/watchdog.c
src/trace.c
src/os_port_arm_m4.c
src/rmk_hal_clock_cfg.c
src/state_controller.c
src/state_machine.c
src/subsys/drive_subsystem.c
src/subsys/input_ctl_subsystem.c
src/subsys/reflectance_array_subsystem.c
src/subsys/comms_subsystem.c
src/subsys/test_subsystem.c
src/subsys/electromagnet_subsystem.c
src/cmd/drive_open_loop_cmd.c
src/cmd/lf_cmd.c
src/cmd/turn_cmd.c
src/cmd/turn180_cmd.c
src/cmd/to_bay_cmd.c
src/cmd/delay_cmd.c
src/cmd/electromagnet_cmd.c
src/cmd/zone_log_cmd.c
)
set(STM_SOURCES
src/stm/startup_stm32f401xe.s
src/stm/system_stm32f4xx.c
src/stm32f4xx_hal_conf.h
src/stm/stm32f401xe.h
src/stm/system_stm32f4xx.h
)
add_executable(${PROJECT_NAME}
${PROJECT_SOURCES}
${STM_SOURCES}
)
add_subdirectory(modules/rmkernel)
add_subdirectory(modules/stcp)
target_link_libraries(${PROJECT_NAME} PRIVATE
rmkernel
stcp
)
target_include_directories(${PROJECT_NAME}
PUBLIC
${CMAKE_SOURCE_DIR}/src
)
target_link_libraries(${PROJECT_NAME} PRIVATE
HAL::STM32::F4::RCC
HAL::STM32::F4::CORTEX
HAL::STM32::F4::GPIO
HAL::STM32::F4::TIM
HAL::STM32::F4::TIMEx
HAL::STM32::F4::UART
CMSIS::STM32::F4
STM32::NoSys)
stm32_add_linker_script(${PROJECT_NAME} PRIVATE F401RE.ld)
stm32_generate_binary_file(${PROJECT_NAME})
stm32_generate_hex_file(${PROJECT_NAME})
stm32_print_size_of_target(${PROJECT_NAME})