forked from adolfogc/stg-8nn-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists_stm32cube.txt
256 lines (244 loc) · 8.53 KB
/
CMakeLists_stm32cube.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# Copyright (C) 2018-2019 Adolfo E. García
#
# This file is part of STG-8nn-Scaffold.
#
# STG-8nn-Scaffold is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# STG-8nn-Scaffold is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with STG-8nn-Scaffold. If not, see <https://www.gnu.org/licenses/>.
if(DEFINED SCAFFOLD_DIR)
set(STM32CUBE_DIR ${SCAFFOLD_DIR}/dependencies/stm32cube)
else()
set(STM32CUBE_DIR dependencies/stm32cube)
endif()
##
## Add dependency: CMSIS device files (stm32cube's)
##
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/cmsis/device/include/stm32f0xx.h
${STM32CUBE_DIR}/cmsis/device/include/stm32f091xc.h
${STM32CUBE_DIR}/cmsis/device/include/system_stm32f0xx.h
${STM32CUBE_DIR}/cmsis/device/src/system_stm32f0xx.c
)
##
## Select the STM32 HAL modules to be used
##
if("${STG_MODEL}" MATCHES "850" OR "${STG_MODEL}" MATCHES "856")
set(USE_HAL TRUE)
set(USE_HAL_ADC FALSE)
set(USE_HAL_CAN FALSE)
set(USE_HAL_IWDG FALSE)
set(USE_HAL_RTC FALSE)
set(USE_HAL_TIM FALSE)
set(USE_HAL_UART FALSE)
set(USE_HAL_IRDA FALSE)
set(USE_HAL_CORTEX TRUE)
set(USE_HAL_DMA FALSE)
set(USE_HAL_FLASH TRUE)
set(USE_HAL_GPIO TRUE)
set(USE_HAL_PWR FALSE)
set(USE_HAL_RCC TRUE)
set(USE_HAL_I2C FALSE)
set(USE_HAL_CRC FALSE)
set(USE_HAL_WWDG FALSE)
endif()
##
## Add dependency: HAL and LL drivers (stm32cube's)
##
set(STM32CUBE_INCLUDE
${STM32CUBE_DIR}/cmsis/device/include
${STM32CUBE_DIR}/hal/include
${STM32CUBE_DIR}/ll/include
)
###
### LL drivers
###
add_definitions(-DUSE_FULL_LL_DRIVER) # enable LL initialization functions and associated resources
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_adc.h
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_bus.h
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_comp.h
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_cortex.h
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_crc.h
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_crs.h
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_dma.h
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_exti.h
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_gpio.h
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_i2c.h
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_iwdg.h
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_pwr.h
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_rcc.h
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_rtc.h
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_system.h
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_tim.h
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_usart.h
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_utils.h
${STM32CUBE_DIR}/ll/include/stm32f0xx_ll_wwdg.h
${STM32CUBE_DIR}/ll/src/stm32f0xx_ll_adc.c
${STM32CUBE_DIR}/ll/src/stm32f0xx_ll_comp.c
${STM32CUBE_DIR}/ll/src/stm32f0xx_ll_crc.c
${STM32CUBE_DIR}/ll/src/stm32f0xx_ll_crs.c
${STM32CUBE_DIR}/ll/src/stm32f0xx_ll_dma.c
${STM32CUBE_DIR}/ll/src/stm32f0xx_ll_exti.c
${STM32CUBE_DIR}/ll/src/stm32f0xx_ll_gpio.c
${STM32CUBE_DIR}/ll/src/stm32f0xx_ll_i2c.c
${STM32CUBE_DIR}/ll/src/stm32f0xx_ll_pwr.c
${STM32CUBE_DIR}/ll/src/stm32f0xx_ll_rcc.c
${STM32CUBE_DIR}/ll/src/stm32f0xx_ll_rtc.c
${STM32CUBE_DIR}/ll/src/stm32f0xx_ll_tim.c
${STM32CUBE_DIR}/ll/src/stm32f0xx_ll_usart.c
${STM32CUBE_DIR}/ll/src/stm32f0xx_ll_utils.c
)
###
### HAL
###
if(USE_HAL)
add_definitions(-DHAL_MODULE_ENABLED)
add_definitions(-DUSE_RTOS=0)
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_def.h
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal.h
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal.c
)
if(USE_HAL_ADC)
add_definitions(-DHAL_ADC_MODULE_ENABLED)
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_adc_ex.h
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_adc.h
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_adc_ex.c
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_adc.c
)
endif()
if(USE_HAL_CAN)
add_definitions(-DHAL_CAN_MODULE_ENABLED)
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_can.h
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_can.c
)
endif()
if(USE_HAL_CRC)
add_definitions(-DHAL_CRC_MODULE_ENABLED)
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_crc_ex.h
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_crc.h
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_crc_ex.c
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_crc.c
)
endif()
if(USE_HAL_IWDG)
add_definitions(-DHAL_IWDG_MODULE_ENABLED)
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_iwdg.h
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_iwdg.c
)
endif()
if(USE_HAL_RTC)
add_definitions(-DHAL_RTC_MODULE_ENABLED)
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_rtc_ex.h
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_rtc.h
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_rtc_ex.c
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_rtc.c
)
endif()
if(USE_HAL_TIM)
add_definitions(-DHAL_TIM_MODULE_ENABLED)
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_tim_ex.h
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_tim.h
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_tim_ex.c
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_tim.c
)
endif()
if(USE_HAL_UART)
add_definitions(-DHAL_UART_MODULE_ENABLED)
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_uart_ex.h
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_uart.h
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_uart_ex.c
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_uart.c
)
endif()
if(USE_HAL_IRDA)
add_definitions(-DHAL_IRDA_MODULE_ENABLED)
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_irda_ex.h
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_irda.h
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_irda.c
)
endif()
if(USE_HAL_CORTEX)
add_definitions(-DHAL_CORTEX_MODULE_ENABLED)
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_cortex.h
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_cortex.c
)
endif()
if(USE_HAL_DMA)
add_definitions(-DHAL_DMA_MODULE_ENABLED)
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_dma_ex.h
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_dma.h
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_dma.c
)
endif()
if(USE_HAL_FLASH)
add_definitions(-DHAL_FLASH_MODULE_ENABLED)
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_flash_ex.h
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_flash.h
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_flash_ex.c
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_flash.c
)
endif()
if(USE_HAL_GPIO)
add_definitions(-DHAL_GPIO_MODULE_ENABLED)
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_gpio_ex.h
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_gpio.h
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_gpio.c
)
endif()
if(USE_HAL_PWR)
add_definitions(-DHAL_PWR_MODULE_ENABLED)
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_pwr_ex.h
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_pwr.h
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_pwr_ex.c
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_pwr.c
)
endif()
if(USE_HAL_RCC)
add_definitions(-DHAL_RCC_MODULE_ENABLED)
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_rcc_ex.h
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_rcc.h
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_rcc_ex.c
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_rcc.c
)
endif()
if(USE_HAL_I2C)
add_definitions(-DHAL_I2C_MODULE_ENABLED)
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_i2c_ex.h
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_i2c.h
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_i2c_ex.c
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_i2c.c
)
endif()
if(USE_HAL_WWDG)
add_definitions(-DHAL_WWDG_MODULE_ENABLED)
list(APPEND STM32CUBE_SOURCES
${STM32CUBE_DIR}/hal/include/stm32f0xx_hal_wwdg.h
${STM32CUBE_DIR}/hal/src/stm32f0xx_hal_wwdg.c
)
endif()
endif()