-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChibiOS3_HAL.cmake
211 lines (196 loc) · 5.71 KB
/
ChibiOS3_HAL.cmake
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
SET(CHIBIOS_HAL_LIB_MODULES chprintf memstreams nullstreams)
SET(CHIBIOS_HAL_MODULES adc can dac ext gpt i2c i2s icu mac mmc_spi mmcsd pal pwm rtc sdc serial serial_usb hal_buffers spi st uart usb)
IF(${CHIBIOS_KERNEL} STREQUAL nil)
SET(CHIBIOS_OSAL_PATH ${CHIBIOS_ROOT}/os/hal/osal/nil)
ELSE()
SET(CHIBIOS_OSAL_PATH ${CHIBIOS_ROOT}/os/hal/osal/rt)
ENDIF()
SET(CHIBIOS_hal_SEARCH_PATH ${CHIBIOS_ROOT}/os/hal/include ${CHIBIOS_ROOT}/os/hal/src/ ${CHIBIOS_OSAL_PATH})
SET(CHIBIOS_hal_SEARCH_HEADERS hal.h osal.h)
SET(CHIBIOS_hal_SOURCES hal.c hal_queues.c osal.c)
FOREACH(module ${CHIBIOS_HAL_MODULES})
IF(${module} STREQUAL "hal_buffers")
MESSAGE(STATUS "hal_buffers is not supported, but it is a do not care, so we do not care")
ELSE()
SET(CHIBIOS_${module}_SEARCH_PATH ${CHIBIOS_ROOT}/os/hal/include ${CHIBIOS_ROOT}/os/hal/src)
SET(CHIBIOS_${module}_SOURCES ${module}.c)
SET(CHIBIOS_${module}_SEARCH_HEADERS ${module}.h)
ENDIF()
IF(${module} STREQUAL mmcsd)
SET(CHIBIOS_${module}_SOURCES hal_mmcsd.c)
ENDIF()
ENDFOREACH()
FOREACH(module ${CHIBIOS_HAL_LIB_MODULES})
SET(CHIBIOS_${module}_SEARCH_PATH ${CHIBIOS_ROOT}/os/hal/lib/streams)
SET(CHIBIOS_${module}_SOURCES ${module}.c)
SET(CHIBIOS_${module}_SEARCH_HEADERS ${module}.h)
ENDFOREACH()
IF(STM32_FAMILY STREQUAL "F1")
SET(CHIBIOS_HAL_PLATFORM_MODULES adc can ext gpt i2c i2s icu mac pal pwm rtc sdc serial spi st uart usb)
SET(CHIBIOS_HAL_PLATFORM_MODULES_PATHES
STM32F1xx
LLD
LLD
LLD/TIMv1
LLD/I2Cv1
LLD/SPIv1
LLD/TIMv1
LLD
LLD/GPIOv1
LLD/TIMv1
LLD/RTCv1
LLD
LLD/USARTv1
LLD/SPIv1
LLD/TIMv1
LLD/USARTv1
LLD/USBv1
)
SET(CHIBIOS_hal_PLATFORM_SEARCH_PATH
${CHIBIOS_ROOT}/os/hal/ports/common/ARMCMx
${CHIBIOS_ROOT}/os/hal/ports/STM32/STM32F1xx
${CHIBIOS_ROOT}/os/hal/ports/STM32
)
SET(CHIBIOS_hal_PLATFORM_SEARCH_HEADERS
hal_lld.h
stm32_dma.h
nvic.h
)
SET(CHIBIOS_hal_PLATFORM_SOURCES
hal_lld.c
stm32_dma.c
nvic.c
)
ELSEIF(STM32_FAMILY STREQUAL "F3")
IF(STM32_CHIP STREQUAL "STM32F373CB")
SET(CHIBIOS_HAL_PLATFORM_MODULES adc can dac ext gpt i2c i2s icu mac pal pwm rtc sdc serial spi st uart usb)
SET(CHIBIOS_HAL_PLATFORM_MODULES_PATHES
STM32F37x
LLD
LLD/DACv1
LLD
LLD/TIMv1
LLD/I2Cv2
LLD/SPIv2
LLD/TIMv1
LLD
LLD/GPIOv2
LLD/TIMv1
LLD/RTCv2
LLD
LLD/USARTv2
LLD/SPIv2
LLD/TIMv1
LLD/USARTv2
LLD/USBv1
)
SET(CHIBIOS_hal_PLATFORM_SEARCH_PATH
${CHIBIOS_ROOT}/os/hal/ports/common/ARMCMx
${CHIBIOS_ROOT}/os/hal/ports/STM32/STM32F37x
${CHIBIOS_ROOT}/os/hal/ports/STM32
${CHIBIOS_ROOT}/os/hal/ports/STM32/LLD/DMAv2
)
SET(CHIBIOS_hal_PLATFORM_SEARCH_HEADERS
hal_lld.h
stm32_dma.h
nvic.h
ext_lld_isr.h
)
SET(CHIBIOS_hal_PLATFORM_SOURCES
hal_lld.c
stm32_dma.c
nvic.c
ext_lld_isr.c
)
ELSE()
SET(CHIBIOS_HAL_PLATFORM_MODULES adc can dac ext gpt i2c i2s icu mac pal pwm rtc sdc serial spi st uart usb)
SET(CHIBIOS_HAL_PLATFORM_MODULES_PATHES
STM32F3xx
LLD
LLD/DACv1
LLD
LLD/TIMv1
LLD/I2Cv2
LLD/SPIv2
LLD/TIMv1
LLD
LLD/GPIOv2
LLD/TIMv1
LLD/RTCv2
LLD
LLD/USARTv2
LLD/SPIv2
LLD/TIMv1
LLD/USARTv2
LLD/USBv1
)
SET(CHIBIOS_hal_PLATFORM_SEARCH_PATH
${CHIBIOS_ROOT}/os/hal/ports/common/ARMCMx
${CHIBIOS_ROOT}/os/hal/ports/STM32/STM32F3xx
${CHIBIOS_ROOT}/os/hal/ports/STM32
${CHIBIOS_ROOT}/os/hal/ports/STM32/LLD/DMAv2
)
SET(CHIBIOS_hal_PLATFORM_SEARCH_HEADERS
hal_lld.h
stm32_dma.h
nvic.h
)
SET(CHIBIOS_hal_PLATFORM_SOURCES
hal_lld.c
stm32_dma.c
nvic.c
)
ENDIF()
ELSEIF(STM32_FAMILY STREQUAL "F4")
SET(CHIBIOS_HAL_PLATFORM_MODULES adc can dac ext gpt i2c i2s icu mac pal pwm rtc sdc serial spi st uart usb)
SET(CHIBIOS_HAL_PLATFORM_MODULES_PATHES
STM32F4xx
LLD
LLD/DACv1
LLD
LLD/TIMv1
LLD/I2Cv1
LLD/SPIv1
LLD/TIMv1
LLD
LLD/GPIOv2
LLD/TIMv1
LLD/RTCv2
LLD
LLD/USARTv1
LLD/SPIv1
LLD/TIMv1
LLD/USARTv1
LLD/OTGv1
)
SET(CHIBIOS_hal_PLATFORM_SEARCH_PATH
${CHIBIOS_ROOT}/os/hal/ports/common/ARMCMx
${CHIBIOS_ROOT}/os/hal/ports/STM32/STM32F4xx
${CHIBIOS_ROOT}/os/hal/ports/STM32
${CHIBIOS_ROOT}/os/hal/ports/STM32/LLD/DMAv2
)
SET(CHIBIOS_hal_PLATFORM_SEARCH_HEADERS
hal_lld.h
stm32_dma.h
nvic.h
)
SET(CHIBIOS_hal_PLATFORM_SOURCES
hal_lld.c
stm32_dma.c
nvic.c
)
ENDIF()
SET(INDEX 0)
FOREACH(module ${CHIBIOS_HAL_PLATFORM_MODULES})
LIST(GET CHIBIOS_HAL_PLATFORM_MODULES_PATHES ${INDEX} path)
SET(CHIBIOS_${module}_PLATFORM_SEARCH_PATH ${CHIBIOS_ROOT}/os/hal/ports/STM32/${path})
SET(CHIBIOS_${module}_PLATFORM_SEARCH_HEADERS ${module}_lld.h)
SET(CHIBIOS_${module}_PLATFORM_SOURCES ${module}_lld.c)
IF(${module} STREQUAL ext)
LIST(GET CHIBIOS_HAL_PLATFORM_MODULES_PATHES 0 path2)
SET(CHIBIOS_${module}_PLATFORM_SEARCH_PATH ${CHIBIOS_ext_PLATFORM_SEARCH_PATH} ${CHIBIOS_ROOT}/os/hal/ports/STM32/${path2})
SET(CHIBIOS_${module}_PLATFORM_SEARCH_HEADERS ${CHIBIOS_ext_PLATFORM_SEARCH_HEADERS} ext_lld_isr.h)
SET(CHIBIOS_${module}_PLATFORM_SOURCES ${CHIBIOS_ext_PLATFORM_SOURCES} ext_lld_isr.c)
ENDIF()
MATH(EXPR INDEX "${INDEX} + 1")
ENDFOREACH()