-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
129 lines (117 loc) · 4.09 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
cmake_minimum_required(VERSION 3.19.2)
project(OBC_SOFTWARE C CXX ASM)
set(CMAKE_CXX_STANDARD 17)
# Linker Script
set(LINKER_SCRIPT ${CMAKE_SOURCE_DIR}/src/config/default/ATSAMV71Q21B.ld)
set(CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,-gc-sections,--print-memory-usage -T ${LINKER_SCRIPT}")
# Definitions
add_definitions(-DARM_MATH_CM7 -DARM_MATH_MATRIX_CHECK -DARM_MATH_ROUNDING -D__FPU_PRESENT=1)
find_package(etl CONFIG REQUIRED)
find_package(logger CONFIG REQUIRED COMPONENTS log_common)
# Include directories
include_directories(
${CMAKE_SOURCE_DIR}
inc
inc/FreeRTOSTasks
inc/Platform
inc/Platform/Parameters
inc/Platform/CAN
inc/Platform/RS422
inc/Platform/ADM
inc/Helpers
src
src/config
src/config/default
src/config/default/osal
src/config/default/peripheral/clk
src/config/default/peripheral/efc
src/config/default/peripheral/nvic
src/config/default/peripheral/pio
src/config/default/peripheral/rtc
src/config/default/peripheral/systick
src/config/default/peripheral/twihs/master
src/config/default/system
src/config/default/system/cache
src/config/default/system/debug
src/config/default/system/int
src/config/default/system/time
src/config/default/system/time/src
lib/FreeRTOS
lib/FreeRTOS/Source
lib/FreeRTOS/Source/include
lib/FreeRTOS/Source/portable
lib/FreeRTOS/Source/portable/GCC
lib/FreeRTOS/Source/portable/GCC/SAM
lib/FreeRTOS/Source/portable/GCC/SAM/CM7
lib/FreeRTOS/Source/portable/MemMang
lib/ECSS/inc
lib/ECSS/inc/etl
lib/ECSS/inc/Helpers
lib/ECSS/inc/Services
lib/ECSS/inc/Time
src/packs
src/packs/ATSAMV71Q21B_DFP
src/packs/ATSAMV71Q21B_DFP/component
src/packs/ATSAMV71Q21B_DFP/instance
src/packs/ATSAMV71Q21B_DFP/pio
src/packs/CMSIS
src/packs/CMSIS/CMSIS
src/packs/CMSIS/CMSIS/Core
src/packs/CMSIS/CMSIS/Core/Include
AutoGenerated.X
AutoGenerated.X/dist
AutoGenerated.X/dist/default
AutoGenerated.X/dist/default/production
AutoGenerated.X/nbproject
AutoGenerated.X/nbproject/private
/opt/microchip/mplabx/v5.45/packs/arm/CMSIS/5.4.0/CMSIS/Core/Include/
lib/SEGGER/RTT
lib/SEGGER/Config
lib/Peripherals/MCP9808/inc
lib/Peripherals/SMC/inc
lib/Peripherals/MRAM/inc
lib/Peripherals/MRAM/src
lib/Peripherals/LCL/inc
lib/Peripherals/NANDFlash/inc
lib/Peripherals/NANDFlash/MT29F_Nand_Driver_Micron
lib/Peripherals/NANDFlash/src
lib/Peripherals/COBS
lib/Peripherals/ADM
lib/Peripherals/LittleFS/inc
lib/Peripherals/PeakSat_HAL/I2C_HAL/inc
lib/Peripherals/EPS/inc
)
# Show and add GitHash to code
include(CheckGit.cmake)
CheckGitSetup()
# Source files
file(GLOB_RECURSE DRIVER_SOURCES
"lib/Peripherals/MCP9808/*.cpp"
"lib/Peripherals/LCL/*.cpp"
"lib/Peripherals/NANDFlash/*.cpp"
"lib/Peripherals/MRAM/*.cpp"
"lib/Peripherals/EPS/*.cpp"
"lib/Peripherals/LittleFS/*.c"
"lib/SEGGER/RTT/*.c"
)
file(GLOB_RECURSE SOURCES "src/*.c" "src/*.cpp" "AutoGenerated.X/*.c")
file(GLOB_RECURSE FREERTOS_SOURCES "lib/FreeRTOS/*.c")
file(GLOB_RECURSE ECSS_SOURCES "lib/ECSS/src/*.cpp" "lib/ECSS/src/Helpers/*.cpp" "lib/ECSS/src/Services/*.cpp" "lib/ECSS/src/Time/*.cpp")
file(GLOB_RECURSE EXTRA_SOURCES "lib/Peripherals/COBS/cobs.c" "lib/Peripherals/COBS/cobsr.c")
# Build the executable
add_executable(${PROJECT_NAME}.elf
${SOURCES}
${LINKER_SCRIPT}
${FREERTOS_SOURCES}
${ECSS_SOURCES}
${DRIVER_SOURCES}
${EXTRA_SOURCES}
)
# Link libraries
target_link_libraries(${PROJECT_NAME}.elf PRIVATE etl log_common git_version)
# Set linker flags
set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS_INIT} -Wl,-Map=${PROJECT_BINARY_DIR}/${PROJECT_NAME}.map"
)
# Compiler definitions
add_compile_definitions(LOGLEVEL_TRACE)