diff options
Diffstat (limited to 'lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY')
6 files changed, 1221 insertions, 0 deletions
diff --git a/lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY/Makefile b/lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY/Makefile new file mode 100644 index 000000000..6808beea1 --- /dev/null +++ b/lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY/Makefile | |||
@@ -0,0 +1,189 @@ | |||
1 | ############################################################################## | ||
2 | # Build global options | ||
3 | # NOTE: Can be overridden externally. | ||
4 | # | ||
5 | |||
6 | # Compiler options here. | ||
7 | ifeq ($(USE_OPT),) | ||
8 | USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 | ||
9 | endif | ||
10 | |||
11 | # C specific options here (added to USE_OPT). | ||
12 | ifeq ($(USE_COPT),) | ||
13 | USE_COPT = | ||
14 | endif | ||
15 | |||
16 | # C++ specific options here (added to USE_OPT). | ||
17 | ifeq ($(USE_CPPOPT),) | ||
18 | USE_CPPOPT = -fno-rtti | ||
19 | endif | ||
20 | |||
21 | # Enable this if you want the linker to remove unused code and data. | ||
22 | ifeq ($(USE_LINK_GC),) | ||
23 | USE_LINK_GC = yes | ||
24 | endif | ||
25 | |||
26 | # Linker extra options here. | ||
27 | ifeq ($(USE_LDOPT),) | ||
28 | USE_LDOPT = | ||
29 | endif | ||
30 | |||
31 | # Enable this if you want link time optimizations (LTO). | ||
32 | ifeq ($(USE_LTO),) | ||
33 | USE_LTO = yes | ||
34 | endif | ||
35 | |||
36 | # Enable this if you want to see the full log while compiling. | ||
37 | ifeq ($(USE_VERBOSE_COMPILE),) | ||
38 | USE_VERBOSE_COMPILE = no | ||
39 | endif | ||
40 | |||
41 | # If enabled, this option makes the build process faster by not compiling | ||
42 | # modules not used in the current configuration. | ||
43 | ifeq ($(USE_SMART_BUILD),) | ||
44 | USE_SMART_BUILD = yes | ||
45 | endif | ||
46 | |||
47 | # | ||
48 | # Build global options | ||
49 | ############################################################################## | ||
50 | |||
51 | ############################################################################## | ||
52 | # Architecture or project specific options | ||
53 | # | ||
54 | |||
55 | # Stack size to be allocated to the Cortex-M process stack. This stack is | ||
56 | # the stack used by the main() thread. | ||
57 | ifeq ($(USE_PROCESS_STACKSIZE),) | ||
58 | USE_PROCESS_STACKSIZE = 0x400 | ||
59 | endif | ||
60 | |||
61 | # Stack size to the allocated to the Cortex-M main/exceptions stack. This | ||
62 | # stack is used for processing interrupts and exceptions. | ||
63 | ifeq ($(USE_EXCEPTIONS_STACKSIZE),) | ||
64 | USE_EXCEPTIONS_STACKSIZE = 0x400 | ||
65 | endif | ||
66 | |||
67 | # Enables the use of FPU (no, softfp, hard). | ||
68 | ifeq ($(USE_FPU),) | ||
69 | USE_FPU = no | ||
70 | endif | ||
71 | |||
72 | # FPU-related options. | ||
73 | ifeq ($(USE_FPU_OPT),) | ||
74 | USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16 | ||
75 | endif | ||
76 | |||
77 | # | ||
78 | # Architecture or project specific options | ||
79 | ############################################################################## | ||
80 | |||
81 | ############################################################################## | ||
82 | # Project, target, sources and paths | ||
83 | # | ||
84 | |||
85 | # Define project name here | ||
86 | PROJECT = ch | ||
87 | |||
88 | # Target settings. | ||
89 | MCU = cortex-m4 | ||
90 | |||
91 | # Imported source files and paths. | ||
92 | CHIBIOS := ../../.. | ||
93 | CONFDIR := ./cfg | ||
94 | BUILDDIR := ./build | ||
95 | DEPDIR := ./.dep | ||
96 | |||
97 | # Licensing files. | ||
98 | include $(CHIBIOS)/os/license/license.mk | ||
99 | # Startup files. | ||
100 | include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk | ||
101 | # HAL-OSAL files (optional). | ||
102 | include $(CHIBIOS)/os/hal/hal.mk | ||
103 | include $(CHIBIOS)/os/hal/ports/STM32/STM32F4xx/platform.mk | ||
104 | include $(CHIBIOS)/os/hal/boards/ST_STM32F4_DISCOVERY/board.mk | ||
105 | include $(CHIBIOS)/os/hal/osal/os-less/ARMCMx/osal.mk | ||
106 | # RTOS files (optional). | ||
107 | #include $(CHIBIOS)/os/rt/rt.mk | ||
108 | #include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk | ||
109 | # Auto-build files in ./source recursively. | ||
110 | include $(CHIBIOS)/tools/mk/autobuild.mk | ||
111 | # Other files (optional). | ||
112 | #include $(CHIBIOS)/test/lib/test.mk | ||
113 | #include $(CHIBIOS)/test/rt/rt_test.mk | ||
114 | #include $(CHIBIOS)/test/oslib/oslib_test.mk | ||
115 | |||
116 | # Define linker script file here | ||
117 | LDSCRIPT= $(STARTUPLD)/STM32F407xG.ld | ||
118 | |||
119 | # C sources that can be compiled in ARM or THUMB mode depending on the global | ||
120 | # setting. | ||
121 | CSRC = $(ALLCSRC) \ | ||
122 | $(TESTSRC) \ | ||
123 | main.c | ||
124 | |||
125 | # C++ sources that can be compiled in ARM or THUMB mode depending on the global | ||
126 | # setting. | ||
127 | CPPSRC = $(ALLCPPSRC) | ||
128 | |||
129 | # List ASM source files here. | ||
130 | ASMSRC = $(ALLASMSRC) | ||
131 | |||
132 | # List ASM with preprocessor source files here. | ||
133 | ASMXSRC = $(ALLXASMSRC) | ||
134 | |||
135 | # Inclusion directories. | ||
136 | INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC) | ||
137 | |||
138 | # Define C warning options here. | ||
139 | CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes | ||
140 | |||
141 | # Define C++ warning options here. | ||
142 | CPPWARN = -Wall -Wextra -Wundef | ||
143 | |||
144 | # | ||
145 | # Project, target, sources and paths | ||
146 | ############################################################################## | ||
147 | |||
148 | ############################################################################## | ||
149 | # Start of user section | ||
150 | # | ||
151 | |||
152 | # List all user C define here, like -D_DEBUG=1 | ||
153 | UDEFS = | ||
154 | |||
155 | # Define ASM defines here | ||
156 | UADEFS = | ||
157 | |||
158 | # List all user directories here | ||
159 | UINCDIR = | ||
160 | |||
161 | # List the user directory to look for the libraries here | ||
162 | ULIBDIR = | ||
163 | |||
164 | # List all user libraries here | ||
165 | ULIBS = | ||
166 | |||
167 | # | ||
168 | # End of user section | ||
169 | ############################################################################## | ||
170 | |||
171 | ############################################################################## | ||
172 | # Common rules | ||
173 | # | ||
174 | |||
175 | RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk | ||
176 | include $(RULESPATH)/arm-none-eabi.mk | ||
177 | include $(RULESPATH)/rules.mk | ||
178 | |||
179 | # | ||
180 | # Common rules | ||
181 | ############################################################################## | ||
182 | |||
183 | ############################################################################## | ||
184 | # Custom rules | ||
185 | # | ||
186 | |||
187 | # | ||
188 | # Custom rules | ||
189 | ############################################################################## | ||
diff --git a/lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY/cfg/halconf.h b/lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY/cfg/halconf.h new file mode 100644 index 000000000..5e342d8c6 --- /dev/null +++ b/lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY/cfg/halconf.h | |||
@@ -0,0 +1,531 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /** | ||
18 | * @file templates/halconf.h | ||
19 | * @brief HAL configuration header. | ||
20 | * @details HAL configuration file, this file allows to enable or disable the | ||
21 | * various device drivers from your application. You may also use | ||
22 | * this file in order to override the device drivers default settings. | ||
23 | * | ||
24 | * @addtogroup HAL_CONF | ||
25 | * @{ | ||
26 | */ | ||
27 | |||
28 | #ifndef HALCONF_H | ||
29 | #define HALCONF_H | ||
30 | |||
31 | #define _CHIBIOS_HAL_CONF_ | ||
32 | #define _CHIBIOS_HAL_CONF_VER_7_1_ | ||
33 | |||
34 | #include "mcuconf.h" | ||
35 | |||
36 | /** | ||
37 | * @brief Enables the PAL subsystem. | ||
38 | */ | ||
39 | #if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) | ||
40 | #define HAL_USE_PAL TRUE | ||
41 | #endif | ||
42 | |||
43 | /** | ||
44 | * @brief Enables the ADC subsystem. | ||
45 | */ | ||
46 | #if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) | ||
47 | #define HAL_USE_ADC FALSE | ||
48 | #endif | ||
49 | |||
50 | /** | ||
51 | * @brief Enables the CAN subsystem. | ||
52 | */ | ||
53 | #if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) | ||
54 | #define HAL_USE_CAN FALSE | ||
55 | #endif | ||
56 | |||
57 | /** | ||
58 | * @brief Enables the cryptographic subsystem. | ||
59 | */ | ||
60 | #if !defined(HAL_USE_CRY) || defined(__DOXYGEN__) | ||
61 | #define HAL_USE_CRY FALSE | ||
62 | #endif | ||
63 | |||
64 | /** | ||
65 | * @brief Enables the DAC subsystem. | ||
66 | */ | ||
67 | #if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) | ||
68 | #define HAL_USE_DAC FALSE | ||
69 | #endif | ||
70 | |||
71 | /** | ||
72 | * @brief Enables the EFlash subsystem. | ||
73 | */ | ||
74 | #if !defined(HAL_USE_EFL) || defined(__DOXYGEN__) | ||
75 | #define HAL_USE_EFL FALSE | ||
76 | #endif | ||
77 | |||
78 | /** | ||
79 | * @brief Enables the GPT subsystem. | ||
80 | */ | ||
81 | #if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) | ||
82 | #define HAL_USE_GPT FALSE | ||
83 | #endif | ||
84 | |||
85 | /** | ||
86 | * @brief Enables the I2C subsystem. | ||
87 | */ | ||
88 | #if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) | ||
89 | #define HAL_USE_I2C FALSE | ||
90 | #endif | ||
91 | |||
92 | /** | ||
93 | * @brief Enables the I2S subsystem. | ||
94 | */ | ||
95 | #if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) | ||
96 | #define HAL_USE_I2S FALSE | ||
97 | #endif | ||
98 | |||
99 | /** | ||
100 | * @brief Enables the ICU subsystem. | ||
101 | */ | ||
102 | #if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) | ||
103 | #define HAL_USE_ICU FALSE | ||
104 | #endif | ||
105 | |||
106 | /** | ||
107 | * @brief Enables the MAC subsystem. | ||
108 | */ | ||
109 | #if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) | ||
110 | #define HAL_USE_MAC FALSE | ||
111 | #endif | ||
112 | |||
113 | /** | ||
114 | * @brief Enables the MMC_SPI subsystem. | ||
115 | */ | ||
116 | #if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) | ||
117 | #define HAL_USE_MMC_SPI FALSE | ||
118 | #endif | ||
119 | |||
120 | /** | ||
121 | * @brief Enables the PWM subsystem. | ||
122 | */ | ||
123 | #if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) | ||
124 | #define HAL_USE_PWM FALSE | ||
125 | #endif | ||
126 | |||
127 | /** | ||
128 | * @brief Enables the RTC subsystem. | ||
129 | */ | ||
130 | #if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) | ||
131 | #define HAL_USE_RTC FALSE | ||
132 | #endif | ||
133 | |||
134 | /** | ||
135 | * @brief Enables the SDC subsystem. | ||
136 | */ | ||
137 | #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) | ||
138 | #define HAL_USE_SDC FALSE | ||
139 | #endif | ||
140 | |||
141 | /** | ||
142 | * @brief Enables the SERIAL subsystem. | ||
143 | */ | ||
144 | #if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) | ||
145 | #define HAL_USE_SERIAL TRUE | ||
146 | #endif | ||
147 | |||
148 | /** | ||
149 | * @brief Enables the SERIAL over USB subsystem. | ||
150 | */ | ||
151 | #if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) | ||
152 | #define HAL_USE_SERIAL_USB FALSE | ||
153 | #endif | ||
154 | |||
155 | /** | ||
156 | * @brief Enables the SIO subsystem. | ||
157 | */ | ||
158 | #if !defined(HAL_USE_SIO) || defined(__DOXYGEN__) | ||
159 | #define HAL_USE_SIO FALSE | ||
160 | #endif | ||
161 | |||
162 | /** | ||
163 | * @brief Enables the SPI subsystem. | ||
164 | */ | ||
165 | #if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) | ||
166 | #define HAL_USE_SPI FALSE | ||
167 | #endif | ||
168 | |||
169 | /** | ||
170 | * @brief Enables the TRNG subsystem. | ||
171 | */ | ||
172 | #if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__) | ||
173 | #define HAL_USE_TRNG FALSE | ||
174 | #endif | ||
175 | |||
176 | /** | ||
177 | * @brief Enables the UART subsystem. | ||
178 | */ | ||
179 | #if !defined(HAL_USE_UART) || defined(__DOXYGEN__) | ||
180 | #define HAL_USE_UART FALSE | ||
181 | #endif | ||
182 | |||
183 | /** | ||
184 | * @brief Enables the USB subsystem. | ||
185 | */ | ||
186 | #if !defined(HAL_USE_USB) || defined(__DOXYGEN__) | ||
187 | #define HAL_USE_USB FALSE | ||
188 | #endif | ||
189 | |||
190 | /** | ||
191 | * @brief Enables the WDG subsystem. | ||
192 | */ | ||
193 | #if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) | ||
194 | #define HAL_USE_WDG FALSE | ||
195 | #endif | ||
196 | |||
197 | /** | ||
198 | * @brief Enables the WSPI subsystem. | ||
199 | */ | ||
200 | #if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__) | ||
201 | #define HAL_USE_WSPI FALSE | ||
202 | #endif | ||
203 | |||
204 | /*===========================================================================*/ | ||
205 | /* PAL driver related settings. */ | ||
206 | /*===========================================================================*/ | ||
207 | |||
208 | /** | ||
209 | * @brief Enables synchronous APIs. | ||
210 | * @note Disabling this option saves both code and data space. | ||
211 | */ | ||
212 | #if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__) | ||
213 | #define PAL_USE_CALLBACKS FALSE | ||
214 | #endif | ||
215 | |||
216 | /** | ||
217 | * @brief Enables synchronous APIs. | ||
218 | * @note Disabling this option saves both code and data space. | ||
219 | */ | ||
220 | #if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__) | ||
221 | #define PAL_USE_WAIT FALSE | ||
222 | #endif | ||
223 | |||
224 | /*===========================================================================*/ | ||
225 | /* ADC driver related settings. */ | ||
226 | /*===========================================================================*/ | ||
227 | |||
228 | /** | ||
229 | * @brief Enables synchronous APIs. | ||
230 | * @note Disabling this option saves both code and data space. | ||
231 | */ | ||
232 | #if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) | ||
233 | #define ADC_USE_WAIT TRUE | ||
234 | #endif | ||
235 | |||
236 | /** | ||
237 | * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. | ||
238 | * @note Disabling this option saves both code and data space. | ||
239 | */ | ||
240 | #if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
241 | #define ADC_USE_MUTUAL_EXCLUSION TRUE | ||
242 | #endif | ||
243 | |||
244 | /*===========================================================================*/ | ||
245 | /* CAN driver related settings. */ | ||
246 | /*===========================================================================*/ | ||
247 | |||
248 | /** | ||
249 | * @brief Sleep mode related APIs inclusion switch. | ||
250 | */ | ||
251 | #if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) | ||
252 | #define CAN_USE_SLEEP_MODE TRUE | ||
253 | #endif | ||
254 | |||
255 | /** | ||
256 | * @brief Enforces the driver to use direct callbacks rather than OSAL events. | ||
257 | */ | ||
258 | #if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__) | ||
259 | #define CAN_ENFORCE_USE_CALLBACKS FALSE | ||
260 | #endif | ||
261 | |||
262 | /*===========================================================================*/ | ||
263 | /* CRY driver related settings. */ | ||
264 | /*===========================================================================*/ | ||
265 | |||
266 | /** | ||
267 | * @brief Enables the SW fall-back of the cryptographic driver. | ||
268 | * @details When enabled, this option, activates a fall-back software | ||
269 | * implementation for algorithms not supported by the underlying | ||
270 | * hardware. | ||
271 | * @note Fall-back implementations may not be present for all algorithms. | ||
272 | */ | ||
273 | #if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__) | ||
274 | #define HAL_CRY_USE_FALLBACK FALSE | ||
275 | #endif | ||
276 | |||
277 | /** | ||
278 | * @brief Makes the driver forcibly use the fall-back implementations. | ||
279 | */ | ||
280 | #if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__) | ||
281 | #define HAL_CRY_ENFORCE_FALLBACK FALSE | ||
282 | #endif | ||
283 | |||
284 | /*===========================================================================*/ | ||
285 | /* DAC driver related settings. */ | ||
286 | /*===========================================================================*/ | ||
287 | |||
288 | /** | ||
289 | * @brief Enables synchronous APIs. | ||
290 | * @note Disabling this option saves both code and data space. | ||
291 | */ | ||
292 | #if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__) | ||
293 | #define DAC_USE_WAIT TRUE | ||
294 | #endif | ||
295 | |||
296 | /** | ||
297 | * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs. | ||
298 | * @note Disabling this option saves both code and data space. | ||
299 | */ | ||
300 | #if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
301 | #define DAC_USE_MUTUAL_EXCLUSION TRUE | ||
302 | #endif | ||
303 | |||
304 | /*===========================================================================*/ | ||
305 | /* I2C driver related settings. */ | ||
306 | /*===========================================================================*/ | ||
307 | |||
308 | /** | ||
309 | * @brief Enables the mutual exclusion APIs on the I2C bus. | ||
310 | */ | ||
311 | #if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
312 | #define I2C_USE_MUTUAL_EXCLUSION TRUE | ||
313 | #endif | ||
314 | |||
315 | /*===========================================================================*/ | ||
316 | /* MAC driver related settings. */ | ||
317 | /*===========================================================================*/ | ||
318 | |||
319 | /** | ||
320 | * @brief Enables the zero-copy API. | ||
321 | */ | ||
322 | #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) | ||
323 | #define MAC_USE_ZERO_COPY FALSE | ||
324 | #endif | ||
325 | |||
326 | /** | ||
327 | * @brief Enables an event sources for incoming packets. | ||
328 | */ | ||
329 | #if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) | ||
330 | #define MAC_USE_EVENTS TRUE | ||
331 | #endif | ||
332 | |||
333 | /*===========================================================================*/ | ||
334 | /* MMC_SPI driver related settings. */ | ||
335 | /*===========================================================================*/ | ||
336 | |||
337 | /** | ||
338 | * @brief Delays insertions. | ||
339 | * @details If enabled this options inserts delays into the MMC waiting | ||
340 | * routines releasing some extra CPU time for the threads with | ||
341 | * lower priority, this may slow down the driver a bit however. | ||
342 | * This option is recommended also if the SPI driver does not | ||
343 | * use a DMA channel and heavily loads the CPU. | ||
344 | */ | ||
345 | #if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) | ||
346 | #define MMC_NICE_WAITING TRUE | ||
347 | #endif | ||
348 | |||
349 | /*===========================================================================*/ | ||
350 | /* SDC driver related settings. */ | ||
351 | /*===========================================================================*/ | ||
352 | |||
353 | /** | ||
354 | * @brief Number of initialization attempts before rejecting the card. | ||
355 | * @note Attempts are performed at 10mS intervals. | ||
356 | */ | ||
357 | #if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) | ||
358 | #define SDC_INIT_RETRY 100 | ||
359 | #endif | ||
360 | |||
361 | /** | ||
362 | * @brief Include support for MMC cards. | ||
363 | * @note MMC support is not yet implemented so this option must be kept | ||
364 | * at @p FALSE. | ||
365 | */ | ||
366 | #if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) | ||
367 | #define SDC_MMC_SUPPORT FALSE | ||
368 | #endif | ||
369 | |||
370 | /** | ||
371 | * @brief Delays insertions. | ||
372 | * @details If enabled this options inserts delays into the MMC waiting | ||
373 | * routines releasing some extra CPU time for the threads with | ||
374 | * lower priority, this may slow down the driver a bit however. | ||
375 | */ | ||
376 | #if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) | ||
377 | #define SDC_NICE_WAITING TRUE | ||
378 | #endif | ||
379 | |||
380 | /** | ||
381 | * @brief OCR initialization constant for V20 cards. | ||
382 | */ | ||
383 | #if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__) | ||
384 | #define SDC_INIT_OCR_V20 0x50FF8000U | ||
385 | #endif | ||
386 | |||
387 | /** | ||
388 | * @brief OCR initialization constant for non-V20 cards. | ||
389 | */ | ||
390 | #if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__) | ||
391 | #define SDC_INIT_OCR 0x80100000U | ||
392 | #endif | ||
393 | |||
394 | /*===========================================================================*/ | ||
395 | /* SERIAL driver related settings. */ | ||
396 | /*===========================================================================*/ | ||
397 | |||
398 | /** | ||
399 | * @brief Default bit rate. | ||
400 | * @details Configuration parameter, this is the baud rate selected for the | ||
401 | * default configuration. | ||
402 | */ | ||
403 | #if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) | ||
404 | #define SERIAL_DEFAULT_BITRATE 38400 | ||
405 | #endif | ||
406 | |||
407 | /** | ||
408 | * @brief Serial buffers size. | ||
409 | * @details Configuration parameter, you can change the depth of the queue | ||
410 | * buffers depending on the requirements of your application. | ||
411 | * @note The default is 16 bytes for both the transmission and receive | ||
412 | * buffers. | ||
413 | */ | ||
414 | #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) | ||
415 | #define SERIAL_BUFFERS_SIZE 16 | ||
416 | #endif | ||
417 | |||
418 | /*===========================================================================*/ | ||
419 | /* SERIAL_USB driver related setting. */ | ||
420 | /*===========================================================================*/ | ||
421 | |||
422 | /** | ||
423 | * @brief Serial over USB buffers size. | ||
424 | * @details Configuration parameter, the buffer size must be a multiple of | ||
425 | * the USB data endpoint maximum packet size. | ||
426 | * @note The default is 256 bytes for both the transmission and receive | ||
427 | * buffers. | ||
428 | */ | ||
429 | #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) | ||
430 | #define SERIAL_USB_BUFFERS_SIZE 256 | ||
431 | #endif | ||
432 | |||
433 | /** | ||
434 | * @brief Serial over USB number of buffers. | ||
435 | * @note The default is 2 buffers. | ||
436 | */ | ||
437 | #if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__) | ||
438 | #define SERIAL_USB_BUFFERS_NUMBER 2 | ||
439 | #endif | ||
440 | |||
441 | /*===========================================================================*/ | ||
442 | /* SPI driver related settings. */ | ||
443 | /*===========================================================================*/ | ||
444 | |||
445 | /** | ||
446 | * @brief Enables synchronous APIs. | ||
447 | * @note Disabling this option saves both code and data space. | ||
448 | */ | ||
449 | #if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) | ||
450 | #define SPI_USE_WAIT TRUE | ||
451 | #endif | ||
452 | |||
453 | /** | ||
454 | * @brief Enables circular transfers APIs. | ||
455 | * @note Disabling this option saves both code and data space. | ||
456 | */ | ||
457 | #if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__) | ||
458 | #define SPI_USE_CIRCULAR FALSE | ||
459 | #endif | ||
460 | |||
461 | /** | ||
462 | * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. | ||
463 | * @note Disabling this option saves both code and data space. | ||
464 | */ | ||
465 | #if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
466 | #define SPI_USE_MUTUAL_EXCLUSION TRUE | ||
467 | #endif | ||
468 | |||
469 | /** | ||
470 | * @brief Handling method for SPI CS line. | ||
471 | * @note Disabling this option saves both code and data space. | ||
472 | */ | ||
473 | #if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__) | ||
474 | #define SPI_SELECT_MODE SPI_SELECT_MODE_PAD | ||
475 | #endif | ||
476 | |||
477 | /*===========================================================================*/ | ||
478 | /* UART driver related settings. */ | ||
479 | /*===========================================================================*/ | ||
480 | |||
481 | /** | ||
482 | * @brief Enables synchronous APIs. | ||
483 | * @note Disabling this option saves both code and data space. | ||
484 | */ | ||
485 | #if !defined(UART_USE_WAIT) || defined(__DOXYGEN__) | ||
486 | #define UART_USE_WAIT FALSE | ||
487 | #endif | ||
488 | |||
489 | /** | ||
490 | * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs. | ||
491 | * @note Disabling this option saves both code and data space. | ||
492 | */ | ||
493 | #if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
494 | #define UART_USE_MUTUAL_EXCLUSION FALSE | ||
495 | #endif | ||
496 | |||
497 | /*===========================================================================*/ | ||
498 | /* USB driver related settings. */ | ||
499 | /*===========================================================================*/ | ||
500 | |||
501 | /** | ||
502 | * @brief Enables synchronous APIs. | ||
503 | * @note Disabling this option saves both code and data space. | ||
504 | */ | ||
505 | #if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) | ||
506 | #define USB_USE_WAIT FALSE | ||
507 | #endif | ||
508 | |||
509 | /*===========================================================================*/ | ||
510 | /* WSPI driver related settings. */ | ||
511 | /*===========================================================================*/ | ||
512 | |||
513 | /** | ||
514 | * @brief Enables synchronous APIs. | ||
515 | * @note Disabling this option saves both code and data space. | ||
516 | */ | ||
517 | #if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__) | ||
518 | #define WSPI_USE_WAIT TRUE | ||
519 | #endif | ||
520 | |||
521 | /** | ||
522 | * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs. | ||
523 | * @note Disabling this option saves both code and data space. | ||
524 | */ | ||
525 | #if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
526 | #define WSPI_USE_MUTUAL_EXCLUSION TRUE | ||
527 | #endif | ||
528 | |||
529 | #endif /* HALCONF_H */ | ||
530 | |||
531 | /** @} */ | ||
diff --git a/lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY/cfg/mcuconf.h b/lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY/cfg/mcuconf.h new file mode 100644 index 000000000..266229649 --- /dev/null +++ b/lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY/cfg/mcuconf.h | |||
@@ -0,0 +1,352 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef MCUCONF_H | ||
18 | #define MCUCONF_H | ||
19 | |||
20 | /* | ||
21 | * STM32F4xx drivers configuration. | ||
22 | * The following settings override the default settings present in | ||
23 | * the various device driver implementation headers. | ||
24 | * Note that the settings for each driver only have effect if the whole | ||
25 | * driver is enabled in halconf.h. | ||
26 | * | ||
27 | * IRQ priorities: | ||
28 | * 15...0 Lowest...Highest. | ||
29 | * | ||
30 | * DMA priorities: | ||
31 | * 0...3 Lowest...Highest. | ||
32 | */ | ||
33 | |||
34 | #define STM32F4xx_MCUCONF | ||
35 | #define STM32F405_MCUCONF | ||
36 | #define STM32F415_MCUCONF | ||
37 | #define STM32F407_MCUCONF | ||
38 | #define STM32F417_MCUCONF | ||
39 | |||
40 | /* | ||
41 | * HAL driver system settings. | ||
42 | */ | ||
43 | #define STM32_NO_INIT FALSE | ||
44 | #define STM32_PVD_ENABLE FALSE | ||
45 | #define STM32_PLS STM32_PLS_LEV0 | ||
46 | #define STM32_BKPRAM_ENABLE FALSE | ||
47 | #define STM32_HSI_ENABLED TRUE | ||
48 | #define STM32_LSI_ENABLED TRUE | ||
49 | #define STM32_HSE_ENABLED TRUE | ||
50 | #define STM32_LSE_ENABLED FALSE | ||
51 | #define STM32_CLOCK48_REQUIRED TRUE | ||
52 | #define STM32_SW STM32_SW_PLL | ||
53 | #define STM32_PLLSRC STM32_PLLSRC_HSE | ||
54 | #define STM32_PLLM_VALUE 8 | ||
55 | #define STM32_PLLN_VALUE 336 | ||
56 | #define STM32_PLLP_VALUE 2 | ||
57 | #define STM32_PLLQ_VALUE 7 | ||
58 | #define STM32_HPRE STM32_HPRE_DIV1 | ||
59 | #define STM32_PPRE1 STM32_PPRE1_DIV4 | ||
60 | #define STM32_PPRE2 STM32_PPRE2_DIV2 | ||
61 | #define STM32_RTCSEL STM32_RTCSEL_LSI | ||
62 | #define STM32_RTCPRE_VALUE 8 | ||
63 | #define STM32_MCO1SEL STM32_MCO1SEL_HSI | ||
64 | #define STM32_MCO1PRE STM32_MCO1PRE_DIV1 | ||
65 | #define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK | ||
66 | #define STM32_MCO2PRE STM32_MCO2PRE_DIV5 | ||
67 | #define STM32_I2SSRC STM32_I2SSRC_CKIN | ||
68 | #define STM32_PLLI2SN_VALUE 192 | ||
69 | #define STM32_PLLI2SR_VALUE 5 | ||
70 | |||
71 | /* | ||
72 | * IRQ system settings. | ||
73 | */ | ||
74 | #define STM32_IRQ_EXTI0_PRIORITY 6 | ||
75 | #define STM32_IRQ_EXTI1_PRIORITY 6 | ||
76 | #define STM32_IRQ_EXTI2_PRIORITY 6 | ||
77 | #define STM32_IRQ_EXTI3_PRIORITY 6 | ||
78 | #define STM32_IRQ_EXTI4_PRIORITY 6 | ||
79 | #define STM32_IRQ_EXTI5_9_PRIORITY 6 | ||
80 | #define STM32_IRQ_EXTI10_15_PRIORITY 6 | ||
81 | #define STM32_IRQ_EXTI16_PRIORITY 6 | ||
82 | #define STM32_IRQ_EXTI17_PRIORITY 15 | ||
83 | #define STM32_IRQ_EXTI18_PRIORITY 6 | ||
84 | #define STM32_IRQ_EXTI19_PRIORITY 6 | ||
85 | #define STM32_IRQ_EXTI20_PRIORITY 6 | ||
86 | #define STM32_IRQ_EXTI21_PRIORITY 15 | ||
87 | #define STM32_IRQ_EXTI22_PRIORITY 15 | ||
88 | |||
89 | /* | ||
90 | * ADC driver system settings. | ||
91 | */ | ||
92 | #define STM32_ADC_ADCPRE ADC_CCR_ADCPRE_DIV4 | ||
93 | #define STM32_ADC_USE_ADC1 FALSE | ||
94 | #define STM32_ADC_USE_ADC2 FALSE | ||
95 | #define STM32_ADC_USE_ADC3 FALSE | ||
96 | #define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 4) | ||
97 | #define STM32_ADC_ADC2_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) | ||
98 | #define STM32_ADC_ADC3_DMA_STREAM STM32_DMA_STREAM_ID(2, 1) | ||
99 | #define STM32_ADC_ADC1_DMA_PRIORITY 2 | ||
100 | #define STM32_ADC_ADC2_DMA_PRIORITY 2 | ||
101 | #define STM32_ADC_ADC3_DMA_PRIORITY 2 | ||
102 | #define STM32_ADC_IRQ_PRIORITY 6 | ||
103 | #define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 6 | ||
104 | #define STM32_ADC_ADC2_DMA_IRQ_PRIORITY 6 | ||
105 | #define STM32_ADC_ADC3_DMA_IRQ_PRIORITY 6 | ||
106 | |||
107 | /* | ||
108 | * CAN driver system settings. | ||
109 | */ | ||
110 | #define STM32_CAN_USE_CAN1 FALSE | ||
111 | #define STM32_CAN_USE_CAN2 FALSE | ||
112 | #define STM32_CAN_CAN1_IRQ_PRIORITY 11 | ||
113 | #define STM32_CAN_CAN2_IRQ_PRIORITY 11 | ||
114 | |||
115 | /* | ||
116 | * DAC driver system settings. | ||
117 | */ | ||
118 | #define STM32_DAC_DUAL_MODE FALSE | ||
119 | #define STM32_DAC_USE_DAC1_CH1 FALSE | ||
120 | #define STM32_DAC_USE_DAC1_CH2 FALSE | ||
121 | #define STM32_DAC_DAC1_CH1_IRQ_PRIORITY 10 | ||
122 | #define STM32_DAC_DAC1_CH2_IRQ_PRIORITY 10 | ||
123 | #define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2 | ||
124 | #define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2 | ||
125 | #define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) | ||
126 | #define STM32_DAC_DAC1_CH2_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) | ||
127 | |||
128 | /* | ||
129 | * GPT driver system settings. | ||
130 | */ | ||
131 | #define STM32_GPT_USE_TIM1 FALSE | ||
132 | #define STM32_GPT_USE_TIM2 FALSE | ||
133 | #define STM32_GPT_USE_TIM3 FALSE | ||
134 | #define STM32_GPT_USE_TIM4 FALSE | ||
135 | #define STM32_GPT_USE_TIM5 FALSE | ||
136 | #define STM32_GPT_USE_TIM6 FALSE | ||
137 | #define STM32_GPT_USE_TIM7 FALSE | ||
138 | #define STM32_GPT_USE_TIM8 FALSE | ||
139 | #define STM32_GPT_USE_TIM9 FALSE | ||
140 | #define STM32_GPT_USE_TIM11 FALSE | ||
141 | #define STM32_GPT_USE_TIM12 FALSE | ||
142 | #define STM32_GPT_USE_TIM14 FALSE | ||
143 | #define STM32_GPT_TIM1_IRQ_PRIORITY 7 | ||
144 | #define STM32_GPT_TIM2_IRQ_PRIORITY 7 | ||
145 | #define STM32_GPT_TIM3_IRQ_PRIORITY 7 | ||
146 | #define STM32_GPT_TIM4_IRQ_PRIORITY 7 | ||
147 | #define STM32_GPT_TIM5_IRQ_PRIORITY 7 | ||
148 | #define STM32_GPT_TIM6_IRQ_PRIORITY 7 | ||
149 | #define STM32_GPT_TIM7_IRQ_PRIORITY 7 | ||
150 | #define STM32_GPT_TIM8_IRQ_PRIORITY 7 | ||
151 | #define STM32_GPT_TIM9_IRQ_PRIORITY 7 | ||
152 | #define STM32_GPT_TIM11_IRQ_PRIORITY 7 | ||
153 | #define STM32_GPT_TIM12_IRQ_PRIORITY 7 | ||
154 | #define STM32_GPT_TIM14_IRQ_PRIORITY 7 | ||
155 | |||
156 | /* | ||
157 | * I2C driver system settings. | ||
158 | */ | ||
159 | #define STM32_I2C_USE_I2C1 FALSE | ||
160 | #define STM32_I2C_USE_I2C2 FALSE | ||
161 | #define STM32_I2C_USE_I2C3 FALSE | ||
162 | #define STM32_I2C_BUSY_TIMEOUT 50 | ||
163 | #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) | ||
164 | #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) | ||
165 | #define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) | ||
166 | #define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) | ||
167 | #define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) | ||
168 | #define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) | ||
169 | #define STM32_I2C_I2C1_IRQ_PRIORITY 5 | ||
170 | #define STM32_I2C_I2C2_IRQ_PRIORITY 5 | ||
171 | #define STM32_I2C_I2C3_IRQ_PRIORITY 5 | ||
172 | #define STM32_I2C_I2C1_DMA_PRIORITY 3 | ||
173 | #define STM32_I2C_I2C2_DMA_PRIORITY 3 | ||
174 | #define STM32_I2C_I2C3_DMA_PRIORITY 3 | ||
175 | #define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure") | ||
176 | |||
177 | /* | ||
178 | * I2S driver system settings. | ||
179 | */ | ||
180 | #define STM32_I2S_USE_SPI2 FALSE | ||
181 | #define STM32_I2S_USE_SPI3 FALSE | ||
182 | #define STM32_I2S_SPI2_IRQ_PRIORITY 10 | ||
183 | #define STM32_I2S_SPI3_IRQ_PRIORITY 10 | ||
184 | #define STM32_I2S_SPI2_DMA_PRIORITY 1 | ||
185 | #define STM32_I2S_SPI3_DMA_PRIORITY 1 | ||
186 | #define STM32_I2S_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) | ||
187 | #define STM32_I2S_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) | ||
188 | #define STM32_I2S_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) | ||
189 | #define STM32_I2S_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) | ||
190 | #define STM32_I2S_DMA_ERROR_HOOK(i2sp) osalSysHalt("DMA failure") | ||
191 | |||
192 | /* | ||
193 | * ICU driver system settings. | ||
194 | */ | ||
195 | #define STM32_ICU_USE_TIM1 FALSE | ||
196 | #define STM32_ICU_USE_TIM2 FALSE | ||
197 | #define STM32_ICU_USE_TIM3 FALSE | ||
198 | #define STM32_ICU_USE_TIM4 FALSE | ||
199 | #define STM32_ICU_USE_TIM5 FALSE | ||
200 | #define STM32_ICU_USE_TIM8 FALSE | ||
201 | #define STM32_ICU_USE_TIM9 FALSE | ||
202 | #define STM32_ICU_TIM1_IRQ_PRIORITY 7 | ||
203 | #define STM32_ICU_TIM2_IRQ_PRIORITY 7 | ||
204 | #define STM32_ICU_TIM3_IRQ_PRIORITY 7 | ||
205 | #define STM32_ICU_TIM4_IRQ_PRIORITY 7 | ||
206 | #define STM32_ICU_TIM5_IRQ_PRIORITY 7 | ||
207 | #define STM32_ICU_TIM8_IRQ_PRIORITY 7 | ||
208 | #define STM32_ICU_TIM9_IRQ_PRIORITY 7 | ||
209 | |||
210 | /* | ||
211 | * MAC driver system settings. | ||
212 | */ | ||
213 | #define STM32_MAC_TRANSMIT_BUFFERS 2 | ||
214 | #define STM32_MAC_RECEIVE_BUFFERS 4 | ||
215 | #define STM32_MAC_BUFFERS_SIZE 1522 | ||
216 | #define STM32_MAC_PHY_TIMEOUT 100 | ||
217 | #define STM32_MAC_ETH1_CHANGE_PHY_STATE TRUE | ||
218 | #define STM32_MAC_ETH1_IRQ_PRIORITY 13 | ||
219 | #define STM32_MAC_IP_CHECKSUM_OFFLOAD 0 | ||
220 | |||
221 | /* | ||
222 | * PWM driver system settings. | ||
223 | */ | ||
224 | #define STM32_PWM_USE_ADVANCED FALSE | ||
225 | #define STM32_PWM_USE_TIM1 FALSE | ||
226 | #define STM32_PWM_USE_TIM2 FALSE | ||
227 | #define STM32_PWM_USE_TIM3 FALSE | ||
228 | #define STM32_PWM_USE_TIM4 FALSE | ||
229 | #define STM32_PWM_USE_TIM5 FALSE | ||
230 | #define STM32_PWM_USE_TIM8 FALSE | ||
231 | #define STM32_PWM_USE_TIM9 FALSE | ||
232 | #define STM32_PWM_TIM1_IRQ_PRIORITY 7 | ||
233 | #define STM32_PWM_TIM2_IRQ_PRIORITY 7 | ||
234 | #define STM32_PWM_TIM3_IRQ_PRIORITY 7 | ||
235 | #define STM32_PWM_TIM4_IRQ_PRIORITY 7 | ||
236 | #define STM32_PWM_TIM5_IRQ_PRIORITY 7 | ||
237 | #define STM32_PWM_TIM8_IRQ_PRIORITY 7 | ||
238 | #define STM32_PWM_TIM9_IRQ_PRIORITY 7 | ||
239 | |||
240 | /* | ||
241 | * RTC driver system settings. | ||
242 | */ | ||
243 | #define STM32_RTC_PRESA_VALUE 32 | ||
244 | #define STM32_RTC_PRESS_VALUE 1024 | ||
245 | #define STM32_RTC_CR_INIT 0 | ||
246 | #define STM32_RTC_TAMPCR_INIT 0 | ||
247 | |||
248 | /* | ||
249 | * SDC driver system settings. | ||
250 | */ | ||
251 | #define STM32_SDC_SDIO_DMA_PRIORITY 3 | ||
252 | #define STM32_SDC_SDIO_IRQ_PRIORITY 9 | ||
253 | #define STM32_SDC_WRITE_TIMEOUT_MS 1000 | ||
254 | #define STM32_SDC_READ_TIMEOUT_MS 1000 | ||
255 | #define STM32_SDC_CLOCK_ACTIVATION_DELAY 10 | ||
256 | #define STM32_SDC_SDIO_UNALIGNED_SUPPORT TRUE | ||
257 | #define STM32_SDC_SDIO_DMA_STREAM STM32_DMA_STREAM_ID(2, 3) | ||
258 | |||
259 | /* | ||
260 | * SERIAL driver system settings. | ||
261 | */ | ||
262 | #define STM32_SERIAL_USE_USART1 FALSE | ||
263 | #define STM32_SERIAL_USE_USART2 TRUE | ||
264 | #define STM32_SERIAL_USE_USART3 FALSE | ||
265 | #define STM32_SERIAL_USE_UART4 FALSE | ||
266 | #define STM32_SERIAL_USE_UART5 FALSE | ||
267 | #define STM32_SERIAL_USE_USART6 FALSE | ||
268 | #define STM32_SERIAL_USART1_PRIORITY 12 | ||
269 | #define STM32_SERIAL_USART2_PRIORITY 12 | ||
270 | #define STM32_SERIAL_USART3_PRIORITY 12 | ||
271 | #define STM32_SERIAL_UART4_PRIORITY 12 | ||
272 | #define STM32_SERIAL_UART5_PRIORITY 12 | ||
273 | #define STM32_SERIAL_USART6_PRIORITY 12 | ||
274 | |||
275 | /* | ||
276 | * SPI driver system settings. | ||
277 | */ | ||
278 | #define STM32_SPI_USE_SPI1 FALSE | ||
279 | #define STM32_SPI_USE_SPI2 FALSE | ||
280 | #define STM32_SPI_USE_SPI3 FALSE | ||
281 | #define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0) | ||
282 | #define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3) | ||
283 | #define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) | ||
284 | #define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) | ||
285 | #define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) | ||
286 | #define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) | ||
287 | #define STM32_SPI_SPI1_DMA_PRIORITY 1 | ||
288 | #define STM32_SPI_SPI2_DMA_PRIORITY 1 | ||
289 | #define STM32_SPI_SPI3_DMA_PRIORITY 1 | ||
290 | #define STM32_SPI_SPI1_IRQ_PRIORITY 10 | ||
291 | #define STM32_SPI_SPI2_IRQ_PRIORITY 10 | ||
292 | #define STM32_SPI_SPI3_IRQ_PRIORITY 10 | ||
293 | #define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure") | ||
294 | |||
295 | /* | ||
296 | * ST driver system settings. | ||
297 | */ | ||
298 | #define STM32_ST_IRQ_PRIORITY 8 | ||
299 | #define STM32_ST_USE_TIMER 2 | ||
300 | |||
301 | /* | ||
302 | * UART driver system settings. | ||
303 | */ | ||
304 | #define STM32_UART_USE_USART1 FALSE | ||
305 | #define STM32_UART_USE_USART2 FALSE | ||
306 | #define STM32_UART_USE_USART3 FALSE | ||
307 | #define STM32_UART_USE_UART4 FALSE | ||
308 | #define STM32_UART_USE_UART5 FALSE | ||
309 | #define STM32_UART_USE_USART6 FALSE | ||
310 | #define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5) | ||
311 | #define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7) | ||
312 | #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) | ||
313 | #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) | ||
314 | #define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 1) | ||
315 | #define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) | ||
316 | #define STM32_UART_UART4_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2) | ||
317 | #define STM32_UART_UART4_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4) | ||
318 | #define STM32_UART_UART5_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0) | ||
319 | #define STM32_UART_UART5_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) | ||
320 | #define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) | ||
321 | #define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7) | ||
322 | #define STM32_UART_USART1_IRQ_PRIORITY 12 | ||
323 | #define STM32_UART_USART2_IRQ_PRIORITY 12 | ||
324 | #define STM32_UART_USART3_IRQ_PRIORITY 12 | ||
325 | #define STM32_UART_UART4_IRQ_PRIORITY 12 | ||
326 | #define STM32_UART_UART5_IRQ_PRIORITY 12 | ||
327 | #define STM32_UART_USART6_IRQ_PRIORITY 12 | ||
328 | #define STM32_UART_USART1_DMA_PRIORITY 0 | ||
329 | #define STM32_UART_USART2_DMA_PRIORITY 0 | ||
330 | #define STM32_UART_USART3_DMA_PRIORITY 0 | ||
331 | #define STM32_UART_UART4_DMA_PRIORITY 0 | ||
332 | #define STM32_UART_UART5_DMA_PRIORITY 0 | ||
333 | #define STM32_UART_USART6_DMA_PRIORITY 0 | ||
334 | #define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure") | ||
335 | |||
336 | /* | ||
337 | * USB driver system settings. | ||
338 | */ | ||
339 | #define STM32_USB_USE_OTG1 FALSE | ||
340 | #define STM32_USB_USE_OTG2 FALSE | ||
341 | #define STM32_USB_OTG1_IRQ_PRIORITY 14 | ||
342 | #define STM32_USB_OTG2_IRQ_PRIORITY 14 | ||
343 | #define STM32_USB_OTG1_RX_FIFO_SIZE 512 | ||
344 | #define STM32_USB_OTG2_RX_FIFO_SIZE 1024 | ||
345 | #define STM32_USB_HOST_WAKEUP_DURATION 2 | ||
346 | |||
347 | /* | ||
348 | * WDG driver system settings. | ||
349 | */ | ||
350 | #define STM32_WDG_USE_IWDG FALSE | ||
351 | |||
352 | #endif /* MCUCONF_H */ | ||
diff --git a/lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY/cfg/osalconf.h b/lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY/cfg/osalconf.h new file mode 100644 index 000000000..c40a38489 --- /dev/null +++ b/lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY/cfg/osalconf.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /** | ||
18 | * @file templates/halconf.h | ||
19 | * @brief Bare-metal OSAL configuration header. | ||
20 | * | ||
21 | * @addtogroup OSAL_CONF | ||
22 | * @{ | ||
23 | */ | ||
24 | |||
25 | #ifndef OSALCONF_H | ||
26 | #define OSALCONF_H | ||
27 | |||
28 | /** | ||
29 | * @brief Frequency in Hertz of the system tick. | ||
30 | */ | ||
31 | #if !defined(OSAL_ST_FREQUENCY) || defined(__DOXYGEN__) | ||
32 | #define OSAL_ST_FREQUENCY 1000 | ||
33 | #endif | ||
34 | |||
35 | /** | ||
36 | * @brief Enables OSAL assertions. | ||
37 | */ | ||
38 | #if !defined(OSAL_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__) | ||
39 | #define OSAL_DBG_ENABLE_ASSERTS FALSE | ||
40 | #endif | ||
41 | |||
42 | /** | ||
43 | * @brief Enables OSAL functions parameters checks. | ||
44 | */ | ||
45 | #if !defined(OSAL_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__) | ||
46 | #define OSAL_DBG_ENABLE_CHECKS FALSE | ||
47 | #endif | ||
48 | |||
49 | /** | ||
50 | * @brief OSAL initialization hook. | ||
51 | */ | ||
52 | #if !defined(OSAL_INIT_HOOK) || defined(__DOXYGEN__) | ||
53 | #define OSAL_INIT_HOOK() { \ | ||
54 | } | ||
55 | #endif | ||
56 | |||
57 | /** | ||
58 | * @brief Idle loop hook macro. | ||
59 | */ | ||
60 | #if !defined(OSAL_IDLE_HOOK) || defined(__DOXYGEN__) | ||
61 | #define OSAL_IDLE_HOOK() { \ | ||
62 | } | ||
63 | #endif | ||
64 | |||
65 | #endif /* OSALCONF_H */ | ||
66 | |||
67 | /** @} */ | ||
diff --git a/lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY/main.c b/lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY/main.c new file mode 100644 index 000000000..552a16a3b --- /dev/null +++ b/lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY/main.c | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | /* | ||
20 | * Application entry point. | ||
21 | */ | ||
22 | int main(void) { | ||
23 | |||
24 | /* | ||
25 | * System initializations. | ||
26 | * - HAL initialization, this also initializes the configured device drivers | ||
27 | * and performs the board-specific initializations. | ||
28 | */ | ||
29 | halInit(); | ||
30 | |||
31 | /* | ||
32 | * Enabling interrupts, initialization done. | ||
33 | */ | ||
34 | osalSysEnable(); | ||
35 | |||
36 | /* | ||
37 | * Activates the serial driver 2 using the driver default configuration. | ||
38 | * PA2(TX) and PA3(RX) are routed to USART2. | ||
39 | */ | ||
40 | sdStart(&SD2, NULL); | ||
41 | palSetPadMode(GPIOA, 2, PAL_MODE_ALTERNATE(7)); | ||
42 | palSetPadMode(GPIOA, 3, PAL_MODE_ALTERNATE(7)); | ||
43 | |||
44 | /* | ||
45 | * Normal main() thread activity, in this demo it just performs | ||
46 | * a shell respawn upon its termination. | ||
47 | */ | ||
48 | while (true) { | ||
49 | chnWriteTimeout(&SD2, (uint8_t *)"Hello World!\r\n", 14, TIME_INFINITE); | ||
50 | |||
51 | palSetPad(GPIOD, GPIOD_LED3); /* Orange. */ | ||
52 | osalThreadSleepMilliseconds(500); | ||
53 | palClearPad(GPIOD, GPIOD_LED3); /* Orange. */ | ||
54 | osalThreadSleepMilliseconds(500); | ||
55 | } | ||
56 | } | ||
diff --git a/lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY/readme.txt b/lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY/readme.txt new file mode 100644 index 000000000..4bde128c8 --- /dev/null +++ b/lib/chibios/demos/STM32/HAL-STM32F407-DISCOVERY/readme.txt | |||
@@ -0,0 +1,26 @@ | |||
1 | ***************************************************************************** | ||
2 | ** ChibiOS/HAL port for ARM-Cortex-M4 STM32F407. ** | ||
3 | ***************************************************************************** | ||
4 | |||
5 | ** TARGET ** | ||
6 | |||
7 | The demo runs on an ST STM32F4-Discovery board. | ||
8 | |||
9 | ** The Demo ** | ||
10 | |||
11 | The demo is an example of HAL use without underlying operating system, it uses | ||
12 | a bare-metal OSAL implementation for ARMCMx. | ||
13 | |||
14 | ** Build Procedure ** | ||
15 | |||
16 | An arm-none-eabi-gcc compliant toolchain is required. Build by giving the "make" | ||
17 | command in the project directory. | ||
18 | |||
19 | ** Notes ** | ||
20 | |||
21 | Some files used by the demo are not part of ChibiOS but are copyright of | ||
22 | ST Microelectronics and are licensed under a different license. | ||
23 | Also note that not all the files present in the ST library are distributed | ||
24 | with ChibiOS, you can find the whole library on the ST web site: | ||
25 | |||
26 | http://www.st.com | ||