aboutsummaryrefslogtreecommitdiff
path: root/platforms
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2020-06-06 18:52:19 +1000
committerJames Young <18669334+noroadsleft@users.noreply.github.com>2020-08-29 14:30:02 -0700
commit385d49cc39b57e74203e0c1c78c0789d249e4742 (patch)
treedbd8b3f7bc30a9d40d51ffaa5cd5a93d5eb47359 /platforms
parent5cc3ab38c9148cd6bc7ccdba176a88fbb95653b1 (diff)
downloadqmk_firmware-385d49cc39b57e74203e0c1c78c0789d249e4742.tar.gz
qmk_firmware-385d49cc39b57e74203e0c1c78c0789d249e4742.zip
Initial work for consolidation of ChibiOS platform files (#8327)
* Initial work for consolidation of board files and default ChibiOS configs. * Migrate F401/F411 black pills for testing. * Add early init bootloader jump flag. * Add support for I2C in order to use i2c_scanner keymap. * Add F401/F411 HSE bypass to get things booting. * Exempt "hooked" ChibiOS conf files from updater script. * Fix up ordering for bootloader_defs file check. * Match previous $(KEYBOARD_PATHS) value for Proton-C, updated for all board configs.
Diffstat (limited to 'platforms')
-rw-r--r--platforms/chibios/BLACKPILL_STM32_F401/board/board.mk9
-rw-r--r--platforms/chibios/BLACKPILL_STM32_F401/configs/board.h20
-rw-r--r--platforms/chibios/BLACKPILL_STM32_F401/configs/chconf.h714
-rw-r--r--platforms/chibios/BLACKPILL_STM32_F401/configs/config.h23
-rw-r--r--platforms/chibios/BLACKPILL_STM32_F401/configs/halconf.h525
-rw-r--r--platforms/chibios/BLACKPILL_STM32_F401/configs/mcuconf.h253
-rw-r--r--platforms/chibios/BLACKPILL_STM32_F411/board/board.mk9
-rw-r--r--platforms/chibios/BLACKPILL_STM32_F411/configs/board.h20
-rw-r--r--platforms/chibios/BLACKPILL_STM32_F411/configs/chconf.h714
-rw-r--r--platforms/chibios/BLACKPILL_STM32_F411/configs/config.h23
-rw-r--r--platforms/chibios/BLACKPILL_STM32_F411/configs/halconf.h525
-rw-r--r--platforms/chibios/BLACKPILL_STM32_F411/configs/mcuconf.h253
-rw-r--r--platforms/chibios/GENERIC_STM32_F042X6/board/board.c269
-rw-r--r--platforms/chibios/GENERIC_STM32_F042X6/board/board.h896
-rw-r--r--platforms/chibios/GENERIC_STM32_F042X6/board/board.mk9
-rw-r--r--platforms/chibios/GENERIC_STM32_F042X6/configs/bootloader_defs.h7
-rw-r--r--platforms/chibios/GENERIC_STM32_F072XB/board/board.c250
-rw-r--r--platforms/chibios/GENERIC_STM32_F072XB/board/board.h407
-rw-r--r--platforms/chibios/GENERIC_STM32_F072XB/board/board.mk9
-rw-r--r--platforms/chibios/GENERIC_STM32_F072XB/configs/bootloader_defs.h7
-rw-r--r--platforms/chibios/GENERIC_STM32_F303XC/board/board.c242
-rw-r--r--platforms/chibios/GENERIC_STM32_F303XC/board/board.h475
-rw-r--r--platforms/chibios/GENERIC_STM32_F303XC/board/board.mk9
-rw-r--r--platforms/chibios/GENERIC_STM32_F303XC/configs/bootloader_defs.h7
-rw-r--r--platforms/chibios/GENERIC_STM32_F303XC/configs/chconf.h714
-rw-r--r--platforms/chibios/GENERIC_STM32_F303XC/configs/halconf.h525
-rw-r--r--platforms/chibios/GENERIC_STM32_F303XC/configs/mcuconf.h273
-rw-r--r--platforms/chibios/GENERIC_STM32_F303XC/configs/proton_c.mk9
-rw-r--r--platforms/chibios/IC_TEENSY_3_1/board/board.c146
-rw-r--r--platforms/chibios/IC_TEENSY_3_1/board/board.h295
-rw-r--r--platforms/chibios/IC_TEENSY_3_1/board/board.mk9
-rw-r--r--platforms/chibios/STM32_F103_STM32DUINO/board/board.c59
-rw-r--r--platforms/chibios/STM32_F103_STM32DUINO/board/board.h166
-rw-r--r--platforms/chibios/STM32_F103_STM32DUINO/board/board.mk9
-rw-r--r--platforms/chibios/keyboard-config-templates/board.h20
-rw-r--r--platforms/chibios/keyboard-config-templates/chconf.h20
-rw-r--r--platforms/chibios/keyboard-config-templates/halconf.h20
-rw-r--r--platforms/chibios/keyboard-config-templates/mcuconf.h21
-rw-r--r--platforms/chibios/ld/MKL26Z64.ld105
-rw-r--r--platforms/chibios/ld/STM32F103x8_stm32duino_bootloader.ld88
40 files changed, 8154 insertions, 0 deletions
diff --git a/platforms/chibios/BLACKPILL_STM32_F401/board/board.mk b/platforms/chibios/BLACKPILL_STM32_F401/board/board.mk
new file mode 100644
index 000000000..fddf7dace
--- /dev/null
+++ b/platforms/chibios/BLACKPILL_STM32_F401/board/board.mk
@@ -0,0 +1,9 @@
1# List of all the board related files.
2BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_STM32F401C_DISCOVERY/board.c
3
4# Required include directories
5BOARDINC = $(CHIBIOS)/os/hal/boards/ST_STM32F401C_DISCOVERY
6
7# Shared variables
8ALLCSRC += $(BOARDSRC)
9ALLINC += $(BOARDINC)
diff --git a/platforms/chibios/BLACKPILL_STM32_F401/configs/board.h b/platforms/chibios/BLACKPILL_STM32_F401/configs/board.h
new file mode 100644
index 000000000..30af6b0c8
--- /dev/null
+++ b/platforms/chibios/BLACKPILL_STM32_F401/configs/board.h
@@ -0,0 +1,20 @@
1/* Copyright 2020 Nick Brassel (tzarc)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <https://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#include_next "board.h"
19
20#undef STM32_HSE_BYPASS
diff --git a/platforms/chibios/BLACKPILL_STM32_F401/configs/chconf.h b/platforms/chibios/BLACKPILL_STM32_F401/configs/chconf.h
new file mode 100644
index 000000000..7dc4f84a8
--- /dev/null
+++ b/platforms/chibios/BLACKPILL_STM32_F401/configs/chconf.h
@@ -0,0 +1,714 @@
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 rt/templates/chconf.h
19 * @brief Configuration file template.
20 * @details A copy of this file must be placed in each project directory, it
21 * contains the application specific kernel settings.
22 *
23 * @addtogroup config
24 * @details Kernel related settings and hooks.
25 * @{
26 */
27
28#ifndef CHCONF_H
29#define CHCONF_H
30
31#define _CHIBIOS_RT_CONF_
32#define _CHIBIOS_RT_CONF_VER_6_0_
33
34/*===========================================================================*/
35/**
36 * @name System timers settings
37 * @{
38 */
39/*===========================================================================*/
40
41/**
42 * @brief System time counter resolution.
43 * @note Allowed values are 16 or 32 bits.
44 */
45#if !defined(CH_CFG_ST_RESOLUTION)
46#define CH_CFG_ST_RESOLUTION 32
47#endif
48
49/**
50 * @brief System tick frequency.
51 * @details Frequency of the system timer that drives the system ticks. This
52 * setting also defines the system tick time unit.
53 */
54#if !defined(CH_CFG_ST_FREQUENCY)
55#define CH_CFG_ST_FREQUENCY 10000
56#endif
57
58/**
59 * @brief Time intervals data size.
60 * @note Allowed values are 16, 32 or 64 bits.
61 */
62#if !defined(CH_CFG_INTERVALS_SIZE)
63#define CH_CFG_INTERVALS_SIZE 32
64#endif
65
66/**
67 * @brief Time types data size.
68 * @note Allowed values are 16 or 32 bits.
69 */
70#if !defined(CH_CFG_TIME_TYPES_SIZE)
71#define CH_CFG_TIME_TYPES_SIZE 32
72#endif
73
74/**
75 * @brief Time delta constant for the tick-less mode.
76 * @note If this value is zero then the system uses the classic
77 * periodic tick. This value represents the minimum number
78 * of ticks that is safe to specify in a timeout directive.
79 * The value one is not valid, timeouts are rounded up to
80 * this value.
81 */
82#if !defined(CH_CFG_ST_TIMEDELTA)
83#define CH_CFG_ST_TIMEDELTA 2
84#endif
85
86/** @} */
87
88/*===========================================================================*/
89/**
90 * @name Kernel parameters and options
91 * @{
92 */
93/*===========================================================================*/
94
95/**
96 * @brief Round robin interval.
97 * @details This constant is the number of system ticks allowed for the
98 * threads before preemption occurs. Setting this value to zero
99 * disables the preemption for threads with equal priority and the
100 * round robin becomes cooperative. Note that higher priority
101 * threads can still preempt, the kernel is always preemptive.
102 * @note Disabling the round robin preemption makes the kernel more compact
103 * and generally faster.
104 * @note The round robin preemption is not supported in tickless mode and
105 * must be set to zero in that case.
106 */
107#if !defined(CH_CFG_TIME_QUANTUM)
108#define CH_CFG_TIME_QUANTUM 0
109#endif
110
111/**
112 * @brief Managed RAM size.
113 * @details Size of the RAM area to be managed by the OS. If set to zero
114 * then the whole available RAM is used. The core memory is made
115 * available to the heap allocator and/or can be used directly through
116 * the simplified core memory allocator.
117 *
118 * @note In order to let the OS manage the whole RAM the linker script must
119 * provide the @p __heap_base__ and @p __heap_end__ symbols.
120 * @note Requires @p CH_CFG_USE_MEMCORE.
121 */
122#if !defined(CH_CFG_MEMCORE_SIZE)
123#define CH_CFG_MEMCORE_SIZE 0
124#endif
125
126/**
127 * @brief Idle thread automatic spawn suppression.
128 * @details When this option is activated the function @p chSysInit()
129 * does not spawn the idle thread. The application @p main()
130 * function becomes the idle thread and must implement an
131 * infinite loop.
132 */
133#if !defined(CH_CFG_NO_IDLE_THREAD)
134#define CH_CFG_NO_IDLE_THREAD FALSE
135#endif
136
137/** @} */
138
139/*===========================================================================*/
140/**
141 * @name Performance options
142 * @{
143 */
144/*===========================================================================*/
145
146/**
147 * @brief OS optimization.
148 * @details If enabled then time efficient rather than space efficient code
149 * is used when two possible implementations exist.
150 *
151 * @note This is not related to the compiler optimization options.
152 * @note The default is @p TRUE.
153 */
154#if !defined(CH_CFG_OPTIMIZE_SPEED)
155#define CH_CFG_OPTIMIZE_SPEED TRUE
156#endif
157
158/** @} */
159
160/*===========================================================================*/
161/**
162 * @name Subsystem options
163 * @{
164 */
165/*===========================================================================*/
166
167/**
168 * @brief Time Measurement APIs.
169 * @details If enabled then the time measurement APIs are included in
170 * the kernel.
171 *
172 * @note The default is @p TRUE.
173 */
174#if !defined(CH_CFG_USE_TM)
175#define CH_CFG_USE_TM TRUE
176#endif
177
178/**
179 * @brief Threads registry APIs.
180 * @details If enabled then the registry APIs are included in the kernel.
181 *
182 * @note The default is @p TRUE.
183 */
184#if !defined(CH_CFG_USE_REGISTRY)
185#define CH_CFG_USE_REGISTRY TRUE
186#endif
187
188/**
189 * @brief Threads synchronization APIs.
190 * @details If enabled then the @p chThdWait() function is included in
191 * the kernel.
192 *
193 * @note The default is @p TRUE.
194 */
195#if !defined(CH_CFG_USE_WAITEXIT)
196#define CH_CFG_USE_WAITEXIT TRUE
197#endif
198
199/**
200 * @brief Semaphores APIs.
201 * @details If enabled then the Semaphores APIs are included in the kernel.
202 *
203 * @note The default is @p TRUE.
204 */
205#if !defined(CH_CFG_USE_SEMAPHORES)
206#define CH_CFG_USE_SEMAPHORES TRUE
207#endif
208
209/**
210 * @brief Semaphores queuing mode.
211 * @details If enabled then the threads are enqueued on semaphores by
212 * priority rather than in FIFO order.
213 *
214 * @note The default is @p FALSE. Enable this if you have special
215 * requirements.
216 * @note Requires @p CH_CFG_USE_SEMAPHORES.
217 */
218#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
219#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
220#endif
221
222/**
223 * @brief Mutexes APIs.
224 * @details If enabled then the mutexes APIs are included in the kernel.
225 *
226 * @note The default is @p TRUE.
227 */
228#if !defined(CH_CFG_USE_MUTEXES)
229#define CH_CFG_USE_MUTEXES TRUE
230#endif
231
232/**
233 * @brief Enables recursive behavior on mutexes.
234 * @note Recursive mutexes are heavier and have an increased
235 * memory footprint.
236 *
237 * @note The default is @p FALSE.
238 * @note Requires @p CH_CFG_USE_MUTEXES.
239 */
240#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
241#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
242#endif
243
244/**
245 * @brief Conditional Variables APIs.
246 * @details If enabled then the conditional variables APIs are included
247 * in the kernel.
248 *
249 * @note The default is @p TRUE.
250 * @note Requires @p CH_CFG_USE_MUTEXES.
251 */
252#if !defined(CH_CFG_USE_CONDVARS)
253#define CH_CFG_USE_CONDVARS TRUE
254#endif
255
256/**
257 * @brief Conditional Variables APIs with timeout.
258 * @details If enabled then the conditional variables APIs with timeout
259 * specification are included in the kernel.
260 *
261 * @note The default is @p TRUE.
262 * @note Requires @p CH_CFG_USE_CONDVARS.
263 */
264#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
265#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
266#endif
267
268/**
269 * @brief Events Flags APIs.
270 * @details If enabled then the event flags APIs are included in the kernel.
271 *
272 * @note The default is @p TRUE.
273 */
274#if !defined(CH_CFG_USE_EVENTS)
275#define CH_CFG_USE_EVENTS TRUE
276#endif
277
278/**
279 * @brief Events Flags APIs with timeout.
280 * @details If enabled then the events APIs with timeout specification
281 * are included in the kernel.
282 *
283 * @note The default is @p TRUE.
284 * @note Requires @p CH_CFG_USE_EVENTS.
285 */
286#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
287#define CH_CFG_USE_EVENTS_TIMEOUT TRUE
288#endif
289
290/**
291 * @brief Synchronous Messages APIs.
292 * @details If enabled then the synchronous messages APIs are included
293 * in the kernel.
294 *
295 * @note The default is @p TRUE.
296 */
297#if !defined(CH_CFG_USE_MESSAGES)
298#define CH_CFG_USE_MESSAGES TRUE
299#endif
300
301/**
302 * @brief Synchronous Messages queuing mode.
303 * @details If enabled then messages are served by priority rather than in
304 * FIFO order.
305 *
306 * @note The default is @p FALSE. Enable this if you have special
307 * requirements.
308 * @note Requires @p CH_CFG_USE_MESSAGES.
309 */
310#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
311#define CH_CFG_USE_MESSAGES_PRIORITY FALSE
312#endif
313
314/**
315 * @brief Mailboxes APIs.
316 * @details If enabled then the asynchronous messages (mailboxes) APIs are
317 * included in the kernel.
318 *
319 * @note The default is @p TRUE.
320 * @note Requires @p CH_CFG_USE_SEMAPHORES.
321 */
322#if !defined(CH_CFG_USE_MAILBOXES)
323#define CH_CFG_USE_MAILBOXES TRUE
324#endif
325
326/**
327 * @brief Core Memory Manager APIs.
328 * @details If enabled then the core memory manager APIs are included
329 * in the kernel.
330 *
331 * @note The default is @p TRUE.
332 */
333#if !defined(CH_CFG_USE_MEMCORE)
334#define CH_CFG_USE_MEMCORE TRUE
335#endif
336
337/**
338 * @brief Heap Allocator APIs.
339 * @details If enabled then the memory heap allocator APIs are included
340 * in the kernel.
341 *
342 * @note The default is @p TRUE.
343 * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
344 * @p CH_CFG_USE_SEMAPHORES.
345 * @note Mutexes are recommended.
346 */
347#if !defined(CH_CFG_USE_HEAP)
348#define CH_CFG_USE_HEAP TRUE
349#endif
350
351/**
352 * @brief Memory Pools Allocator APIs.
353 * @details If enabled then the memory pools allocator APIs are included
354 * in the kernel.
355 *
356 * @note The default is @p TRUE.
357 */
358#if !defined(CH_CFG_USE_MEMPOOLS)
359#define CH_CFG_USE_MEMPOOLS TRUE
360#endif
361
362/**
363 * @brief Objects FIFOs APIs.
364 * @details If enabled then the objects FIFOs APIs are included
365 * in the kernel.
366 *
367 * @note The default is @p TRUE.
368 */
369#if !defined(CH_CFG_USE_OBJ_FIFOS)
370#define CH_CFG_USE_OBJ_FIFOS TRUE
371#endif
372
373/**
374 * @brief Pipes APIs.
375 * @details If enabled then the pipes APIs are included
376 * in the kernel.
377 *
378 * @note The default is @p TRUE.
379 */
380#if !defined(CH_CFG_USE_PIPES)
381#define CH_CFG_USE_PIPES TRUE
382#endif
383
384/**
385 * @brief Dynamic Threads APIs.
386 * @details If enabled then the dynamic threads creation APIs are included
387 * in the kernel.
388 *
389 * @note The default is @p TRUE.
390 * @note Requires @p CH_CFG_USE_WAITEXIT.
391 * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
392 */
393#if !defined(CH_CFG_USE_DYNAMIC)
394#define CH_CFG_USE_DYNAMIC TRUE
395#endif
396
397/** @} */
398
399/*===========================================================================*/
400/**
401 * @name Objects factory options
402 * @{
403 */
404/*===========================================================================*/
405
406/**
407 * @brief Objects Factory APIs.
408 * @details If enabled then the objects factory APIs are included in the
409 * kernel.
410 *
411 * @note The default is @p FALSE.
412 */
413#if !defined(CH_CFG_USE_FACTORY)
414#define CH_CFG_USE_FACTORY TRUE
415#endif
416
417/**
418 * @brief Maximum length for object names.
419 * @details If the specified length is zero then the name is stored by
420 * pointer but this could have unintended side effects.
421 */
422#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
423#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8
424#endif
425
426/**
427 * @brief Enables the registry of generic objects.
428 */
429#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
430#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
431#endif
432
433/**
434 * @brief Enables factory for generic buffers.
435 */
436#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
437#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
438#endif
439
440/**
441 * @brief Enables factory for semaphores.
442 */
443#if !defined(CH_CFG_FACTORY_SEMAPHORES)
444#define CH_CFG_FACTORY_SEMAPHORES TRUE
445#endif
446
447/**
448 * @brief Enables factory for mailboxes.
449 */
450#if !defined(CH_CFG_FACTORY_MAILBOXES)
451#define CH_CFG_FACTORY_MAILBOXES TRUE
452#endif
453
454/**
455 * @brief Enables factory for objects FIFOs.
456 */
457#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
458#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
459#endif
460
461/**
462 * @brief Enables factory for Pipes.
463 */
464#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
465#define CH_CFG_FACTORY_PIPES TRUE
466#endif
467
468/** @} */
469
470/*===========================================================================*/
471/**
472 * @name Debug options
473 * @{
474 */
475/*===========================================================================*/
476
477/**
478 * @brief Debug option, kernel statistics.
479 *
480 * @note The default is @p FALSE.
481 */
482#if !defined(CH_DBG_STATISTICS)
483#define CH_DBG_STATISTICS FALSE
484#endif
485
486/**
487 * @brief Debug option, system state check.
488 * @details If enabled the correct call protocol for system APIs is checked
489 * at runtime.
490 *
491 * @note The default is @p FALSE.
492 */
493#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
494#define CH_DBG_SYSTEM_STATE_CHECK FALSE
495#endif
496
497/**
498 * @brief Debug option, parameters checks.
499 * @details If enabled then the checks on the API functions input
500 * parameters are activated.
501 *
502 * @note The default is @p FALSE.
503 */
504#if !defined(CH_DBG_ENABLE_CHECKS)
505#define CH_DBG_ENABLE_CHECKS FALSE
506#endif
507
508/**
509 * @brief Debug option, consistency checks.
510 * @details If enabled then all the assertions in the kernel code are
511 * activated. This includes consistency checks inside the kernel,
512 * runtime anomalies and port-defined checks.
513 *
514 * @note The default is @p FALSE.
515 */
516#if !defined(CH_DBG_ENABLE_ASSERTS)
517#define CH_DBG_ENABLE_ASSERTS FALSE
518#endif
519
520/**
521 * @brief Debug option, trace buffer.
522 * @details If enabled then the trace buffer is activated.
523 *
524 * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
525 */
526#if !defined(CH_DBG_TRACE_MASK)
527#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
528#endif
529
530/**
531 * @brief Trace buffer entries.
532 * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
533 * different from @p CH_DBG_TRACE_MASK_DISABLED.
534 */
535#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
536#define CH_DBG_TRACE_BUFFER_SIZE 128
537#endif
538
539/**
540 * @brief Debug option, stack checks.
541 * @details If enabled then a runtime stack check is performed.
542 *
543 * @note The default is @p FALSE.
544 * @note The stack check is performed in a architecture/port dependent way.
545 * It may not be implemented or some ports.
546 * @note The default failure mode is to halt the system with the global
547 * @p panic_msg variable set to @p NULL.
548 */
549#if !defined(CH_DBG_ENABLE_STACK_CHECK)
550#define CH_DBG_ENABLE_STACK_CHECK FALSE
551#endif
552
553/**
554 * @brief Debug option, stacks initialization.
555 * @details If enabled then the threads working area is filled with a byte
556 * value when a thread is created. This can be useful for the
557 * runtime measurement of the used stack.
558 *
559 * @note The default is @p FALSE.
560 */
561#if !defined(CH_DBG_FILL_THREADS)
562#define CH_DBG_FILL_THREADS FALSE
563#endif
564
565/**
566 * @brief Debug option, threads profiling.
567 * @details If enabled then a field is added to the @p thread_t structure that
568 * counts the system ticks occurred while executing the thread.
569 *
570 * @note The default is @p FALSE.
571 * @note This debug option is not currently compatible with the
572 * tickless mode.
573 */
574#if !defined(CH_DBG_THREADS_PROFILING)
575#define CH_DBG_THREADS_PROFILING FALSE
576#endif
577
578/** @} */
579
580/*===========================================================================*/
581/**
582 * @name Kernel hooks
583 * @{
584 */
585/*===========================================================================*/
586
587/**
588 * @brief System structure extension.
589 * @details User fields added to the end of the @p ch_system_t structure.
590 */
591#define CH_CFG_SYSTEM_EXTRA_FIELDS \
592 /* Add threads custom fields here.*/
593
594/**
595 * @brief System initialization hook.
596 * @details User initialization code added to the @p chSysInit() function
597 * just before interrupts are enabled globally.
598 */
599#define CH_CFG_SYSTEM_INIT_HOOK() { \
600 /* Add threads initialization code here.*/ \
601}
602
603/**
604 * @brief Threads descriptor structure extension.
605 * @details User fields added to the end of the @p thread_t structure.
606 */
607#define CH_CFG_THREAD_EXTRA_FIELDS \
608 /* Add threads custom fields here.*/
609
610/**
611 * @brief Threads initialization hook.
612 * @details User initialization code added to the @p _thread_init() function.
613 *
614 * @note It is invoked from within @p _thread_init() and implicitly from all
615 * the threads creation APIs.
616 */
617#define CH_CFG_THREAD_INIT_HOOK(tp) { \
618 /* Add threads initialization code here.*/ \
619}
620
621/**
622 * @brief Threads finalization hook.
623 * @details User finalization code added to the @p chThdExit() API.
624 */
625#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
626 /* Add threads finalization code here.*/ \
627}
628
629/**
630 * @brief Context switch hook.
631 * @details This hook is invoked just before switching between threads.
632 */
633#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
634 /* Context switch code here.*/ \
635}
636
637/**
638 * @brief ISR enter hook.
639 */
640#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
641 /* IRQ prologue code here.*/ \
642}
643
644/**
645 * @brief ISR exit hook.
646 */
647#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
648 /* IRQ epilogue code here.*/ \
649}
650
651/**
652 * @brief Idle thread enter hook.
653 * @note This hook is invoked within a critical zone, no OS functions
654 * should be invoked from here.
655 * @note This macro can be used to activate a power saving mode.
656 */
657#define CH_CFG_IDLE_ENTER_HOOK() { \
658 /* Idle-enter code here.*/ \
659}
660
661/**
662 * @brief Idle thread leave hook.
663 * @note This hook is invoked within a critical zone, no OS functions
664 * should be invoked from here.
665 * @note This macro can be used to deactivate a power saving mode.
666 */
667#define CH_CFG_IDLE_LEAVE_HOOK() { \
668 /* Idle-leave code here.*/ \
669}
670
671/**
672 * @brief Idle Loop hook.
673 * @details This hook is continuously invoked by the idle thread loop.
674 */
675#define CH_CFG_IDLE_LOOP_HOOK() { \
676 /* Idle loop code here.*/ \
677}
678
679/**
680 * @brief System tick event hook.
681 * @details This hook is invoked in the system tick handler immediately
682 * after processing the virtual timers queue.
683 */
684#define CH_CFG_SYSTEM_TICK_HOOK() { \
685 /* System tick event code here.*/ \
686}
687
688/**
689 * @brief System halt hook.
690 * @details This hook is invoked in case to a system halting error before
691 * the system is halted.
692 */
693#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
694 /* System halt code here.*/ \
695}
696
697/**
698 * @brief Trace hook.
699 * @details This hook is invoked each time a new record is written in the
700 * trace buffer.
701 */
702#define CH_CFG_TRACE_HOOK(tep) { \
703 /* Trace code here.*/ \
704}
705
706/** @} */
707
708/*===========================================================================*/
709/* Port-specific settings (override port settings defaulted in chcore.h). */
710/*===========================================================================*/
711
712#endif /* CHCONF_H */
713
714/** @} */
diff --git a/platforms/chibios/BLACKPILL_STM32_F401/configs/config.h b/platforms/chibios/BLACKPILL_STM32_F401/configs/config.h
new file mode 100644
index 000000000..eb73e72ef
--- /dev/null
+++ b/platforms/chibios/BLACKPILL_STM32_F401/configs/config.h
@@ -0,0 +1,23 @@
1/* Copyright 2020 Nick Brassel (tzarc)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <https://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#define BOARD_OTG_NOVBUSSENS 1
19
20#define STM32_LSECLK 32768U
21#define STM32_HSECLK 25000000U
22
23#define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
diff --git a/platforms/chibios/BLACKPILL_STM32_F401/configs/halconf.h b/platforms/chibios/BLACKPILL_STM32_F401/configs/halconf.h
new file mode 100644
index 000000000..a8db392aa
--- /dev/null
+++ b/platforms/chibios/BLACKPILL_STM32_F401/configs/halconf.h
@@ -0,0 +1,525 @@
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_0_
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 GPT subsystem.
73 */
74#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
75#define HAL_USE_GPT FALSE
76#endif
77
78/**
79 * @brief Enables the I2C subsystem.
80 */
81#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
82#define HAL_USE_I2C FALSE
83#endif
84
85/**
86 * @brief Enables the I2S subsystem.
87 */
88#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
89#define HAL_USE_I2S FALSE
90#endif
91
92/**
93 * @brief Enables the ICU subsystem.
94 */
95#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
96#define HAL_USE_ICU FALSE
97#endif
98
99/**
100 * @brief Enables the MAC subsystem.
101 */
102#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
103#define HAL_USE_MAC FALSE
104#endif
105
106/**
107 * @brief Enables the MMC_SPI subsystem.
108 */
109#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
110#define HAL_USE_MMC_SPI FALSE
111#endif
112
113/**
114 * @brief Enables the PWM subsystem.
115 */
116#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
117#define HAL_USE_PWM FALSE
118#endif
119
120/**
121 * @brief Enables the RTC subsystem.
122 */
123#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
124#define HAL_USE_RTC FALSE
125#endif
126
127/**
128 * @brief Enables the SDC subsystem.
129 */
130#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
131#define HAL_USE_SDC FALSE
132#endif
133
134/**
135 * @brief Enables the SERIAL subsystem.
136 */
137#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
138#define HAL_USE_SERIAL FALSE
139#endif
140
141/**
142 * @brief Enables the SERIAL over USB subsystem.
143 */
144#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
145#define HAL_USE_SERIAL_USB FALSE
146#endif
147
148/**
149 * @brief Enables the SIO subsystem.
150 */
151#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
152#define HAL_USE_SIO FALSE
153#endif
154
155/**
156 * @brief Enables the SPI subsystem.
157 */
158#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
159#define HAL_USE_SPI FALSE
160#endif
161
162/**
163 * @brief Enables the TRNG subsystem.
164 */
165#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
166#define HAL_USE_TRNG FALSE
167#endif
168
169/**
170 * @brief Enables the UART subsystem.
171 */
172#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
173#define HAL_USE_UART FALSE
174#endif
175
176/**
177 * @brief Enables the USB subsystem.
178 */
179#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
180#define HAL_USE_USB TRUE
181#endif
182
183/**
184 * @brief Enables the WDG subsystem.
185 */
186#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
187#define HAL_USE_WDG FALSE
188#endif
189
190/**
191 * @brief Enables the WSPI subsystem.
192 */
193#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
194#define HAL_USE_WSPI FALSE
195#endif
196
197/*===========================================================================*/
198/* PAL driver related settings. */
199/*===========================================================================*/
200
201/**
202 * @brief Enables synchronous APIs.
203 * @note Disabling this option saves both code and data space.
204 */
205#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
206#define PAL_USE_CALLBACKS FALSE
207#endif
208
209/**
210 * @brief Enables synchronous APIs.
211 * @note Disabling this option saves both code and data space.
212 */
213#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
214#define PAL_USE_WAIT FALSE
215#endif
216
217/*===========================================================================*/
218/* ADC driver related settings. */
219/*===========================================================================*/
220
221/**
222 * @brief Enables synchronous APIs.
223 * @note Disabling this option saves both code and data space.
224 */
225#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
226#define ADC_USE_WAIT TRUE
227#endif
228
229/**
230 * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
231 * @note Disabling this option saves both code and data space.
232 */
233#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
234#define ADC_USE_MUTUAL_EXCLUSION TRUE
235#endif
236
237/*===========================================================================*/
238/* CAN driver related settings. */
239/*===========================================================================*/
240
241/**
242 * @brief Sleep mode related APIs inclusion switch.
243 */
244#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
245#define CAN_USE_SLEEP_MODE TRUE
246#endif
247
248/**
249 * @brief Enforces the driver to use direct callbacks rather than OSAL events.
250 */
251#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
252#define CAN_ENFORCE_USE_CALLBACKS FALSE
253#endif
254
255/*===========================================================================*/
256/* CRY driver related settings. */
257/*===========================================================================*/
258
259/**
260 * @brief Enables the SW fall-back of the cryptographic driver.
261 * @details When enabled, this option, activates a fall-back software
262 * implementation for algorithms not supported by the underlying
263 * hardware.
264 * @note Fall-back implementations may not be present for all algorithms.
265 */
266#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
267#define HAL_CRY_USE_FALLBACK FALSE
268#endif
269
270/**
271 * @brief Makes the driver forcibly use the fall-back implementations.
272 */
273#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
274#define HAL_CRY_ENFORCE_FALLBACK FALSE
275#endif
276
277/*===========================================================================*/
278/* DAC driver related settings. */
279/*===========================================================================*/
280
281/**
282 * @brief Enables synchronous APIs.
283 * @note Disabling this option saves both code and data space.
284 */
285#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
286#define DAC_USE_WAIT TRUE
287#endif
288
289/**
290 * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
291 * @note Disabling this option saves both code and data space.
292 */
293#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
294#define DAC_USE_MUTUAL_EXCLUSION TRUE
295#endif
296
297/*===========================================================================*/
298/* I2C driver related settings. */
299/*===========================================================================*/
300
301/**
302 * @brief Enables the mutual exclusion APIs on the I2C bus.
303 */
304#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
305#define I2C_USE_MUTUAL_EXCLUSION TRUE
306#endif
307
308/*===========================================================================*/
309/* MAC driver related settings. */
310/*===========================================================================*/
311
312/**
313 * @brief Enables the zero-copy API.
314 */
315#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
316#define MAC_USE_ZERO_COPY FALSE
317#endif
318
319/**
320 * @brief Enables an event sources for incoming packets.
321 */
322#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
323#define MAC_USE_EVENTS TRUE
324#endif
325
326/*===========================================================================*/
327/* MMC_SPI driver related settings. */
328/*===========================================================================*/
329
330/**
331 * @brief Delays insertions.
332 * @details If enabled this options inserts delays into the MMC waiting
333 * routines releasing some extra CPU time for the threads with
334 * lower priority, this may slow down the driver a bit however.
335 * This option is recommended also if the SPI driver does not
336 * use a DMA channel and heavily loads the CPU.
337 */
338#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
339#define MMC_NICE_WAITING TRUE
340#endif
341
342/*===========================================================================*/
343/* SDC driver related settings. */
344/*===========================================================================*/
345
346/**
347 * @brief Number of initialization attempts before rejecting the card.
348 * @note Attempts are performed at 10mS intervals.
349 */
350#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
351#define SDC_INIT_RETRY 100
352#endif
353
354/**
355 * @brief Include support for MMC cards.
356 * @note MMC support is not yet implemented so this option must be kept
357 * at @p FALSE.
358 */
359#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
360#define SDC_MMC_SUPPORT FALSE
361#endif
362
363/**
364 * @brief Delays insertions.
365 * @details If enabled this options inserts delays into the MMC waiting
366 * routines releasing some extra CPU time for the threads with
367 * lower priority, this may slow down the driver a bit however.
368 */
369#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
370#define SDC_NICE_WAITING TRUE
371#endif
372
373/**
374 * @brief OCR initialization constant for V20 cards.
375 */
376#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
377#define SDC_INIT_OCR_V20 0x50FF8000U
378#endif
379
380/**
381 * @brief OCR initialization constant for non-V20 cards.
382 */
383#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
384#define SDC_INIT_OCR 0x80100000U
385#endif
386
387/*===========================================================================*/
388/* SERIAL driver related settings. */
389/*===========================================================================*/
390
391/**
392 * @brief Default bit rate.
393 * @details Configuration parameter, this is the baud rate selected for the
394 * default configuration.
395 */
396#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
397#define SERIAL_DEFAULT_BITRATE 38400
398#endif
399
400/**
401 * @brief Serial buffers size.
402 * @details Configuration parameter, you can change the depth of the queue
403 * buffers depending on the requirements of your application.
404 * @note The default is 16 bytes for both the transmission and receive
405 * buffers.
406 */
407#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
408#define SERIAL_BUFFERS_SIZE 16
409#endif
410
411/*===========================================================================*/
412/* SERIAL_USB driver related setting. */
413/*===========================================================================*/
414
415/**
416 * @brief Serial over USB buffers size.
417 * @details Configuration parameter, the buffer size must be a multiple of
418 * the USB data endpoint maximum packet size.
419 * @note The default is 256 bytes for both the transmission and receive
420 * buffers.
421 */
422#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
423#define SERIAL_USB_BUFFERS_SIZE 256
424#endif
425
426/**
427 * @brief Serial over USB number of buffers.
428 * @note The default is 2 buffers.
429 */
430#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
431#define SERIAL_USB_BUFFERS_NUMBER 2
432#endif
433
434/*===========================================================================*/
435/* SPI driver related settings. */
436/*===========================================================================*/
437
438/**
439 * @brief Enables synchronous APIs.
440 * @note Disabling this option saves both code and data space.
441 */
442#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
443#define SPI_USE_WAIT TRUE
444#endif
445
446/**
447 * @brief Enables circular transfers APIs.
448 * @note Disabling this option saves both code and data space.
449 */
450#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
451#define SPI_USE_CIRCULAR FALSE
452#endif
453
454
455/**
456 * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
457 * @note Disabling this option saves both code and data space.
458 */
459#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
460#define SPI_USE_MUTUAL_EXCLUSION TRUE
461#endif
462
463/**
464 * @brief Handling method for SPI CS line.
465 * @note Disabling this option saves both code and data space.
466 */
467#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
468#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
469#endif
470
471/*===========================================================================*/
472/* UART driver related settings. */
473/*===========================================================================*/
474
475/**
476 * @brief Enables synchronous APIs.
477 * @note Disabling this option saves both code and data space.
478 */
479#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
480#define UART_USE_WAIT FALSE
481#endif
482
483/**
484 * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
485 * @note Disabling this option saves both code and data space.
486 */
487#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
488#define UART_USE_MUTUAL_EXCLUSION FALSE
489#endif
490
491/*===========================================================================*/
492/* USB driver related settings. */
493/*===========================================================================*/
494
495/**
496 * @brief Enables synchronous APIs.
497 * @note Disabling this option saves both code and data space.
498 */
499#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
500#define USB_USE_WAIT TRUE
501#endif
502
503/*===========================================================================*/
504/* WSPI driver related settings. */
505/*===========================================================================*/
506
507/**
508 * @brief Enables synchronous APIs.
509 * @note Disabling this option saves both code and data space.
510 */
511#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
512#define WSPI_USE_WAIT TRUE
513#endif
514
515/**
516 * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
517 * @note Disabling this option saves both code and data space.
518 */
519#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
520#define WSPI_USE_MUTUAL_EXCLUSION TRUE
521#endif
522
523#endif /* HALCONF_H */
524
525/** @} */
diff --git a/platforms/chibios/BLACKPILL_STM32_F401/configs/mcuconf.h b/platforms/chibios/BLACKPILL_STM32_F401/configs/mcuconf.h
new file mode 100644
index 000000000..ba6e934fe
--- /dev/null
+++ b/platforms/chibios/BLACKPILL_STM32_F401/configs/mcuconf.h
@@ -0,0 +1,253 @@
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
36/*
37 * HAL driver system settings.
38 */
39#define STM32_NO_INIT FALSE
40#define STM32_HSI_ENABLED TRUE
41#define STM32_LSI_ENABLED TRUE
42#define STM32_HSE_ENABLED TRUE
43#define STM32_LSE_ENABLED FALSE
44#define STM32_CLOCK48_REQUIRED TRUE
45#define STM32_SW STM32_SW_PLL
46#define STM32_PLLSRC STM32_PLLSRC_HSE
47#define STM32_PLLM_VALUE 25
48#define STM32_PLLN_VALUE 336
49#define STM32_PLLP_VALUE 4
50#define STM32_PLLQ_VALUE 7
51#define STM32_HPRE STM32_HPRE_DIV1
52#define STM32_PPRE1 STM32_PPRE1_DIV4
53#define STM32_PPRE2 STM32_PPRE2_DIV2
54#define STM32_RTCSEL STM32_RTCSEL_LSI
55#define STM32_RTCPRE_VALUE 8
56#define STM32_MCO1SEL STM32_MCO1SEL_HSI
57#define STM32_MCO1PRE STM32_MCO1PRE_DIV1
58#define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK
59#define STM32_MCO2PRE STM32_MCO2PRE_DIV5
60#define STM32_I2SSRC STM32_I2SSRC_CKIN
61#define STM32_PLLI2SN_VALUE 192
62#define STM32_PLLI2SR_VALUE 5
63#define STM32_PVD_ENABLE FALSE
64#define STM32_PLS STM32_PLS_LEV0
65#define STM32_BKPRAM_ENABLE FALSE
66
67/*
68 * IRQ system settings.
69 */
70#define STM32_IRQ_EXTI0_PRIORITY 6
71#define STM32_IRQ_EXTI1_PRIORITY 6
72#define STM32_IRQ_EXTI2_PRIORITY 6
73#define STM32_IRQ_EXTI3_PRIORITY 6
74#define STM32_IRQ_EXTI4_PRIORITY 6
75#define STM32_IRQ_EXTI5_9_PRIORITY 6
76#define STM32_IRQ_EXTI10_15_PRIORITY 6
77#define STM32_IRQ_EXTI16_PRIORITY 6
78#define STM32_IRQ_EXTI17_PRIORITY 15
79#define STM32_IRQ_EXTI18_PRIORITY 6
80#define STM32_IRQ_EXTI19_PRIORITY 6
81#define STM32_IRQ_EXTI20_PRIORITY 6
82#define STM32_IRQ_EXTI21_PRIORITY 15
83#define STM32_IRQ_EXTI22_PRIORITY 15
84
85/*
86 * ADC driver system settings.
87 */
88#define STM32_ADC_ADCPRE ADC_CCR_ADCPRE_DIV4
89#define STM32_ADC_USE_ADC1 FALSE
90#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
91#define STM32_ADC_ADC1_DMA_PRIORITY 2
92#define STM32_ADC_IRQ_PRIORITY 6
93#define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 6
94
95/*
96 * GPT driver system settings.
97 */
98#define STM32_GPT_USE_TIM1 FALSE
99#define STM32_GPT_USE_TIM2 FALSE
100#define STM32_GPT_USE_TIM3 FALSE
101#define STM32_GPT_USE_TIM4 FALSE
102#define STM32_GPT_USE_TIM5 FALSE
103#define STM32_GPT_USE_TIM9 FALSE
104#define STM32_GPT_USE_TIM11 FALSE
105#define STM32_GPT_TIM1_IRQ_PRIORITY 7
106#define STM32_GPT_TIM2_IRQ_PRIORITY 7
107#define STM32_GPT_TIM3_IRQ_PRIORITY 7
108#define STM32_GPT_TIM4_IRQ_PRIORITY 7
109#define STM32_GPT_TIM5_IRQ_PRIORITY 7
110#define STM32_GPT_TIM9_IRQ_PRIORITY 7
111#define STM32_GPT_TIM11_IRQ_PRIORITY 7
112
113/*
114 * I2C driver system settings.
115 */
116#define STM32_I2C_USE_I2C1 FALSE
117#define STM32_I2C_USE_I2C2 FALSE
118#define STM32_I2C_USE_I2C3 FALSE
119#define STM32_I2C_BUSY_TIMEOUT 50
120#define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
121#define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
122#define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
123#define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
124#define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
125#define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
126#define STM32_I2C_I2C1_IRQ_PRIORITY 5
127#define STM32_I2C_I2C2_IRQ_PRIORITY 5
128#define STM32_I2C_I2C3_IRQ_PRIORITY 5
129#define STM32_I2C_I2C1_DMA_PRIORITY 3
130#define STM32_I2C_I2C2_DMA_PRIORITY 3
131#define STM32_I2C_I2C3_DMA_PRIORITY 3
132#define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
133
134/*
135 * I2S driver system settings.
136 */
137#define STM32_I2S_USE_SPI2 FALSE
138#define STM32_I2S_USE_SPI3 FALSE
139#define STM32_I2S_SPI2_IRQ_PRIORITY 10
140#define STM32_I2S_SPI3_IRQ_PRIORITY 10
141#define STM32_I2S_SPI2_DMA_PRIORITY 1
142#define STM32_I2S_SPI3_DMA_PRIORITY 1
143#define STM32_I2S_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
144#define STM32_I2S_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
145#define STM32_I2S_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
146#define STM32_I2S_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
147#define STM32_I2S_DMA_ERROR_HOOK(i2sp) osalSysHalt("DMA failure")
148
149/*
150 * ICU driver system settings.
151 */
152#define STM32_ICU_USE_TIM1 FALSE
153#define STM32_ICU_USE_TIM2 FALSE
154#define STM32_ICU_USE_TIM3 FALSE
155#define STM32_ICU_USE_TIM4 FALSE
156#define STM32_ICU_USE_TIM5 FALSE
157#define STM32_ICU_USE_TIM9 FALSE
158#define STM32_ICU_TIM1_IRQ_PRIORITY 7
159#define STM32_ICU_TIM2_IRQ_PRIORITY 7
160#define STM32_ICU_TIM3_IRQ_PRIORITY 7
161#define STM32_ICU_TIM4_IRQ_PRIORITY 7
162#define STM32_ICU_TIM5_IRQ_PRIORITY 7
163#define STM32_ICU_TIM9_IRQ_PRIORITY 7
164
165/*
166 * PWM driver system settings.
167 */
168#define STM32_PWM_USE_ADVANCED FALSE
169#define STM32_PWM_USE_TIM1 FALSE
170#define STM32_PWM_USE_TIM2 FALSE
171#define STM32_PWM_USE_TIM3 FALSE
172#define STM32_PWM_USE_TIM4 FALSE
173#define STM32_PWM_USE_TIM5 FALSE
174#define STM32_PWM_USE_TIM9 FALSE
175#define STM32_PWM_TIM1_IRQ_PRIORITY 7
176#define STM32_PWM_TIM2_IRQ_PRIORITY 7
177#define STM32_PWM_TIM3_IRQ_PRIORITY 7
178#define STM32_PWM_TIM4_IRQ_PRIORITY 7
179#define STM32_PWM_TIM5_IRQ_PRIORITY 7
180#define STM32_PWM_TIM9_IRQ_PRIORITY 7
181
182/*
183 * SERIAL driver system settings.
184 */
185#define STM32_SERIAL_USE_USART1 FALSE
186#define STM32_SERIAL_USE_USART2 FALSE
187#define STM32_SERIAL_USE_USART6 FALSE
188#define STM32_SERIAL_USART1_PRIORITY 12
189#define STM32_SERIAL_USART2_PRIORITY 12
190#define STM32_SERIAL_USART6_PRIORITY 12
191
192/*
193 * SPI driver system settings.
194 */
195#define STM32_SPI_USE_SPI1 FALSE
196#define STM32_SPI_USE_SPI2 FALSE
197#define STM32_SPI_USE_SPI3 FALSE
198#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0)
199#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
200#define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
201#define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
202#define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
203#define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
204#define STM32_SPI_SPI1_DMA_PRIORITY 1
205#define STM32_SPI_SPI2_DMA_PRIORITY 1
206#define STM32_SPI_SPI3_DMA_PRIORITY 1
207#define STM32_SPI_SPI1_IRQ_PRIORITY 10
208#define STM32_SPI_SPI2_IRQ_PRIORITY 10
209#define STM32_SPI_SPI3_IRQ_PRIORITY 10
210#define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
211
212/*
213 * ST driver system settings.
214 */
215#define STM32_ST_IRQ_PRIORITY 8
216#define STM32_ST_USE_TIMER 2
217
218/*
219 * UART driver system settings.
220 */
221#define STM32_UART_USE_USART1 FALSE
222#define STM32_UART_USE_USART2 FALSE
223#define STM32_UART_USE_USART6 FALSE
224#define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
225#define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
226#define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
227#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
228#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
229#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
230#define STM32_UART_USART1_IRQ_PRIORITY 12
231#define STM32_UART_USART2_IRQ_PRIORITY 12
232#define STM32_UART_USART6_IRQ_PRIORITY 12
233#define STM32_UART_USART1_DMA_PRIORITY 0
234#define STM32_UART_USART2_DMA_PRIORITY 0
235#define STM32_UART_USART6_DMA_PRIORITY 0
236#define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")
237
238/*
239 * USB driver system settings.
240 */
241#define STM32_USB_USE_OTG1 TRUE
242#define STM32_USB_OTG1_IRQ_PRIORITY 14
243#define STM32_USB_OTG1_RX_FIFO_SIZE 512
244#define STM32_USB_OTG_THREAD_PRIO NORMALPRIO+1
245#define STM32_USB_OTG_THREAD_STACK_SIZE 128
246#define STM32_USB_OTGFIFO_FILL_BASEPRI 0
247
248/*
249 * WDG driver system settings.
250 */
251#define STM32_WDG_USE_IWDG FALSE
252
253#endif /* MCUCONF_H */
diff --git a/platforms/chibios/BLACKPILL_STM32_F411/board/board.mk b/platforms/chibios/BLACKPILL_STM32_F411/board/board.mk
new file mode 100644
index 000000000..bb00b1a2b
--- /dev/null
+++ b/platforms/chibios/BLACKPILL_STM32_F411/board/board.mk
@@ -0,0 +1,9 @@
1# List of all the board related files.
2BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_F411RE/board.c
3
4# Required include directories
5BOARDINC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_F411RE
6
7# Shared variables
8ALLCSRC += $(BOARDSRC)
9ALLINC += $(BOARDINC)
diff --git a/platforms/chibios/BLACKPILL_STM32_F411/configs/board.h b/platforms/chibios/BLACKPILL_STM32_F411/configs/board.h
new file mode 100644
index 000000000..30af6b0c8
--- /dev/null
+++ b/platforms/chibios/BLACKPILL_STM32_F411/configs/board.h
@@ -0,0 +1,20 @@
1/* Copyright 2020 Nick Brassel (tzarc)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <https://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#include_next "board.h"
19
20#undef STM32_HSE_BYPASS
diff --git a/platforms/chibios/BLACKPILL_STM32_F411/configs/chconf.h b/platforms/chibios/BLACKPILL_STM32_F411/configs/chconf.h
new file mode 100644
index 000000000..7dc4f84a8
--- /dev/null
+++ b/platforms/chibios/BLACKPILL_STM32_F411/configs/chconf.h
@@ -0,0 +1,714 @@
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 rt/templates/chconf.h
19 * @brief Configuration file template.
20 * @details A copy of this file must be placed in each project directory, it
21 * contains the application specific kernel settings.
22 *
23 * @addtogroup config
24 * @details Kernel related settings and hooks.
25 * @{
26 */
27
28#ifndef CHCONF_H
29#define CHCONF_H
30
31#define _CHIBIOS_RT_CONF_
32#define _CHIBIOS_RT_CONF_VER_6_0_
33
34/*===========================================================================*/
35/**
36 * @name System timers settings
37 * @{
38 */
39/*===========================================================================*/
40
41/**
42 * @brief System time counter resolution.
43 * @note Allowed values are 16 or 32 bits.
44 */
45#if !defined(CH_CFG_ST_RESOLUTION)
46#define CH_CFG_ST_RESOLUTION 32
47#endif
48
49/**
50 * @brief System tick frequency.
51 * @details Frequency of the system timer that drives the system ticks. This
52 * setting also defines the system tick time unit.
53 */
54#if !defined(CH_CFG_ST_FREQUENCY)
55#define CH_CFG_ST_FREQUENCY 10000
56#endif
57
58/**
59 * @brief Time intervals data size.
60 * @note Allowed values are 16, 32 or 64 bits.
61 */
62#if !defined(CH_CFG_INTERVALS_SIZE)
63#define CH_CFG_INTERVALS_SIZE 32
64#endif
65
66/**
67 * @brief Time types data size.
68 * @note Allowed values are 16 or 32 bits.
69 */
70#if !defined(CH_CFG_TIME_TYPES_SIZE)
71#define CH_CFG_TIME_TYPES_SIZE 32
72#endif
73
74/**
75 * @brief Time delta constant for the tick-less mode.
76 * @note If this value is zero then the system uses the classic
77 * periodic tick. This value represents the minimum number
78 * of ticks that is safe to specify in a timeout directive.
79 * The value one is not valid, timeouts are rounded up to
80 * this value.
81 */
82#if !defined(CH_CFG_ST_TIMEDELTA)
83#define CH_CFG_ST_TIMEDELTA 2
84#endif
85
86/** @} */
87
88/*===========================================================================*/
89/**
90 * @name Kernel parameters and options
91 * @{
92 */
93/*===========================================================================*/
94
95/**
96 * @brief Round robin interval.
97 * @details This constant is the number of system ticks allowed for the
98 * threads before preemption occurs. Setting this value to zero
99 * disables the preemption for threads with equal priority and the
100 * round robin becomes cooperative. Note that higher priority
101 * threads can still preempt, the kernel is always preemptive.
102 * @note Disabling the round robin preemption makes the kernel more compact
103 * and generally faster.
104 * @note The round robin preemption is not supported in tickless mode and
105 * must be set to zero in that case.
106 */
107#if !defined(CH_CFG_TIME_QUANTUM)
108#define CH_CFG_TIME_QUANTUM 0
109#endif
110
111/**
112 * @brief Managed RAM size.
113 * @details Size of the RAM area to be managed by the OS. If set to zero
114 * then the whole available RAM is used. The core memory is made
115 * available to the heap allocator and/or can be used directly through
116 * the simplified core memory allocator.
117 *
118 * @note In order to let the OS manage the whole RAM the linker script must
119 * provide the @p __heap_base__ and @p __heap_end__ symbols.
120 * @note Requires @p CH_CFG_USE_MEMCORE.
121 */
122#if !defined(CH_CFG_MEMCORE_SIZE)
123#define CH_CFG_MEMCORE_SIZE 0
124#endif
125
126/**
127 * @brief Idle thread automatic spawn suppression.
128 * @details When this option is activated the function @p chSysInit()
129 * does not spawn the idle thread. The application @p main()
130 * function becomes the idle thread and must implement an
131 * infinite loop.
132 */
133#if !defined(CH_CFG_NO_IDLE_THREAD)
134#define CH_CFG_NO_IDLE_THREAD FALSE
135#endif
136
137/** @} */
138
139/*===========================================================================*/
140/**
141 * @name Performance options
142 * @{
143 */
144/*===========================================================================*/
145
146/**
147 * @brief OS optimization.
148 * @details If enabled then time efficient rather than space efficient code
149 * is used when two possible implementations exist.
150 *
151 * @note This is not related to the compiler optimization options.
152 * @note The default is @p TRUE.
153 */
154#if !defined(CH_CFG_OPTIMIZE_SPEED)
155#define CH_CFG_OPTIMIZE_SPEED TRUE
156#endif
157
158/** @} */
159
160/*===========================================================================*/
161/**
162 * @name Subsystem options
163 * @{
164 */
165/*===========================================================================*/
166
167/**
168 * @brief Time Measurement APIs.
169 * @details If enabled then the time measurement APIs are included in
170 * the kernel.
171 *
172 * @note The default is @p TRUE.
173 */
174#if !defined(CH_CFG_USE_TM)
175#define CH_CFG_USE_TM TRUE
176#endif
177
178/**
179 * @brief Threads registry APIs.
180 * @details If enabled then the registry APIs are included in the kernel.
181 *
182 * @note The default is @p TRUE.
183 */
184#if !defined(CH_CFG_USE_REGISTRY)
185#define CH_CFG_USE_REGISTRY TRUE
186#endif
187
188/**
189 * @brief Threads synchronization APIs.
190 * @details If enabled then the @p chThdWait() function is included in
191 * the kernel.
192 *
193 * @note The default is @p TRUE.
194 */
195#if !defined(CH_CFG_USE_WAITEXIT)
196#define CH_CFG_USE_WAITEXIT TRUE
197#endif
198
199/**
200 * @brief Semaphores APIs.
201 * @details If enabled then the Semaphores APIs are included in the kernel.
202 *
203 * @note The default is @p TRUE.
204 */
205#if !defined(CH_CFG_USE_SEMAPHORES)
206#define CH_CFG_USE_SEMAPHORES TRUE
207#endif
208
209/**
210 * @brief Semaphores queuing mode.
211 * @details If enabled then the threads are enqueued on semaphores by
212 * priority rather than in FIFO order.
213 *
214 * @note The default is @p FALSE. Enable this if you have special
215 * requirements.
216 * @note Requires @p CH_CFG_USE_SEMAPHORES.
217 */
218#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
219#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
220#endif
221
222/**
223 * @brief Mutexes APIs.
224 * @details If enabled then the mutexes APIs are included in the kernel.
225 *
226 * @note The default is @p TRUE.
227 */
228#if !defined(CH_CFG_USE_MUTEXES)
229#define CH_CFG_USE_MUTEXES TRUE
230#endif
231
232/**
233 * @brief Enables recursive behavior on mutexes.
234 * @note Recursive mutexes are heavier and have an increased
235 * memory footprint.
236 *
237 * @note The default is @p FALSE.
238 * @note Requires @p CH_CFG_USE_MUTEXES.
239 */
240#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
241#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
242#endif
243
244/**
245 * @brief Conditional Variables APIs.
246 * @details If enabled then the conditional variables APIs are included
247 * in the kernel.
248 *
249 * @note The default is @p TRUE.
250 * @note Requires @p CH_CFG_USE_MUTEXES.
251 */
252#if !defined(CH_CFG_USE_CONDVARS)
253#define CH_CFG_USE_CONDVARS TRUE
254#endif
255
256/**
257 * @brief Conditional Variables APIs with timeout.
258 * @details If enabled then the conditional variables APIs with timeout
259 * specification are included in the kernel.
260 *
261 * @note The default is @p TRUE.
262 * @note Requires @p CH_CFG_USE_CONDVARS.
263 */
264#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
265#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
266#endif
267
268/**
269 * @brief Events Flags APIs.
270 * @details If enabled then the event flags APIs are included in the kernel.
271 *
272 * @note The default is @p TRUE.
273 */
274#if !defined(CH_CFG_USE_EVENTS)
275#define CH_CFG_USE_EVENTS TRUE
276#endif
277
278/**
279 * @brief Events Flags APIs with timeout.
280 * @details If enabled then the events APIs with timeout specification
281 * are included in the kernel.
282 *
283 * @note The default is @p TRUE.
284 * @note Requires @p CH_CFG_USE_EVENTS.
285 */
286#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
287#define CH_CFG_USE_EVENTS_TIMEOUT TRUE
288#endif
289
290/**
291 * @brief Synchronous Messages APIs.
292 * @details If enabled then the synchronous messages APIs are included
293 * in the kernel.
294 *
295 * @note The default is @p TRUE.
296 */
297#if !defined(CH_CFG_USE_MESSAGES)
298#define CH_CFG_USE_MESSAGES TRUE
299#endif
300
301/**
302 * @brief Synchronous Messages queuing mode.
303 * @details If enabled then messages are served by priority rather than in
304 * FIFO order.
305 *
306 * @note The default is @p FALSE. Enable this if you have special
307 * requirements.
308 * @note Requires @p CH_CFG_USE_MESSAGES.
309 */
310#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
311#define CH_CFG_USE_MESSAGES_PRIORITY FALSE
312#endif
313
314/**
315 * @brief Mailboxes APIs.
316 * @details If enabled then the asynchronous messages (mailboxes) APIs are
317 * included in the kernel.
318 *
319 * @note The default is @p TRUE.
320 * @note Requires @p CH_CFG_USE_SEMAPHORES.
321 */
322#if !defined(CH_CFG_USE_MAILBOXES)
323#define CH_CFG_USE_MAILBOXES TRUE
324#endif
325
326/**
327 * @brief Core Memory Manager APIs.
328 * @details If enabled then the core memory manager APIs are included
329 * in the kernel.
330 *
331 * @note The default is @p TRUE.
332 */
333#if !defined(CH_CFG_USE_MEMCORE)
334#define CH_CFG_USE_MEMCORE TRUE
335#endif
336
337/**
338 * @brief Heap Allocator APIs.
339 * @details If enabled then the memory heap allocator APIs are included
340 * in the kernel.
341 *
342 * @note The default is @p TRUE.
343 * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
344 * @p CH_CFG_USE_SEMAPHORES.
345 * @note Mutexes are recommended.
346 */
347#if !defined(CH_CFG_USE_HEAP)
348#define CH_CFG_USE_HEAP TRUE
349#endif
350
351/**
352 * @brief Memory Pools Allocator APIs.
353 * @details If enabled then the memory pools allocator APIs are included
354 * in the kernel.
355 *
356 * @note The default is @p TRUE.
357 */
358#if !defined(CH_CFG_USE_MEMPOOLS)
359#define CH_CFG_USE_MEMPOOLS TRUE
360#endif
361
362/**
363 * @brief Objects FIFOs APIs.
364 * @details If enabled then the objects FIFOs APIs are included
365 * in the kernel.
366 *
367 * @note The default is @p TRUE.
368 */
369#if !defined(CH_CFG_USE_OBJ_FIFOS)
370#define CH_CFG_USE_OBJ_FIFOS TRUE
371#endif
372
373/**
374 * @brief Pipes APIs.
375 * @details If enabled then the pipes APIs are included
376 * in the kernel.
377 *
378 * @note The default is @p TRUE.
379 */
380#if !defined(CH_CFG_USE_PIPES)
381#define CH_CFG_USE_PIPES TRUE
382#endif
383
384/**
385 * @brief Dynamic Threads APIs.
386 * @details If enabled then the dynamic threads creation APIs are included
387 * in the kernel.
388 *
389 * @note The default is @p TRUE.
390 * @note Requires @p CH_CFG_USE_WAITEXIT.
391 * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
392 */
393#if !defined(CH_CFG_USE_DYNAMIC)
394#define CH_CFG_USE_DYNAMIC TRUE
395#endif
396
397/** @} */
398
399/*===========================================================================*/
400/**
401 * @name Objects factory options
402 * @{
403 */
404/*===========================================================================*/
405
406/**
407 * @brief Objects Factory APIs.
408 * @details If enabled then the objects factory APIs are included in the
409 * kernel.
410 *
411 * @note The default is @p FALSE.
412 */
413#if !defined(CH_CFG_USE_FACTORY)
414#define CH_CFG_USE_FACTORY TRUE
415#endif
416
417/**
418 * @brief Maximum length for object names.
419 * @details If the specified length is zero then the name is stored by
420 * pointer but this could have unintended side effects.
421 */
422#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
423#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8
424#endif
425
426/**
427 * @brief Enables the registry of generic objects.
428 */
429#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
430#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
431#endif
432
433/**
434 * @brief Enables factory for generic buffers.
435 */
436#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
437#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
438#endif
439
440/**
441 * @brief Enables factory for semaphores.
442 */
443#if !defined(CH_CFG_FACTORY_SEMAPHORES)
444#define CH_CFG_FACTORY_SEMAPHORES TRUE
445#endif
446
447/**
448 * @brief Enables factory for mailboxes.
449 */
450#if !defined(CH_CFG_FACTORY_MAILBOXES)
451#define CH_CFG_FACTORY_MAILBOXES TRUE
452#endif
453
454/**
455 * @brief Enables factory for objects FIFOs.
456 */
457#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
458#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
459#endif
460
461/**
462 * @brief Enables factory for Pipes.
463 */
464#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
465#define CH_CFG_FACTORY_PIPES TRUE
466#endif
467
468/** @} */
469
470/*===========================================================================*/
471/**
472 * @name Debug options
473 * @{
474 */
475/*===========================================================================*/
476
477/**
478 * @brief Debug option, kernel statistics.
479 *
480 * @note The default is @p FALSE.
481 */
482#if !defined(CH_DBG_STATISTICS)
483#define CH_DBG_STATISTICS FALSE
484#endif
485
486/**
487 * @brief Debug option, system state check.
488 * @details If enabled the correct call protocol for system APIs is checked
489 * at runtime.
490 *
491 * @note The default is @p FALSE.
492 */
493#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
494#define CH_DBG_SYSTEM_STATE_CHECK FALSE
495#endif
496
497/**
498 * @brief Debug option, parameters checks.
499 * @details If enabled then the checks on the API functions input
500 * parameters are activated.
501 *
502 * @note The default is @p FALSE.
503 */
504#if !defined(CH_DBG_ENABLE_CHECKS)
505#define CH_DBG_ENABLE_CHECKS FALSE
506#endif
507
508/**
509 * @brief Debug option, consistency checks.
510 * @details If enabled then all the assertions in the kernel code are
511 * activated. This includes consistency checks inside the kernel,
512 * runtime anomalies and port-defined checks.
513 *
514 * @note The default is @p FALSE.
515 */
516#if !defined(CH_DBG_ENABLE_ASSERTS)
517#define CH_DBG_ENABLE_ASSERTS FALSE
518#endif
519
520/**
521 * @brief Debug option, trace buffer.
522 * @details If enabled then the trace buffer is activated.
523 *
524 * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
525 */
526#if !defined(CH_DBG_TRACE_MASK)
527#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
528#endif
529
530/**
531 * @brief Trace buffer entries.
532 * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
533 * different from @p CH_DBG_TRACE_MASK_DISABLED.
534 */
535#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
536#define CH_DBG_TRACE_BUFFER_SIZE 128
537#endif
538
539/**
540 * @brief Debug option, stack checks.
541 * @details If enabled then a runtime stack check is performed.
542 *
543 * @note The default is @p FALSE.
544 * @note The stack check is performed in a architecture/port dependent way.
545 * It may not be implemented or some ports.
546 * @note The default failure mode is to halt the system with the global
547 * @p panic_msg variable set to @p NULL.
548 */
549#if !defined(CH_DBG_ENABLE_STACK_CHECK)
550#define CH_DBG_ENABLE_STACK_CHECK FALSE
551#endif
552
553/**
554 * @brief Debug option, stacks initialization.
555 * @details If enabled then the threads working area is filled with a byte
556 * value when a thread is created. This can be useful for the
557 * runtime measurement of the used stack.
558 *
559 * @note The default is @p FALSE.
560 */
561#if !defined(CH_DBG_FILL_THREADS)
562#define CH_DBG_FILL_THREADS FALSE
563#endif
564
565/**
566 * @brief Debug option, threads profiling.
567 * @details If enabled then a field is added to the @p thread_t structure that
568 * counts the system ticks occurred while executing the thread.
569 *
570 * @note The default is @p FALSE.
571 * @note This debug option is not currently compatible with the
572 * tickless mode.
573 */
574#if !defined(CH_DBG_THREADS_PROFILING)
575#define CH_DBG_THREADS_PROFILING FALSE
576#endif
577
578/** @} */
579
580/*===========================================================================*/
581/**
582 * @name Kernel hooks
583 * @{
584 */
585/*===========================================================================*/
586
587/**
588 * @brief System structure extension.
589 * @details User fields added to the end of the @p ch_system_t structure.
590 */
591#define CH_CFG_SYSTEM_EXTRA_FIELDS \
592 /* Add threads custom fields here.*/
593
594/**
595 * @brief System initialization hook.
596 * @details User initialization code added to the @p chSysInit() function
597 * just before interrupts are enabled globally.
598 */
599#define CH_CFG_SYSTEM_INIT_HOOK() { \
600 /* Add threads initialization code here.*/ \
601}
602
603/**
604 * @brief Threads descriptor structure extension.
605 * @details User fields added to the end of the @p thread_t structure.
606 */
607#define CH_CFG_THREAD_EXTRA_FIELDS \
608 /* Add threads custom fields here.*/
609
610/**
611 * @brief Threads initialization hook.
612 * @details User initialization code added to the @p _thread_init() function.
613 *
614 * @note It is invoked from within @p _thread_init() and implicitly from all
615 * the threads creation APIs.
616 */
617#define CH_CFG_THREAD_INIT_HOOK(tp) { \
618 /* Add threads initialization code here.*/ \
619}
620
621/**
622 * @brief Threads finalization hook.
623 * @details User finalization code added to the @p chThdExit() API.
624 */
625#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
626 /* Add threads finalization code here.*/ \
627}
628
629/**
630 * @brief Context switch hook.
631 * @details This hook is invoked just before switching between threads.
632 */
633#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
634 /* Context switch code here.*/ \
635}
636
637/**
638 * @brief ISR enter hook.
639 */
640#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
641 /* IRQ prologue code here.*/ \
642}
643
644/**
645 * @brief ISR exit hook.
646 */
647#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
648 /* IRQ epilogue code here.*/ \
649}
650
651/**
652 * @brief Idle thread enter hook.
653 * @note This hook is invoked within a critical zone, no OS functions
654 * should be invoked from here.
655 * @note This macro can be used to activate a power saving mode.
656 */
657#define CH_CFG_IDLE_ENTER_HOOK() { \
658 /* Idle-enter code here.*/ \
659}
660
661/**
662 * @brief Idle thread leave hook.
663 * @note This hook is invoked within a critical zone, no OS functions
664 * should be invoked from here.
665 * @note This macro can be used to deactivate a power saving mode.
666 */
667#define CH_CFG_IDLE_LEAVE_HOOK() { \
668 /* Idle-leave code here.*/ \
669}
670
671/**
672 * @brief Idle Loop hook.
673 * @details This hook is continuously invoked by the idle thread loop.
674 */
675#define CH_CFG_IDLE_LOOP_HOOK() { \
676 /* Idle loop code here.*/ \
677}
678
679/**
680 * @brief System tick event hook.
681 * @details This hook is invoked in the system tick handler immediately
682 * after processing the virtual timers queue.
683 */
684#define CH_CFG_SYSTEM_TICK_HOOK() { \
685 /* System tick event code here.*/ \
686}
687
688/**
689 * @brief System halt hook.
690 * @details This hook is invoked in case to a system halting error before
691 * the system is halted.
692 */
693#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
694 /* System halt code here.*/ \
695}
696
697/**
698 * @brief Trace hook.
699 * @details This hook is invoked each time a new record is written in the
700 * trace buffer.
701 */
702#define CH_CFG_TRACE_HOOK(tep) { \
703 /* Trace code here.*/ \
704}
705
706/** @} */
707
708/*===========================================================================*/
709/* Port-specific settings (override port settings defaulted in chcore.h). */
710/*===========================================================================*/
711
712#endif /* CHCONF_H */
713
714/** @} */
diff --git a/platforms/chibios/BLACKPILL_STM32_F411/configs/config.h b/platforms/chibios/BLACKPILL_STM32_F411/configs/config.h
new file mode 100644
index 000000000..eb73e72ef
--- /dev/null
+++ b/platforms/chibios/BLACKPILL_STM32_F411/configs/config.h
@@ -0,0 +1,23 @@
1/* Copyright 2020 Nick Brassel (tzarc)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <https://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#define BOARD_OTG_NOVBUSSENS 1
19
20#define STM32_LSECLK 32768U
21#define STM32_HSECLK 25000000U
22
23#define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
diff --git a/platforms/chibios/BLACKPILL_STM32_F411/configs/halconf.h b/platforms/chibios/BLACKPILL_STM32_F411/configs/halconf.h
new file mode 100644
index 000000000..a8db392aa
--- /dev/null
+++ b/platforms/chibios/BLACKPILL_STM32_F411/configs/halconf.h
@@ -0,0 +1,525 @@
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_0_
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 GPT subsystem.
73 */
74#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
75#define HAL_USE_GPT FALSE
76#endif
77
78/**
79 * @brief Enables the I2C subsystem.
80 */
81#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
82#define HAL_USE_I2C FALSE
83#endif
84
85/**
86 * @brief Enables the I2S subsystem.
87 */
88#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
89#define HAL_USE_I2S FALSE
90#endif
91
92/**
93 * @brief Enables the ICU subsystem.
94 */
95#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
96#define HAL_USE_ICU FALSE
97#endif
98
99/**
100 * @brief Enables the MAC subsystem.
101 */
102#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
103#define HAL_USE_MAC FALSE
104#endif
105
106/**
107 * @brief Enables the MMC_SPI subsystem.
108 */
109#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
110#define HAL_USE_MMC_SPI FALSE
111#endif
112
113/**
114 * @brief Enables the PWM subsystem.
115 */
116#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
117#define HAL_USE_PWM FALSE
118#endif
119
120/**
121 * @brief Enables the RTC subsystem.
122 */
123#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
124#define HAL_USE_RTC FALSE
125#endif
126
127/**
128 * @brief Enables the SDC subsystem.
129 */
130#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
131#define HAL_USE_SDC FALSE
132#endif
133
134/**
135 * @brief Enables the SERIAL subsystem.
136 */
137#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
138#define HAL_USE_SERIAL FALSE
139#endif
140
141/**
142 * @brief Enables the SERIAL over USB subsystem.
143 */
144#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
145#define HAL_USE_SERIAL_USB FALSE
146#endif
147
148/**
149 * @brief Enables the SIO subsystem.
150 */
151#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
152#define HAL_USE_SIO FALSE
153#endif
154
155/**
156 * @brief Enables the SPI subsystem.
157 */
158#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
159#define HAL_USE_SPI FALSE
160#endif
161
162/**
163 * @brief Enables the TRNG subsystem.
164 */
165#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
166#define HAL_USE_TRNG FALSE
167#endif
168
169/**
170 * @brief Enables the UART subsystem.
171 */
172#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
173#define HAL_USE_UART FALSE
174#endif
175
176/**
177 * @brief Enables the USB subsystem.
178 */
179#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
180#define HAL_USE_USB TRUE
181#endif
182
183/**
184 * @brief Enables the WDG subsystem.
185 */
186#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
187#define HAL_USE_WDG FALSE
188#endif
189
190/**
191 * @brief Enables the WSPI subsystem.
192 */
193#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
194#define HAL_USE_WSPI FALSE
195#endif
196
197/*===========================================================================*/
198/* PAL driver related settings. */
199/*===========================================================================*/
200
201/**
202 * @brief Enables synchronous APIs.
203 * @note Disabling this option saves both code and data space.
204 */
205#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
206#define PAL_USE_CALLBACKS FALSE
207#endif
208
209/**
210 * @brief Enables synchronous APIs.
211 * @note Disabling this option saves both code and data space.
212 */
213#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
214#define PAL_USE_WAIT FALSE
215#endif
216
217/*===========================================================================*/
218/* ADC driver related settings. */
219/*===========================================================================*/
220
221/**
222 * @brief Enables synchronous APIs.
223 * @note Disabling this option saves both code and data space.
224 */
225#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
226#define ADC_USE_WAIT TRUE
227#endif
228
229/**
230 * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
231 * @note Disabling this option saves both code and data space.
232 */
233#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
234#define ADC_USE_MUTUAL_EXCLUSION TRUE
235#endif
236
237/*===========================================================================*/
238/* CAN driver related settings. */
239/*===========================================================================*/
240
241/**
242 * @brief Sleep mode related APIs inclusion switch.
243 */
244#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
245#define CAN_USE_SLEEP_MODE TRUE
246#endif
247
248/**
249 * @brief Enforces the driver to use direct callbacks rather than OSAL events.
250 */
251#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
252#define CAN_ENFORCE_USE_CALLBACKS FALSE
253#endif
254
255/*===========================================================================*/
256/* CRY driver related settings. */
257/*===========================================================================*/
258
259/**
260 * @brief Enables the SW fall-back of the cryptographic driver.
261 * @details When enabled, this option, activates a fall-back software
262 * implementation for algorithms not supported by the underlying
263 * hardware.
264 * @note Fall-back implementations may not be present for all algorithms.
265 */
266#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
267#define HAL_CRY_USE_FALLBACK FALSE
268#endif
269
270/**
271 * @brief Makes the driver forcibly use the fall-back implementations.
272 */
273#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
274#define HAL_CRY_ENFORCE_FALLBACK FALSE
275#endif
276
277/*===========================================================================*/
278/* DAC driver related settings. */
279/*===========================================================================*/
280
281/**
282 * @brief Enables synchronous APIs.
283 * @note Disabling this option saves both code and data space.
284 */
285#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
286#define DAC_USE_WAIT TRUE
287#endif
288
289/**
290 * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
291 * @note Disabling this option saves both code and data space.
292 */
293#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
294#define DAC_USE_MUTUAL_EXCLUSION TRUE
295#endif
296
297/*===========================================================================*/
298/* I2C driver related settings. */
299/*===========================================================================*/
300
301/**
302 * @brief Enables the mutual exclusion APIs on the I2C bus.
303 */
304#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
305#define I2C_USE_MUTUAL_EXCLUSION TRUE
306#endif
307
308/*===========================================================================*/
309/* MAC driver related settings. */
310/*===========================================================================*/
311
312/**
313 * @brief Enables the zero-copy API.
314 */
315#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
316#define MAC_USE_ZERO_COPY FALSE
317#endif
318
319/**
320 * @brief Enables an event sources for incoming packets.
321 */
322#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
323#define MAC_USE_EVENTS TRUE
324#endif
325
326/*===========================================================================*/
327/* MMC_SPI driver related settings. */
328/*===========================================================================*/
329
330/**
331 * @brief Delays insertions.
332 * @details If enabled this options inserts delays into the MMC waiting
333 * routines releasing some extra CPU time for the threads with
334 * lower priority, this may slow down the driver a bit however.
335 * This option is recommended also if the SPI driver does not
336 * use a DMA channel and heavily loads the CPU.
337 */
338#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
339#define MMC_NICE_WAITING TRUE
340#endif
341
342/*===========================================================================*/
343/* SDC driver related settings. */
344/*===========================================================================*/
345
346/**
347 * @brief Number of initialization attempts before rejecting the card.
348 * @note Attempts are performed at 10mS intervals.
349 */
350#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
351#define SDC_INIT_RETRY 100
352#endif
353
354/**
355 * @brief Include support for MMC cards.
356 * @note MMC support is not yet implemented so this option must be kept
357 * at @p FALSE.
358 */
359#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
360#define SDC_MMC_SUPPORT FALSE
361#endif
362
363/**
364 * @brief Delays insertions.
365 * @details If enabled this options inserts delays into the MMC waiting
366 * routines releasing some extra CPU time for the threads with
367 * lower priority, this may slow down the driver a bit however.
368 */
369#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
370#define SDC_NICE_WAITING TRUE
371#endif
372
373/**
374 * @brief OCR initialization constant for V20 cards.
375 */
376#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
377#define SDC_INIT_OCR_V20 0x50FF8000U
378#endif
379
380/**
381 * @brief OCR initialization constant for non-V20 cards.
382 */
383#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
384#define SDC_INIT_OCR 0x80100000U
385#endif
386
387/*===========================================================================*/
388/* SERIAL driver related settings. */
389/*===========================================================================*/
390
391/**
392 * @brief Default bit rate.
393 * @details Configuration parameter, this is the baud rate selected for the
394 * default configuration.
395 */
396#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
397#define SERIAL_DEFAULT_BITRATE 38400
398#endif
399
400/**
401 * @brief Serial buffers size.
402 * @details Configuration parameter, you can change the depth of the queue
403 * buffers depending on the requirements of your application.
404 * @note The default is 16 bytes for both the transmission and receive
405 * buffers.
406 */
407#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
408#define SERIAL_BUFFERS_SIZE 16
409#endif
410
411/*===========================================================================*/
412/* SERIAL_USB driver related setting. */
413/*===========================================================================*/
414
415/**
416 * @brief Serial over USB buffers size.
417 * @details Configuration parameter, the buffer size must be a multiple of
418 * the USB data endpoint maximum packet size.
419 * @note The default is 256 bytes for both the transmission and receive
420 * buffers.
421 */
422#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
423#define SERIAL_USB_BUFFERS_SIZE 256
424#endif
425
426/**
427 * @brief Serial over USB number of buffers.
428 * @note The default is 2 buffers.
429 */
430#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
431#define SERIAL_USB_BUFFERS_NUMBER 2
432#endif
433
434/*===========================================================================*/
435/* SPI driver related settings. */
436/*===========================================================================*/
437
438/**
439 * @brief Enables synchronous APIs.
440 * @note Disabling this option saves both code and data space.
441 */
442#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
443#define SPI_USE_WAIT TRUE
444#endif
445
446/**
447 * @brief Enables circular transfers APIs.
448 * @note Disabling this option saves both code and data space.
449 */
450#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
451#define SPI_USE_CIRCULAR FALSE
452#endif
453
454
455/**
456 * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
457 * @note Disabling this option saves both code and data space.
458 */
459#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
460#define SPI_USE_MUTUAL_EXCLUSION TRUE
461#endif
462
463/**
464 * @brief Handling method for SPI CS line.
465 * @note Disabling this option saves both code and data space.
466 */
467#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
468#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
469#endif
470
471/*===========================================================================*/
472/* UART driver related settings. */
473/*===========================================================================*/
474
475/**
476 * @brief Enables synchronous APIs.
477 * @note Disabling this option saves both code and data space.
478 */
479#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
480#define UART_USE_WAIT FALSE
481#endif
482
483/**
484 * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
485 * @note Disabling this option saves both code and data space.
486 */
487#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
488#define UART_USE_MUTUAL_EXCLUSION FALSE
489#endif
490
491/*===========================================================================*/
492/* USB driver related settings. */
493/*===========================================================================*/
494
495/**
496 * @brief Enables synchronous APIs.
497 * @note Disabling this option saves both code and data space.
498 */
499#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
500#define USB_USE_WAIT TRUE
501#endif
502
503/*===========================================================================*/
504/* WSPI driver related settings. */
505/*===========================================================================*/
506
507/**
508 * @brief Enables synchronous APIs.
509 * @note Disabling this option saves both code and data space.
510 */
511#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
512#define WSPI_USE_WAIT TRUE
513#endif
514
515/**
516 * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
517 * @note Disabling this option saves both code and data space.
518 */
519#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
520#define WSPI_USE_MUTUAL_EXCLUSION TRUE
521#endif
522
523#endif /* HALCONF_H */
524
525/** @} */
diff --git a/platforms/chibios/BLACKPILL_STM32_F411/configs/mcuconf.h b/platforms/chibios/BLACKPILL_STM32_F411/configs/mcuconf.h
new file mode 100644
index 000000000..0394ff56b
--- /dev/null
+++ b/platforms/chibios/BLACKPILL_STM32_F411/configs/mcuconf.h
@@ -0,0 +1,253 @@
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
36/*
37 * HAL driver system settings.
38 */
39#define STM32_NO_INIT FALSE
40#define STM32_HSI_ENABLED TRUE
41#define STM32_LSI_ENABLED TRUE
42#define STM32_HSE_ENABLED TRUE
43#define STM32_LSE_ENABLED FALSE
44#define STM32_CLOCK48_REQUIRED TRUE
45#define STM32_SW STM32_SW_PLL
46#define STM32_PLLSRC STM32_PLLSRC_HSE
47#define STM32_PLLM_VALUE 25
48#define STM32_PLLN_VALUE 384
49#define STM32_PLLP_VALUE 4
50#define STM32_PLLQ_VALUE 8
51#define STM32_HPRE STM32_HPRE_DIV1
52#define STM32_PPRE1 STM32_PPRE1_DIV4
53#define STM32_PPRE2 STM32_PPRE2_DIV2
54#define STM32_RTCSEL STM32_RTCSEL_LSI
55#define STM32_RTCPRE_VALUE 8
56#define STM32_MCO1SEL STM32_MCO1SEL_HSI
57#define STM32_MCO1PRE STM32_MCO1PRE_DIV1
58#define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK
59#define STM32_MCO2PRE STM32_MCO2PRE_DIV5
60#define STM32_I2SSRC STM32_I2SSRC_CKIN
61#define STM32_PLLI2SN_VALUE 192
62#define STM32_PLLI2SR_VALUE 5
63#define STM32_PVD_ENABLE FALSE
64#define STM32_PLS STM32_PLS_LEV0
65#define STM32_BKPRAM_ENABLE FALSE
66
67/*
68 * IRQ system settings.
69 */
70#define STM32_IRQ_EXTI0_PRIORITY 6
71#define STM32_IRQ_EXTI1_PRIORITY 6
72#define STM32_IRQ_EXTI2_PRIORITY 6
73#define STM32_IRQ_EXTI3_PRIORITY 6
74#define STM32_IRQ_EXTI4_PRIORITY 6
75#define STM32_IRQ_EXTI5_9_PRIORITY 6
76#define STM32_IRQ_EXTI10_15_PRIORITY 6
77#define STM32_IRQ_EXTI16_PRIORITY 6
78#define STM32_IRQ_EXTI17_PRIORITY 15
79#define STM32_IRQ_EXTI18_PRIORITY 6
80#define STM32_IRQ_EXTI19_PRIORITY 6
81#define STM32_IRQ_EXTI20_PRIORITY 6
82#define STM32_IRQ_EXTI21_PRIORITY 15
83#define STM32_IRQ_EXTI22_PRIORITY 15
84
85/*
86 * ADC driver system settings.
87 */
88#define STM32_ADC_ADCPRE ADC_CCR_ADCPRE_DIV4
89#define STM32_ADC_USE_ADC1 FALSE
90#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
91#define STM32_ADC_ADC1_DMA_PRIORITY 2
92#define STM32_ADC_IRQ_PRIORITY 6
93#define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 6
94
95/*
96 * GPT driver system settings.
97 */
98#define STM32_GPT_USE_TIM1 FALSE
99#define STM32_GPT_USE_TIM2 FALSE
100#define STM32_GPT_USE_TIM3 FALSE
101#define STM32_GPT_USE_TIM4 FALSE
102#define STM32_GPT_USE_TIM5 FALSE
103#define STM32_GPT_USE_TIM9 FALSE
104#define STM32_GPT_USE_TIM11 FALSE
105#define STM32_GPT_TIM1_IRQ_PRIORITY 7
106#define STM32_GPT_TIM2_IRQ_PRIORITY 7
107#define STM32_GPT_TIM3_IRQ_PRIORITY 7
108#define STM32_GPT_TIM4_IRQ_PRIORITY 7
109#define STM32_GPT_TIM5_IRQ_PRIORITY 7
110#define STM32_GPT_TIM9_IRQ_PRIORITY 7
111#define STM32_GPT_TIM11_IRQ_PRIORITY 7
112
113/*
114 * I2C driver system settings.
115 */
116#define STM32_I2C_USE_I2C1 FALSE
117#define STM32_I2C_USE_I2C2 FALSE
118#define STM32_I2C_USE_I2C3 FALSE
119#define STM32_I2C_BUSY_TIMEOUT 50
120#define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
121#define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
122#define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
123#define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
124#define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
125#define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
126#define STM32_I2C_I2C1_IRQ_PRIORITY 5
127#define STM32_I2C_I2C2_IRQ_PRIORITY 5
128#define STM32_I2C_I2C3_IRQ_PRIORITY 5
129#define STM32_I2C_I2C1_DMA_PRIORITY 3
130#define STM32_I2C_I2C2_DMA_PRIORITY 3
131#define STM32_I2C_I2C3_DMA_PRIORITY 3
132#define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
133
134/*
135 * I2S driver system settings.
136 */
137#define STM32_I2S_USE_SPI2 FALSE
138#define STM32_I2S_USE_SPI3 FALSE
139#define STM32_I2S_SPI2_IRQ_PRIORITY 10
140#define STM32_I2S_SPI3_IRQ_PRIORITY 10
141#define STM32_I2S_SPI2_DMA_PRIORITY 1
142#define STM32_I2S_SPI3_DMA_PRIORITY 1
143#define STM32_I2S_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
144#define STM32_I2S_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
145#define STM32_I2S_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
146#define STM32_I2S_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
147#define STM32_I2S_DMA_ERROR_HOOK(i2sp) osalSysHalt("DMA failure")
148
149/*
150 * ICU driver system settings.
151 */
152#define STM32_ICU_USE_TIM1 FALSE
153#define STM32_ICU_USE_TIM2 FALSE
154#define STM32_ICU_USE_TIM3 FALSE
155#define STM32_ICU_USE_TIM4 FALSE
156#define STM32_ICU_USE_TIM5 FALSE
157#define STM32_ICU_USE_TIM9 FALSE
158#define STM32_ICU_TIM1_IRQ_PRIORITY 7
159#define STM32_ICU_TIM2_IRQ_PRIORITY 7
160#define STM32_ICU_TIM3_IRQ_PRIORITY 7
161#define STM32_ICU_TIM4_IRQ_PRIORITY 7
162#define STM32_ICU_TIM5_IRQ_PRIORITY 7
163#define STM32_ICU_TIM9_IRQ_PRIORITY 7
164
165/*
166 * PWM driver system settings.
167 */
168#define STM32_PWM_USE_ADVANCED FALSE
169#define STM32_PWM_USE_TIM1 FALSE
170#define STM32_PWM_USE_TIM2 FALSE
171#define STM32_PWM_USE_TIM3 FALSE
172#define STM32_PWM_USE_TIM4 FALSE
173#define STM32_PWM_USE_TIM5 FALSE
174#define STM32_PWM_USE_TIM9 FALSE
175#define STM32_PWM_TIM1_IRQ_PRIORITY 7
176#define STM32_PWM_TIM2_IRQ_PRIORITY 7
177#define STM32_PWM_TIM3_IRQ_PRIORITY 7
178#define STM32_PWM_TIM4_IRQ_PRIORITY 7
179#define STM32_PWM_TIM5_IRQ_PRIORITY 7
180#define STM32_PWM_TIM9_IRQ_PRIORITY 7
181
182/*
183 * SERIAL driver system settings.
184 */
185#define STM32_SERIAL_USE_USART1 FALSE
186#define STM32_SERIAL_USE_USART2 FALSE
187#define STM32_SERIAL_USE_USART6 FALSE
188#define STM32_SERIAL_USART1_PRIORITY 12
189#define STM32_SERIAL_USART2_PRIORITY 12
190#define STM32_SERIAL_USART6_PRIORITY 12
191
192/*
193 * SPI driver system settings.
194 */
195#define STM32_SPI_USE_SPI1 FALSE
196#define STM32_SPI_USE_SPI2 FALSE
197#define STM32_SPI_USE_SPI3 FALSE
198#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0)
199#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
200#define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
201#define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
202#define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
203#define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
204#define STM32_SPI_SPI1_DMA_PRIORITY 1
205#define STM32_SPI_SPI2_DMA_PRIORITY 1
206#define STM32_SPI_SPI3_DMA_PRIORITY 1
207#define STM32_SPI_SPI1_IRQ_PRIORITY 10
208#define STM32_SPI_SPI2_IRQ_PRIORITY 10
209#define STM32_SPI_SPI3_IRQ_PRIORITY 10
210#define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
211
212/*
213 * ST driver system settings.
214 */
215#define STM32_ST_IRQ_PRIORITY 8
216#define STM32_ST_USE_TIMER 2
217
218/*
219 * UART driver system settings.
220 */
221#define STM32_UART_USE_USART1 FALSE
222#define STM32_UART_USE_USART2 FALSE
223#define STM32_UART_USE_USART6 FALSE
224#define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
225#define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
226#define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
227#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
228#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
229#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
230#define STM32_UART_USART1_IRQ_PRIORITY 12
231#define STM32_UART_USART2_IRQ_PRIORITY 12
232#define STM32_UART_USART6_IRQ_PRIORITY 12
233#define STM32_UART_USART1_DMA_PRIORITY 0
234#define STM32_UART_USART2_DMA_PRIORITY 0
235#define STM32_UART_USART6_DMA_PRIORITY 0
236#define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")
237
238/*
239 * USB driver system settings.
240 */
241#define STM32_USB_USE_OTG1 TRUE
242#define STM32_USB_OTG1_IRQ_PRIORITY 14
243#define STM32_USB_OTG1_RX_FIFO_SIZE 512
244#define STM32_USB_OTG_THREAD_PRIO NORMALPRIO+1
245#define STM32_USB_OTG_THREAD_STACK_SIZE 128
246#define STM32_USB_OTGFIFO_FILL_BASEPRI 0
247
248/*
249 * WDG driver system settings.
250 */
251#define STM32_WDG_USE_IWDG FALSE
252
253#endif /* MCUCONF_H */
diff --git a/platforms/chibios/GENERIC_STM32_F042X6/board/board.c b/platforms/chibios/GENERIC_STM32_F042X6/board/board.c
new file mode 100644
index 000000000..7d93b68f9
--- /dev/null
+++ b/platforms/chibios/GENERIC_STM32_F042X6/board/board.c
@@ -0,0 +1,269 @@
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 * This file has been automatically generated using ChibiStudio board
19 * generator plugin. Do not edit manually.
20 */
21
22#include "hal.h"
23#include "stm32_gpio.h"
24
25/*===========================================================================*/
26/* Driver local definitions. */
27/*===========================================================================*/
28
29/*===========================================================================*/
30/* Driver exported variables. */
31/*===========================================================================*/
32
33/*===========================================================================*/
34/* Driver local variables and types. */
35/*===========================================================================*/
36
37/**
38 * @brief Type of STM32 GPIO port setup.
39 */
40typedef struct {
41 uint32_t moder;
42 uint32_t otyper;
43 uint32_t ospeedr;
44 uint32_t pupdr;
45 uint32_t odr;
46 uint32_t afrl;
47 uint32_t afrh;
48} gpio_setup_t;
49
50/**
51 * @brief Type of STM32 GPIO initialization data.
52 */
53typedef struct {
54#if STM32_HAS_GPIOA || defined(__DOXYGEN__)
55 gpio_setup_t PAData;
56#endif
57#if STM32_HAS_GPIOB || defined(__DOXYGEN__)
58 gpio_setup_t PBData;
59#endif
60#if STM32_HAS_GPIOC || defined(__DOXYGEN__)
61 gpio_setup_t PCData;
62#endif
63#if STM32_HAS_GPIOD || defined(__DOXYGEN__)
64 gpio_setup_t PDData;
65#endif
66#if STM32_HAS_GPIOE || defined(__DOXYGEN__)
67 gpio_setup_t PEData;
68#endif
69#if STM32_HAS_GPIOF || defined(__DOXYGEN__)
70 gpio_setup_t PFData;
71#endif
72#if STM32_HAS_GPIOG || defined(__DOXYGEN__)
73 gpio_setup_t PGData;
74#endif
75#if STM32_HAS_GPIOH || defined(__DOXYGEN__)
76 gpio_setup_t PHData;
77#endif
78#if STM32_HAS_GPIOI || defined(__DOXYGEN__)
79 gpio_setup_t PIData;
80#endif
81#if STM32_HAS_GPIOJ || defined(__DOXYGEN__)
82 gpio_setup_t PJData;
83#endif
84#if STM32_HAS_GPIOK || defined(__DOXYGEN__)
85 gpio_setup_t PKData;
86#endif
87} gpio_config_t;
88
89/**
90 * @brief STM32 GPIO static initialization data.
91 */
92static const gpio_config_t gpio_default_config = {
93#if STM32_HAS_GPIOA
94 {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
95 VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
96#endif
97#if STM32_HAS_GPIOB
98 {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR,
99 VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH},
100#endif
101#if STM32_HAS_GPIOC
102 {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR,
103 VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH},
104#endif
105#if STM32_HAS_GPIOD
106 {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR,
107 VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH},
108#endif
109#if STM32_HAS_GPIOE
110 {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR,
111 VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH},
112#endif
113#if STM32_HAS_GPIOF
114 {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR,
115 VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH},
116#endif
117#if STM32_HAS_GPIOG
118 {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR,
119 VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH},
120#endif
121#if STM32_HAS_GPIOH
122 {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR,
123 VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH},
124#endif
125#if STM32_HAS_GPIOI
126 {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
127 VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
128#endif
129#if STM32_HAS_GPIOJ
130 {VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR,
131 VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
132#endif
133#if STM32_HAS_GPIOK
134 {VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR,
135 VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
136#endif
137};
138
139/*===========================================================================*/
140/* Driver local functions. */
141/*===========================================================================*/
142
143static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) {
144
145 gpiop->OTYPER = config->otyper;
146 gpiop->OSPEEDR = config->ospeedr;
147 gpiop->PUPDR = config->pupdr;
148 gpiop->ODR = config->odr;
149 gpiop->AFRL = config->afrl;
150 gpiop->AFRH = config->afrh;
151 gpiop->MODER = config->moder;
152}
153
154static void stm32_gpio_init(void) {
155
156 /* Enabling GPIO-related clocks, the mask comes from the
157 registry header file.*/
158 rccResetAHB(STM32_GPIO_EN_MASK);
159 rccEnableAHB(STM32_GPIO_EN_MASK, true);
160
161 /* Initializing all the defined GPIO ports.*/
162#if STM32_HAS_GPIOA
163 gpio_init(GPIOA, &gpio_default_config.PAData);
164#endif
165#if STM32_HAS_GPIOB
166 gpio_init(GPIOB, &gpio_default_config.PBData);
167#endif
168#if STM32_HAS_GPIOC
169 gpio_init(GPIOC, &gpio_default_config.PCData);
170#endif
171#if STM32_HAS_GPIOD
172 gpio_init(GPIOD, &gpio_default_config.PDData);
173#endif
174#if STM32_HAS_GPIOE
175 gpio_init(GPIOE, &gpio_default_config.PEData);
176#endif
177#if STM32_HAS_GPIOF
178 gpio_init(GPIOF, &gpio_default_config.PFData);
179#endif
180#if STM32_HAS_GPIOG
181 gpio_init(GPIOG, &gpio_default_config.PGData);
182#endif
183#if STM32_HAS_GPIOH
184 gpio_init(GPIOH, &gpio_default_config.PHData);
185#endif
186#if STM32_HAS_GPIOI
187 gpio_init(GPIOI, &gpio_default_config.PIData);
188#endif
189#if STM32_HAS_GPIOJ
190 gpio_init(GPIOJ, &gpio_default_config.PJData);
191#endif
192#if STM32_HAS_GPIOK
193 gpio_init(GPIOK, &gpio_default_config.PKData);
194#endif
195}
196
197/*===========================================================================*/
198/* Driver interrupt handlers. */
199/*===========================================================================*/
200
201/*===========================================================================*/
202/* Driver exported functions. */
203/*===========================================================================*/
204
205__attribute__((weak)) void enter_bootloader_mode_if_requested(void) {}
206
207/**
208 * @brief Early initialization code.
209 * @details GPIO ports and system clocks are initialized before everything
210 * else.
211 */
212void __early_init(void) {
213 enter_bootloader_mode_if_requested();
214
215 stm32_gpio_init();
216 stm32_clock_init();
217}
218
219#if HAL_USE_SDC || defined(__DOXYGEN__)
220/**
221 * @brief SDC card detection.
222 */
223bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
224
225 (void)sdcp;
226 /* TODO: Fill the implementation.*/
227 return true;
228}
229
230/**
231 * @brief SDC card write protection detection.
232 */
233bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
234
235 (void)sdcp;
236 /* TODO: Fill the implementation.*/
237 return false;
238}
239#endif /* HAL_USE_SDC */
240
241#if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
242/**
243 * @brief MMC_SPI card detection.
244 */
245bool mmc_lld_is_card_inserted(MMCDriver *mmcp) {
246
247 (void)mmcp;
248 /* TODO: Fill the implementation.*/
249 return true;
250}
251
252/**
253 * @brief MMC_SPI card write protection detection.
254 */
255bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
256
257 (void)mmcp;
258 /* TODO: Fill the implementation.*/
259 return false;
260}
261#endif
262
263/**
264 * @brief Board-specific initialization code.
265 * @todo Add your board-specific code, if any.
266 */
267void boardInit(void) {
268
269}
diff --git a/platforms/chibios/GENERIC_STM32_F042X6/board/board.h b/platforms/chibios/GENERIC_STM32_F042X6/board/board.h
new file mode 100644
index 000000000..ee9d31e04
--- /dev/null
+++ b/platforms/chibios/GENERIC_STM32_F042X6/board/board.h
@@ -0,0 +1,896 @@
1/*
2 ChibiOS - Copyright (C) 2006..2016 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#ifndef _BOARD_H
17#define _BOARD_H
18
19/*
20 * Setup for STMicroelectronics STM32 Nucleo32-F042K6 board.
21 */
22
23/*
24 * Board identifier.
25 */
26#define BOARD_GENERIC_STM32_F042X6
27#define BOARD_NAME "Generic STM32F042 PCB"
28
29/*
30 * Board oscillators-related settings.
31 * NOTE: LSE not fitted.
32 * NOTE: HSE not fitted.
33 */
34#if !defined(STM32_LSECLK)
35#define STM32_LSECLK 0U
36#endif
37
38#define STM32_LSEDRV (3U << 3U)
39
40#if !defined(STM32_HSECLK)
41#define STM32_HSECLK 0U
42#endif
43
44/*
45 * MCU type as defined in the ST header.
46 */
47#define STM32F042x6
48
49/*
50 * IO pins assignments.
51 */
52#define GPIOA_PIN0 0U
53#define GPIOA_PIN1 1U
54#define GPIOA_PIN2 2U
55#define GPIOA_PIN3 3U
56#define GPIOA_PIN4 4U
57#define GPIOA_PIN5 5U
58#define GPIOA_PIN6 6U
59#define GPIOA_PIN7 7U
60#define GPIOA_PIN8 8U
61#define GPIOA_PIN9 9U
62#define GPIOA_PIN10 10U
63#define GPIOA_PIN11 11U
64#define GPIOA_PIN12 12U
65#define GPIOA_PIN13 13U
66#define GPIOA_PIN14 14U
67#define GPIOA_PIN15 15U
68
69#define GPIOB_PIN0 0U
70#define GPIOB_PIN1 1U
71#define GPIOB_PIN2 2U
72#define GPIOB_PIN3 3U
73#define GPIOB_PIN4 4U
74#define GPIOB_PIN5 5U
75#define GPIOB_PIN6 6U
76#define GPIOB_PIN7 7U
77#define GPIOB_PIN8 8U
78#define GPIOB_PIN9 9U
79#define GPIOB_PIN10 10U
80#define GPIOB_PIN11 11U
81#define GPIOB_PIN12 12U
82#define GPIOB_PIN13 13U
83#define GPIOB_PIN14 14U
84#define GPIOB_PIN15 15U
85
86#define GPIOC_PIN0 0U
87#define GPIOC_PIN1 1U
88#define GPIOC_PIN2 2U
89#define GPIOC_PIN3 3U
90#define GPIOC_PIN4 4U
91#define GPIOC_PIN5 5U
92#define GPIOC_PIN6 6U
93#define GPIOC_PIN7 7U
94#define GPIOC_PIN8 8U
95#define GPIOC_PIN9 9U
96#define GPIOC_PIN10 10U
97#define GPIOC_PIN11 11U
98#define GPIOC_PIN12 12U
99#define GPIOC_PIN13 13U
100#define GPIOC_PIN14 14U
101#define GPIOC_PIN15 15U
102
103#define GPIOD_PIN0 0U
104#define GPIOD_PIN1 1U
105#define GPIOD_PIN2 2U
106#define GPIOD_PIN3 3U
107#define GPIOD_PIN4 4U
108#define GPIOD_PIN5 5U
109#define GPIOD_PIN6 6U
110#define GPIOD_PIN7 7U
111#define GPIOD_PIN8 8U
112#define GPIOD_PIN9 9U
113#define GPIOD_PIN10 10U
114#define GPIOD_PIN11 11U
115#define GPIOD_PIN12 12U
116#define GPIOD_PIN13 13U
117#define GPIOD_PIN14 14U
118#define GPIOD_PIN15 15U
119
120#define GPIOE_PIN0 0U
121#define GPIOE_PIN1 1U
122#define GPIOE_PIN2 2U
123#define GPIOE_PIN3 3U
124#define GPIOE_PIN4 4U
125#define GPIOE_PIN5 5U
126#define GPIOE_PIN6 6U
127#define GPIOE_PIN7 7U
128#define GPIOE_PIN8 8U
129#define GPIOE_PIN9 9U
130#define GPIOE_PIN10 10U
131#define GPIOE_PIN11 11U
132#define GPIOE_PIN12 12U
133#define GPIOE_PIN13 13U
134#define GPIOE_PIN14 14U
135#define GPIOE_PIN15 15U
136
137#define GPIOF_PIN0 0U
138#define GPIOF_PIN1 1U
139#define GPIOF_PIN2 2U
140#define GPIOF_PIN3 3U
141#define GPIOF_PIN4 4U
142#define GPIOF_PIN5 5U
143#define GPIOF_PIN6 6U
144#define GPIOF_PIN7 7U
145#define GPIOF_PIN8 8U
146#define GPIOF_PIN9 9U
147#define GPIOF_PIN10 10U
148#define GPIOF_PIN11 11U
149#define GPIOF_PIN12 12U
150#define GPIOF_PIN13 13U
151#define GPIOF_PIN14 14U
152#define GPIOF_PIN15 15U
153
154/*
155 * IO lines assignments.
156 */
157
158#define LINE_BOOT0 PAL_LINE(GPIOB, 8U)
159#define LINE_SWCLK PAL_LINE(GPIOA, 14U)
160#define LINE_SWDIO PAL_LINE(GPIOA, 13U)
161
162/*
163 * I/O ports initial setup, this configuration is established soon after reset
164 * in the initialization code.
165 * Please refer to the STM32 Reference Manual for details.
166 */
167#define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
168#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
169#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
170#define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
171#define PIN_ODR_LOW(n) (0U << (n))
172#define PIN_ODR_HIGH(n) (1U << (n))
173#define PIN_OTYPE_PUSHPULL(n) (0U << (n))
174#define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
175#define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U))
176#define PIN_OSPEED_LOW(n) (1U << ((n) * 2U))
177#define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U))
178#define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U))
179#define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
180#define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
181#define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
182#define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
183
184/*
185 * GPIOA setup:
186 *
187 * PA0 - COL5
188 * PA1 - COL4
189 * PA2 - COL3
190 * PA3 - COL2
191 * PA4 - COL1
192 * PA5 - COL0
193 * PA6 - ROW4
194 * PA7 - ROW3
195 * PA8 - NC
196 * PA9 - ROW1
197 * PA10 - ROW0
198 * PA11 - USB_DM
199 * PA12 - USB_DP
200 * PA13 - COL15/SWDIO (for now, COL15)
201 * PA14 - COL14/SWCLK (for now, COL14)
202 * PA15 - COL13
203 */
204#define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_PIN0) | \
205 PIN_MODE_INPUT(GPIOA_PIN1) | \
206 PIN_MODE_INPUT(GPIOA_PIN2) | \
207 PIN_MODE_INPUT(GPIOA_PIN3) | \
208 PIN_MODE_INPUT(GPIOA_PIN4) | \
209 PIN_MODE_INPUT(GPIOA_PIN5) | \
210 PIN_MODE_INPUT(GPIOA_PIN6) | \
211 PIN_MODE_INPUT(GPIOA_PIN7) | \
212 PIN_MODE_INPUT(GPIOA_PIN8) | \
213 PIN_MODE_INPUT(GPIOA_PIN9) | \
214 PIN_MODE_INPUT(GPIOA_PIN10) | \
215 PIN_MODE_INPUT(GPIOA_PIN11) | \
216 PIN_MODE_INPUT(GPIOA_PIN12) | \
217 PIN_MODE_INPUT(GPIOA_PIN13) | \
218 PIN_MODE_INPUT(GPIOA_PIN14) | \
219 PIN_MODE_INPUT(GPIOA_PIN15))
220#define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_PIN0) | \
221 PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | \
222 PIN_OTYPE_PUSHPULL(GPIOA_PIN2) | \
223 PIN_OTYPE_PUSHPULL(GPIOA_PIN3) | \
224 PIN_OTYPE_PUSHPULL(GPIOA_PIN4) | \
225 PIN_OTYPE_PUSHPULL(GPIOA_PIN5) | \
226 PIN_OTYPE_PUSHPULL(GPIOA_PIN6) | \
227 PIN_OTYPE_PUSHPULL(GPIOA_PIN7) | \
228 PIN_OTYPE_PUSHPULL(GPIOA_PIN8) | \
229 PIN_OTYPE_PUSHPULL(GPIOA_PIN9) | \
230 PIN_OTYPE_PUSHPULL(GPIOA_PIN10) | \
231 PIN_OTYPE_PUSHPULL(GPIOA_PIN11) | \
232 PIN_OTYPE_PUSHPULL(GPIOA_PIN12) | \
233 PIN_OTYPE_PUSHPULL(GPIOA_PIN13) | \
234 PIN_OTYPE_PUSHPULL(GPIOA_PIN14) | \
235 PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
236#define VAL_GPIOA_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOA_PIN0) | \
237 PIN_OSPEED_VERYLOW(GPIOA_PIN1) | \
238 PIN_OSPEED_VERYLOW(GPIOA_PIN2) | \
239 PIN_OSPEED_VERYLOW(GPIOA_PIN3) | \
240 PIN_OSPEED_VERYLOW(GPIOA_PIN4) | \
241 PIN_OSPEED_VERYLOW(GPIOA_PIN5) | \
242 PIN_OSPEED_VERYLOW(GPIOA_PIN6) | \
243 PIN_OSPEED_VERYLOW(GPIOA_PIN7) | \
244 PIN_OSPEED_VERYLOW(GPIOA_PIN8) | \
245 PIN_OSPEED_VERYLOW(GPIOA_PIN9) | \
246 PIN_OSPEED_VERYLOW(GPIOA_PIN10) | \
247 PIN_OSPEED_HIGH(GPIOA_PIN11) | \
248 PIN_OSPEED_VERYLOW(GPIOA_PIN12) | \
249 PIN_OSPEED_VERYLOW(GPIOA_PIN13) | \
250 PIN_OSPEED_VERYLOW(GPIOA_PIN14) | \
251 PIN_OSPEED_VERYLOW(GPIOA_PIN15))
252#define VAL_GPIOA_PUPDR (PIN_PUPDR_PULLUP(GPIOA_PIN0) | \
253 PIN_PUPDR_PULLUP(GPIOA_PIN1) | \
254 PIN_PUPDR_PULLUP(GPIOA_PIN2) | \
255 PIN_PUPDR_PULLUP(GPIOA_PIN3) | \
256 PIN_PUPDR_PULLUP(GPIOA_PIN4) | \
257 PIN_PUPDR_PULLUP(GPIOA_PIN5) | \
258 PIN_PUPDR_PULLUP(GPIOA_PIN6) | \
259 PIN_PUPDR_PULLUP(GPIOA_PIN7) | \
260 PIN_PUPDR_PULLUP(GPIOA_PIN8) | \
261 PIN_PUPDR_PULLUP(GPIOA_PIN9) | \
262 PIN_PUPDR_PULLUP(GPIOA_PIN10) | \
263 PIN_PUPDR_FLOATING(GPIOA_PIN11) | \
264 PIN_PUPDR_FLOATING(GPIOA_PIN12) | \
265 PIN_PUPDR_PULLUP(GPIOA_PIN13) | \
266 PIN_PUPDR_PULLUP(GPIOA_PIN14) | \
267 PIN_PUPDR_PULLUP(GPIOA_PIN15))
268#define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_PIN0) | \
269 PIN_ODR_HIGH(GPIOA_PIN1) | \
270 PIN_ODR_HIGH(GPIOA_PIN2) | \
271 PIN_ODR_HIGH(GPIOA_PIN3) | \
272 PIN_ODR_HIGH(GPIOA_PIN4) | \
273 PIN_ODR_HIGH(GPIOA_PIN5) | \
274 PIN_ODR_HIGH(GPIOA_PIN6) | \
275 PIN_ODR_HIGH(GPIOA_PIN7) | \
276 PIN_ODR_HIGH(GPIOA_PIN8) | \
277 PIN_ODR_HIGH(GPIOA_PIN9) | \
278 PIN_ODR_HIGH(GPIOA_PIN10) | \
279 PIN_ODR_HIGH(GPIOA_PIN11) | \
280 PIN_ODR_HIGH(GPIOA_PIN12) | \
281 PIN_ODR_HIGH(GPIOA_PIN13) | \
282 PIN_ODR_HIGH(GPIOA_PIN14) | \
283 PIN_ODR_HIGH(GPIOA_PIN15))
284#define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_PIN0, 0U) | \
285 PIN_AFIO_AF(GPIOA_PIN1, 0U) | \
286 PIN_AFIO_AF(GPIOA_PIN2, 0U) | \
287 PIN_AFIO_AF(GPIOA_PIN3, 0U) | \
288 PIN_AFIO_AF(GPIOA_PIN4, 0U) | \
289 PIN_AFIO_AF(GPIOA_PIN5, 0U) | \
290 PIN_AFIO_AF(GPIOA_PIN6, 0U) | \
291 PIN_AFIO_AF(GPIOA_PIN7, 0U))
292#define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_PIN8, 0U) | \
293 PIN_AFIO_AF(GPIOA_PIN9, 0U) | \
294 PIN_AFIO_AF(GPIOA_PIN10, 0U) | \
295 PIN_AFIO_AF(GPIOA_PIN11, 0U) | \
296 PIN_AFIO_AF(GPIOA_PIN12, 0U) | \
297 PIN_AFIO_AF(GPIOA_PIN13, 0U) | \
298 PIN_AFIO_AF(GPIOA_PIN14, 0U) | \
299 PIN_AFIO_AF(GPIOA_PIN15, 0U))
300
301/*
302 * GPIOB setup:
303 *
304 * PB0 - ROW2
305 * PB1 - RGB_D
306 * PB2 - PIN2 (input pullup).
307 * PB3 - COL12
308 * PB4 - COL11
309 * PB5 - COL10
310 * PB6 - COL9
311 * PB7 - COL8
312 * PB8 - BOOT0 (set as output for STM32F042)
313 * PB9 - PIN9 (input pullup).
314 * PB10 - PIN10 (input pullup).
315 * PB11 - PIN11 (input pullup).
316 * PB12 - PIN12 (input pullup).
317 * PB13 - PIN13 (input pullup).
318 * PB14 - PIN14 (input pullup).
319 * PB15 - PIN15 (input pullup).
320 */
321#define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | \
322 PIN_MODE_OUTPUT(GPIOB_PIN1) | \
323 PIN_MODE_INPUT(GPIOB_PIN2) | \
324 PIN_MODE_INPUT(GPIOB_PIN3) | \
325 PIN_MODE_INPUT(GPIOB_PIN4) | \
326 PIN_MODE_INPUT(GPIOB_PIN5) | \
327 PIN_MODE_INPUT(GPIOB_PIN6) | \
328 PIN_MODE_INPUT(GPIOB_PIN7) | \
329 PIN_MODE_OUTPUT(GPIOB_PIN8) | \
330 PIN_MODE_INPUT(GPIOB_PIN9) | \
331 PIN_MODE_INPUT(GPIOB_PIN10) | \
332 PIN_MODE_INPUT(GPIOB_PIN11) | \
333 PIN_MODE_INPUT(GPIOB_PIN12) | \
334 PIN_MODE_INPUT(GPIOB_PIN13) | \
335 PIN_MODE_INPUT(GPIOB_PIN14) | \
336 PIN_MODE_INPUT(GPIOB_PIN15))
337#define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | \
338 PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | \
339 PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | \
340 PIN_OTYPE_PUSHPULL(GPIOB_PIN3) | \
341 PIN_OTYPE_PUSHPULL(GPIOB_PIN4) | \
342 PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | \
343 PIN_OTYPE_PUSHPULL(GPIOB_PIN6) | \
344 PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \
345 PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | \
346 PIN_OTYPE_PUSHPULL(GPIOB_PIN9) | \
347 PIN_OTYPE_PUSHPULL(GPIOB_PIN10) | \
348 PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \
349 PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | \
350 PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | \
351 PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | \
352 PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
353#define VAL_GPIOB_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOB_PIN0) | \
354 PIN_OSPEED_HIGH(GPIOB_PIN1) | \
355 PIN_OSPEED_HIGH(GPIOB_PIN2) | \
356 PIN_OSPEED_VERYLOW(GPIOB_PIN3) | \
357 PIN_OSPEED_VERYLOW(GPIOB_PIN4) | \
358 PIN_OSPEED_VERYLOW(GPIOB_PIN5) | \
359 PIN_OSPEED_VERYLOW(GPIOB_PIN6) | \
360 PIN_OSPEED_VERYLOW(GPIOB_PIN7) | \
361 PIN_OSPEED_VERYLOW(GPIOB_PIN8) | \
362 PIN_OSPEED_HIGH(GPIOB_PIN9) | \
363 PIN_OSPEED_HIGH(GPIOB_PIN10) | \
364 PIN_OSPEED_HIGH(GPIOB_PIN11) | \
365 PIN_OSPEED_HIGH(GPIOB_PIN12) | \
366 PIN_OSPEED_HIGH(GPIOB_PIN13) | \
367 PIN_OSPEED_HIGH(GPIOB_PIN14) | \
368 PIN_OSPEED_HIGH(GPIOB_PIN15))
369#define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_PIN0) | \
370 PIN_PUPDR_FLOATING(GPIOB_PIN1) | \
371 PIN_PUPDR_PULLUP(GPIOB_PIN2) | \
372 PIN_PUPDR_PULLUP(GPIOB_PIN3) | \
373 PIN_PUPDR_PULLUP(GPIOB_PIN4) | \
374 PIN_PUPDR_PULLUP(GPIOB_PIN5) | \
375 PIN_PUPDR_PULLUP(GPIOB_PIN6) | \
376 PIN_PUPDR_PULLUP(GPIOB_PIN7) | \
377 PIN_PUPDR_PULLDOWN(GPIOB_PIN8) | \
378 PIN_PUPDR_PULLUP(GPIOB_PIN9) | \
379 PIN_PUPDR_PULLUP(GPIOB_PIN10) | \
380 PIN_PUPDR_PULLUP(GPIOB_PIN11) | \
381 PIN_PUPDR_PULLUP(GPIOB_PIN12) | \
382 PIN_PUPDR_PULLUP(GPIOB_PIN13) | \
383 PIN_PUPDR_PULLUP(GPIOB_PIN14) | \
384 PIN_PUPDR_PULLUP(GPIOB_PIN15))
385#define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_PIN0) | \
386 PIN_ODR_HIGH(GPIOB_PIN1) | \
387 PIN_ODR_HIGH(GPIOB_PIN2) | \
388 PIN_ODR_HIGH(GPIOB_PIN3) | \
389 PIN_ODR_HIGH(GPIOB_PIN4) | \
390 PIN_ODR_HIGH(GPIOB_PIN5) | \
391 PIN_ODR_HIGH(GPIOB_PIN6) | \
392 PIN_ODR_HIGH(GPIOB_PIN7) | \
393 PIN_ODR_HIGH(GPIOB_PIN8) | \
394 PIN_ODR_HIGH(GPIOB_PIN9) | \
395 PIN_ODR_HIGH(GPIOB_PIN10) | \
396 PIN_ODR_HIGH(GPIOB_PIN11) | \
397 PIN_ODR_HIGH(GPIOB_PIN12) | \
398 PIN_ODR_HIGH(GPIOB_PIN13) | \
399 PIN_ODR_HIGH(GPIOB_PIN14) | \
400 PIN_ODR_HIGH(GPIOB_PIN15))
401#define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0U) | \
402 PIN_AFIO_AF(GPIOB_PIN1, 0U) | \
403 PIN_AFIO_AF(GPIOB_PIN2, 0U) | \
404 PIN_AFIO_AF(GPIOB_PIN3, 0U) | \
405 PIN_AFIO_AF(GPIOB_PIN4, 0U) | \
406 PIN_AFIO_AF(GPIOB_PIN5, 0U) | \
407 PIN_AFIO_AF(GPIOB_PIN6, 0U) | \
408 PIN_AFIO_AF(GPIOB_PIN7, 0U))
409#define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0U) | \
410 PIN_AFIO_AF(GPIOB_PIN9, 0U) | \
411 PIN_AFIO_AF(GPIOB_PIN10, 0U) | \
412 PIN_AFIO_AF(GPIOB_PIN11, 0U) | \
413 PIN_AFIO_AF(GPIOB_PIN12, 0U) | \
414 PIN_AFIO_AF(GPIOB_PIN13, 0U) | \
415 PIN_AFIO_AF(GPIOB_PIN14, 0U) | \
416 PIN_AFIO_AF(GPIOB_PIN15, 0U))
417
418/*
419 * GPIOC setup:
420 *
421 * PC0 - PIN0 (input pullup).
422 * PC1 - PIN1 (input pullup).
423 * PC2 - PIN2 (input pullup).
424 * PC3 - PIN3 (input pullup).
425 * PC4 - PIN4 (input pullup).
426 * PC5 - PIN5 (input pullup).
427 * PC6 - PIN6 (input pullup).
428 * PC7 - PIN7 (input pullup).
429 * PC8 - PIN8 (input pullup).
430 * PC9 - PIN9 (input pullup).
431 * PC10 - PIN10 (input pullup).
432 * PC11 - PIN11 (input pullup).
433 * PC12 - PIN12 (input pullup).
434 * PC13 - PIN13 (input pullup).
435 * PC14 - PIN14 (input pullup).
436 * PC15 - PIN15 (input pullup).
437 */
438#define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_PIN0) | \
439 PIN_MODE_INPUT(GPIOC_PIN1) | \
440 PIN_MODE_INPUT(GPIOC_PIN2) | \
441 PIN_MODE_INPUT(GPIOC_PIN3) | \
442 PIN_MODE_INPUT(GPIOC_PIN4) | \
443 PIN_MODE_INPUT(GPIOC_PIN5) | \
444 PIN_MODE_INPUT(GPIOC_PIN6) | \
445 PIN_MODE_INPUT(GPIOC_PIN7) | \
446 PIN_MODE_INPUT(GPIOC_PIN8) | \
447 PIN_MODE_INPUT(GPIOC_PIN9) | \
448 PIN_MODE_INPUT(GPIOC_PIN10) | \
449 PIN_MODE_INPUT(GPIOC_PIN11) | \
450 PIN_MODE_INPUT(GPIOC_PIN12) | \
451 PIN_MODE_INPUT(GPIOC_PIN13) | \
452 PIN_MODE_INPUT(GPIOC_PIN14) | \
453 PIN_MODE_INPUT(GPIOC_PIN15))
454#define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_PIN0) | \
455 PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | \
456 PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | \
457 PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | \
458 PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \
459 PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | \
460 PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \
461 PIN_OTYPE_PUSHPULL(GPIOC_PIN7) | \
462 PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \
463 PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | \
464 PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | \
465 PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \
466 PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | \
467 PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | \
468 PIN_OTYPE_PUSHPULL(GPIOC_PIN14) | \
469 PIN_OTYPE_PUSHPULL(GPIOC_PIN15))
470#define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_PIN0) | \
471 PIN_OSPEED_HIGH(GPIOC_PIN1) | \
472 PIN_OSPEED_HIGH(GPIOC_PIN2) | \
473 PIN_OSPEED_HIGH(GPIOC_PIN3) | \
474 PIN_OSPEED_HIGH(GPIOC_PIN4) | \
475 PIN_OSPEED_HIGH(GPIOC_PIN5) | \
476 PIN_OSPEED_HIGH(GPIOC_PIN6) | \
477 PIN_OSPEED_HIGH(GPIOC_PIN7) | \
478 PIN_OSPEED_HIGH(GPIOC_PIN8) | \
479 PIN_OSPEED_HIGH(GPIOC_PIN9) | \
480 PIN_OSPEED_HIGH(GPIOC_PIN10) | \
481 PIN_OSPEED_HIGH(GPIOC_PIN11) | \
482 PIN_OSPEED_HIGH(GPIOC_PIN12) | \
483 PIN_OSPEED_HIGH(GPIOC_PIN13) | \
484 PIN_OSPEED_HIGH(GPIOC_PIN14) | \
485 PIN_OSPEED_HIGH(GPIOC_PIN15))
486#define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_PIN0) | \
487 PIN_PUPDR_PULLUP(GPIOC_PIN1) | \
488 PIN_PUPDR_PULLUP(GPIOC_PIN2) | \
489 PIN_PUPDR_PULLUP(GPIOC_PIN3) | \
490 PIN_PUPDR_PULLUP(GPIOC_PIN4) | \
491 PIN_PUPDR_PULLUP(GPIOC_PIN5) | \
492 PIN_PUPDR_PULLUP(GPIOC_PIN6) | \
493 PIN_PUPDR_PULLUP(GPIOC_PIN7) | \
494 PIN_PUPDR_PULLUP(GPIOC_PIN8) | \
495 PIN_PUPDR_PULLUP(GPIOC_PIN9) | \
496 PIN_PUPDR_PULLUP(GPIOC_PIN10) | \
497 PIN_PUPDR_PULLUP(GPIOC_PIN11) | \
498 PIN_PUPDR_PULLUP(GPIOC_PIN12) | \
499 PIN_PUPDR_PULLUP(GPIOC_PIN13) | \
500 PIN_PUPDR_PULLUP(GPIOC_PIN14) | \
501 PIN_PUPDR_PULLUP(GPIOC_PIN15))
502#define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_PIN0) | \
503 PIN_ODR_HIGH(GPIOC_PIN1) | \
504 PIN_ODR_HIGH(GPIOC_PIN2) | \
505 PIN_ODR_HIGH(GPIOC_PIN3) | \
506 PIN_ODR_HIGH(GPIOC_PIN4) | \
507 PIN_ODR_HIGH(GPIOC_PIN5) | \
508 PIN_ODR_HIGH(GPIOC_PIN6) | \
509 PIN_ODR_HIGH(GPIOC_PIN7) | \
510 PIN_ODR_HIGH(GPIOC_PIN8) | \
511 PIN_ODR_HIGH(GPIOC_PIN9) | \
512 PIN_ODR_HIGH(GPIOC_PIN10) | \
513 PIN_ODR_HIGH(GPIOC_PIN11) | \
514 PIN_ODR_HIGH(GPIOC_PIN12) | \
515 PIN_ODR_HIGH(GPIOC_PIN13) | \
516 PIN_ODR_HIGH(GPIOC_PIN14) | \
517 PIN_ODR_HIGH(GPIOC_PIN15))
518#define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_PIN0, 0U) | \
519 PIN_AFIO_AF(GPIOC_PIN1, 0U) | \
520 PIN_AFIO_AF(GPIOC_PIN2, 0U) | \
521 PIN_AFIO_AF(GPIOC_PIN3, 0U) | \
522 PIN_AFIO_AF(GPIOC_PIN4, 0U) | \
523 PIN_AFIO_AF(GPIOC_PIN5, 0U) | \
524 PIN_AFIO_AF(GPIOC_PIN6, 0U) | \
525 PIN_AFIO_AF(GPIOC_PIN7, 0U))
526#define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0U) | \
527 PIN_AFIO_AF(GPIOC_PIN9, 0U) | \
528 PIN_AFIO_AF(GPIOC_PIN10, 0U) | \
529 PIN_AFIO_AF(GPIOC_PIN11, 0U) | \
530 PIN_AFIO_AF(GPIOC_PIN12, 0U) | \
531 PIN_AFIO_AF(GPIOC_PIN13, 0U) | \
532 PIN_AFIO_AF(GPIOC_PIN14, 0U) | \
533 PIN_AFIO_AF(GPIOC_PIN15, 0U))
534
535/*
536 * GPIOD setup:
537 *
538 * PD0 - PIN0 (input pullup).
539 * PD1 - PIN1 (input pullup).
540 * PD2 - PIN2 (input pullup).
541 * PD3 - PIN3 (input pullup).
542 * PD4 - PIN4 (input pullup).
543 * PD5 - PIN5 (input pullup).
544 * PD6 - PIN6 (input pullup).
545 * PD7 - PIN7 (input pullup).
546 * PD8 - PIN8 (input pullup).
547 * PD9 - PIN9 (input pullup).
548 * PD10 - PIN10 (input pullup).
549 * PD11 - PIN11 (input pullup).
550 * PD12 - PIN12 (input pullup).
551 * PD13 - PIN13 (input pullup).
552 * PD14 - PIN14 (input pullup).
553 * PD15 - PIN15 (input pullup).
554 */
555#define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | \
556 PIN_MODE_INPUT(GPIOD_PIN1) | \
557 PIN_MODE_INPUT(GPIOD_PIN2) | \
558 PIN_MODE_INPUT(GPIOD_PIN3) | \
559 PIN_MODE_INPUT(GPIOD_PIN4) | \
560 PIN_MODE_INPUT(GPIOD_PIN5) | \
561 PIN_MODE_INPUT(GPIOD_PIN6) | \
562 PIN_MODE_INPUT(GPIOD_PIN7) | \
563 PIN_MODE_INPUT(GPIOD_PIN8) | \
564 PIN_MODE_INPUT(GPIOD_PIN9) | \
565 PIN_MODE_INPUT(GPIOD_PIN10) | \
566 PIN_MODE_INPUT(GPIOD_PIN11) | \
567 PIN_MODE_INPUT(GPIOD_PIN12) | \
568 PIN_MODE_INPUT(GPIOD_PIN13) | \
569 PIN_MODE_INPUT(GPIOD_PIN14) | \
570 PIN_MODE_INPUT(GPIOD_PIN15))
571#define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \
572 PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \
573 PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \
574 PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \
575 PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | \
576 PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | \
577 PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | \
578 PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \
579 PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | \
580 PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \
581 PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \
582 PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \
583 PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | \
584 PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \
585 PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \
586 PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
587#define VAL_GPIOD_OSPEEDR (PIN_OSPEED_HIGH(GPIOD_PIN0) | \
588 PIN_OSPEED_HIGH(GPIOD_PIN1) | \
589 PIN_OSPEED_HIGH(GPIOD_PIN2) | \
590 PIN_OSPEED_HIGH(GPIOD_PIN3) | \
591 PIN_OSPEED_HIGH(GPIOD_PIN4) | \
592 PIN_OSPEED_HIGH(GPIOD_PIN5) | \
593 PIN_OSPEED_HIGH(GPIOD_PIN6) | \
594 PIN_OSPEED_HIGH(GPIOD_PIN7) | \
595 PIN_OSPEED_HIGH(GPIOD_PIN8) | \
596 PIN_OSPEED_HIGH(GPIOD_PIN9) | \
597 PIN_OSPEED_HIGH(GPIOD_PIN10) | \
598 PIN_OSPEED_HIGH(GPIOD_PIN11) | \
599 PIN_OSPEED_HIGH(GPIOD_PIN12) | \
600 PIN_OSPEED_HIGH(GPIOD_PIN13) | \
601 PIN_OSPEED_HIGH(GPIOD_PIN14) | \
602 PIN_OSPEED_HIGH(GPIOD_PIN15))
603#define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | \
604 PIN_PUPDR_PULLUP(GPIOD_PIN1) | \
605 PIN_PUPDR_PULLUP(GPIOD_PIN2) | \
606 PIN_PUPDR_PULLUP(GPIOD_PIN3) | \
607 PIN_PUPDR_PULLUP(GPIOD_PIN4) | \
608 PIN_PUPDR_PULLUP(GPIOD_PIN5) | \
609 PIN_PUPDR_PULLUP(GPIOD_PIN6) | \
610 PIN_PUPDR_PULLUP(GPIOD_PIN7) | \
611 PIN_PUPDR_PULLUP(GPIOD_PIN8) | \
612 PIN_PUPDR_PULLUP(GPIOD_PIN9) | \
613 PIN_PUPDR_PULLUP(GPIOD_PIN10) | \
614 PIN_PUPDR_PULLUP(GPIOD_PIN11) | \
615 PIN_PUPDR_PULLUP(GPIOD_PIN12) | \
616 PIN_PUPDR_PULLUP(GPIOD_PIN13) | \
617 PIN_PUPDR_PULLUP(GPIOD_PIN14) | \
618 PIN_PUPDR_PULLUP(GPIOD_PIN15))
619#define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | \
620 PIN_ODR_HIGH(GPIOD_PIN1) | \
621 PIN_ODR_HIGH(GPIOD_PIN2) | \
622 PIN_ODR_HIGH(GPIOD_PIN3) | \
623 PIN_ODR_HIGH(GPIOD_PIN4) | \
624 PIN_ODR_HIGH(GPIOD_PIN5) | \
625 PIN_ODR_HIGH(GPIOD_PIN6) | \
626 PIN_ODR_HIGH(GPIOD_PIN7) | \
627 PIN_ODR_HIGH(GPIOD_PIN8) | \
628 PIN_ODR_HIGH(GPIOD_PIN9) | \
629 PIN_ODR_HIGH(GPIOD_PIN10) | \
630 PIN_ODR_HIGH(GPIOD_PIN11) | \
631 PIN_ODR_HIGH(GPIOD_PIN12) | \
632 PIN_ODR_HIGH(GPIOD_PIN13) | \
633 PIN_ODR_HIGH(GPIOD_PIN14) | \
634 PIN_ODR_HIGH(GPIOD_PIN15))
635#define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0U) | \
636 PIN_AFIO_AF(GPIOD_PIN1, 0U) | \
637 PIN_AFIO_AF(GPIOD_PIN2, 0U) | \
638 PIN_AFIO_AF(GPIOD_PIN3, 0U) | \
639 PIN_AFIO_AF(GPIOD_PIN4, 0U) | \
640 PIN_AFIO_AF(GPIOD_PIN5, 0U) | \
641 PIN_AFIO_AF(GPIOD_PIN6, 0U) | \
642 PIN_AFIO_AF(GPIOD_PIN7, 0U))
643#define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0U) | \
644 PIN_AFIO_AF(GPIOD_PIN9, 0U) | \
645 PIN_AFIO_AF(GPIOD_PIN10, 0U) | \
646 PIN_AFIO_AF(GPIOD_PIN11, 0U) | \
647 PIN_AFIO_AF(GPIOD_PIN12, 0U) | \
648 PIN_AFIO_AF(GPIOD_PIN13, 0U) | \
649 PIN_AFIO_AF(GPIOD_PIN14, 0U) | \
650 PIN_AFIO_AF(GPIOD_PIN15, 0U))
651
652/*
653 * GPIOE setup:
654 *
655 * PE0 - PIN0 (input pullup).
656 * PE1 - PIN1 (input pullup).
657 * PE2 - PIN2 (input pullup).
658 * PE3 - PIN3 (input pullup).
659 * PE4 - PIN4 (input pullup).
660 * PE5 - PIN5 (input pullup).
661 * PE6 - PIN6 (input pullup).
662 * PE7 - PIN7 (input pullup).
663 * PE8 - PIN8 (input pullup).
664 * PE9 - PIN9 (input pullup).
665 * PE10 - PIN10 (input pullup).
666 * PE11 - PIN11 (input pullup).
667 * PE12 - PIN12 (input pullup).
668 * PE13 - PIN13 (input pullup).
669 * PE14 - PIN14 (input pullup).
670 * PE15 - PIN15 (input pullup).
671 */
672#define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_PIN0) | \
673 PIN_MODE_INPUT(GPIOE_PIN1) | \
674 PIN_MODE_INPUT(GPIOE_PIN2) | \
675 PIN_MODE_INPUT(GPIOE_PIN3) | \
676 PIN_MODE_INPUT(GPIOE_PIN4) | \
677 PIN_MODE_INPUT(GPIOE_PIN5) | \
678 PIN_MODE_INPUT(GPIOE_PIN6) | \
679 PIN_MODE_INPUT(GPIOE_PIN7) | \
680 PIN_MODE_INPUT(GPIOE_PIN8) | \
681 PIN_MODE_INPUT(GPIOE_PIN9) | \
682 PIN_MODE_INPUT(GPIOE_PIN10) | \
683 PIN_MODE_INPUT(GPIOE_PIN11) | \
684 PIN_MODE_INPUT(GPIOE_PIN12) | \
685 PIN_MODE_INPUT(GPIOE_PIN13) | \
686 PIN_MODE_INPUT(GPIOE_PIN14) | \
687 PIN_MODE_INPUT(GPIOE_PIN15))
688#define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) | \
689 PIN_OTYPE_PUSHPULL(GPIOE_PIN1) | \
690 PIN_OTYPE_PUSHPULL(GPIOE_PIN2) | \
691 PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | \
692 PIN_OTYPE_PUSHPULL(GPIOE_PIN4) | \
693 PIN_OTYPE_PUSHPULL(GPIOE_PIN5) | \
694 PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | \
695 PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | \
696 PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | \
697 PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | \
698 PIN_OTYPE_PUSHPULL(GPIOE_PIN10) | \
699 PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | \
700 PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | \
701 PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | \
702 PIN_OTYPE_PUSHPULL(GPIOE_PIN14) | \
703 PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
704#define VAL_GPIOE_OSPEEDR (PIN_OSPEED_HIGH(GPIOE_PIN0) | \
705 PIN_OSPEED_HIGH(GPIOE_PIN1) | \
706 PIN_OSPEED_HIGH(GPIOE_PIN2) | \
707 PIN_OSPEED_HIGH(GPIOE_PIN3) | \
708 PIN_OSPEED_HIGH(GPIOE_PIN4) | \
709 PIN_OSPEED_HIGH(GPIOE_PIN5) | \
710 PIN_OSPEED_HIGH(GPIOE_PIN6) | \
711 PIN_OSPEED_HIGH(GPIOE_PIN7) | \
712 PIN_OSPEED_HIGH(GPIOE_PIN8) | \
713 PIN_OSPEED_HIGH(GPIOE_PIN9) | \
714 PIN_OSPEED_HIGH(GPIOE_PIN10) | \
715 PIN_OSPEED_HIGH(GPIOE_PIN11) | \
716 PIN_OSPEED_HIGH(GPIOE_PIN12) | \
717 PIN_OSPEED_HIGH(GPIOE_PIN13) | \
718 PIN_OSPEED_HIGH(GPIOE_PIN14) | \
719 PIN_OSPEED_HIGH(GPIOE_PIN15))
720#define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(GPIOE_PIN0) | \
721 PIN_PUPDR_PULLUP(GPIOE_PIN1) | \
722 PIN_PUPDR_PULLUP(GPIOE_PIN2) | \
723 PIN_PUPDR_PULLUP(GPIOE_PIN3) | \
724 PIN_PUPDR_PULLUP(GPIOE_PIN4) | \
725 PIN_PUPDR_PULLUP(GPIOE_PIN5) | \
726 PIN_PUPDR_PULLUP(GPIOE_PIN6) | \
727 PIN_PUPDR_PULLUP(GPIOE_PIN7) | \
728 PIN_PUPDR_PULLUP(GPIOE_PIN8) | \
729 PIN_PUPDR_PULLUP(GPIOE_PIN9) | \
730 PIN_PUPDR_PULLUP(GPIOE_PIN10) | \
731 PIN_PUPDR_PULLUP(GPIOE_PIN11) | \
732 PIN_PUPDR_PULLUP(GPIOE_PIN12) | \
733 PIN_PUPDR_PULLUP(GPIOE_PIN13) | \
734 PIN_PUPDR_PULLUP(GPIOE_PIN14) | \
735 PIN_PUPDR_PULLUP(GPIOE_PIN15))
736#define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_PIN0) | \
737 PIN_ODR_HIGH(GPIOE_PIN1) | \
738 PIN_ODR_HIGH(GPIOE_PIN2) | \
739 PIN_ODR_HIGH(GPIOE_PIN3) | \
740 PIN_ODR_HIGH(GPIOE_PIN4) | \
741 PIN_ODR_HIGH(GPIOE_PIN5) | \
742 PIN_ODR_HIGH(GPIOE_PIN6) | \
743 PIN_ODR_HIGH(GPIOE_PIN7) | \
744 PIN_ODR_HIGH(GPIOE_PIN8) | \
745 PIN_ODR_HIGH(GPIOE_PIN9) | \
746 PIN_ODR_HIGH(GPIOE_PIN10) | \
747 PIN_ODR_HIGH(GPIOE_PIN11) | \
748 PIN_ODR_HIGH(GPIOE_PIN12) | \
749 PIN_ODR_HIGH(GPIOE_PIN13) | \
750 PIN_ODR_HIGH(GPIOE_PIN14) | \
751 PIN_ODR_HIGH(GPIOE_PIN15))
752#define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_PIN0, 0U) | \
753 PIN_AFIO_AF(GPIOE_PIN1, 0U) | \
754 PIN_AFIO_AF(GPIOE_PIN2, 0U) | \
755 PIN_AFIO_AF(GPIOE_PIN3, 0U) | \
756 PIN_AFIO_AF(GPIOE_PIN4, 0U) | \
757 PIN_AFIO_AF(GPIOE_PIN5, 0U) | \
758 PIN_AFIO_AF(GPIOE_PIN6, 0U) | \
759 PIN_AFIO_AF(GPIOE_PIN7, 0U))
760#define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0U) | \
761 PIN_AFIO_AF(GPIOE_PIN9, 0U) | \
762 PIN_AFIO_AF(GPIOE_PIN10, 0U) | \
763 PIN_AFIO_AF(GPIOE_PIN11, 0U) | \
764 PIN_AFIO_AF(GPIOE_PIN12, 0U) | \
765 PIN_AFIO_AF(GPIOE_PIN13, 0U) | \
766 PIN_AFIO_AF(GPIOE_PIN14, 0U) | \
767 PIN_AFIO_AF(GPIOE_PIN15, 0U))
768
769/*
770 * GPIOF setup:
771 *
772 * PF0 - COL7
773 * PF1 - COL6
774 * PF2 - PIN2 (input pullup).
775 * PF3 - PIN3 (input pullup).
776 * PF4 - PIN4 (input pullup).
777 * PF5 - PIN5 (input pullup).
778 * PF6 - PIN6 (input pullup).
779 * PF7 - PIN7 (input pullup).
780 * PF8 - PIN8 (input pullup).
781 * PF9 - PIN9 (input pullup).
782 * PF10 - PIN10 (input pullup).
783 * PF11 - PIN11 (input pullup).
784 * PF12 - PIN12 (input pullup).
785 * PF13 - PIN13 (input pullup).
786 * PF14 - PIN14 (input pullup).
787 * PF15 - PIN15 (input pullup).
788 */
789#define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_PIN0) | \
790 PIN_MODE_INPUT(GPIOF_PIN1) | \
791 PIN_MODE_INPUT(GPIOF_PIN2) | \
792 PIN_MODE_INPUT(GPIOF_PIN3) | \
793 PIN_MODE_INPUT(GPIOF_PIN4) | \
794 PIN_MODE_INPUT(GPIOF_PIN5) | \
795 PIN_MODE_INPUT(GPIOF_PIN6) | \
796 PIN_MODE_INPUT(GPIOF_PIN7) | \
797 PIN_MODE_INPUT(GPIOF_PIN8) | \
798 PIN_MODE_INPUT(GPIOF_PIN9) | \
799 PIN_MODE_INPUT(GPIOF_PIN10) | \
800 PIN_MODE_INPUT(GPIOF_PIN11) | \
801 PIN_MODE_INPUT(GPIOF_PIN12) | \
802 PIN_MODE_INPUT(GPIOF_PIN13) | \
803 PIN_MODE_INPUT(GPIOF_PIN14) | \
804 PIN_MODE_INPUT(GPIOF_PIN15))
805#define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_PIN0) | \
806 PIN_OTYPE_PUSHPULL(GPIOF_PIN1) | \
807 PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | \
808 PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | \
809 PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | \
810 PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | \
811 PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | \
812 PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | \
813 PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | \
814 PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | \
815 PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | \
816 PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | \
817 PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | \
818 PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | \
819 PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | \
820 PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
821#define VAL_GPIOF_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOF_PIN0) | \
822 PIN_OSPEED_VERYLOW(GPIOF_PIN1) | \
823 PIN_OSPEED_HIGH(GPIOF_PIN2) | \
824 PIN_OSPEED_HIGH(GPIOF_PIN3) | \
825 PIN_OSPEED_HIGH(GPIOF_PIN4) | \
826 PIN_OSPEED_HIGH(GPIOF_PIN5) | \
827 PIN_OSPEED_HIGH(GPIOF_PIN6) | \
828 PIN_OSPEED_HIGH(GPIOF_PIN7) | \
829 PIN_OSPEED_HIGH(GPIOF_PIN8) | \
830 PIN_OSPEED_HIGH(GPIOF_PIN9) | \
831 PIN_OSPEED_HIGH(GPIOF_PIN10) | \
832 PIN_OSPEED_HIGH(GPIOF_PIN11) | \
833 PIN_OSPEED_HIGH(GPIOF_PIN12) | \
834 PIN_OSPEED_HIGH(GPIOF_PIN13) | \
835 PIN_OSPEED_HIGH(GPIOF_PIN14) | \
836 PIN_OSPEED_HIGH(GPIOF_PIN15))
837#define VAL_GPIOF_PUPDR (PIN_PUPDR_PULLUP(GPIOF_PIN0) | \
838 PIN_PUPDR_PULLUP(GPIOF_PIN1) | \
839 PIN_PUPDR_PULLUP(GPIOF_PIN2) | \
840 PIN_PUPDR_PULLUP(GPIOF_PIN3) | \
841 PIN_PUPDR_PULLUP(GPIOF_PIN4) | \
842 PIN_PUPDR_PULLUP(GPIOF_PIN5) | \
843 PIN_PUPDR_PULLUP(GPIOF_PIN6) | \
844 PIN_PUPDR_PULLUP(GPIOF_PIN7) | \
845 PIN_PUPDR_PULLUP(GPIOF_PIN8) | \
846 PIN_PUPDR_PULLUP(GPIOF_PIN9) | \
847 PIN_PUPDR_PULLUP(GPIOF_PIN10) | \
848 PIN_PUPDR_PULLUP(GPIOF_PIN11) | \
849 PIN_PUPDR_PULLUP(GPIOF_PIN12) | \
850 PIN_PUPDR_PULLUP(GPIOF_PIN13) | \
851 PIN_PUPDR_PULLUP(GPIOF_PIN14) | \
852 PIN_PUPDR_PULLUP(GPIOF_PIN15))
853#define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_PIN0) | \
854 PIN_ODR_HIGH(GPIOF_PIN1) | \
855 PIN_ODR_HIGH(GPIOF_PIN2) | \
856 PIN_ODR_HIGH(GPIOF_PIN3) | \
857 PIN_ODR_HIGH(GPIOF_PIN4) | \
858 PIN_ODR_HIGH(GPIOF_PIN5) | \
859 PIN_ODR_HIGH(GPIOF_PIN6) | \
860 PIN_ODR_HIGH(GPIOF_PIN7) | \
861 PIN_ODR_HIGH(GPIOF_PIN8) | \
862 PIN_ODR_HIGH(GPIOF_PIN9) | \
863 PIN_ODR_HIGH(GPIOF_PIN10) | \
864 PIN_ODR_HIGH(GPIOF_PIN11) | \
865 PIN_ODR_HIGH(GPIOF_PIN12) | \
866 PIN_ODR_HIGH(GPIOF_PIN13) | \
867 PIN_ODR_HIGH(GPIOF_PIN14) | \
868 PIN_ODR_HIGH(GPIOF_PIN15))
869#define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_PIN0, 0U) | \
870 PIN_AFIO_AF(GPIOF_PIN1, 0U) | \
871 PIN_AFIO_AF(GPIOF_PIN2, 0U) | \
872 PIN_AFIO_AF(GPIOF_PIN3, 0U) | \
873 PIN_AFIO_AF(GPIOF_PIN4, 0U) | \
874 PIN_AFIO_AF(GPIOF_PIN5, 0U) | \
875 PIN_AFIO_AF(GPIOF_PIN6, 0U) | \
876 PIN_AFIO_AF(GPIOF_PIN7, 0U))
877#define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0U) | \
878 PIN_AFIO_AF(GPIOF_PIN9, 0U) | \
879 PIN_AFIO_AF(GPIOF_PIN10, 0U) | \
880 PIN_AFIO_AF(GPIOF_PIN11, 0U) | \
881 PIN_AFIO_AF(GPIOF_PIN12, 0U) | \
882 PIN_AFIO_AF(GPIOF_PIN13, 0U) | \
883 PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
884 PIN_AFIO_AF(GPIOF_PIN15, 0U))
885
886#if !defined(_FROM_ASM_)
887#ifdef __cplusplus
888extern "C" {
889#endif
890 void boardInit(void);
891#ifdef __cplusplus
892}
893#endif
894#endif /* _FROM_ASM_ */
895
896#endif /* _BOARD_H */
diff --git a/platforms/chibios/GENERIC_STM32_F042X6/board/board.mk b/platforms/chibios/GENERIC_STM32_F042X6/board/board.mk
new file mode 100644
index 000000000..842e33590
--- /dev/null
+++ b/platforms/chibios/GENERIC_STM32_F042X6/board/board.mk
@@ -0,0 +1,9 @@
1# List of all the board related files.
2BOARDSRC = $(BOARD_PATH)/board/board.c
3
4# Required include directories
5BOARDINC = $(BOARD_PATH)/board
6
7# Shared variables
8ALLCSRC += $(BOARDSRC)
9ALLINC += $(BOARDINC)
diff --git a/platforms/chibios/GENERIC_STM32_F042X6/configs/bootloader_defs.h b/platforms/chibios/GENERIC_STM32_F042X6/configs/bootloader_defs.h
new file mode 100644
index 000000000..4994be9c2
--- /dev/null
+++ b/platforms/chibios/GENERIC_STM32_F042X6/configs/bootloader_defs.h
@@ -0,0 +1,7 @@
1/* Address for jumping to bootloader on STM32 chips. */
2/* It is chip dependent, the correct number can be looked up here:
3 * http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
4 * This also requires a patch to chibios:
5 * <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch
6 */
7#define STM32_BOOTLOADER_ADDRESS 0x1FFFC400 \ No newline at end of file
diff --git a/platforms/chibios/GENERIC_STM32_F072XB/board/board.c b/platforms/chibios/GENERIC_STM32_F072XB/board/board.c
new file mode 100644
index 000000000..c91136e8f
--- /dev/null
+++ b/platforms/chibios/GENERIC_STM32_F072XB/board/board.c
@@ -0,0 +1,250 @@
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 * This file has been automatically generated using ChibiStudio board
19 * generator plugin. Do not edit manually.
20 */
21
22#include "hal.h"
23#include "stm32_gpio.h"
24
25/*===========================================================================*/
26/* Driver local definitions. */
27/*===========================================================================*/
28
29/*===========================================================================*/
30/* Driver exported variables. */
31/*===========================================================================*/
32
33/*===========================================================================*/
34/* Driver local variables and types. */
35/*===========================================================================*/
36
37/**
38 * @brief Type of STM32 GPIO port setup.
39 */
40typedef struct {
41 uint32_t moder;
42 uint32_t otyper;
43 uint32_t ospeedr;
44 uint32_t pupdr;
45 uint32_t odr;
46 uint32_t afrl;
47 uint32_t afrh;
48} gpio_setup_t;
49
50/**
51 * @brief Type of STM32 GPIO initialization data.
52 */
53typedef struct {
54#if STM32_HAS_GPIOA || defined(__DOXYGEN__)
55 gpio_setup_t PAData;
56#endif
57#if STM32_HAS_GPIOB || defined(__DOXYGEN__)
58 gpio_setup_t PBData;
59#endif
60#if STM32_HAS_GPIOC || defined(__DOXYGEN__)
61 gpio_setup_t PCData;
62#endif
63#if STM32_HAS_GPIOD || defined(__DOXYGEN__)
64 gpio_setup_t PDData;
65#endif
66#if STM32_HAS_GPIOE || defined(__DOXYGEN__)
67 gpio_setup_t PEData;
68#endif
69#if STM32_HAS_GPIOF || defined(__DOXYGEN__)
70 gpio_setup_t PFData;
71#endif
72#if STM32_HAS_GPIOG || defined(__DOXYGEN__)
73 gpio_setup_t PGData;
74#endif
75#if STM32_HAS_GPIOH || defined(__DOXYGEN__)
76 gpio_setup_t PHData;
77#endif
78#if STM32_HAS_GPIOI || defined(__DOXYGEN__)
79 gpio_setup_t PIData;
80#endif
81#if STM32_HAS_GPIOJ || defined(__DOXYGEN__)
82 gpio_setup_t PJData;
83#endif
84#if STM32_HAS_GPIOK || defined(__DOXYGEN__)
85 gpio_setup_t PKData;
86#endif
87} gpio_config_t;
88
89/**
90 * @brief STM32 GPIO static initialization data.
91 */
92static const gpio_config_t gpio_default_config = {
93#if STM32_HAS_GPIOA
94 {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
95#endif
96#if STM32_HAS_GPIOB
97 {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH},
98#endif
99#if STM32_HAS_GPIOC
100 {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH},
101#endif
102#if STM32_HAS_GPIOD
103 {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH},
104#endif
105#if STM32_HAS_GPIOE
106 {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH},
107#endif
108#if STM32_HAS_GPIOF
109 {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH},
110#endif
111#if STM32_HAS_GPIOG
112 {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH},
113#endif
114#if STM32_HAS_GPIOH
115 {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH},
116#endif
117#if STM32_HAS_GPIOI
118 {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
119#endif
120#if STM32_HAS_GPIOJ
121 {VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR, VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
122#endif
123#if STM32_HAS_GPIOK
124 {VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR, VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
125#endif
126};
127
128/*===========================================================================*/
129/* Driver local functions. */
130/*===========================================================================*/
131
132static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) {
133 gpiop->OTYPER = config->otyper;
134 gpiop->OSPEEDR = config->ospeedr;
135 gpiop->PUPDR = config->pupdr;
136 gpiop->ODR = config->odr;
137 gpiop->AFRL = config->afrl;
138 gpiop->AFRH = config->afrh;
139 gpiop->MODER = config->moder;
140}
141
142static void stm32_gpio_init(void) {
143 /* Enabling GPIO-related clocks, the mask comes from the
144 registry header file.*/
145 rccResetAHB(STM32_GPIO_EN_MASK);
146 rccEnableAHB(STM32_GPIO_EN_MASK, true);
147
148 /* Initializing all the defined GPIO ports.*/
149#if STM32_HAS_GPIOA
150 gpio_init(GPIOA, &gpio_default_config.PAData);
151#endif
152#if STM32_HAS_GPIOB
153 gpio_init(GPIOB, &gpio_default_config.PBData);
154#endif
155#if STM32_HAS_GPIOC
156 gpio_init(GPIOC, &gpio_default_config.PCData);
157#endif
158#if STM32_HAS_GPIOD
159 gpio_init(GPIOD, &gpio_default_config.PDData);
160#endif
161#if STM32_HAS_GPIOE
162 gpio_init(GPIOE, &gpio_default_config.PEData);
163#endif
164#if STM32_HAS_GPIOF
165 gpio_init(GPIOF, &gpio_default_config.PFData);
166#endif
167#if STM32_HAS_GPIOG
168 gpio_init(GPIOG, &gpio_default_config.PGData);
169#endif
170#if STM32_HAS_GPIOH
171 gpio_init(GPIOH, &gpio_default_config.PHData);
172#endif
173#if STM32_HAS_GPIOI
174 gpio_init(GPIOI, &gpio_default_config.PIData);
175#endif
176#if STM32_HAS_GPIOJ
177 gpio_init(GPIOJ, &gpio_default_config.PJData);
178#endif
179#if STM32_HAS_GPIOK
180 gpio_init(GPIOK, &gpio_default_config.PKData);
181#endif
182}
183
184/*===========================================================================*/
185/* Driver interrupt handlers. */
186/*===========================================================================*/
187
188/*===========================================================================*/
189/* Driver exported functions. */
190/*===========================================================================*/
191
192__attribute__((weak)) void enter_bootloader_mode_if_requested(void) {}
193
194/**
195 * @brief Early initialization code.
196 * @details GPIO ports and system clocks are initialized before everything
197 * else.
198 */
199void __early_init(void) {
200 enter_bootloader_mode_if_requested();
201
202 stm32_gpio_init();
203 stm32_clock_init();
204}
205
206#if HAL_USE_SDC || defined(__DOXYGEN__)
207/**
208 * @brief SDC card detection.
209 */
210bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
211 (void)sdcp;
212 /* TODO: Fill the implementation.*/
213 return true;
214}
215
216/**
217 * @brief SDC card write protection detection.
218 */
219bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
220 (void)sdcp;
221 /* TODO: Fill the implementation.*/
222 return false;
223}
224#endif /* HAL_USE_SDC */
225
226#if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
227/**
228 * @brief MMC_SPI card detection.
229 */
230bool mmc_lld_is_card_inserted(MMCDriver *mmcp) {
231 (void)mmcp;
232 /* TODO: Fill the implementation.*/
233 return true;
234}
235
236/**
237 * @brief MMC_SPI card write protection detection.
238 */
239bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
240 (void)mmcp;
241 /* TODO: Fill the implementation.*/
242 return false;
243}
244#endif
245
246/**
247 * @brief Board-specific initialization code.
248 * @todo Add your board-specific code, if any.
249 */
250void boardInit(void) {}
diff --git a/platforms/chibios/GENERIC_STM32_F072XB/board/board.h b/platforms/chibios/GENERIC_STM32_F072XB/board/board.h
new file mode 100644
index 000000000..87570e62d
--- /dev/null
+++ b/platforms/chibios/GENERIC_STM32_F072XB/board/board.h
@@ -0,0 +1,407 @@
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 * This file has been automatically generated using ChibiStudio board
19 * generator plugin. Do not edit manually.
20 */
21
22#ifndef BOARD_H
23#define BOARD_H
24
25/*===========================================================================*/
26/* Driver constants. */
27/*===========================================================================*/
28
29/*
30 * Setup for Generic STM32_F072 Board
31 */
32
33/*
34 * Board identifier.
35 */
36#define BOARD_GENERIC_STM32_F072XB
37#define BOARD_NAME "STM32_F072"
38
39/*
40 * Board oscillators-related settings.
41 * NOTE: LSE not fitted.
42 * NOTE: HSE not fitted.
43 */
44#if !defined(STM32_LSECLK)
45# define STM32_LSECLK 0U
46#endif
47
48#define STM32_LSEDRV (3U << 3U)
49
50#if !defined(STM32_HSECLK)
51# define STM32_HSECLK 0U
52#endif
53
54#define STM32_HSE_BYPASS
55
56/*
57 * MCU type as defined in the ST header.
58 */
59#define STM32F072xB
60
61/*
62 * IO pins assignments.
63 */
64#define GPIOA_BUTTON 0U
65#define GPIOA_PIN1 1U
66#define GPIOA_PIN2 2U
67#define GPIOA_PIN3 3U
68#define GPIOA_PIN4 4U
69#define GPIOA_PIN5 5U
70#define GPIOA_PIN6 6U
71#define GPIOA_PIN7 7U
72#define GPIOA_PIN8 8U
73#define GPIOA_PIN9 9U
74#define GPIOA_PIN10 10U
75#define GPIOA_USB_DM 11U
76#define GPIOA_USB_DP 12U
77#define GPIOA_SWDIO 13U
78#define GPIOA_SWCLK 14U
79#define GPIOA_PIN15 15U
80
81#define GPIOB_PIN0 0U
82#define GPIOB_PIN1 1U
83#define GPIOB_PIN2 2U
84#define GPIOB_PIN3 3U
85#define GPIOB_PIN4 4U
86#define GPIOB_PIN5 5U
87#define GPIOB_PIN6 6U
88#define GPIOB_PIN7 7U
89#define GPIOB_PIN8 8U
90#define GPIOB_PIN9 9U
91#define GPIOB_PIN10 10U
92#define GPIOB_PIN11 11U
93#define GPIOB_PIN12 12U
94#define GPIOB_SPI2_SCK 13U
95#define GPIOB_SPI2_MISO 14U
96#define GPIOB_SPI2_MOSI 15U
97
98#define GPIOC_MEMS_CS 0U
99#define GPIOC_PIN1 1U
100#define GPIOC_PIN2 2U
101#define GPIOC_PIN3 3U
102#define GPIOC_PIN4 4U
103#define GPIOC_PIN5 5U
104#define GPIOC_LED_RED 6U
105#define GPIOC_LED_BLUE 7U
106#define GPIOC_LED_ORANGE 8U
107#define GPIOC_LED_GREEN 9U
108#define GPIOC_PIN10 10U
109#define GPIOC_PIN11 11U
110#define GPIOC_PIN12 12U
111#define GPIOC_PIN13 13U
112#define GPIOC_OSC32_IN 14U
113#define GPIOC_OSC32_OUT 15U
114
115#define GPIOD_PIN0 0U
116#define GPIOD_PIN1 1U
117#define GPIOD_PIN2 2U
118#define GPIOD_PIN3 3U
119#define GPIOD_PIN4 4U
120#define GPIOD_PIN5 5U
121#define GPIOD_PIN6 6U
122#define GPIOD_PIN7 7U
123#define GPIOD_PIN8 8U
124#define GPIOD_PIN9 9U
125#define GPIOD_PIN10 10U
126#define GPIOD_PIN11 11U
127#define GPIOD_PIN12 12U
128#define GPIOD_PIN13 13U
129#define GPIOD_PIN14 14U
130#define GPIOD_PIN15 15U
131
132#define GPIOE_PIN0 0U
133#define GPIOE_PIN1 1U
134#define GPIOE_PIN2 2U
135#define GPIOE_PIN3 3U
136#define GPIOE_PIN4 4U
137#define GPIOE_PIN5 5U
138#define GPIOE_PIN6 6U
139#define GPIOE_PIN7 7U
140#define GPIOE_PIN8 8U
141#define GPIOE_PIN9 9U
142#define GPIOE_PIN10 10U
143#define GPIOE_PIN11 11U
144#define GPIOE_PIN12 12U
145#define GPIOE_PIN13 13U
146#define GPIOE_PIN14 14U
147#define GPIOE_PIN15 15U
148
149#define GPIOF_OSC_IN 0U
150#define GPIOF_OSC_OUT 1U
151#define GPIOF_PIN2 2U
152#define GPIOF_PIN3 3U
153#define GPIOF_PIN4 4U
154#define GPIOF_PIN5 5U
155#define GPIOF_PIN6 6U
156#define GPIOF_PIN7 7U
157#define GPIOF_PIN8 8U
158#define GPIOF_PIN9 9U
159#define GPIOF_PIN10 10U
160#define GPIOF_PIN11 11U
161#define GPIOF_PIN12 12U
162#define GPIOF_PIN13 13U
163#define GPIOF_PIN14 14U
164#define GPIOF_PIN15 15U
165
166/*
167 * IO lines assignments.
168 */
169#define LINE_BUTTON PAL_LINE(GPIOA, 0U)
170#define LINE_USB_DM PAL_LINE(GPIOA, 11U)
171#define LINE_USB_DP PAL_LINE(GPIOA, 12U)
172#define LINE_SWDIO PAL_LINE(GPIOA, 13U)
173#define LINE_SWCLK PAL_LINE(GPIOA, 14U)
174#define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U)
175#define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U)
176#define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U)
177#define LINE_MEMS_CS PAL_LINE(GPIOC, 0U)
178#define LINE_LED_RED PAL_LINE(GPIOC, 6U)
179#define LINE_LED_BLUE PAL_LINE(GPIOC, 7U)
180#define LINE_LED_ORANGE PAL_LINE(GPIOC, 8U)
181#define LINE_LED_GREEN PAL_LINE(GPIOC, 9U)
182#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
183#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
184#define LINE_OSC_IN PAL_LINE(GPIOF, 0U)
185#define LINE_OSC_OUT PAL_LINE(GPIOF, 1U)
186
187/*===========================================================================*/
188/* Driver pre-compile time settings. */
189/*===========================================================================*/
190
191/*===========================================================================*/
192/* Derived constants and error checks. */
193/*===========================================================================*/
194
195/*===========================================================================*/
196/* Driver data structures and types. */
197/*===========================================================================*/
198
199/*===========================================================================*/
200/* Driver macros. */
201/*===========================================================================*/
202
203/*
204 * I/O ports initial setup, this configuration is established soon after reset
205 * in the initialization code.
206 * Please refer to the STM32 Reference Manual for details.
207 */
208#define PIN_MODE_INPUT(n) (0U << ((n)*2U))
209#define PIN_MODE_OUTPUT(n) (1U << ((n)*2U))
210#define PIN_MODE_ALTERNATE(n) (2U << ((n)*2U))
211#define PIN_MODE_ANALOG(n) (3U << ((n)*2U))
212#define PIN_ODR_LOW(n) (0U << (n))
213#define PIN_ODR_HIGH(n) (1U << (n))
214#define PIN_OTYPE_PUSHPULL(n) (0U << (n))
215#define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
216#define PIN_OSPEED_VERYLOW(n) (0U << ((n)*2U))
217#define PIN_OSPEED_LOW(n) (1U << ((n)*2U))
218#define PIN_OSPEED_MEDIUM(n) (2U << ((n)*2U))
219#define PIN_OSPEED_HIGH(n) (3U << ((n)*2U))
220#define PIN_PUPDR_FLOATING(n) (0U << ((n)*2U))
221#define PIN_PUPDR_PULLUP(n) (1U << ((n)*2U))
222#define PIN_PUPDR_PULLDOWN(n) (2U << ((n)*2U))
223#define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
224
225/*
226 * GPIOA setup:
227 *
228 * PA0 - BUTTON (input floating).
229 * PA1 - PIN1 (input pullup).
230 * PA2 - PIN2 (input pullup).
231 * PA3 - PIN3 (input pullup).
232 * PA4 - PIN4 (input pullup).
233 * PA5 - PIN5 (input pullup).
234 * PA6 - PIN6 (input pullup).
235 * PA7 - PIN7 (input pullup).
236 * PA8 - PIN8 (input pullup).
237 * PA9 - PIN9 (input pullup).
238 * PA10 - PIN10 (input pullup).
239 * PA11 - USB_DM (input floating).
240 * PA12 - USB_DP (input floating).
241 * PA13 - SWDIO (alternate 0).
242 * PA14 - SWCLK (alternate 0).
243 * PA15 - PIN15 (input pullup).
244 */
245#define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_BUTTON) | PIN_MODE_INPUT(GPIOA_PIN1) | PIN_MODE_INPUT(GPIOA_PIN2) | PIN_MODE_INPUT(GPIOA_PIN3) | PIN_MODE_INPUT(GPIOA_PIN4) | PIN_MODE_INPUT(GPIOA_PIN5) | PIN_MODE_INPUT(GPIOA_PIN6) | PIN_MODE_INPUT(GPIOA_PIN7) | PIN_MODE_INPUT(GPIOA_PIN8) | PIN_MODE_INPUT(GPIOA_PIN9) | PIN_MODE_INPUT(GPIOA_PIN10) | PIN_MODE_INPUT(GPIOA_USB_DM) | PIN_MODE_INPUT(GPIOA_USB_DP) | PIN_MODE_ALTERNATE(GPIOA_SWDIO) | PIN_MODE_ALTERNATE(GPIOA_SWCLK) | PIN_MODE_INPUT(GPIOA_PIN15))
246#define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_BUTTON) | PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | PIN_OTYPE_PUSHPULL(GPIOA_PIN2) | PIN_OTYPE_PUSHPULL(GPIOA_PIN3) | PIN_OTYPE_PUSHPULL(GPIOA_PIN4) | PIN_OTYPE_PUSHPULL(GPIOA_PIN5) | PIN_OTYPE_PUSHPULL(GPIOA_PIN6) | PIN_OTYPE_PUSHPULL(GPIOA_PIN7) | PIN_OTYPE_PUSHPULL(GPIOA_PIN8) | PIN_OTYPE_PUSHPULL(GPIOA_PIN9) | PIN_OTYPE_PUSHPULL(GPIOA_PIN10) | PIN_OTYPE_PUSHPULL(GPIOA_USB_DM) | PIN_OTYPE_PUSHPULL(GPIOA_USB_DP) | PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
247#define VAL_GPIOA_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOA_BUTTON) | PIN_OSPEED_VERYLOW(GPIOA_PIN1) | PIN_OSPEED_VERYLOW(GPIOA_PIN2) | PIN_OSPEED_VERYLOW(GPIOA_PIN3) | PIN_OSPEED_VERYLOW(GPIOA_PIN4) | PIN_OSPEED_VERYLOW(GPIOA_PIN5) | PIN_OSPEED_VERYLOW(GPIOA_PIN6) | PIN_OSPEED_VERYLOW(GPIOA_PIN7) | PIN_OSPEED_VERYLOW(GPIOA_PIN8) | PIN_OSPEED_VERYLOW(GPIOA_PIN9) | PIN_OSPEED_VERYLOW(GPIOA_PIN10) | PIN_OSPEED_VERYLOW(GPIOA_USB_DM) | PIN_OSPEED_VERYLOW(GPIOA_USB_DP) | PIN_OSPEED_HIGH(GPIOA_SWDIO) | PIN_OSPEED_HIGH(GPIOA_SWCLK) | PIN_OSPEED_HIGH(GPIOA_PIN15))
248#define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_BUTTON) | PIN_PUPDR_PULLUP(GPIOA_PIN1) | PIN_PUPDR_PULLUP(GPIOA_PIN2) | PIN_PUPDR_PULLUP(GPIOA_PIN3) | PIN_PUPDR_PULLUP(GPIOA_PIN4) | PIN_PUPDR_PULLUP(GPIOA_PIN5) | PIN_PUPDR_PULLUP(GPIOA_PIN6) | PIN_PUPDR_PULLUP(GPIOA_PIN7) | PIN_PUPDR_PULLUP(GPIOA_PIN8) | PIN_PUPDR_PULLUP(GPIOA_PIN9) | PIN_PUPDR_PULLUP(GPIOA_PIN10) | PIN_PUPDR_FLOATING(GPIOA_USB_DM) | PIN_PUPDR_FLOATING(GPIOA_USB_DP) | PIN_PUPDR_PULLUP(GPIOA_SWDIO) | PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | PIN_PUPDR_PULLUP(GPIOA_PIN15))
249#define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_BUTTON) | PIN_ODR_HIGH(GPIOA_PIN1) | PIN_ODR_HIGH(GPIOA_PIN2) | PIN_ODR_HIGH(GPIOA_PIN3) | PIN_ODR_HIGH(GPIOA_PIN4) | PIN_ODR_HIGH(GPIOA_PIN5) | PIN_ODR_HIGH(GPIOA_PIN6) | PIN_ODR_HIGH(GPIOA_PIN7) | PIN_ODR_HIGH(GPIOA_PIN8) | PIN_ODR_HIGH(GPIOA_PIN9) | PIN_ODR_HIGH(GPIOA_PIN10) | PIN_ODR_HIGH(GPIOA_USB_DM) | PIN_ODR_HIGH(GPIOA_USB_DP) | PIN_ODR_HIGH(GPIOA_SWDIO) | PIN_ODR_HIGH(GPIOA_SWCLK) | PIN_ODR_HIGH(GPIOA_PIN15))
250#define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_BUTTON, 0U) | PIN_AFIO_AF(GPIOA_PIN1, 0U) | PIN_AFIO_AF(GPIOA_PIN2, 0U) | PIN_AFIO_AF(GPIOA_PIN3, 0U) | PIN_AFIO_AF(GPIOA_PIN4, 0U) | PIN_AFIO_AF(GPIOA_PIN5, 0U) | PIN_AFIO_AF(GPIOA_PIN6, 0U) | PIN_AFIO_AF(GPIOA_PIN7, 0U))
251#define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_PIN8, 0U) | PIN_AFIO_AF(GPIOA_PIN9, 0U) | PIN_AFIO_AF(GPIOA_PIN10, 0U) | PIN_AFIO_AF(GPIOA_USB_DM, 0U) | PIN_AFIO_AF(GPIOA_USB_DP, 0U) | PIN_AFIO_AF(GPIOA_SWDIO, 0U) | PIN_AFIO_AF(GPIOA_SWCLK, 0U) | PIN_AFIO_AF(GPIOA_PIN15, 0U))
252
253/*
254 * GPIOB setup:
255 *
256 * PB0 - PIN0 (input pullup).
257 * PB1 - PIN1 (input pullup).
258 * PB2 - PIN2 (input pullup).
259 * PB3 - PIN3 (input pullup).
260 * PB4 - PIN4 (input pullup).
261 * PB5 - PIN5 (input pullup).
262 * PB6 - PIN6 (input pullup).
263 * PB7 - PIN7 (input pullup).
264 * PB8 - PIN8 (input pullup).
265 * PB9 - PIN9 (input pullup).
266 * PB10 - PIN10 (input pullup).
267 * PB11 - PIN11 (input pullup).
268 * PB12 - PIN12 (input pullup).
269 * PB13 - SPI2_SCK (alternate 0).
270 * PB14 - SPI2_MISO (alternate 0).
271 * PB15 - SPI2_MOSI (alternate 0).
272 */
273#define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | PIN_MODE_INPUT(GPIOB_PIN1) | PIN_MODE_INPUT(GPIOB_PIN2) | PIN_MODE_INPUT(GPIOB_PIN3) | PIN_MODE_INPUT(GPIOB_PIN4) | PIN_MODE_INPUT(GPIOB_PIN5) | PIN_MODE_INPUT(GPIOB_PIN6) | PIN_MODE_INPUT(GPIOB_PIN7) | PIN_MODE_INPUT(GPIOB_PIN8) | PIN_MODE_INPUT(GPIOB_PIN9) | PIN_MODE_INPUT(GPIOB_PIN10) | PIN_MODE_INPUT(GPIOB_PIN11) | PIN_MODE_INPUT(GPIOB_PIN12) | PIN_MODE_ALTERNATE(GPIOB_SPI2_SCK) | PIN_MODE_ALTERNATE(GPIOB_SPI2_MISO) | PIN_MODE_ALTERNATE(GPIOB_SPI2_MOSI))
274#define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | PIN_OTYPE_PUSHPULL(GPIOB_PIN3) | PIN_OTYPE_PUSHPULL(GPIOB_PIN4) | PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | PIN_OTYPE_PUSHPULL(GPIOB_PIN6) | PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | PIN_OTYPE_PUSHPULL(GPIOB_PIN9) | PIN_OTYPE_PUSHPULL(GPIOB_PIN10) | PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | PIN_OTYPE_PUSHPULL(GPIOB_SPI2_SCK) | PIN_OTYPE_PUSHPULL(GPIOB_SPI2_MISO) | PIN_OTYPE_PUSHPULL(GPIOB_SPI2_MOSI))
275#define VAL_GPIOB_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOB_PIN0) | PIN_OSPEED_VERYLOW(GPIOB_PIN1) | PIN_OSPEED_HIGH(GPIOB_PIN2) | PIN_OSPEED_HIGH(GPIOB_PIN3) | PIN_OSPEED_HIGH(GPIOB_PIN4) | PIN_OSPEED_VERYLOW(GPIOB_PIN5) | PIN_OSPEED_VERYLOW(GPIOB_PIN6) | PIN_OSPEED_VERYLOW(GPIOB_PIN7) | PIN_OSPEED_VERYLOW(GPIOB_PIN8) | PIN_OSPEED_VERYLOW(GPIOB_PIN9) | PIN_OSPEED_VERYLOW(GPIOB_PIN10) | PIN_OSPEED_VERYLOW(GPIOB_PIN11) | PIN_OSPEED_VERYLOW(GPIOB_PIN12) | PIN_OSPEED_VERYLOW(GPIOB_SPI2_SCK) | PIN_OSPEED_VERYLOW(GPIOB_SPI2_MISO) | PIN_OSPEED_VERYLOW(GPIOB_SPI2_MOSI))
276#define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_PIN0) | PIN_PUPDR_PULLUP(GPIOB_PIN1) | PIN_PUPDR_PULLUP(GPIOB_PIN2) | PIN_PUPDR_PULLUP(GPIOB_PIN3) | PIN_PUPDR_PULLUP(GPIOB_PIN4) | PIN_PUPDR_PULLUP(GPIOB_PIN5) | PIN_PUPDR_PULLUP(GPIOB_PIN6) | PIN_PUPDR_PULLUP(GPIOB_PIN7) | PIN_PUPDR_PULLUP(GPIOB_PIN8) | PIN_PUPDR_PULLUP(GPIOB_PIN9) | PIN_PUPDR_PULLUP(GPIOB_PIN10) | PIN_PUPDR_PULLUP(GPIOB_PIN11) | PIN_PUPDR_PULLUP(GPIOB_PIN12) | PIN_PUPDR_FLOATING(GPIOB_SPI2_SCK) | PIN_PUPDR_FLOATING(GPIOB_SPI2_MISO) | PIN_PUPDR_FLOATING(GPIOB_SPI2_MOSI))
277#define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_PIN0) | PIN_ODR_HIGH(GPIOB_PIN1) | PIN_ODR_HIGH(GPIOB_PIN2) | PIN_ODR_HIGH(GPIOB_PIN3) | PIN_ODR_HIGH(GPIOB_PIN4) | PIN_ODR_HIGH(GPIOB_PIN5) | PIN_ODR_HIGH(GPIOB_PIN6) | PIN_ODR_HIGH(GPIOB_PIN7) | PIN_ODR_HIGH(GPIOB_PIN8) | PIN_ODR_HIGH(GPIOB_PIN9) | PIN_ODR_HIGH(GPIOB_PIN10) | PIN_ODR_HIGH(GPIOB_PIN11) | PIN_ODR_HIGH(GPIOB_PIN12) | PIN_ODR_HIGH(GPIOB_SPI2_SCK) | PIN_ODR_HIGH(GPIOB_SPI2_MISO) | PIN_ODR_HIGH(GPIOB_SPI2_MOSI))
278#define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0U) | PIN_AFIO_AF(GPIOB_PIN1, 0U) | PIN_AFIO_AF(GPIOB_PIN2, 0U) | PIN_AFIO_AF(GPIOB_PIN3, 0U) | PIN_AFIO_AF(GPIOB_PIN4, 0U) | PIN_AFIO_AF(GPIOB_PIN5, 0U) | PIN_AFIO_AF(GPIOB_PIN6, 0U) | PIN_AFIO_AF(GPIOB_PIN7, 0U))
279#define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0U) | PIN_AFIO_AF(GPIOB_PIN9, 0U) | PIN_AFIO_AF(GPIOB_PIN10, 0U) | PIN_AFIO_AF(GPIOB_PIN11, 0U) | PIN_AFIO_AF(GPIOB_PIN12, 0U) | PIN_AFIO_AF(GPIOB_SPI2_SCK, 0U) | PIN_AFIO_AF(GPIOB_SPI2_MISO, 0U) | PIN_AFIO_AF(GPIOB_SPI2_MOSI, 0U))
280
281/*
282 * GPIOC setup:
283 *
284 * PC0 - MEMS_CS (output pushpull maximum).
285 * PC1 - PIN1 (input pullup).
286 * PC2 - PIN2 (input pullup).
287 * PC3 - PIN3 (input pullup).
288 * PC4 - PIN4 (input pullup).
289 * PC5 - PIN5 (input pullup).
290 * PC6 - LED_RED (output pushpull maximum).
291 * PC7 - LED_BLUE (output pushpull maximum).
292 * PC8 - LED_ORANGE (output pushpull maximum).
293 * PC9 - LED_GREEN (output pushpull maximum).
294 * PC10 - PIN10 (input pullup).
295 * PC11 - PIN11 (input pullup).
296 * PC12 - PIN12 (input pullup).
297 * PC13 - PIN13 (input pullup).
298 * PC14 - OSC32_IN (input floating).
299 * PC15 - OSC32_OUT (input floating).
300 */
301#define VAL_GPIOC_MODER (PIN_MODE_OUTPUT(GPIOC_MEMS_CS) | PIN_MODE_INPUT(GPIOC_PIN1) | PIN_MODE_INPUT(GPIOC_PIN2) | PIN_MODE_INPUT(GPIOC_PIN3) | PIN_MODE_INPUT(GPIOC_PIN4) | PIN_MODE_INPUT(GPIOC_PIN5) | PIN_MODE_OUTPUT(GPIOC_LED_RED) | PIN_MODE_OUTPUT(GPIOC_LED_BLUE) | PIN_MODE_OUTPUT(GPIOC_LED_ORANGE) | PIN_MODE_OUTPUT(GPIOC_LED_GREEN) | PIN_MODE_INPUT(GPIOC_PIN10) | PIN_MODE_INPUT(GPIOC_PIN11) | PIN_MODE_INPUT(GPIOC_PIN12) | PIN_MODE_INPUT(GPIOC_PIN13) | PIN_MODE_INPUT(GPIOC_OSC32_IN) | PIN_MODE_INPUT(GPIOC_OSC32_OUT))
302#define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_MEMS_CS) | PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | PIN_OTYPE_PUSHPULL(GPIOC_LED_RED) | PIN_OTYPE_PUSHPULL(GPIOC_LED_BLUE) | PIN_OTYPE_PUSHPULL(GPIOC_LED_ORANGE) | PIN_OTYPE_PUSHPULL(GPIOC_LED_GREEN) | PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT))
303#define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_MEMS_CS) | PIN_OSPEED_VERYLOW(GPIOC_PIN1) | PIN_OSPEED_VERYLOW(GPIOC_PIN2) | PIN_OSPEED_VERYLOW(GPIOC_PIN3) | PIN_OSPEED_VERYLOW(GPIOC_PIN4) | PIN_OSPEED_VERYLOW(GPIOC_PIN5) | PIN_OSPEED_HIGH(GPIOC_LED_RED) | PIN_OSPEED_HIGH(GPIOC_LED_BLUE) | PIN_OSPEED_HIGH(GPIOC_LED_ORANGE) | PIN_OSPEED_HIGH(GPIOC_LED_GREEN) | PIN_OSPEED_VERYLOW(GPIOC_PIN10) | PIN_OSPEED_VERYLOW(GPIOC_PIN11) | PIN_OSPEED_VERYLOW(GPIOC_PIN12) | PIN_OSPEED_VERYLOW(GPIOC_PIN13) | PIN_OSPEED_HIGH(GPIOC_OSC32_IN) | PIN_OSPEED_HIGH(GPIOC_OSC32_OUT))
304#define VAL_GPIOC_PUPDR (PIN_PUPDR_FLOATING(GPIOC_MEMS_CS) | PIN_PUPDR_PULLUP(GPIOC_PIN1) | PIN_PUPDR_PULLUP(GPIOC_PIN2) | PIN_PUPDR_PULLUP(GPIOC_PIN3) | PIN_PUPDR_PULLUP(GPIOC_PIN4) | PIN_PUPDR_PULLUP(GPIOC_PIN5) | PIN_PUPDR_FLOATING(GPIOC_LED_RED) | PIN_PUPDR_FLOATING(GPIOC_LED_BLUE) | PIN_PUPDR_FLOATING(GPIOC_LED_ORANGE) | PIN_PUPDR_FLOATING(GPIOC_LED_GREEN) | PIN_PUPDR_PULLUP(GPIOC_PIN10) | PIN_PUPDR_PULLUP(GPIOC_PIN11) | PIN_PUPDR_PULLUP(GPIOC_PIN12) | PIN_PUPDR_PULLUP(GPIOC_PIN13) | PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT))
305#define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_MEMS_CS) | PIN_ODR_HIGH(GPIOC_PIN1) | PIN_ODR_HIGH(GPIOC_PIN2) | PIN_ODR_HIGH(GPIOC_PIN3) | PIN_ODR_HIGH(GPIOC_PIN4) | PIN_ODR_HIGH(GPIOC_PIN5) | PIN_ODR_LOW(GPIOC_LED_RED) | PIN_ODR_LOW(GPIOC_LED_BLUE) | PIN_ODR_LOW(GPIOC_LED_ORANGE) | PIN_ODR_LOW(GPIOC_LED_GREEN) | PIN_ODR_HIGH(GPIOC_PIN10) | PIN_ODR_HIGH(GPIOC_PIN11) | PIN_ODR_HIGH(GPIOC_PIN12) | PIN_ODR_HIGH(GPIOC_PIN13) | PIN_ODR_HIGH(GPIOC_OSC32_IN) | PIN_ODR_HIGH(GPIOC_OSC32_OUT))
306#define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_MEMS_CS, 0U) | PIN_AFIO_AF(GPIOC_PIN1, 0U) | PIN_AFIO_AF(GPIOC_PIN2, 0U) | PIN_AFIO_AF(GPIOC_PIN3, 0U) | PIN_AFIO_AF(GPIOC_PIN4, 0U) | PIN_AFIO_AF(GPIOC_PIN5, 0U) | PIN_AFIO_AF(GPIOC_LED_RED, 0U) | PIN_AFIO_AF(GPIOC_LED_BLUE, 0U))
307#define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_LED_ORANGE, 0U) | PIN_AFIO_AF(GPIOC_LED_GREEN, 0U) | PIN_AFIO_AF(GPIOC_PIN10, 0U) | PIN_AFIO_AF(GPIOC_PIN11, 0U) | PIN_AFIO_AF(GPIOC_PIN12, 0U) | PIN_AFIO_AF(GPIOC_PIN13, 0U) | PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) | PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U))
308
309/*
310 * GPIOD setup:
311 *
312 * PD0 - PIN0 (input pullup).
313 * PD1 - PIN1 (input pullup).
314 * PD2 - PIN2 (input pullup).
315 * PD3 - PIN3 (input pullup).
316 * PD4 - PIN4 (input pullup).
317 * PD5 - PIN5 (input pullup).
318 * PD6 - PIN6 (input pullup).
319 * PD7 - PIN7 (input pullup).
320 * PD8 - PIN8 (input pullup).
321 * PD9 - PIN9 (input pullup).
322 * PD10 - PIN10 (input pullup).
323 * PD11 - PIN11 (input pullup).
324 * PD12 - PIN12 (input pullup).
325 * PD13 - PIN13 (input pullup).
326 * PD14 - PIN14 (input pullup).
327 * PD15 - PIN15 (input pullup).
328 */
329#define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | PIN_MODE_INPUT(GPIOD_PIN1) | PIN_MODE_INPUT(GPIOD_PIN2) | PIN_MODE_INPUT(GPIOD_PIN3) | PIN_MODE_INPUT(GPIOD_PIN4) | PIN_MODE_INPUT(GPIOD_PIN5) | PIN_MODE_INPUT(GPIOD_PIN6) | PIN_MODE_INPUT(GPIOD_PIN7) | PIN_MODE_INPUT(GPIOD_PIN8) | PIN_MODE_INPUT(GPIOD_PIN9) | PIN_MODE_INPUT(GPIOD_PIN10) | PIN_MODE_INPUT(GPIOD_PIN11) | PIN_MODE_INPUT(GPIOD_PIN12) | PIN_MODE_INPUT(GPIOD_PIN13) | PIN_MODE_INPUT(GPIOD_PIN14) | PIN_MODE_INPUT(GPIOD_PIN15))
330#define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
331#define VAL_GPIOD_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOD_PIN0) | PIN_OSPEED_VERYLOW(GPIOD_PIN1) | PIN_OSPEED_VERYLOW(GPIOD_PIN2) | PIN_OSPEED_VERYLOW(GPIOD_PIN3) | PIN_OSPEED_VERYLOW(GPIOD_PIN4) | PIN_OSPEED_VERYLOW(GPIOD_PIN5) | PIN_OSPEED_VERYLOW(GPIOD_PIN6) | PIN_OSPEED_VERYLOW(GPIOD_PIN7) | PIN_OSPEED_VERYLOW(GPIOD_PIN8) | PIN_OSPEED_VERYLOW(GPIOD_PIN9) | PIN_OSPEED_VERYLOW(GPIOD_PIN10) | PIN_OSPEED_VERYLOW(GPIOD_PIN11) | PIN_OSPEED_VERYLOW(GPIOD_PIN12) | PIN_OSPEED_VERYLOW(GPIOD_PIN13) | PIN_OSPEED_VERYLOW(GPIOD_PIN14) | PIN_OSPEED_VERYLOW(GPIOD_PIN15))
332#define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | PIN_PUPDR_PULLUP(GPIOD_PIN1) | PIN_PUPDR_PULLUP(GPIOD_PIN2) | PIN_PUPDR_PULLUP(GPIOD_PIN3) | PIN_PUPDR_PULLUP(GPIOD_PIN4) | PIN_PUPDR_PULLUP(GPIOD_PIN5) | PIN_PUPDR_PULLUP(GPIOD_PIN6) | PIN_PUPDR_PULLUP(GPIOD_PIN7) | PIN_PUPDR_PULLUP(GPIOD_PIN8) | PIN_PUPDR_PULLUP(GPIOD_PIN9) | PIN_PUPDR_PULLUP(GPIOD_PIN10) | PIN_PUPDR_PULLUP(GPIOD_PIN11) | PIN_PUPDR_PULLUP(GPIOD_PIN12) | PIN_PUPDR_PULLUP(GPIOD_PIN13) | PIN_PUPDR_PULLUP(GPIOD_PIN14) | PIN_PUPDR_PULLUP(GPIOD_PIN15))
333#define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | PIN_ODR_HIGH(GPIOD_PIN1) | PIN_ODR_HIGH(GPIOD_PIN2) | PIN_ODR_HIGH(GPIOD_PIN3) | PIN_ODR_HIGH(GPIOD_PIN4) | PIN_ODR_HIGH(GPIOD_PIN5) | PIN_ODR_HIGH(GPIOD_PIN6) | PIN_ODR_HIGH(GPIOD_PIN7) | PIN_ODR_HIGH(GPIOD_PIN8) | PIN_ODR_HIGH(GPIOD_PIN9) | PIN_ODR_HIGH(GPIOD_PIN10) | PIN_ODR_HIGH(GPIOD_PIN11) | PIN_ODR_HIGH(GPIOD_PIN12) | PIN_ODR_HIGH(GPIOD_PIN13) | PIN_ODR_HIGH(GPIOD_PIN14) | PIN_ODR_HIGH(GPIOD_PIN15))
334#define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0U) | PIN_AFIO_AF(GPIOD_PIN1, 0U) | PIN_AFIO_AF(GPIOD_PIN2, 0U) | PIN_AFIO_AF(GPIOD_PIN3, 0U) | PIN_AFIO_AF(GPIOD_PIN4, 0U) | PIN_AFIO_AF(GPIOD_PIN5, 0U) | PIN_AFIO_AF(GPIOD_PIN6, 0U) | PIN_AFIO_AF(GPIOD_PIN7, 0U))
335#define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0U) | PIN_AFIO_AF(GPIOD_PIN9, 0U) | PIN_AFIO_AF(GPIOD_PIN10, 0U) | PIN_AFIO_AF(GPIOD_PIN11, 0U) | PIN_AFIO_AF(GPIOD_PIN12, 0U) | PIN_AFIO_AF(GPIOD_PIN13, 0U) | PIN_AFIO_AF(GPIOD_PIN14, 0U) | PIN_AFIO_AF(GPIOD_PIN15, 0U))
336
337/*
338 * GPIOE setup:
339 *
340 * PE0 - PIN0 (input pullup).
341 * PE1 - PIN1 (input pullup).
342 * PE2 - PIN2 (input pullup).
343 * PE3 - PIN3 (input pullup).
344 * PE4 - PIN4 (input pullup).
345 * PE5 - PIN5 (input pullup).
346 * PE6 - PIN6 (input pullup).
347 * PE7 - PIN7 (input pullup).
348 * PE8 - PIN8 (input pullup).
349 * PE9 - PIN9 (input pullup).
350 * PE10 - PIN10 (input pullup).
351 * PE11 - PIN11 (input pullup).
352 * PE12 - PIN12 (input pullup).
353 * PE13 - PIN13 (input pullup).
354 * PE14 - PIN14 (input pullup).
355 * PE15 - PIN15 (input pullup).
356 */
357#define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_PIN0) | PIN_MODE_INPUT(GPIOE_PIN1) | PIN_MODE_INPUT(GPIOE_PIN2) | PIN_MODE_INPUT(GPIOE_PIN3) | PIN_MODE_INPUT(GPIOE_PIN4) | PIN_MODE_INPUT(GPIOE_PIN5) | PIN_MODE_INPUT(GPIOE_PIN6) | PIN_MODE_INPUT(GPIOE_PIN7) | PIN_MODE_INPUT(GPIOE_PIN8) | PIN_MODE_INPUT(GPIOE_PIN9) | PIN_MODE_INPUT(GPIOE_PIN10) | PIN_MODE_INPUT(GPIOE_PIN11) | PIN_MODE_INPUT(GPIOE_PIN12) | PIN_MODE_INPUT(GPIOE_PIN13) | PIN_MODE_INPUT(GPIOE_PIN14) | PIN_MODE_INPUT(GPIOE_PIN15))
358#define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) | PIN_OTYPE_PUSHPULL(GPIOE_PIN1) | PIN_OTYPE_PUSHPULL(GPIOE_PIN2) | PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | PIN_OTYPE_PUSHPULL(GPIOE_PIN4) | PIN_OTYPE_PUSHPULL(GPIOE_PIN5) | PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | PIN_OTYPE_PUSHPULL(GPIOE_PIN10) | PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | PIN_OTYPE_PUSHPULL(GPIOE_PIN14) | PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
359#define VAL_GPIOE_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOE_PIN0) | PIN_OSPEED_VERYLOW(GPIOE_PIN1) | PIN_OSPEED_VERYLOW(GPIOE_PIN2) | PIN_OSPEED_VERYLOW(GPIOE_PIN3) | PIN_OSPEED_VERYLOW(GPIOE_PIN4) | PIN_OSPEED_VERYLOW(GPIOE_PIN5) | PIN_OSPEED_VERYLOW(GPIOE_PIN6) | PIN_OSPEED_VERYLOW(GPIOE_PIN7) | PIN_OSPEED_VERYLOW(GPIOE_PIN8) | PIN_OSPEED_VERYLOW(GPIOE_PIN9) | PIN_OSPEED_VERYLOW(GPIOE_PIN10) | PIN_OSPEED_VERYLOW(GPIOE_PIN11) | PIN_OSPEED_VERYLOW(GPIOE_PIN12) | PIN_OSPEED_VERYLOW(GPIOE_PIN13) | PIN_OSPEED_VERYLOW(GPIOE_PIN14) | PIN_OSPEED_VERYLOW(GPIOE_PIN15))
360#define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(GPIOE_PIN0) | PIN_PUPDR_PULLUP(GPIOE_PIN1) | PIN_PUPDR_PULLUP(GPIOE_PIN2) | PIN_PUPDR_PULLUP(GPIOE_PIN3) | PIN_PUPDR_PULLUP(GPIOE_PIN4) | PIN_PUPDR_PULLUP(GPIOE_PIN5) | PIN_PUPDR_PULLUP(GPIOE_PIN6) | PIN_PUPDR_PULLUP(GPIOE_PIN7) | PIN_PUPDR_PULLUP(GPIOE_PIN8) | PIN_PUPDR_PULLUP(GPIOE_PIN9) | PIN_PUPDR_PULLUP(GPIOE_PIN10) | PIN_PUPDR_PULLUP(GPIOE_PIN11) | PIN_PUPDR_PULLUP(GPIOE_PIN12) | PIN_PUPDR_PULLUP(GPIOE_PIN13) | PIN_PUPDR_PULLUP(GPIOE_PIN14) | PIN_PUPDR_PULLUP(GPIOE_PIN15))
361#define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_PIN0) | PIN_ODR_HIGH(GPIOE_PIN1) | PIN_ODR_HIGH(GPIOE_PIN2) | PIN_ODR_HIGH(GPIOE_PIN3) | PIN_ODR_HIGH(GPIOE_PIN4) | PIN_ODR_HIGH(GPIOE_PIN5) | PIN_ODR_HIGH(GPIOE_PIN6) | PIN_ODR_HIGH(GPIOE_PIN7) | PIN_ODR_HIGH(GPIOE_PIN8) | PIN_ODR_HIGH(GPIOE_PIN9) | PIN_ODR_HIGH(GPIOE_PIN10) | PIN_ODR_HIGH(GPIOE_PIN11) | PIN_ODR_HIGH(GPIOE_PIN12) | PIN_ODR_HIGH(GPIOE_PIN13) | PIN_ODR_HIGH(GPIOE_PIN14) | PIN_ODR_HIGH(GPIOE_PIN15))
362#define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_PIN0, 0U) | PIN_AFIO_AF(GPIOE_PIN1, 0U) | PIN_AFIO_AF(GPIOE_PIN2, 0U) | PIN_AFIO_AF(GPIOE_PIN3, 0U) | PIN_AFIO_AF(GPIOE_PIN4, 0U) | PIN_AFIO_AF(GPIOE_PIN5, 0U) | PIN_AFIO_AF(GPIOE_PIN6, 0U) | PIN_AFIO_AF(GPIOE_PIN7, 0U))
363#define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0U) | PIN_AFIO_AF(GPIOE_PIN9, 0U) | PIN_AFIO_AF(GPIOE_PIN10, 0U) | PIN_AFIO_AF(GPIOE_PIN11, 0U) | PIN_AFIO_AF(GPIOE_PIN12, 0U) | PIN_AFIO_AF(GPIOE_PIN13, 0U) | PIN_AFIO_AF(GPIOE_PIN14, 0U) | PIN_AFIO_AF(GPIOE_PIN15, 0U))
364
365/*
366 * GPIOF setup:
367 *
368 * PF0 - OSC_IN (input floating).
369 * PF1 - OSC_OUT (input floating).
370 * PF2 - PIN2 (input pullup).
371 * PF3 - PIN3 (input pullup).
372 * PF4 - PIN4 (input pullup).
373 * PF5 - PIN5 (input pullup).
374 * PF6 - PIN6 (input pullup).
375 * PF7 - PIN7 (input pullup).
376 * PF8 - PIN8 (input pullup).
377 * PF9 - PIN9 (input pullup).
378 * PF10 - PIN10 (input pullup).
379 * PF11 - PIN11 (input pullup).
380 * PF12 - PIN12 (input pullup).
381 * PF13 - PIN13 (input pullup).
382 * PF14 - PIN14 (input pullup).
383 * PF15 - PIN15 (input pullup).
384 */
385#define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_OSC_IN) | PIN_MODE_INPUT(GPIOF_OSC_OUT) | PIN_MODE_INPUT(GPIOF_PIN2) | PIN_MODE_INPUT(GPIOF_PIN3) | PIN_MODE_INPUT(GPIOF_PIN4) | PIN_MODE_INPUT(GPIOF_PIN5) | PIN_MODE_INPUT(GPIOF_PIN6) | PIN_MODE_INPUT(GPIOF_PIN7) | PIN_MODE_INPUT(GPIOF_PIN8) | PIN_MODE_INPUT(GPIOF_PIN9) | PIN_MODE_INPUT(GPIOF_PIN10) | PIN_MODE_INPUT(GPIOF_PIN11) | PIN_MODE_INPUT(GPIOF_PIN12) | PIN_MODE_INPUT(GPIOF_PIN13) | PIN_MODE_INPUT(GPIOF_PIN14) | PIN_MODE_INPUT(GPIOF_PIN15))
386#define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_OSC_IN) | PIN_OTYPE_PUSHPULL(GPIOF_OSC_OUT) | PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
387#define VAL_GPIOF_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOF_OSC_IN) | PIN_OSPEED_VERYLOW(GPIOF_OSC_OUT) | PIN_OSPEED_VERYLOW(GPIOF_PIN2) | PIN_OSPEED_VERYLOW(GPIOF_PIN3) | PIN_OSPEED_VERYLOW(GPIOF_PIN4) | PIN_OSPEED_VERYLOW(GPIOF_PIN5) | PIN_OSPEED_VERYLOW(GPIOF_PIN6) | PIN_OSPEED_VERYLOW(GPIOF_PIN7) | PIN_OSPEED_VERYLOW(GPIOF_PIN8) | PIN_OSPEED_VERYLOW(GPIOF_PIN9) | PIN_OSPEED_VERYLOW(GPIOF_PIN10) | PIN_OSPEED_VERYLOW(GPIOF_PIN11) | PIN_OSPEED_VERYLOW(GPIOF_PIN12) | PIN_OSPEED_VERYLOW(GPIOF_PIN13) | PIN_OSPEED_VERYLOW(GPIOF_PIN14) | PIN_OSPEED_VERYLOW(GPIOF_PIN15))
388#define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(GPIOF_OSC_IN) | PIN_PUPDR_FLOATING(GPIOF_OSC_OUT) | PIN_PUPDR_PULLUP(GPIOF_PIN2) | PIN_PUPDR_PULLUP(GPIOF_PIN3) | PIN_PUPDR_PULLUP(GPIOF_PIN4) | PIN_PUPDR_PULLUP(GPIOF_PIN5) | PIN_PUPDR_PULLUP(GPIOF_PIN6) | PIN_PUPDR_PULLUP(GPIOF_PIN7) | PIN_PUPDR_PULLUP(GPIOF_PIN8) | PIN_PUPDR_PULLUP(GPIOF_PIN9) | PIN_PUPDR_PULLUP(GPIOF_PIN10) | PIN_PUPDR_PULLUP(GPIOF_PIN11) | PIN_PUPDR_PULLUP(GPIOF_PIN12) | PIN_PUPDR_PULLUP(GPIOF_PIN13) | PIN_PUPDR_PULLUP(GPIOF_PIN14) | PIN_PUPDR_PULLUP(GPIOF_PIN15))
389#define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_OSC_IN) | PIN_ODR_HIGH(GPIOF_OSC_OUT) | PIN_ODR_HIGH(GPIOF_PIN2) | PIN_ODR_HIGH(GPIOF_PIN3) | PIN_ODR_HIGH(GPIOF_PIN4) | PIN_ODR_HIGH(GPIOF_PIN5) | PIN_ODR_HIGH(GPIOF_PIN6) | PIN_ODR_HIGH(GPIOF_PIN7) | PIN_ODR_HIGH(GPIOF_PIN8) | PIN_ODR_HIGH(GPIOF_PIN9) | PIN_ODR_HIGH(GPIOF_PIN10) | PIN_ODR_HIGH(GPIOF_PIN11) | PIN_ODR_HIGH(GPIOF_PIN12) | PIN_ODR_HIGH(GPIOF_PIN13) | PIN_ODR_HIGH(GPIOF_PIN14) | PIN_ODR_HIGH(GPIOF_PIN15))
390#define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_OSC_IN, 0U) | PIN_AFIO_AF(GPIOF_OSC_OUT, 0U) | PIN_AFIO_AF(GPIOF_PIN2, 0U) | PIN_AFIO_AF(GPIOF_PIN3, 0U) | PIN_AFIO_AF(GPIOF_PIN4, 0U) | PIN_AFIO_AF(GPIOF_PIN5, 0U) | PIN_AFIO_AF(GPIOF_PIN6, 0U) | PIN_AFIO_AF(GPIOF_PIN7, 0U))
391#define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0U) | PIN_AFIO_AF(GPIOF_PIN9, 0U) | PIN_AFIO_AF(GPIOF_PIN10, 0U) | PIN_AFIO_AF(GPIOF_PIN11, 0U) | PIN_AFIO_AF(GPIOF_PIN12, 0U) | PIN_AFIO_AF(GPIOF_PIN13, 0U) | PIN_AFIO_AF(GPIOF_PIN14, 0U) | PIN_AFIO_AF(GPIOF_PIN15, 0U))
392
393/*===========================================================================*/
394/* External declarations. */
395/*===========================================================================*/
396
397#if !defined(_FROM_ASM_)
398# ifdef __cplusplus
399extern "C" {
400# endif
401void boardInit(void);
402# ifdef __cplusplus
403}
404# endif
405#endif /* _FROM_ASM_ */
406
407#endif /* BOARD_H */
diff --git a/platforms/chibios/GENERIC_STM32_F072XB/board/board.mk b/platforms/chibios/GENERIC_STM32_F072XB/board/board.mk
new file mode 100644
index 000000000..842e33590
--- /dev/null
+++ b/platforms/chibios/GENERIC_STM32_F072XB/board/board.mk
@@ -0,0 +1,9 @@
1# List of all the board related files.
2BOARDSRC = $(BOARD_PATH)/board/board.c
3
4# Required include directories
5BOARDINC = $(BOARD_PATH)/board
6
7# Shared variables
8ALLCSRC += $(BOARDSRC)
9ALLINC += $(BOARDINC)
diff --git a/platforms/chibios/GENERIC_STM32_F072XB/configs/bootloader_defs.h b/platforms/chibios/GENERIC_STM32_F072XB/configs/bootloader_defs.h
new file mode 100644
index 000000000..02c48c4e6
--- /dev/null
+++ b/platforms/chibios/GENERIC_STM32_F072XB/configs/bootloader_defs.h
@@ -0,0 +1,7 @@
1/* Address for jumping to bootloader on STM32 chips. */
2/* It is chip dependent, the correct number can be looked up here (page 175):
3 * http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
4 * This also requires a patch to chibios:
5 * <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch
6 */
7#define STM32_BOOTLOADER_ADDRESS 0x1FFFC800
diff --git a/platforms/chibios/GENERIC_STM32_F303XC/board/board.c b/platforms/chibios/GENERIC_STM32_F303XC/board/board.c
new file mode 100644
index 000000000..4722acd64
--- /dev/null
+++ b/platforms/chibios/GENERIC_STM32_F303XC/board/board.c
@@ -0,0 +1,242 @@
1/*
2 ChibiOS - Copyright (C) 2006..2016 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 * This file has been automatically generated using ChibiStudio board
19 * generator plugin. Do not edit manually.
20 */
21
22#include "hal.h"
23#include "stm32_gpio.h"
24
25/*===========================================================================*/
26/* Driver local definitions. */
27/*===========================================================================*/
28
29/*===========================================================================*/
30/* Driver exported variables. */
31/*===========================================================================*/
32
33/*===========================================================================*/
34/* Driver local variables and types. */
35/*===========================================================================*/
36
37/**
38 * @brief Type of STM32 GPIO port setup.
39 */
40typedef struct {
41 uint32_t moder;
42 uint32_t otyper;
43 uint32_t ospeedr;
44 uint32_t pupdr;
45 uint32_t odr;
46 uint32_t afrl;
47 uint32_t afrh;
48} gpio_setup_t;
49
50/**
51 * @brief Type of STM32 GPIO initialization data.
52 */
53typedef struct {
54#if STM32_HAS_GPIOA || defined(__DOXYGEN__)
55 gpio_setup_t PAData;
56#endif
57#if STM32_HAS_GPIOB || defined(__DOXYGEN__)
58 gpio_setup_t PBData;
59#endif
60#if STM32_HAS_GPIOC || defined(__DOXYGEN__)
61 gpio_setup_t PCData;
62#endif
63#if STM32_HAS_GPIOD || defined(__DOXYGEN__)
64 gpio_setup_t PDData;
65#endif
66#if STM32_HAS_GPIOE || defined(__DOXYGEN__)
67 gpio_setup_t PEData;
68#endif
69#if STM32_HAS_GPIOF || defined(__DOXYGEN__)
70 gpio_setup_t PFData;
71#endif
72#if STM32_HAS_GPIOG || defined(__DOXYGEN__)
73 gpio_setup_t PGData;
74#endif
75#if STM32_HAS_GPIOH || defined(__DOXYGEN__)
76 gpio_setup_t PHData;
77#endif
78#if STM32_HAS_GPIOI || defined(__DOXYGEN__)
79 gpio_setup_t PIData;
80#endif
81#if STM32_HAS_GPIOJ || defined(__DOXYGEN__)
82 gpio_setup_t PJData;
83#endif
84#if STM32_HAS_GPIOK || defined(__DOXYGEN__)
85 gpio_setup_t PKData;
86#endif
87} gpio_config_t;
88
89/**
90 * @brief STM32 GPIO static initialization data.
91 */
92static const gpio_config_t gpio_default_config = {
93#if STM32_HAS_GPIOA
94 {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
95#endif
96#if STM32_HAS_GPIOB
97 {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH},
98#endif
99#if STM32_HAS_GPIOC
100 {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH},
101#endif
102#if STM32_HAS_GPIOD
103 {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH},
104#endif
105#if STM32_HAS_GPIOE
106 {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH},
107#endif
108#if STM32_HAS_GPIOF
109 {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH},
110#endif
111#if STM32_HAS_GPIOG
112 {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH},
113#endif
114#if STM32_HAS_GPIOH
115 {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH},
116#endif
117#if STM32_HAS_GPIOI
118 {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
119#endif
120#if STM32_HAS_GPIOJ
121 {VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR, VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
122#endif
123#if STM32_HAS_GPIOK
124 {VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR, VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
125#endif
126};
127
128/*===========================================================================*/
129/* Driver local functions. */
130/*===========================================================================*/
131
132static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) {
133 gpiop->OTYPER = config->otyper;
134 gpiop->OSPEEDR = config->ospeedr;
135 gpiop->PUPDR = config->pupdr;
136 gpiop->ODR = config->odr;
137 gpiop->AFRL = config->afrl;
138 gpiop->AFRH = config->afrh;
139 gpiop->MODER = config->moder;
140}
141
142static void stm32_gpio_init(void) {
143 /* Enabling GPIO-related clocks, the mask comes from the
144 registry header file.*/
145 rccResetAHB(STM32_GPIO_EN_MASK);
146 rccEnableAHB(STM32_GPIO_EN_MASK, true);
147
148 /* Initializing all the defined GPIO ports.*/
149#if STM32_HAS_GPIOA
150 gpio_init(GPIOA, &gpio_default_config.PAData);
151#endif
152#if STM32_HAS_GPIOB
153 gpio_init(GPIOB, &gpio_default_config.PBData);
154#endif
155#if STM32_HAS_GPIOC
156 gpio_init(GPIOC, &gpio_default_config.PCData);
157#endif
158#if STM32_HAS_GPIOD
159 gpio_init(GPIOD, &gpio_default_config.PDData);
160#endif
161#if STM32_HAS_GPIOE
162 gpio_init(GPIOE, &gpio_default_config.PEData);
163#endif
164#if STM32_HAS_GPIOF
165 gpio_init(GPIOF, &gpio_default_config.PFData);
166#endif
167#if STM32_HAS_GPIOG
168 gpio_init(GPIOG, &gpio_default_config.PGData);
169#endif
170#if STM32_HAS_GPIOH
171 gpio_init(GPIOH, &gpio_default_config.PHData);
172#endif
173#if STM32_HAS_GPIOI
174 gpio_init(GPIOI, &gpio_default_config.PIData);
175#endif
176#if STM32_HAS_GPIOJ
177 gpio_init(GPIOJ, &gpio_default_config.PJData);
178#endif
179#if STM32_HAS_GPIOK
180 gpio_init(GPIOK, &gpio_default_config.PKData);
181#endif
182}
183
184__attribute__((weak)) void enter_bootloader_mode_if_requested(void) {}
185
186/**
187 * @brief Early initialization code.
188 * @details This initialization must be performed just after stack setup
189 * and before any other initialization.
190 */
191void __early_init(void) {
192 enter_bootloader_mode_if_requested();
193
194 stm32_gpio_init();
195 stm32_clock_init();
196}
197
198#if HAL_USE_SDC || defined(__DOXYGEN__)
199/**
200 * @brief SDC card detection.
201 */
202bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
203 (void)sdcp;
204 /* TODO: Fill the implementation.*/
205 return true;
206}
207
208/**
209 * @brief SDC card write protection detection.
210 */
211bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
212 (void)sdcp;
213 /* TODO: Fill the implementation.*/
214 return false;
215}
216#endif /* HAL_USE_SDC */
217
218#if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
219/**
220 * @brief MMC_SPI card detection.
221 */
222bool mmc_lld_is_card_inserted(MMCDriver *mmcp) {
223 (void)mmcp;
224 /* TODO: Fill the implementation.*/
225 return true;
226}
227
228/**
229 * @brief MMC_SPI card write protection detection.
230 */
231bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
232 (void)mmcp;
233 /* TODO: Fill the implementation.*/
234 return false;
235}
236#endif
237
238/**
239 * @brief Board-specific initialization code.
240 * @todo Add your board-specific code, if any.
241 */
242void boardInit(void) {}
diff --git a/platforms/chibios/GENERIC_STM32_F303XC/board/board.h b/platforms/chibios/GENERIC_STM32_F303XC/board/board.h
new file mode 100644
index 000000000..3579c8277
--- /dev/null
+++ b/platforms/chibios/GENERIC_STM32_F303XC/board/board.h
@@ -0,0 +1,475 @@
1/*
2 ChibiOS - Copyright (C) 2006..2016 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 _BOARD_H_
18#define _BOARD_H_
19
20/*
21 * Setup for Generic STM32_F303 Board
22 */
23
24/*
25 * Board identifier.
26 */
27#define BOARD_GENERIC_STM32_F303XC
28#define BOARD_NAME "STM32_F303"
29
30/*
31 * Board oscillators-related settings.
32 * NOTE: LSE not fitted.
33 */
34#if !defined(STM32_LSECLK)
35# define STM32_LSECLK 0U
36#endif
37
38#define STM32_LSEDRV (3U << 3U)
39
40#if !defined(STM32_HSECLK)
41# define STM32_HSECLK 8000000U
42#endif
43
44// #define STM32_HSE_BYPASS
45
46/*
47 * MCU type as defined in the ST header.
48 */
49#define STM32F303xC
50
51/*
52 * IO pins assignments.
53 */
54#define GPIOA_PIN0 0U
55#define GPIOA_PIN1 1U
56#define GPIOA_PIN2 2U
57#define GPIOA_PIN3 3U
58#define GPIOA_PIN4 4U
59#define GPIOA_PIN5 5U
60#define GPIOA_PIN6 6U
61#define GPIOA_PIN7 7U
62#define GPIOA_PIN8 8U
63#define GPIOA_PIN9 9U
64#define GPIOA_PIN10 10U
65#define GPIOA_USB_DM 11U
66#define GPIOA_USB_DP 12U
67#define GPIOA_SWDIO 13U
68#define GPIOA_SWCLK 14U
69#define GPIOA_PIN15 15U
70
71#define GPIOB_PIN0 0U
72#define GPIOB_PIN1 1U
73#define GPIOB_PIN2 2U
74#define GPIOB_PIN3 3U
75#define GPIOB_PIN4 4U
76#define GPIOB_PIN5 5U
77#define GPIOB_PIN6 6U
78#define GPIOB_PIN7 7U
79#define GPIOB_PIN8 8U
80#define GPIOB_PIN9 9U
81#define GPIOB_PIN10 10U
82#define GPIOB_PIN11 11U
83#define GPIOB_PIN12 12U
84#define GPIOB_PIN13 13U
85#define GPIOB_PIN14 14U
86#define GPIOB_PIN15 15U
87
88#define GPIOC_PIN0 0U
89#define GPIOC_PIN1 1U
90#define GPIOC_PIN2 2U
91#define GPIOC_PIN3 3U
92#define GPIOC_PIN4 4U
93#define GPIOC_PIN5 5U
94#define GPIOC_PIN6 6U
95#define GPIOC_PIN7 7U
96#define GPIOC_PIN8 8U
97#define GPIOC_PIN9 9U
98#define GPIOC_PIN10 10U
99#define GPIOC_PIN11 11U
100#define GPIOC_PIN12 12U
101#define GPIOC_PIN13 13U
102#define GPIOC_PIN14 14U
103#define GPIOC_PIN15 15U
104
105#define GPIOD_PIN0 0U
106#define GPIOD_PIN1 1U
107#define GPIOD_PIN2 2U
108#define GPIOD_PIN3 3U
109#define GPIOD_PIN4 4U
110#define GPIOD_PIN5 5U
111#define GPIOD_PIN6 6U
112#define GPIOD_PIN7 7U
113#define GPIOD_PIN8 8U
114#define GPIOD_PIN9 9U
115#define GPIOD_PIN10 10U
116#define GPIOD_PIN11 11U
117#define GPIOD_PIN12 12U
118#define GPIOD_PIN13 13U
119#define GPIOD_PIN14 14U
120#define GPIOD_PIN15 15U
121
122#define GPIOE_PIN0 0U
123#define GPIOE_PIN1 1U
124#define GPIOE_PIN2 2U
125#define GPIOE_PIN3 3U
126#define GPIOE_PIN4 4U
127#define GPIOE_PIN5 5U
128#define GPIOE_PIN6 6U
129#define GPIOE_PIN7 7U
130#define GPIOE_PIN8 8U
131#define GPIOE_PIN9 9U
132#define GPIOE_PIN10 10U
133#define GPIOE_PIN11 11U
134#define GPIOE_PIN12 12U
135#define GPIOE_PIN13 13U
136#define GPIOE_PIN14 14U
137#define GPIOE_PIN15 15U
138
139#define GPIOF_I2C2_SDA 0U
140#define GPIOF_I2C2_SCL 1U
141#define GPIOF_PIN2 2U
142#define GPIOF_PIN3 3U
143#define GPIOF_PIN4 4U
144#define GPIOF_PIN5 5U
145#define GPIOF_PIN6 6U
146#define GPIOF_PIN7 7U
147#define GPIOF_PIN8 8U
148#define GPIOF_PIN9 9U
149#define GPIOF_PIN10 10U
150#define GPIOF_PIN11 11U
151#define GPIOF_PIN12 12U
152#define GPIOF_PIN13 13U
153#define GPIOF_PIN14 14U
154#define GPIOF_PIN15 15U
155
156#define GPIOG_PIN0 0U
157#define GPIOG_PIN1 1U
158#define GPIOG_PIN2 2U
159#define GPIOG_PIN3 3U
160#define GPIOG_PIN4 4U
161#define GPIOG_PIN5 5U
162#define GPIOG_PIN6 6U
163#define GPIOG_PIN7 7U
164#define GPIOG_PIN8 8U
165#define GPIOG_PIN9 9U
166#define GPIOG_PIN10 10U
167#define GPIOG_PIN11 11U
168#define GPIOG_PIN12 12U
169#define GPIOG_PIN13 13U
170#define GPIOG_PIN14 14U
171#define GPIOG_PIN15 15U
172
173#define GPIOH_PIN0 0U
174#define GPIOH_PIN1 1U
175#define GPIOH_PIN2 2U
176#define GPIOH_PIN3 3U
177#define GPIOH_PIN4 4U
178#define GPIOH_PIN5 5U
179#define GPIOH_PIN6 6U
180#define GPIOH_PIN7 7U
181#define GPIOH_PIN8 8U
182#define GPIOH_PIN9 9U
183#define GPIOH_PIN10 10U
184#define GPIOH_PIN11 11U
185#define GPIOH_PIN12 12U
186#define GPIOH_PIN13 13U
187#define GPIOH_PIN14 14U
188#define GPIOH_PIN15 15U
189
190/*
191 * IO lines assignments.
192 */
193#define LINE_L3GD20_SDI PAL_LINE(GPIOA, 7U)
194#define LINE_USB_DM PAL_LINE(GPIOA, 11U)
195#define LINE_USB_DP PAL_LINE(GPIOA, 12U)
196#define LINE_SWDIO PAL_LINE(GPIOA, 13U)
197#define LINE_SWCLK PAL_LINE(GPIOA, 14U)
198
199#define LINE_PIN6 PAL_LINE(GPIOF, 0U)
200#define LINE_PIN7 PAL_LINE(GPIOF, 1U)
201
202#define LINE_CAPS_LOCK PAL_LINE(GPIOB, 7U)
203
204/*
205 * I/O ports initial setup, this configuration is established soon after reset
206 * in the initialization code.
207 * Please refer to the STM32 Reference Manual for details.
208 */
209#define PIN_MODE_INPUT(n) (0U << ((n)*2U))
210#define PIN_MODE_OUTPUT(n) (1U << ((n)*2U))
211#define PIN_MODE_ALTERNATE(n) (2U << ((n)*2U))
212#define PIN_MODE_ANALOG(n) (3U << ((n)*2U))
213#define PIN_ODR_LOW(n) (0U << (n))
214#define PIN_ODR_HIGH(n) (1U << (n))
215#define PIN_OTYPE_PUSHPULL(n) (0U << (n))
216#define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
217#define PIN_OSPEED_VERYLOW(n) (0U << ((n)*2U))
218#define PIN_OSPEED_LOW(n) (1U << ((n)*2U))
219#define PIN_OSPEED_MEDIUM(n) (2U << ((n)*2U))
220#define PIN_OSPEED_HIGH(n) (3U << ((n)*2U))
221#define PIN_PUPDR_FLOATING(n) (0U << ((n)*2U))
222#define PIN_PUPDR_PULLUP(n) (1U << ((n)*2U))
223#define PIN_PUPDR_PULLDOWN(n) (2U << ((n)*2U))
224#define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
225
226/*
227 * GPIOA setup:
228 *
229 * PA0 - NC
230 * PA1 - NC
231 * PA2 - COL1
232 * PA3 - COL2
233 * PA4 - SPEAKER1
234 * PA5 - SPEAKER2
235 * PA6 - COL3
236 * PA7 - COL8
237 * PA8 - COL6
238 * PA9 - COL7
239 * PA10 - ROW5
240 * PA11 - USB_DM (alternate 14).
241 * PA12 - USB_DP (alternate 14).
242 * PA13 - SWDIO (alternate 0).
243 * PA14 - SWCLK (alternate 0).
244 * PA15 - ROW4
245 */
246#define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_PIN0) | PIN_MODE_ALTERNATE(GPIOA_PIN1) | PIN_MODE_INPUT(GPIOA_PIN2) | PIN_MODE_INPUT(GPIOA_PIN3) | PIN_MODE_INPUT(GPIOA_PIN4) | PIN_MODE_INPUT(GPIOA_PIN5) | PIN_MODE_INPUT(GPIOA_PIN6) | PIN_MODE_INPUT(GPIOA_PIN7) | PIN_MODE_INPUT(GPIOA_PIN8) | PIN_MODE_INPUT(GPIOA_PIN9) | PIN_MODE_INPUT(GPIOA_PIN10) | PIN_MODE_ALTERNATE(GPIOA_USB_DM) | PIN_MODE_ALTERNATE(GPIOA_USB_DP) | PIN_MODE_ALTERNATE(GPIOA_SWDIO) | PIN_MODE_ALTERNATE(GPIOA_SWCLK) | PIN_MODE_INPUT(GPIOA_PIN15))
247#define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_PIN0) | PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | PIN_OTYPE_PUSHPULL(GPIOA_PIN2) | PIN_OTYPE_PUSHPULL(GPIOA_PIN3) | PIN_OTYPE_PUSHPULL(GPIOA_PIN4) | PIN_OTYPE_PUSHPULL(GPIOA_PIN5) | PIN_OTYPE_PUSHPULL(GPIOA_PIN6) | PIN_OTYPE_PUSHPULL(GPIOA_PIN7) | PIN_OTYPE_PUSHPULL(GPIOA_PIN8) | PIN_OTYPE_PUSHPULL(GPIOA_PIN9) | PIN_OTYPE_PUSHPULL(GPIOA_PIN10) | PIN_OTYPE_PUSHPULL(GPIOA_USB_DM) | PIN_OTYPE_PUSHPULL(GPIOA_USB_DP) | PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
248#define VAL_GPIOA_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOA_PIN0) | PIN_OSPEED_HIGH(GPIOA_PIN1) | PIN_OSPEED_VERYLOW(GPIOA_PIN2) | PIN_OSPEED_VERYLOW(GPIOA_PIN3) | PIN_OSPEED_VERYLOW(GPIOA_PIN4) | PIN_OSPEED_VERYLOW(GPIOA_PIN5) | PIN_OSPEED_VERYLOW(GPIOA_PIN6) | PIN_OSPEED_VERYLOW(GPIOA_PIN7) | PIN_OSPEED_VERYLOW(GPIOA_PIN8) | PIN_OSPEED_VERYLOW(GPIOA_PIN9) | PIN_OSPEED_VERYLOW(GPIOA_PIN10) | PIN_OSPEED_HIGH(GPIOA_USB_DM) | PIN_OSPEED_VERYLOW(GPIOA_USB_DP) | PIN_OSPEED_HIGH(GPIOA_SWDIO) | PIN_OSPEED_HIGH(GPIOA_SWCLK) | PIN_OSPEED_VERYLOW(GPIOA_PIN15))
249#define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_PIN0) | PIN_PUPDR_FLOATING(GPIOA_PIN1) | PIN_PUPDR_PULLUP(GPIOA_PIN2) | PIN_PUPDR_PULLUP(GPIOA_PIN3) | PIN_PUPDR_PULLUP(GPIOA_PIN4) | PIN_PUPDR_PULLUP(GPIOA_PIN5) | PIN_PUPDR_PULLUP(GPIOA_PIN6) | PIN_PUPDR_FLOATING(GPIOA_PIN7) | PIN_PUPDR_PULLUP(GPIOA_PIN8) | PIN_PUPDR_PULLUP(GPIOA_PIN9) | PIN_PUPDR_PULLUP(GPIOA_PIN10) | PIN_PUPDR_FLOATING(GPIOA_USB_DM) | PIN_PUPDR_FLOATING(GPIOA_USB_DP) | PIN_PUPDR_PULLUP(GPIOA_SWDIO) | PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | PIN_PUPDR_PULLUP(GPIOA_PIN15))
250#define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_PIN0) | PIN_ODR_HIGH(GPIOA_PIN1) | PIN_ODR_HIGH(GPIOA_PIN2) | PIN_ODR_HIGH(GPIOA_PIN3) | PIN_ODR_HIGH(GPIOA_PIN4) | PIN_ODR_HIGH(GPIOA_PIN5) | PIN_ODR_HIGH(GPIOA_PIN6) | PIN_ODR_HIGH(GPIOA_PIN7) | PIN_ODR_HIGH(GPIOA_PIN8) | PIN_ODR_HIGH(GPIOA_PIN9) | PIN_ODR_HIGH(GPIOA_PIN10) | PIN_ODR_HIGH(GPIOA_USB_DM) | PIN_ODR_HIGH(GPIOA_USB_DP) | PIN_ODR_HIGH(GPIOA_SWDIO) | PIN_ODR_HIGH(GPIOA_SWCLK) | PIN_ODR_HIGH(GPIOA_PIN15))
251#define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_PIN0, 0) | PIN_AFIO_AF(GPIOA_PIN1, 1) | PIN_AFIO_AF(GPIOA_PIN2, 0) | PIN_AFIO_AF(GPIOA_PIN3, 0) | PIN_AFIO_AF(GPIOA_PIN4, 0) | PIN_AFIO_AF(GPIOA_PIN5, 5) | PIN_AFIO_AF(GPIOA_PIN6, 5) | PIN_AFIO_AF(GPIOA_PIN7, 5))
252#define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_PIN8, 0) | PIN_AFIO_AF(GPIOA_PIN9, 0) | PIN_AFIO_AF(GPIOA_PIN10, 0) | PIN_AFIO_AF(GPIOA_USB_DM, 14) | PIN_AFIO_AF(GPIOA_USB_DP, 14) | PIN_AFIO_AF(GPIOA_SWDIO, 0) | PIN_AFIO_AF(GPIOA_SWCLK, 0) | PIN_AFIO_AF(GPIOA_PIN15, 0))
253
254/*
255 * GPIOB setup:
256 *
257 * PB0 - PIN0 (input pullup).
258 * PB1 - PIN1 (input pullup).
259 * PB2 - PIN2 (input pullup).
260 * PB3 - PIN3 (alternate 0).
261 * PB4 - PIN4 (input pullup).
262 * PB5 - PIN5 (input pullup).
263 * PB6 - PIN6 LSM303DLHC_SCL (alternate 4).
264 * PB7 - PIN7 LSM303DLHC_SDA (alternate 4).
265 * PB8 - PIN8 (input pullup).
266 * PB9 - PIN9 (input pullup).
267 * PB10 - PIN10 (input pullup).
268 * PB11 - PIN11 (input pullup).
269 * PB12 - PIN12 (input pullup).
270 * PB13 - PIN13 (input pullup).
271 * PB14 - PIN14 (input pullup).
272 * PB15 - PIN15 (input pullup).
273 */
274#define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | PIN_MODE_INPUT(GPIOB_PIN1) | PIN_MODE_INPUT(GPIOB_PIN2) | PIN_MODE_ALTERNATE(GPIOB_PIN3) | PIN_MODE_INPUT(GPIOB_PIN4) | PIN_MODE_INPUT(GPIOB_PIN5) | PIN_MODE_ALTERNATE(GPIOB_PIN6) | PIN_MODE_OUTPUT(GPIOB_PIN7) | PIN_MODE_INPUT(GPIOB_PIN8) | PIN_MODE_INPUT(GPIOB_PIN9) | PIN_MODE_INPUT(GPIOB_PIN10) | PIN_MODE_INPUT(GPIOB_PIN11) | PIN_MODE_INPUT(GPIOB_PIN12) | PIN_MODE_INPUT(GPIOB_PIN13) | PIN_MODE_INPUT(GPIOB_PIN14) | PIN_MODE_INPUT(GPIOB_PIN15))
275#define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | PIN_OTYPE_PUSHPULL(GPIOB_PIN3) | PIN_OTYPE_PUSHPULL(GPIOB_PIN4) | PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | PIN_OTYPE_OPENDRAIN(GPIOB_PIN6) | PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | PIN_OTYPE_PUSHPULL(GPIOB_PIN9) | PIN_OTYPE_PUSHPULL(GPIOB_PIN10) | PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
276#define VAL_GPIOB_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOB_PIN0) | PIN_OSPEED_VERYLOW(GPIOB_PIN1) | PIN_OSPEED_VERYLOW(GPIOB_PIN2) | PIN_OSPEED_HIGH(GPIOB_PIN3) | PIN_OSPEED_VERYLOW(GPIOB_PIN4) | PIN_OSPEED_VERYLOW(GPIOB_PIN5) | PIN_OSPEED_HIGH(GPIOB_PIN6) | PIN_OSPEED_VERYLOW(GPIOB_PIN7) | PIN_OSPEED_VERYLOW(GPIOB_PIN8) | PIN_OSPEED_VERYLOW(GPIOB_PIN9) | PIN_OSPEED_VERYLOW(GPIOB_PIN10) | PIN_OSPEED_VERYLOW(GPIOB_PIN11) | PIN_OSPEED_VERYLOW(GPIOB_PIN12) | PIN_OSPEED_VERYLOW(GPIOB_PIN13) | PIN_OSPEED_VERYLOW(GPIOB_PIN14) | PIN_OSPEED_VERYLOW(GPIOB_PIN15))
277#define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_PIN0) | PIN_PUPDR_PULLUP(GPIOB_PIN1) | PIN_PUPDR_PULLUP(GPIOB_PIN2) | PIN_PUPDR_FLOATING(GPIOB_PIN3) | PIN_PUPDR_PULLUP(GPIOB_PIN4) | PIN_PUPDR_PULLUP(GPIOB_PIN5) | PIN_PUPDR_FLOATING(GPIOB_PIN6) | PIN_PUPDR_PULLDOWN(GPIOB_PIN7) | PIN_PUPDR_PULLUP(GPIOB_PIN8) | PIN_PUPDR_PULLUP(GPIOB_PIN9) | PIN_PUPDR_PULLUP(GPIOB_PIN10) | PIN_PUPDR_PULLUP(GPIOB_PIN11) | PIN_PUPDR_PULLUP(GPIOB_PIN12) | PIN_PUPDR_PULLUP(GPIOB_PIN13) | PIN_PUPDR_PULLUP(GPIOB_PIN14) | PIN_PUPDR_PULLUP(GPIOB_PIN15))
278#define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_PIN0) | PIN_ODR_HIGH(GPIOB_PIN1) | PIN_ODR_HIGH(GPIOB_PIN2) | PIN_ODR_HIGH(GPIOB_PIN3) | PIN_ODR_HIGH(GPIOB_PIN4) | PIN_ODR_HIGH(GPIOB_PIN5) | PIN_ODR_HIGH(GPIOB_PIN6) | PIN_ODR_LOW(GPIOB_PIN7) | PIN_ODR_HIGH(GPIOB_PIN8) | PIN_ODR_HIGH(GPIOB_PIN9) | PIN_ODR_HIGH(GPIOB_PIN10) | PIN_ODR_HIGH(GPIOB_PIN11) | PIN_ODR_HIGH(GPIOB_PIN12) | PIN_ODR_HIGH(GPIOB_PIN13) | PIN_ODR_HIGH(GPIOB_PIN14) | PIN_ODR_HIGH(GPIOB_PIN15))
279#define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0) | PIN_AFIO_AF(GPIOB_PIN1, 0) | PIN_AFIO_AF(GPIOB_PIN2, 0) | PIN_AFIO_AF(GPIOB_PIN3, 0) | PIN_AFIO_AF(GPIOB_PIN4, 0) | PIN_AFIO_AF(GPIOB_PIN5, 0) | PIN_AFIO_AF(GPIOB_PIN6, 4) | PIN_AFIO_AF(GPIOB_PIN7, 0))
280#define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0) | PIN_AFIO_AF(GPIOB_PIN9, 0) | PIN_AFIO_AF(GPIOB_PIN10, 0) | PIN_AFIO_AF(GPIOB_PIN11, 0) | PIN_AFIO_AF(GPIOB_PIN12, 0) | PIN_AFIO_AF(GPIOB_PIN13, 0) | PIN_AFIO_AF(GPIOB_PIN14, 0) | PIN_AFIO_AF(GPIOB_PIN15, 0))
281
282/*
283 * GPIOC setup:
284 *
285 * PC0 - PIN0 (input pullup).
286 * PC1 - PIN1 (input pullup).
287 * PC2 - PIN2 (input pullup).
288 * PC3 - PIN3 (input pullup).
289 * PC4 - PIN4 (input pullup).
290 * PC5 - PIN5 (input pullup).
291 * PC6 - PIN6 (input pullup).
292 * PC7 - PIN7 (input pullup).
293 * PC8 - PIN8 (input pullup).
294 * PC9 - PIN9 (input pullup).
295 * PC10 - PIN10 (input pullup).
296 * PC11 - PIN11 (input pullup).
297 * PC12 - PIN12 (input pullup).
298 * PC13 - PIN13 (input pullup).
299 * PC14 - PIN14 (input floating).
300 * PC15 - PIN15 (input floating).
301 */
302#define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_PIN0) | PIN_MODE_INPUT(GPIOC_PIN1) | PIN_MODE_INPUT(GPIOC_PIN2) | PIN_MODE_INPUT(GPIOC_PIN3) | PIN_MODE_INPUT(GPIOC_PIN4) | PIN_MODE_INPUT(GPIOC_PIN5) | PIN_MODE_INPUT(GPIOC_PIN6) | PIN_MODE_INPUT(GPIOC_PIN7) | PIN_MODE_INPUT(GPIOC_PIN8) | PIN_MODE_INPUT(GPIOC_PIN9) | PIN_MODE_INPUT(GPIOC_PIN10) | PIN_MODE_INPUT(GPIOC_PIN11) | PIN_MODE_INPUT(GPIOC_PIN12) | PIN_MODE_INPUT(GPIOC_PIN13) | PIN_MODE_INPUT(GPIOC_PIN14) | PIN_MODE_INPUT(GPIOC_PIN15))
303#define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_PIN0) | PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | PIN_OTYPE_PUSHPULL(GPIOC_PIN7) | PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | PIN_OTYPE_PUSHPULL(GPIOC_PIN14) | PIN_OTYPE_PUSHPULL(GPIOC_PIN15))
304#define VAL_GPIOC_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOC_PIN0) | PIN_OSPEED_VERYLOW(GPIOC_PIN1) | PIN_OSPEED_VERYLOW(GPIOC_PIN2) | PIN_OSPEED_VERYLOW(GPIOC_PIN3) | PIN_OSPEED_VERYLOW(GPIOC_PIN4) | PIN_OSPEED_VERYLOW(GPIOC_PIN5) | PIN_OSPEED_VERYLOW(GPIOC_PIN6) | PIN_OSPEED_VERYLOW(GPIOC_PIN7) | PIN_OSPEED_VERYLOW(GPIOC_PIN8) | PIN_OSPEED_VERYLOW(GPIOC_PIN9) | PIN_OSPEED_VERYLOW(GPIOC_PIN10) | PIN_OSPEED_VERYLOW(GPIOC_PIN11) | PIN_OSPEED_VERYLOW(GPIOC_PIN12) | PIN_OSPEED_VERYLOW(GPIOC_PIN13) | PIN_OSPEED_HIGH(GPIOC_PIN14) | PIN_OSPEED_HIGH(GPIOC_PIN15))
305#define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_PIN0) | PIN_PUPDR_PULLUP(GPIOC_PIN1) | PIN_PUPDR_PULLUP(GPIOC_PIN2) | PIN_PUPDR_PULLUP(GPIOC_PIN3) | PIN_PUPDR_PULLUP(GPIOC_PIN4) | PIN_PUPDR_PULLUP(GPIOC_PIN5) | PIN_PUPDR_PULLUP(GPIOC_PIN6) | PIN_PUPDR_PULLUP(GPIOC_PIN7) | PIN_PUPDR_PULLUP(GPIOC_PIN8) | PIN_PUPDR_PULLUP(GPIOC_PIN9) | PIN_PUPDR_PULLUP(GPIOC_PIN10) | PIN_PUPDR_PULLUP(GPIOC_PIN11) | PIN_PUPDR_PULLUP(GPIOC_PIN12) | PIN_PUPDR_PULLUP(GPIOC_PIN13) | PIN_PUPDR_FLOATING(GPIOC_PIN14) | PIN_PUPDR_FLOATING(GPIOC_PIN15))
306#define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_PIN0) | PIN_ODR_HIGH(GPIOC_PIN1) | PIN_ODR_HIGH(GPIOC_PIN2) | PIN_ODR_HIGH(GPIOC_PIN3) | PIN_ODR_HIGH(GPIOC_PIN4) | PIN_ODR_HIGH(GPIOC_PIN5) | PIN_ODR_HIGH(GPIOC_PIN6) | PIN_ODR_HIGH(GPIOC_PIN7) | PIN_ODR_HIGH(GPIOC_PIN8) | PIN_ODR_HIGH(GPIOC_PIN9) | PIN_ODR_HIGH(GPIOC_PIN10) | PIN_ODR_HIGH(GPIOC_PIN11) | PIN_ODR_HIGH(GPIOC_PIN12) | PIN_ODR_HIGH(GPIOC_PIN13) | PIN_ODR_HIGH(GPIOC_PIN14) | PIN_ODR_HIGH(GPIOC_PIN15))
307#define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_PIN0, 0) | PIN_AFIO_AF(GPIOC_PIN1, 0) | PIN_AFIO_AF(GPIOC_PIN2, 0) | PIN_AFIO_AF(GPIOC_PIN3, 0) | PIN_AFIO_AF(GPIOC_PIN4, 0) | PIN_AFIO_AF(GPIOC_PIN5, 0) | PIN_AFIO_AF(GPIOC_PIN6, 0) | PIN_AFIO_AF(GPIOC_PIN7, 0))
308#define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0) | PIN_AFIO_AF(GPIOC_PIN9, 0) | PIN_AFIO_AF(GPIOC_PIN10, 0) | PIN_AFIO_AF(GPIOC_PIN11, 0) | PIN_AFIO_AF(GPIOC_PIN12, 0) | PIN_AFIO_AF(GPIOC_PIN13, 0) | PIN_AFIO_AF(GPIOC_PIN14, 0) | PIN_AFIO_AF(GPIOC_PIN15, 0))
309
310/*
311 * GPIOD setup:
312 *
313 * PD0 - PIN0 (input pullup).
314 * PD1 - PIN1 (input pullup).
315 * PD2 - PIN2 (input pullup).
316 * PD3 - PIN3 (input pullup).
317 * PD4 - PIN4 (input pullup).
318 * PD5 - PIN5 (input pullup).
319 * PD6 - PIN6 (input pullup).
320 * PD7 - PIN7 (input pullup).
321 * PD8 - PIN8 (input pullup).
322 * PD9 - PIN9 (input pullup).
323 * PD11 - PIN10 (input pullup).
324 * PD11 - PIN11 (input pullup).
325 * PD12 - PIN12 (input pullup).
326 * PD13 - PIN13 (input pullup).
327 * PD14 - PIN14 (input pullup).
328 * PD15 - PIN15 (input pullup).
329 */
330#define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | PIN_MODE_INPUT(GPIOD_PIN1) | PIN_MODE_INPUT(GPIOD_PIN2) | PIN_MODE_INPUT(GPIOD_PIN3) | PIN_MODE_INPUT(GPIOD_PIN4) | PIN_MODE_INPUT(GPIOD_PIN5) | PIN_MODE_INPUT(GPIOD_PIN6) | PIN_MODE_INPUT(GPIOD_PIN7) | PIN_MODE_INPUT(GPIOD_PIN8) | PIN_MODE_INPUT(GPIOD_PIN9) | PIN_MODE_INPUT(GPIOD_PIN10) | PIN_MODE_INPUT(GPIOD_PIN11) | PIN_MODE_INPUT(GPIOD_PIN12) | PIN_MODE_INPUT(GPIOD_PIN13) | PIN_MODE_INPUT(GPIOD_PIN14) | PIN_MODE_INPUT(GPIOD_PIN15))
331#define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
332#define VAL_GPIOD_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOD_PIN0) | PIN_OSPEED_VERYLOW(GPIOD_PIN1) | PIN_OSPEED_VERYLOW(GPIOD_PIN2) | PIN_OSPEED_VERYLOW(GPIOD_PIN3) | PIN_OSPEED_VERYLOW(GPIOD_PIN4) | PIN_OSPEED_VERYLOW(GPIOD_PIN5) | PIN_OSPEED_VERYLOW(GPIOD_PIN6) | PIN_OSPEED_VERYLOW(GPIOD_PIN7) | PIN_OSPEED_VERYLOW(GPIOD_PIN8) | PIN_OSPEED_VERYLOW(GPIOD_PIN9) | PIN_OSPEED_VERYLOW(GPIOD_PIN10) | PIN_OSPEED_VERYLOW(GPIOD_PIN11) | PIN_OSPEED_VERYLOW(GPIOD_PIN12) | PIN_OSPEED_VERYLOW(GPIOD_PIN13) | PIN_OSPEED_VERYLOW(GPIOD_PIN14) | PIN_OSPEED_VERYLOW(GPIOD_PIN15))
333#define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | PIN_PUPDR_PULLUP(GPIOD_PIN1) | PIN_PUPDR_PULLUP(GPIOD_PIN2) | PIN_PUPDR_PULLUP(GPIOD_PIN3) | PIN_PUPDR_PULLUP(GPIOD_PIN4) | PIN_PUPDR_PULLUP(GPIOD_PIN5) | PIN_PUPDR_PULLUP(GPIOD_PIN6) | PIN_PUPDR_PULLUP(GPIOD_PIN7) | PIN_PUPDR_PULLUP(GPIOD_PIN8) | PIN_PUPDR_PULLUP(GPIOD_PIN9) | PIN_PUPDR_PULLUP(GPIOD_PIN10) | PIN_PUPDR_PULLUP(GPIOD_PIN11) | PIN_PUPDR_PULLUP(GPIOD_PIN12) | PIN_PUPDR_PULLUP(GPIOD_PIN13) | PIN_PUPDR_PULLUP(GPIOD_PIN14) | PIN_PUPDR_PULLUP(GPIOD_PIN15))
334#define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | PIN_ODR_HIGH(GPIOD_PIN1) | PIN_ODR_HIGH(GPIOD_PIN2) | PIN_ODR_HIGH(GPIOD_PIN3) | PIN_ODR_HIGH(GPIOD_PIN4) | PIN_ODR_HIGH(GPIOD_PIN5) | PIN_ODR_HIGH(GPIOD_PIN6) | PIN_ODR_HIGH(GPIOD_PIN7) | PIN_ODR_HIGH(GPIOD_PIN8) | PIN_ODR_HIGH(GPIOD_PIN9) | PIN_ODR_HIGH(GPIOD_PIN10) | PIN_ODR_HIGH(GPIOD_PIN11) | PIN_ODR_HIGH(GPIOD_PIN12) | PIN_ODR_HIGH(GPIOD_PIN13) | PIN_ODR_HIGH(GPIOD_PIN14) | PIN_ODR_HIGH(GPIOD_PIN15))
335#define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0) | PIN_AFIO_AF(GPIOD_PIN1, 0) | PIN_AFIO_AF(GPIOD_PIN2, 0) | PIN_AFIO_AF(GPIOD_PIN3, 0) | PIN_AFIO_AF(GPIOD_PIN4, 0) | PIN_AFIO_AF(GPIOD_PIN5, 0) | PIN_AFIO_AF(GPIOD_PIN6, 0) | PIN_AFIO_AF(GPIOD_PIN7, 0))
336#define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0) | PIN_AFIO_AF(GPIOD_PIN9, 0) | PIN_AFIO_AF(GPIOD_PIN10, 0) | PIN_AFIO_AF(GPIOD_PIN11, 0) | PIN_AFIO_AF(GPIOD_PIN12, 0) | PIN_AFIO_AF(GPIOD_PIN13, 0) | PIN_AFIO_AF(GPIOD_PIN14, 0) | PIN_AFIO_AF(GPIOD_PIN15, 0))
337
338/*
339 * GPIOE setup:
340 *
341 * PE0 - PIN0 (input pullup).
342 * PE1 - PIN1 (input pullup).
343 * PE2 - PIN2 (input pullup).
344 * PE3 - PIN3 L3GD20_CS (output pushpull maximum).
345 * PE4 - PIN4 (input pullup).
346 * PE5 - PIN5 (input pullup).
347 * PE6 - PIN6 (input pullup).
348 * PE7 - PIN7 (input pullup).
349 * PE8 - PIN8 (output pushpull maximum).
350 * PE9 - PIN9 (output pushpull maximum).
351 * PE10 - PIN10 (output pushpull maximum).
352 * PE11 - PIN11 (output pushpull maximum).
353 * PE12 - PIN12 (output pushpull maximum).
354 * PE13 - PIN13 (output pushpull maximum).
355 * PE14 - PIN14 (output pushpull maximum).
356 * PE15 - PIN15 (output pushpull maximum).
357 */
358#define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_PIN0) | PIN_MODE_INPUT(GPIOE_PIN1) | PIN_MODE_INPUT(GPIOE_PIN2) | PIN_MODE_OUTPUT(GPIOE_PIN3) | PIN_MODE_INPUT(GPIOE_PIN4) | PIN_MODE_INPUT(GPIOE_PIN5) | PIN_MODE_INPUT(GPIOE_PIN6) | PIN_MODE_INPUT(GPIOE_PIN7) | PIN_MODE_OUTPUT(GPIOE_PIN8) | PIN_MODE_OUTPUT(GPIOE_PIN9) | PIN_MODE_OUTPUT(GPIOE_PIN10) | PIN_MODE_OUTPUT(GPIOE_PIN11) | PIN_MODE_OUTPUT(GPIOE_PIN12) | PIN_MODE_OUTPUT(GPIOE_PIN13) | PIN_MODE_OUTPUT(GPIOE_PIN14) | PIN_MODE_OUTPUT(GPIOE_PIN15))
359#define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) | PIN_OTYPE_PUSHPULL(GPIOE_PIN1) | PIN_OTYPE_PUSHPULL(GPIOE_PIN2) | PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | PIN_OTYPE_PUSHPULL(GPIOE_PIN4) | PIN_OTYPE_PUSHPULL(GPIOE_PIN5) | PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | PIN_OTYPE_PUSHPULL(GPIOE_PIN10) | PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | PIN_OTYPE_PUSHPULL(GPIOE_PIN14) | PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
360#define VAL_GPIOE_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOE_PIN0) | PIN_OSPEED_VERYLOW(GPIOE_PIN1) | PIN_OSPEED_VERYLOW(GPIOE_PIN2) | PIN_OSPEED_HIGH(GPIOE_PIN3) | PIN_OSPEED_VERYLOW(GPIOE_PIN4) | PIN_OSPEED_VERYLOW(GPIOE_PIN5) | PIN_OSPEED_VERYLOW(GPIOE_PIN6) | PIN_OSPEED_VERYLOW(GPIOE_PIN7) | PIN_OSPEED_HIGH(GPIOE_PIN8) | PIN_OSPEED_HIGH(GPIOE_PIN9) | PIN_OSPEED_HIGH(GPIOE_PIN10) | PIN_OSPEED_HIGH(GPIOE_PIN11) | PIN_OSPEED_HIGH(GPIOE_PIN12) | PIN_OSPEED_HIGH(GPIOE_PIN13) | PIN_OSPEED_HIGH(GPIOE_PIN14) | PIN_OSPEED_HIGH(GPIOE_PIN15))
361#define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(GPIOE_PIN0) | PIN_PUPDR_PULLUP(GPIOE_PIN1) | PIN_PUPDR_PULLUP(GPIOE_PIN2) | PIN_PUPDR_FLOATING(GPIOE_PIN3) | PIN_PUPDR_PULLUP(GPIOE_PIN4) | PIN_PUPDR_PULLUP(GPIOE_PIN5) | PIN_PUPDR_PULLUP(GPIOE_PIN6) | PIN_PUPDR_PULLUP(GPIOE_PIN7) | PIN_PUPDR_PULLUP(GPIOE_PIN8) | PIN_PUPDR_PULLUP(GPIOE_PIN9) | PIN_PUPDR_PULLUP(GPIOE_PIN10) | PIN_PUPDR_FLOATING(GPIOE_PIN11) | PIN_PUPDR_PULLUP(GPIOE_PIN12) | PIN_PUPDR_FLOATING(GPIOE_PIN13) | PIN_PUPDR_FLOATING(GPIOE_PIN14) | PIN_PUPDR_FLOATING(GPIOE_PIN15))
362#define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_PIN0) | PIN_ODR_HIGH(GPIOE_PIN1) | PIN_ODR_HIGH(GPIOE_PIN2) | PIN_ODR_HIGH(GPIOE_PIN3) | PIN_ODR_HIGH(GPIOE_PIN4) | PIN_ODR_HIGH(GPIOE_PIN5) | PIN_ODR_HIGH(GPIOE_PIN6) | PIN_ODR_HIGH(GPIOE_PIN7) | PIN_ODR_LOW(GPIOE_PIN8) | PIN_ODR_LOW(GPIOE_PIN9) | PIN_ODR_LOW(GPIOE_PIN10) | PIN_ODR_LOW(GPIOE_PIN11) | PIN_ODR_LOW(GPIOE_PIN12) | PIN_ODR_LOW(GPIOE_PIN13) | PIN_ODR_LOW(GPIOE_PIN14) | PIN_ODR_LOW(GPIOE_PIN15))
363#define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_PIN0, 0) | PIN_AFIO_AF(GPIOE_PIN1, 0) | PIN_AFIO_AF(GPIOE_PIN2, 0) | PIN_AFIO_AF(GPIOE_PIN3, 0) | PIN_AFIO_AF(GPIOE_PIN4, 0) | PIN_AFIO_AF(GPIOE_PIN5, 0) | PIN_AFIO_AF(GPIOE_PIN6, 0) | PIN_AFIO_AF(GPIOE_PIN7, 0))
364#define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0) | PIN_AFIO_AF(GPIOE_PIN9, 0) | PIN_AFIO_AF(GPIOE_PIN10, 0) | PIN_AFIO_AF(GPIOE_PIN11, 0) | PIN_AFIO_AF(GPIOE_PIN12, 0) | PIN_AFIO_AF(GPIOE_PIN13, 0) | PIN_AFIO_AF(GPIOE_PIN14, 0) | PIN_AFIO_AF(GPIOE_PIN15, 0))
365
366/*
367 * GPIOF setup:
368 *
369 * PF0 - I2C2_SDA (input floating).
370 * PF1 - I2C2_SCL (input floating).
371 * PF2 - PIN2 (input pullup).
372 * PF3 - PIN3 (input pullup).
373 * PF4 - PIN4 (input pullup).
374 * PF5 - PIN5 (input pullup).
375 * PF6 - PIN6 (input pullup).
376 * PF7 - PIN7 (input pullup).
377 * PF8 - PIN8 (input pullup).
378 * PF9 - PIN9 (input pullup).
379 * PF10 - PIN10 (input pullup).
380 * PF11 - PIN11 (input pullup).
381 * PF12 - PIN12 (input pullup).
382 * PF13 - PIN13 (input pullup).
383 * PF14 - PIN14 (input pullup).
384 * PF15 - PIN15 (input pullup).
385 */
386#define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_I2C2_SDA) | PIN_MODE_INPUT(GPIOF_I2C2_SCL) | PIN_MODE_INPUT(GPIOF_PIN2) | PIN_MODE_INPUT(GPIOF_PIN3) | PIN_MODE_INPUT(GPIOF_PIN4) | PIN_MODE_INPUT(GPIOF_PIN5) | PIN_MODE_INPUT(GPIOF_PIN6) | PIN_MODE_INPUT(GPIOF_PIN7) | PIN_MODE_INPUT(GPIOF_PIN8) | PIN_MODE_INPUT(GPIOF_PIN9) | PIN_MODE_INPUT(GPIOF_PIN10) | PIN_MODE_INPUT(GPIOF_PIN11) | PIN_MODE_INPUT(GPIOF_PIN12) | PIN_MODE_INPUT(GPIOF_PIN13) | PIN_MODE_INPUT(GPIOF_PIN14) | PIN_MODE_INPUT(GPIOF_PIN15))
387#define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_I2C2_SDA) | PIN_OTYPE_PUSHPULL(GPIOF_I2C2_SCL) | PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
388#define VAL_GPIOF_OSPEEDR (PIN_OSPEED_HIGH(GPIOF_I2C2_SDA) | PIN_OSPEED_HIGH(GPIOF_I2C2_SCL) | PIN_OSPEED_VERYLOW(GPIOF_PIN2) | PIN_OSPEED_VERYLOW(GPIOF_PIN3) | PIN_OSPEED_VERYLOW(GPIOF_PIN4) | PIN_OSPEED_VERYLOW(GPIOF_PIN5) | PIN_OSPEED_VERYLOW(GPIOF_PIN6) | PIN_OSPEED_VERYLOW(GPIOF_PIN7) | PIN_OSPEED_VERYLOW(GPIOF_PIN8) | PIN_OSPEED_VERYLOW(GPIOF_PIN9) | PIN_OSPEED_VERYLOW(GPIOF_PIN10) | PIN_OSPEED_VERYLOW(GPIOF_PIN11) | PIN_OSPEED_VERYLOW(GPIOF_PIN12) | PIN_OSPEED_VERYLOW(GPIOF_PIN13) | PIN_OSPEED_VERYLOW(GPIOF_PIN14) | PIN_OSPEED_VERYLOW(GPIOF_PIN15))
389#define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(GPIOF_I2C2_SDA) | PIN_PUPDR_FLOATING(GPIOF_I2C2_SCL) | PIN_PUPDR_PULLUP(GPIOF_PIN2) | PIN_PUPDR_PULLUP(GPIOF_PIN3) | PIN_PUPDR_PULLUP(GPIOF_PIN4) | PIN_PUPDR_PULLUP(GPIOF_PIN5) | PIN_PUPDR_PULLUP(GPIOF_PIN6) | PIN_PUPDR_PULLUP(GPIOF_PIN7) | PIN_PUPDR_PULLUP(GPIOF_PIN8) | PIN_PUPDR_PULLUP(GPIOF_PIN9) | PIN_PUPDR_PULLUP(GPIOF_PIN10) | PIN_PUPDR_PULLUP(GPIOF_PIN11) | PIN_PUPDR_PULLUP(GPIOF_PIN12) | PIN_PUPDR_PULLUP(GPIOF_PIN13) | PIN_PUPDR_PULLUP(GPIOF_PIN14) | PIN_PUPDR_PULLUP(GPIOF_PIN15))
390#define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_I2C2_SDA) | PIN_ODR_HIGH(GPIOF_I2C2_SCL) | PIN_ODR_HIGH(GPIOF_PIN2) | PIN_ODR_HIGH(GPIOF_PIN3) | PIN_ODR_HIGH(GPIOF_PIN4) | PIN_ODR_HIGH(GPIOF_PIN5) | PIN_ODR_HIGH(GPIOF_PIN6) | PIN_ODR_HIGH(GPIOF_PIN7) | PIN_ODR_HIGH(GPIOF_PIN8) | PIN_ODR_HIGH(GPIOF_PIN9) | PIN_ODR_HIGH(GPIOF_PIN10) | PIN_ODR_HIGH(GPIOF_PIN11) | PIN_ODR_HIGH(GPIOF_PIN12) | PIN_ODR_HIGH(GPIOF_PIN13) | PIN_ODR_HIGH(GPIOF_PIN14) | PIN_ODR_HIGH(GPIOF_PIN15))
391#define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_I2C2_SDA, 0) | PIN_AFIO_AF(GPIOF_I2C2_SCL, 0) | PIN_AFIO_AF(GPIOF_PIN2, 0) | PIN_AFIO_AF(GPIOF_PIN3, 0) | PIN_AFIO_AF(GPIOF_PIN4, 0) | PIN_AFIO_AF(GPIOF_PIN5, 0) | PIN_AFIO_AF(GPIOF_PIN6, 0) | PIN_AFIO_AF(GPIOF_PIN7, 0))
392#define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0) | PIN_AFIO_AF(GPIOF_PIN9, 0) | PIN_AFIO_AF(GPIOF_PIN10, 0) | PIN_AFIO_AF(GPIOF_PIN11, 0) | PIN_AFIO_AF(GPIOF_PIN12, 0) | PIN_AFIO_AF(GPIOF_PIN13, 0) | PIN_AFIO_AF(GPIOF_PIN14, 0) | PIN_AFIO_AF(GPIOF_PIN15, 0))
393
394/*
395 * GPIOG setup:
396 *
397 * PG0 - PIN0 (input pullup).
398 * PG1 - PIN1 (input pullup).
399 * PG2 - PIN2 (input pullup).
400 * PG3 - PIN3 (input pullup).
401 * PG4 - PIN4 (input pullup).
402 * PG5 - PIN5 (input pullup).
403 * PG6 - PIN6 (input pullup).
404 * PG7 - PIN7 (input pullup).
405 * PG8 - PIN8 (input pullup).
406 * PG9 - PIN9 (input pullup).
407 * PG10 - PIN10 (input pullup).
408 * PG11 - PIN11 (input pullup).
409 * PG12 - PIN12 (input pullup).
410 * PG13 - PIN13 (input pullup).
411 * PG14 - PIN14 (input pullup).
412 * PG15 - PIN15 (input pullup).
413 */
414#define VAL_GPIOG_MODER (PIN_MODE_INPUT(GPIOG_PIN0) | PIN_MODE_INPUT(GPIOG_PIN1) | PIN_MODE_INPUT(GPIOG_PIN2) | PIN_MODE_INPUT(GPIOG_PIN3) | PIN_MODE_INPUT(GPIOG_PIN4) | PIN_MODE_INPUT(GPIOG_PIN5) | PIN_MODE_INPUT(GPIOG_PIN6) | PIN_MODE_INPUT(GPIOG_PIN7) | PIN_MODE_INPUT(GPIOG_PIN8) | PIN_MODE_INPUT(GPIOG_PIN9) | PIN_MODE_INPUT(GPIOG_PIN10) | PIN_MODE_INPUT(GPIOG_PIN11) | PIN_MODE_INPUT(GPIOG_PIN12) | PIN_MODE_INPUT(GPIOG_PIN13) | PIN_MODE_INPUT(GPIOG_PIN14) | PIN_MODE_INPUT(GPIOG_PIN15))
415#define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) | PIN_OTYPE_PUSHPULL(GPIOG_PIN1) | PIN_OTYPE_PUSHPULL(GPIOG_PIN2) | PIN_OTYPE_PUSHPULL(GPIOG_PIN3) | PIN_OTYPE_PUSHPULL(GPIOG_PIN4) | PIN_OTYPE_PUSHPULL(GPIOG_PIN5) | PIN_OTYPE_PUSHPULL(GPIOG_PIN6) | PIN_OTYPE_PUSHPULL(GPIOG_PIN7) | PIN_OTYPE_PUSHPULL(GPIOG_PIN8) | PIN_OTYPE_PUSHPULL(GPIOG_PIN9) | PIN_OTYPE_PUSHPULL(GPIOG_PIN10) | PIN_OTYPE_PUSHPULL(GPIOG_PIN11) | PIN_OTYPE_PUSHPULL(GPIOG_PIN12) | PIN_OTYPE_PUSHPULL(GPIOG_PIN13) | PIN_OTYPE_PUSHPULL(GPIOG_PIN14) | PIN_OTYPE_PUSHPULL(GPIOG_PIN15))
416#define VAL_GPIOG_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOG_PIN0) | PIN_OSPEED_VERYLOW(GPIOG_PIN1) | PIN_OSPEED_VERYLOW(GPIOG_PIN2) | PIN_OSPEED_VERYLOW(GPIOG_PIN3) | PIN_OSPEED_VERYLOW(GPIOG_PIN4) | PIN_OSPEED_VERYLOW(GPIOG_PIN5) | PIN_OSPEED_VERYLOW(GPIOG_PIN6) | PIN_OSPEED_VERYLOW(GPIOG_PIN7) | PIN_OSPEED_VERYLOW(GPIOG_PIN8) | PIN_OSPEED_VERYLOW(GPIOG_PIN9) | PIN_OSPEED_VERYLOW(GPIOG_PIN10) | PIN_OSPEED_VERYLOW(GPIOG_PIN11) | PIN_OSPEED_VERYLOW(GPIOG_PIN12) | PIN_OSPEED_VERYLOW(GPIOG_PIN13) | PIN_OSPEED_VERYLOW(GPIOG_PIN14) | PIN_OSPEED_VERYLOW(GPIOG_PIN15))
417#define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLUP(GPIOG_PIN0) | PIN_PUPDR_PULLUP(GPIOG_PIN1) | PIN_PUPDR_PULLUP(GPIOG_PIN2) | PIN_PUPDR_PULLUP(GPIOG_PIN3) | PIN_PUPDR_PULLUP(GPIOG_PIN4) | PIN_PUPDR_PULLUP(GPIOG_PIN5) | PIN_PUPDR_PULLUP(GPIOG_PIN6) | PIN_PUPDR_PULLUP(GPIOG_PIN7) | PIN_PUPDR_PULLUP(GPIOG_PIN8) | PIN_PUPDR_PULLUP(GPIOG_PIN9) | PIN_PUPDR_PULLUP(GPIOG_PIN10) | PIN_PUPDR_PULLUP(GPIOG_PIN11) | PIN_PUPDR_PULLUP(GPIOG_PIN12) | PIN_PUPDR_PULLUP(GPIOG_PIN13) | PIN_PUPDR_PULLUP(GPIOG_PIN14) | PIN_PUPDR_PULLUP(GPIOG_PIN15))
418#define VAL_GPIOG_ODR (PIN_ODR_HIGH(GPIOG_PIN0) | PIN_ODR_HIGH(GPIOG_PIN1) | PIN_ODR_HIGH(GPIOG_PIN2) | PIN_ODR_HIGH(GPIOG_PIN3) | PIN_ODR_HIGH(GPIOG_PIN4) | PIN_ODR_HIGH(GPIOG_PIN5) | PIN_ODR_HIGH(GPIOG_PIN6) | PIN_ODR_HIGH(GPIOG_PIN7) | PIN_ODR_HIGH(GPIOG_PIN8) | PIN_ODR_HIGH(GPIOG_PIN9) | PIN_ODR_HIGH(GPIOG_PIN10) | PIN_ODR_HIGH(GPIOG_PIN11) | PIN_ODR_HIGH(GPIOG_PIN12) | PIN_ODR_HIGH(GPIOG_PIN13) | PIN_ODR_HIGH(GPIOG_PIN14) | PIN_ODR_HIGH(GPIOG_PIN15))
419#define VAL_GPIOG_AFRL (PIN_AFIO_AF(GPIOG_PIN0, 0) | PIN_AFIO_AF(GPIOG_PIN1, 0) | PIN_AFIO_AF(GPIOG_PIN2, 0) | PIN_AFIO_AF(GPIOG_PIN3, 0) | PIN_AFIO_AF(GPIOG_PIN4, 0) | PIN_AFIO_AF(GPIOG_PIN5, 0) | PIN_AFIO_AF(GPIOG_PIN6, 0) | PIN_AFIO_AF(GPIOG_PIN7, 0))
420#define VAL_GPIOG_AFRH (PIN_AFIO_AF(GPIOG_PIN8, 0) | PIN_AFIO_AF(GPIOG_PIN9, 0) | PIN_AFIO_AF(GPIOG_PIN10, 0) | PIN_AFIO_AF(GPIOG_PIN11, 0) | PIN_AFIO_AF(GPIOG_PIN12, 0) | PIN_AFIO_AF(GPIOG_PIN13, 0) | PIN_AFIO_AF(GPIOG_PIN14, 0) | PIN_AFIO_AF(GPIOG_PIN15, 0))
421
422/*
423 * GPIOH setup:
424 *
425 * PH0 - PIN0 (input pullup).
426 * PH1 - PIN1 (input pullup).
427 * PH2 - PIN2 (input pullup).
428 * PH3 - PIN3 (input pullup).
429 * PH4 - PIN4 (input pullup).
430 * PH5 - PIN5 (input pullup).
431 * PH6 - PIN6 (input pullup).
432 * PH7 - PIN7 (input pullup).
433 * PH8 - PIN8 (input pullup).
434 * PH9 - PIN9 (input pullup).
435 * PH10 - PIN10 (input pullup).
436 * PH11 - PIN11 (input pullup).
437 * PH12 - PIN12 (input pullup).
438 * PH13 - PIN13 (input pullup).
439 * PH14 - PIN14 (input pullup).
440 * PH15 - PIN15 (input pullup).
441 */
442#define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_PIN0) | PIN_MODE_INPUT(GPIOH_PIN1) | PIN_MODE_INPUT(GPIOH_PIN2) | PIN_MODE_INPUT(GPIOH_PIN3) | PIN_MODE_INPUT(GPIOH_PIN4) | PIN_MODE_INPUT(GPIOH_PIN5) | PIN_MODE_INPUT(GPIOH_PIN6) | PIN_MODE_INPUT(GPIOH_PIN7) | PIN_MODE_INPUT(GPIOH_PIN8) | PIN_MODE_INPUT(GPIOH_PIN9) | PIN_MODE_INPUT(GPIOH_PIN10) | PIN_MODE_INPUT(GPIOH_PIN11) | PIN_MODE_INPUT(GPIOH_PIN12) | PIN_MODE_INPUT(GPIOH_PIN13) | PIN_MODE_INPUT(GPIOH_PIN14) | PIN_MODE_INPUT(GPIOH_PIN15))
443#define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_PIN0) | PIN_OTYPE_PUSHPULL(GPIOH_PIN1) | PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
444#define VAL_GPIOH_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOH_PIN0) | PIN_OSPEED_VERYLOW(GPIOH_PIN1) | PIN_OSPEED_VERYLOW(GPIOH_PIN2) | PIN_OSPEED_VERYLOW(GPIOH_PIN3) | PIN_OSPEED_VERYLOW(GPIOH_PIN4) | PIN_OSPEED_VERYLOW(GPIOH_PIN5) | PIN_OSPEED_VERYLOW(GPIOH_PIN6) | PIN_OSPEED_VERYLOW(GPIOH_PIN7) | PIN_OSPEED_VERYLOW(GPIOH_PIN8) | PIN_OSPEED_VERYLOW(GPIOH_PIN9) | PIN_OSPEED_VERYLOW(GPIOH_PIN10) | PIN_OSPEED_VERYLOW(GPIOH_PIN11) | PIN_OSPEED_VERYLOW(GPIOH_PIN12) | PIN_OSPEED_VERYLOW(GPIOH_PIN13) | PIN_OSPEED_VERYLOW(GPIOH_PIN14) | PIN_OSPEED_VERYLOW(GPIOH_PIN15))
445#define VAL_GPIOH_PUPDR (PIN_PUPDR_PULLUP(GPIOH_PIN0) | PIN_PUPDR_PULLUP(GPIOH_PIN1) | PIN_PUPDR_PULLUP(GPIOH_PIN2) | PIN_PUPDR_PULLUP(GPIOH_PIN3) | PIN_PUPDR_PULLUP(GPIOH_PIN4) | PIN_PUPDR_PULLUP(GPIOH_PIN5) | PIN_PUPDR_PULLUP(GPIOH_PIN6) | PIN_PUPDR_PULLUP(GPIOH_PIN7) | PIN_PUPDR_PULLUP(GPIOH_PIN8) | PIN_PUPDR_PULLUP(GPIOH_PIN9) | PIN_PUPDR_PULLUP(GPIOH_PIN10) | PIN_PUPDR_PULLUP(GPIOH_PIN11) | PIN_PUPDR_PULLUP(GPIOH_PIN12) | PIN_PUPDR_PULLUP(GPIOH_PIN13) | PIN_PUPDR_PULLUP(GPIOH_PIN14) | PIN_PUPDR_PULLUP(GPIOH_PIN15))
446#define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_PIN0) | PIN_ODR_HIGH(GPIOH_PIN1) | PIN_ODR_HIGH(GPIOH_PIN2) | PIN_ODR_HIGH(GPIOH_PIN3) | PIN_ODR_HIGH(GPIOH_PIN4) | PIN_ODR_HIGH(GPIOH_PIN5) | PIN_ODR_HIGH(GPIOH_PIN6) | PIN_ODR_HIGH(GPIOH_PIN7) | PIN_ODR_HIGH(GPIOH_PIN8) | PIN_ODR_HIGH(GPIOH_PIN9) | PIN_ODR_HIGH(GPIOH_PIN10) | PIN_ODR_HIGH(GPIOH_PIN11) | PIN_ODR_HIGH(GPIOH_PIN12) | PIN_ODR_HIGH(GPIOH_PIN13) | PIN_ODR_HIGH(GPIOH_PIN14) | PIN_ODR_HIGH(GPIOH_PIN15))
447#define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_PIN0, 0) | PIN_AFIO_AF(GPIOH_PIN1, 0) | PIN_AFIO_AF(GPIOH_PIN2, 0) | PIN_AFIO_AF(GPIOH_PIN3, 0) | PIN_AFIO_AF(GPIOH_PIN4, 0) | PIN_AFIO_AF(GPIOH_PIN5, 0) | PIN_AFIO_AF(GPIOH_PIN6, 0) | PIN_AFIO_AF(GPIOH_PIN7, 0))
448#define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0) | PIN_AFIO_AF(GPIOH_PIN9, 0) | PIN_AFIO_AF(GPIOH_PIN10, 0) | PIN_AFIO_AF(GPIOH_PIN11, 0) | PIN_AFIO_AF(GPIOH_PIN12, 0) | PIN_AFIO_AF(GPIOH_PIN13, 0) | PIN_AFIO_AF(GPIOH_PIN14, 0) | PIN_AFIO_AF(GPIOH_PIN15, 0))
449
450/*
451 * USB bus activation macro, required by the USB driver.
452 */
453// #define usb_lld_connect_bus(usbp)
454#define usb_lld_connect_bus(usbp) (palSetPadMode(GPIOA, GPIOA_USB_DP, PAL_MODE_ALTERNATE(14)))
455// #define usb_lld_connect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_INPUT)
456/*
457 * USB bus de-activation macro, required by the USB driver.
458 */
459// #define usb_lld_disconnect_bus(usbp)
460#define usb_lld_disconnect_bus(usbp) \
461 (palSetPadMode(GPIOA, GPIOA_USB_DP, PAL_MODE_OUTPUT_PUSHPULL)); \
462 palClearPad(GPIOA, GPIOA_USB_DP)
463// #define usb_lld_disconnect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_OUTPUT_PUSHPULL); palClearPad(GPIOA, 12)
464
465#if !defined(_FROM_ASM_)
466# ifdef __cplusplus
467extern "C" {
468# endif
469void boardInit(void);
470# ifdef __cplusplus
471}
472# endif
473#endif /* _FROM_ASM_ */
474
475#endif /* _BOARD_H_ */
diff --git a/platforms/chibios/GENERIC_STM32_F303XC/board/board.mk b/platforms/chibios/GENERIC_STM32_F303XC/board/board.mk
new file mode 100644
index 000000000..842e33590
--- /dev/null
+++ b/platforms/chibios/GENERIC_STM32_F303XC/board/board.mk
@@ -0,0 +1,9 @@
1# List of all the board related files.
2BOARDSRC = $(BOARD_PATH)/board/board.c
3
4# Required include directories
5BOARDINC = $(BOARD_PATH)/board
6
7# Shared variables
8ALLCSRC += $(BOARDSRC)
9ALLINC += $(BOARDINC)
diff --git a/platforms/chibios/GENERIC_STM32_F303XC/configs/bootloader_defs.h b/platforms/chibios/GENERIC_STM32_F303XC/configs/bootloader_defs.h
new file mode 100644
index 000000000..3b0e9d20a
--- /dev/null
+++ b/platforms/chibios/GENERIC_STM32_F303XC/configs/bootloader_defs.h
@@ -0,0 +1,7 @@
1/* Address for jumping to bootloader on STM32 chips. */
2/* It is chip dependent, the correct number can be looked up here:
3 * http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf
4 * This also requires a patch to chibios:
5 * <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch
6 */
7#define STM32_BOOTLOADER_ADDRESS 0x1FFFD800
diff --git a/platforms/chibios/GENERIC_STM32_F303XC/configs/chconf.h b/platforms/chibios/GENERIC_STM32_F303XC/configs/chconf.h
new file mode 100644
index 000000000..aac330370
--- /dev/null
+++ b/platforms/chibios/GENERIC_STM32_F303XC/configs/chconf.h
@@ -0,0 +1,714 @@
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 rt/templates/chconf.h
19 * @brief Configuration file template.
20 * @details A copy of this file must be placed in each project directory, it
21 * contains the application specific kernel settings.
22 *
23 * @addtogroup config
24 * @details Kernel related settings and hooks.
25 * @{
26 */
27
28#ifndef CHCONF_H
29#define CHCONF_H
30
31#define _CHIBIOS_RT_CONF_
32#define _CHIBIOS_RT_CONF_VER_6_0_
33
34/*===========================================================================*/
35/**
36 * @name System timers settings
37 * @{
38 */
39/*===========================================================================*/
40
41/**
42 * @brief System time counter resolution.
43 * @note Allowed values are 16 or 32 bits.
44 */
45#if !defined(CH_CFG_ST_RESOLUTION)
46#define CH_CFG_ST_RESOLUTION 32
47#endif
48
49/**
50 * @brief System tick frequency.
51 * @details Frequency of the system timer that drives the system ticks. This
52 * setting also defines the system tick time unit.
53 */
54#if !defined(CH_CFG_ST_FREQUENCY)
55#define CH_CFG_ST_FREQUENCY 100000
56#endif
57
58/**
59 * @brief Time intervals data size.
60 * @note Allowed values are 16, 32 or 64 bits.
61 */
62#if !defined(CH_CFG_INTERVALS_SIZE)
63#define CH_CFG_INTERVALS_SIZE 32
64#endif
65
66/**
67 * @brief Time types data size.
68 * @note Allowed values are 16 or 32 bits.
69 */
70#if !defined(CH_CFG_TIME_TYPES_SIZE)
71#define CH_CFG_TIME_TYPES_SIZE 32
72#endif
73
74/**
75 * @brief Time delta constant for the tick-less mode.
76 * @note If this value is zero then the system uses the classic
77 * periodic tick. This value represents the minimum number
78 * of ticks that is safe to specify in a timeout directive.
79 * The value one is not valid, timeouts are rounded up to
80 * this value.
81 */
82#if !defined(CH_CFG_ST_TIMEDELTA)
83#define CH_CFG_ST_TIMEDELTA 2
84#endif
85
86/** @} */
87
88/*===========================================================================*/
89/**
90 * @name Kernel parameters and options
91 * @{
92 */
93/*===========================================================================*/
94
95/**
96 * @brief Round robin interval.
97 * @details This constant is the number of system ticks allowed for the
98 * threads before preemption occurs. Setting this value to zero
99 * disables the preemption for threads with equal priority and the
100 * round robin becomes cooperative. Note that higher priority
101 * threads can still preempt, the kernel is always preemptive.
102 * @note Disabling the round robin preemption makes the kernel more compact
103 * and generally faster.
104 * @note The round robin preemption is not supported in tickless mode and
105 * must be set to zero in that case.
106 */
107#if !defined(CH_CFG_TIME_QUANTUM)
108#define CH_CFG_TIME_QUANTUM 0
109#endif
110
111/**
112 * @brief Managed RAM size.
113 * @details Size of the RAM area to be managed by the OS. If set to zero
114 * then the whole available RAM is used. The core memory is made
115 * available to the heap allocator and/or can be used directly through
116 * the simplified core memory allocator.
117 *
118 * @note In order to let the OS manage the whole RAM the linker script must
119 * provide the @p __heap_base__ and @p __heap_end__ symbols.
120 * @note Requires @p CH_CFG_USE_MEMCORE.
121 */
122#if !defined(CH_CFG_MEMCORE_SIZE)
123#define CH_CFG_MEMCORE_SIZE 0
124#endif
125
126/**
127 * @brief Idle thread automatic spawn suppression.
128 * @details When this option is activated the function @p chSysInit()
129 * does not spawn the idle thread. The application @p main()
130 * function becomes the idle thread and must implement an
131 * infinite loop.
132 */
133#if !defined(CH_CFG_NO_IDLE_THREAD)
134#define CH_CFG_NO_IDLE_THREAD FALSE
135#endif
136
137/** @} */
138
139/*===========================================================================*/
140/**
141 * @name Performance options
142 * @{
143 */
144/*===========================================================================*/
145
146/**
147 * @brief OS optimization.
148 * @details If enabled then time efficient rather than space efficient code
149 * is used when two possible implementations exist.
150 *
151 * @note This is not related to the compiler optimization options.
152 * @note The default is @p TRUE.
153 */
154#if !defined(CH_CFG_OPTIMIZE_SPEED)
155#define CH_CFG_OPTIMIZE_SPEED TRUE
156#endif
157
158/** @} */
159
160/*===========================================================================*/
161/**
162 * @name Subsystem options
163 * @{
164 */
165/*===========================================================================*/
166
167/**
168 * @brief Time Measurement APIs.
169 * @details If enabled then the time measurement APIs are included in
170 * the kernel.
171 *
172 * @note The default is @p TRUE.
173 */
174#if !defined(CH_CFG_USE_TM)
175#define CH_CFG_USE_TM TRUE
176#endif
177
178/**
179 * @brief Threads registry APIs.
180 * @details If enabled then the registry APIs are included in the kernel.
181 *
182 * @note The default is @p TRUE.
183 */
184#if !defined(CH_CFG_USE_REGISTRY)
185#define CH_CFG_USE_REGISTRY TRUE
186#endif
187
188/**
189 * @brief Threads synchronization APIs.
190 * @details If enabled then the @p chThdWait() function is included in
191 * the kernel.
192 *
193 * @note The default is @p TRUE.
194 */
195#if !defined(CH_CFG_USE_WAITEXIT)
196#define CH_CFG_USE_WAITEXIT TRUE
197#endif
198
199/**
200 * @brief Semaphores APIs.
201 * @details If enabled then the Semaphores APIs are included in the kernel.
202 *
203 * @note The default is @p TRUE.
204 */
205#if !defined(CH_CFG_USE_SEMAPHORES)
206#define CH_CFG_USE_SEMAPHORES TRUE
207#endif
208
209/**
210 * @brief Semaphores queuing mode.
211 * @details If enabled then the threads are enqueued on semaphores by
212 * priority rather than in FIFO order.
213 *
214 * @note The default is @p FALSE. Enable this if you have special
215 * requirements.
216 * @note Requires @p CH_CFG_USE_SEMAPHORES.
217 */
218#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
219#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
220#endif
221
222/**
223 * @brief Mutexes APIs.
224 * @details If enabled then the mutexes APIs are included in the kernel.
225 *
226 * @note The default is @p TRUE.
227 */
228#if !defined(CH_CFG_USE_MUTEXES)
229#define CH_CFG_USE_MUTEXES TRUE
230#endif
231
232/**
233 * @brief Enables recursive behavior on mutexes.
234 * @note Recursive mutexes are heavier and have an increased
235 * memory footprint.
236 *
237 * @note The default is @p FALSE.
238 * @note Requires @p CH_CFG_USE_MUTEXES.
239 */
240#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
241#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
242#endif
243
244/**
245 * @brief Conditional Variables APIs.
246 * @details If enabled then the conditional variables APIs are included
247 * in the kernel.
248 *
249 * @note The default is @p TRUE.
250 * @note Requires @p CH_CFG_USE_MUTEXES.
251 */
252#if !defined(CH_CFG_USE_CONDVARS)
253#define CH_CFG_USE_CONDVARS TRUE
254#endif
255
256/**
257 * @brief Conditional Variables APIs with timeout.
258 * @details If enabled then the conditional variables APIs with timeout
259 * specification are included in the kernel.
260 *
261 * @note The default is @p TRUE.
262 * @note Requires @p CH_CFG_USE_CONDVARS.
263 */
264#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
265#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
266#endif
267
268/**
269 * @brief Events Flags APIs.
270 * @details If enabled then the event flags APIs are included in the kernel.
271 *
272 * @note The default is @p TRUE.
273 */
274#if !defined(CH_CFG_USE_EVENTS)
275#define CH_CFG_USE_EVENTS TRUE
276#endif
277
278/**
279 * @brief Events Flags APIs with timeout.
280 * @details If enabled then the events APIs with timeout specification
281 * are included in the kernel.
282 *
283 * @note The default is @p TRUE.
284 * @note Requires @p CH_CFG_USE_EVENTS.
285 */
286#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
287#define CH_CFG_USE_EVENTS_TIMEOUT TRUE
288#endif
289
290/**
291 * @brief Synchronous Messages APIs.
292 * @details If enabled then the synchronous messages APIs are included
293 * in the kernel.
294 *
295 * @note The default is @p TRUE.
296 */
297#if !defined(CH_CFG_USE_MESSAGES)
298#define CH_CFG_USE_MESSAGES TRUE
299#endif
300
301/**
302 * @brief Synchronous Messages queuing mode.
303 * @details If enabled then messages are served by priority rather than in
304 * FIFO order.
305 *
306 * @note The default is @p FALSE. Enable this if you have special
307 * requirements.
308 * @note Requires @p CH_CFG_USE_MESSAGES.
309 */
310#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
311#define CH_CFG_USE_MESSAGES_PRIORITY TRUE
312#endif
313
314/**
315 * @brief Mailboxes APIs.
316 * @details If enabled then the asynchronous messages (mailboxes) APIs are
317 * included in the kernel.
318 *
319 * @note The default is @p TRUE.
320 * @note Requires @p CH_CFG_USE_SEMAPHORES.
321 */
322#if !defined(CH_CFG_USE_MAILBOXES)
323#define CH_CFG_USE_MAILBOXES TRUE
324#endif
325
326/**
327 * @brief Core Memory Manager APIs.
328 * @details If enabled then the core memory manager APIs are included
329 * in the kernel.
330 *
331 * @note The default is @p TRUE.
332 */
333#if !defined(CH_CFG_USE_MEMCORE)
334#define CH_CFG_USE_MEMCORE TRUE
335#endif
336
337/**
338 * @brief Heap Allocator APIs.
339 * @details If enabled then the memory heap allocator APIs are included
340 * in the kernel.
341 *
342 * @note The default is @p TRUE.
343 * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
344 * @p CH_CFG_USE_SEMAPHORES.
345 * @note Mutexes are recommended.
346 */
347#if !defined(CH_CFG_USE_HEAP)
348#define CH_CFG_USE_HEAP TRUE
349#endif
350
351/**
352 * @brief Memory Pools Allocator APIs.
353 * @details If enabled then the memory pools allocator APIs are included
354 * in the kernel.
355 *
356 * @note The default is @p TRUE.
357 */
358#if !defined(CH_CFG_USE_MEMPOOLS)
359#define CH_CFG_USE_MEMPOOLS TRUE
360#endif
361
362/**
363 * @brief Objects FIFOs APIs.
364 * @details If enabled then the objects FIFOs APIs are included
365 * in the kernel.
366 *
367 * @note The default is @p TRUE.
368 */
369#if !defined(CH_CFG_USE_OBJ_FIFOS)
370#define CH_CFG_USE_OBJ_FIFOS TRUE
371#endif
372
373/**
374 * @brief Pipes APIs.
375 * @details If enabled then the pipes APIs are included
376 * in the kernel.
377 *
378 * @note The default is @p TRUE.
379 */
380#if !defined(CH_CFG_USE_PIPES)
381#define CH_CFG_USE_PIPES TRUE
382#endif
383
384/**
385 * @brief Dynamic Threads APIs.
386 * @details If enabled then the dynamic threads creation APIs are included
387 * in the kernel.
388 *
389 * @note The default is @p TRUE.
390 * @note Requires @p CH_CFG_USE_WAITEXIT.
391 * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
392 */
393#if !defined(CH_CFG_USE_DYNAMIC)
394#define CH_CFG_USE_DYNAMIC TRUE
395#endif
396
397/** @} */
398
399/*===========================================================================*/
400/**
401 * @name Objects factory options
402 * @{
403 */
404/*===========================================================================*/
405
406/**
407 * @brief Objects Factory APIs.
408 * @details If enabled then the objects factory APIs are included in the
409 * kernel.
410 *
411 * @note The default is @p FALSE.
412 */
413#if !defined(CH_CFG_USE_FACTORY)
414#define CH_CFG_USE_FACTORY TRUE
415#endif
416
417/**
418 * @brief Maximum length for object names.
419 * @details If the specified length is zero then the name is stored by
420 * pointer but this could have unintended side effects.
421 */
422#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
423#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8
424#endif
425
426/**
427 * @brief Enables the registry of generic objects.
428 */
429#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
430#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE
431#endif
432
433/**
434 * @brief Enables factory for generic buffers.
435 */
436#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
437#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
438#endif
439
440/**
441 * @brief Enables factory for semaphores.
442 */
443#if !defined(CH_CFG_FACTORY_SEMAPHORES)
444#define CH_CFG_FACTORY_SEMAPHORES TRUE
445#endif
446
447/**
448 * @brief Enables factory for mailboxes.
449 */
450#if !defined(CH_CFG_FACTORY_MAILBOXES)
451#define CH_CFG_FACTORY_MAILBOXES TRUE
452#endif
453
454/**
455 * @brief Enables factory for objects FIFOs.
456 */
457#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
458#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
459#endif
460
461/**
462 * @brief Enables factory for Pipes.
463 */
464#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
465#define CH_CFG_FACTORY_PIPES TRUE
466#endif
467
468/** @} */
469
470/*===========================================================================*/
471/**
472 * @name Debug options
473 * @{
474 */
475/*===========================================================================*/
476
477/**
478 * @brief Debug option, kernel statistics.
479 *
480 * @note The default is @p FALSE.
481 */
482#if !defined(CH_DBG_STATISTICS)
483#define CH_DBG_STATISTICS FALSE
484#endif
485
486/**
487 * @brief Debug option, system state check.
488 * @details If enabled the correct call protocol for system APIs is checked
489 * at runtime.
490 *
491 * @note The default is @p FALSE.
492 */
493#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
494#define CH_DBG_SYSTEM_STATE_CHECK FALSE
495#endif
496
497/**
498 * @brief Debug option, parameters checks.
499 * @details If enabled then the checks on the API functions input
500 * parameters are activated.
501 *
502 * @note The default is @p FALSE.
503 */
504#if !defined(CH_DBG_ENABLE_CHECKS)
505#define CH_DBG_ENABLE_CHECKS FALSE
506#endif
507
508/**
509 * @brief Debug option, consistency checks.
510 * @details If enabled then all the assertions in the kernel code are
511 * activated. This includes consistency checks inside the kernel,
512 * runtime anomalies and port-defined checks.
513 *
514 * @note The default is @p FALSE.
515 */
516#if !defined(CH_DBG_ENABLE_ASSERTS)
517#define CH_DBG_ENABLE_ASSERTS FALSE
518#endif
519
520/**
521 * @brief Debug option, trace buffer.
522 * @details If enabled then the trace buffer is activated.
523 *
524 * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
525 */
526#if !defined(CH_DBG_TRACE_MASK)
527#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
528#endif
529
530/**
531 * @brief Trace buffer entries.
532 * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
533 * different from @p CH_DBG_TRACE_MASK_DISABLED.
534 */
535#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
536#define CH_DBG_TRACE_BUFFER_SIZE 128
537#endif
538
539/**
540 * @brief Debug option, stack checks.
541 * @details If enabled then a runtime stack check is performed.
542 *
543 * @note The default is @p FALSE.
544 * @note The stack check is performed in a architecture/port dependent way.
545 * It may not be implemented or some ports.
546 * @note The default failure mode is to halt the system with the global
547 * @p panic_msg variable set to @p NULL.
548 */
549#if !defined(CH_DBG_ENABLE_STACK_CHECK)
550#define CH_DBG_ENABLE_STACK_CHECK TRUE
551#endif
552
553/**
554 * @brief Debug option, stacks initialization.
555 * @details If enabled then the threads working area is filled with a byte
556 * value when a thread is created. This can be useful for the
557 * runtime measurement of the used stack.
558 *
559 * @note The default is @p FALSE.
560 */
561#if !defined(CH_DBG_FILL_THREADS)
562#define CH_DBG_FILL_THREADS FALSE
563#endif
564
565/**
566 * @brief Debug option, threads profiling.
567 * @details If enabled then a field is added to the @p thread_t structure that
568 * counts the system ticks occurred while executing the thread.
569 *
570 * @note The default is @p FALSE.
571 * @note This debug option is not currently compatible with the
572 * tickless mode.
573 */
574#if !defined(CH_DBG_THREADS_PROFILING)
575#define CH_DBG_THREADS_PROFILING FALSE
576#endif
577
578/** @} */
579
580/*===========================================================================*/
581/**
582 * @name Kernel hooks
583 * @{
584 */
585/*===========================================================================*/
586
587/**
588 * @brief System structure extension.
589 * @details User fields added to the end of the @p ch_system_t structure.
590 */
591#define CH_CFG_SYSTEM_EXTRA_FIELDS \
592 /* Add threads custom fields here.*/
593
594/**
595 * @brief System initialization hook.
596 * @details User initialization code added to the @p chSysInit() function
597 * just before interrupts are enabled globally.
598 */
599#define CH_CFG_SYSTEM_INIT_HOOK() { \
600 /* Add threads initialization code here.*/ \
601}
602
603/**
604 * @brief Threads descriptor structure extension.
605 * @details User fields added to the end of the @p thread_t structure.
606 */
607#define CH_CFG_THREAD_EXTRA_FIELDS \
608 /* Add threads custom fields here.*/
609
610/**
611 * @brief Threads initialization hook.
612 * @details User initialization code added to the @p _thread_init() function.
613 *
614 * @note It is invoked from within @p _thread_init() and implicitly from all
615 * the threads creation APIs.
616 */
617#define CH_CFG_THREAD_INIT_HOOK(tp) { \
618 /* Add threads initialization code here.*/ \
619}
620
621/**
622 * @brief Threads finalization hook.
623 * @details User finalization code added to the @p chThdExit() API.
624 */
625#define CH_CFG_THREAD_EXIT_HOOK(tp) { \
626 /* Add threads finalization code here.*/ \
627}
628
629/**
630 * @brief Context switch hook.
631 * @details This hook is invoked just before switching between threads.
632 */
633#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
634 /* Context switch code here.*/ \
635}
636
637/**
638 * @brief ISR enter hook.
639 */
640#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
641 /* IRQ prologue code here.*/ \
642}
643
644/**
645 * @brief ISR exit hook.
646 */
647#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
648 /* IRQ epilogue code here.*/ \
649}
650
651/**
652 * @brief Idle thread enter hook.
653 * @note This hook is invoked within a critical zone, no OS functions
654 * should be invoked from here.
655 * @note This macro can be used to activate a power saving mode.
656 */
657#define CH_CFG_IDLE_ENTER_HOOK() { \
658 /* Idle-enter code here.*/ \
659}
660
661/**
662 * @brief Idle thread leave hook.
663 * @note This hook is invoked within a critical zone, no OS functions
664 * should be invoked from here.
665 * @note This macro can be used to deactivate a power saving mode.
666 */
667#define CH_CFG_IDLE_LEAVE_HOOK() { \
668 /* Idle-leave code here.*/ \
669}
670
671/**
672 * @brief Idle Loop hook.
673 * @details This hook is continuously invoked by the idle thread loop.
674 */
675#define CH_CFG_IDLE_LOOP_HOOK() { \
676 /* Idle loop code here.*/ \
677}
678
679/**
680 * @brief System tick event hook.
681 * @details This hook is invoked in the system tick handler immediately
682 * after processing the virtual timers queue.
683 */
684#define CH_CFG_SYSTEM_TICK_HOOK() { \
685 /* System tick event code here.*/ \
686}
687
688/**
689 * @brief System halt hook.
690 * @details This hook is invoked in case to a system halting error before
691 * the system is halted.
692 */
693#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
694 /* System halt code here.*/ \
695}
696
697/**
698 * @brief Trace hook.
699 * @details This hook is invoked each time a new record is written in the
700 * trace buffer.
701 */
702#define CH_CFG_TRACE_HOOK(tep) { \
703 /* Trace code here.*/ \
704}
705
706/** @} */
707
708/*===========================================================================*/
709/* Port-specific settings (override port settings defaulted in chcore.h). */
710/*===========================================================================*/
711
712#endif /* CHCONF_H */
713
714/** @} */
diff --git a/platforms/chibios/GENERIC_STM32_F303XC/configs/halconf.h b/platforms/chibios/GENERIC_STM32_F303XC/configs/halconf.h
new file mode 100644
index 000000000..6b48e289f
--- /dev/null
+++ b/platforms/chibios/GENERIC_STM32_F303XC/configs/halconf.h
@@ -0,0 +1,525 @@
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_0_
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 TRUE
69#endif
70
71/**
72 * @brief Enables the GPT subsystem.
73 */
74#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
75#define HAL_USE_GPT TRUE
76#endif
77
78/**
79 * @brief Enables the I2C subsystem.
80 */
81#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
82#define HAL_USE_I2C TRUE
83#endif
84
85/**
86 * @brief Enables the I2S subsystem.
87 */
88#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
89#define HAL_USE_I2S FALSE
90#endif
91
92/**
93 * @brief Enables the ICU subsystem.
94 */
95#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
96#define HAL_USE_ICU FALSE
97#endif
98
99/**
100 * @brief Enables the MAC subsystem.
101 */
102#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
103#define HAL_USE_MAC FALSE
104#endif
105
106/**
107 * @brief Enables the MMC_SPI subsystem.
108 */
109#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
110#define HAL_USE_MMC_SPI FALSE
111#endif
112
113/**
114 * @brief Enables the PWM subsystem.
115 */
116#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
117#define HAL_USE_PWM TRUE
118#endif
119
120/**
121 * @brief Enables the RTC subsystem.
122 */
123#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
124#define HAL_USE_RTC FALSE
125#endif
126
127/**
128 * @brief Enables the SDC subsystem.
129 */
130#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
131#define HAL_USE_SDC FALSE
132#endif
133
134/**
135 * @brief Enables the SERIAL subsystem.
136 */
137#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
138#define HAL_USE_SERIAL FALSE
139#endif
140
141/**
142 * @brief Enables the SERIAL over USB subsystem.
143 */
144#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
145#define HAL_USE_SERIAL_USB TRUE
146#endif
147
148/**
149 * @brief Enables the SIO subsystem.
150 */
151#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
152#define HAL_USE_SIO FALSE
153#endif
154
155/**
156 * @brief Enables the SPI subsystem.
157 */
158#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
159#define HAL_USE_SPI TRUE
160#endif
161
162/**
163 * @brief Enables the TRNG subsystem.
164 */
165#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
166#define HAL_USE_TRNG FALSE
167#endif
168
169/**
170 * @brief Enables the UART subsystem.
171 */
172#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
173#define HAL_USE_UART FALSE
174#endif
175
176/**
177 * @brief Enables the USB subsystem.
178 */
179#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
180#define HAL_USE_USB TRUE
181#endif
182
183/**
184 * @brief Enables the WDG subsystem.
185 */
186#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
187#define HAL_USE_WDG FALSE
188#endif
189
190/**
191 * @brief Enables the WSPI subsystem.
192 */
193#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
194#define HAL_USE_WSPI FALSE
195#endif
196
197/*===========================================================================*/
198/* PAL driver related settings. */
199/*===========================================================================*/
200
201/**
202 * @brief Enables synchronous APIs.
203 * @note Disabling this option saves both code and data space.
204 */
205#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
206#define PAL_USE_CALLBACKS TRUE
207#endif
208
209/**
210 * @brief Enables synchronous APIs.
211 * @note Disabling this option saves both code and data space.
212 */
213#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
214#define PAL_USE_WAIT TRUE
215#endif
216
217/*===========================================================================*/
218/* ADC driver related settings. */
219/*===========================================================================*/
220
221/**
222 * @brief Enables synchronous APIs.
223 * @note Disabling this option saves both code and data space.
224 */
225#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
226#define ADC_USE_WAIT TRUE
227#endif
228
229/**
230 * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
231 * @note Disabling this option saves both code and data space.
232 */
233#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
234#define ADC_USE_MUTUAL_EXCLUSION TRUE
235#endif
236
237/*===========================================================================*/
238/* CAN driver related settings. */
239/*===========================================================================*/
240
241/**
242 * @brief Sleep mode related APIs inclusion switch.
243 */
244#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
245#define CAN_USE_SLEEP_MODE TRUE
246#endif
247
248/**
249 * @brief Enforces the driver to use direct callbacks rather than OSAL events.
250 */
251#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
252#define CAN_ENFORCE_USE_CALLBACKS FALSE
253#endif
254
255/*===========================================================================*/
256/* CRY driver related settings. */
257/*===========================================================================*/
258
259/**
260 * @brief Enables the SW fall-back of the cryptographic driver.
261 * @details When enabled, this option, activates a fall-back software
262 * implementation for algorithms not supported by the underlying
263 * hardware.
264 * @note Fall-back implementations may not be present for all algorithms.
265 */
266#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
267#define HAL_CRY_USE_FALLBACK FALSE
268#endif
269
270/**
271 * @brief Makes the driver forcibly use the fall-back implementations.
272 */
273#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
274#define HAL_CRY_ENFORCE_FALLBACK FALSE
275#endif
276
277/*===========================================================================*/
278/* DAC driver related settings. */
279/*===========================================================================*/
280
281/**
282 * @brief Enables synchronous APIs.
283 * @note Disabling this option saves both code and data space.
284 */
285#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
286#define DAC_USE_WAIT TRUE
287#endif
288
289/**
290 * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
291 * @note Disabling this option saves both code and data space.
292 */
293#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
294#define DAC_USE_MUTUAL_EXCLUSION TRUE
295#endif
296
297/*===========================================================================*/
298/* I2C driver related settings. */
299/*===========================================================================*/
300
301/**
302 * @brief Enables the mutual exclusion APIs on the I2C bus.
303 */
304#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
305#define I2C_USE_MUTUAL_EXCLUSION TRUE
306#endif
307
308/*===========================================================================*/
309/* MAC driver related settings. */
310/*===========================================================================*/
311
312/**
313 * @brief Enables the zero-copy API.
314 */
315#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
316#define MAC_USE_ZERO_COPY FALSE
317#endif
318
319/**
320 * @brief Enables an event sources for incoming packets.
321 */
322#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
323#define MAC_USE_EVENTS TRUE
324#endif
325
326/*===========================================================================*/
327/* MMC_SPI driver related settings. */
328/*===========================================================================*/
329
330/**
331 * @brief Delays insertions.
332 * @details If enabled this options inserts delays into the MMC waiting
333 * routines releasing some extra CPU time for the threads with
334 * lower priority, this may slow down the driver a bit however.
335 * This option is recommended also if the SPI driver does not
336 * use a DMA channel and heavily loads the CPU.
337 */
338#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
339#define MMC_NICE_WAITING TRUE
340#endif
341
342/*===========================================================================*/
343/* SDC driver related settings. */
344/*===========================================================================*/
345
346/**
347 * @brief Number of initialization attempts before rejecting the card.
348 * @note Attempts are performed at 10mS intervals.
349 */
350#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
351#define SDC_INIT_RETRY 100
352#endif
353
354/**
355 * @brief Include support for MMC cards.
356 * @note MMC support is not yet implemented so this option must be kept
357 * at @p FALSE.
358 */
359#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
360#define SDC_MMC_SUPPORT FALSE
361#endif
362
363/**
364 * @brief Delays insertions.
365 * @details If enabled this options inserts delays into the MMC waiting
366 * routines releasing some extra CPU time for the threads with
367 * lower priority, this may slow down the driver a bit however.
368 */
369#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
370#define SDC_NICE_WAITING TRUE
371#endif
372
373/**
374 * @brief OCR initialization constant for V20 cards.
375 */
376#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
377#define SDC_INIT_OCR_V20 0x50FF8000U
378#endif
379
380/**
381 * @brief OCR initialization constant for non-V20 cards.
382 */
383#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
384#define SDC_INIT_OCR 0x80100000U
385#endif
386
387/*===========================================================================*/
388/* SERIAL driver related settings. */
389/*===========================================================================*/
390
391/**
392 * @brief Default bit rate.
393 * @details Configuration parameter, this is the baud rate selected for the
394 * default configuration.
395 */
396#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
397#define SERIAL_DEFAULT_BITRATE 38400
398#endif
399
400/**
401 * @brief Serial buffers size.
402 * @details Configuration parameter, you can change the depth of the queue
403 * buffers depending on the requirements of your application.
404 * @note The default is 16 bytes for both the transmission and receive
405 * buffers.
406 */
407#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
408#define SERIAL_BUFFERS_SIZE 16
409#endif
410
411/*===========================================================================*/
412/* SERIAL_USB driver related setting. */
413/*===========================================================================*/
414
415/**
416 * @brief Serial over USB buffers size.
417 * @details Configuration parameter, the buffer size must be a multiple of
418 * the USB data endpoint maximum packet size.
419 * @note The default is 256 bytes for both the transmission and receive
420 * buffers.
421 */
422#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
423#define SERIAL_USB_BUFFERS_SIZE 1
424#endif
425
426/**
427 * @brief Serial over USB number of buffers.
428 * @note The default is 2 buffers.
429 */
430#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
431#define SERIAL_USB_BUFFERS_NUMBER 2
432#endif
433
434/*===========================================================================*/
435/* SPI driver related settings. */
436/*===========================================================================*/
437
438/**
439 * @brief Enables synchronous APIs.
440 * @note Disabling this option saves both code and data space.
441 */
442#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
443#define SPI_USE_WAIT TRUE
444#endif
445
446/**
447 * @brief Enables circular transfers APIs.
448 * @note Disabling this option saves both code and data space.
449 */
450#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
451#define SPI_USE_CIRCULAR FALSE
452#endif
453
454
455/**
456 * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
457 * @note Disabling this option saves both code and data space.
458 */
459#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
460#define SPI_USE_MUTUAL_EXCLUSION TRUE
461#endif
462
463/**
464 * @brief Handling method for SPI CS line.
465 * @note Disabling this option saves both code and data space.
466 */
467#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
468#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
469#endif
470
471/*===========================================================================*/
472/* UART driver related settings. */
473/*===========================================================================*/
474
475/**
476 * @brief Enables synchronous APIs.
477 * @note Disabling this option saves both code and data space.
478 */
479#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
480#define UART_USE_WAIT FALSE
481#endif
482
483/**
484 * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
485 * @note Disabling this option saves both code and data space.
486 */
487#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
488#define UART_USE_MUTUAL_EXCLUSION FALSE
489#endif
490
491/*===========================================================================*/
492/* USB driver related settings. */
493/*===========================================================================*/
494
495/**
496 * @brief Enables synchronous APIs.
497 * @note Disabling this option saves both code and data space.
498 */
499#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
500#define USB_USE_WAIT TRUE
501#endif
502
503/*===========================================================================*/
504/* WSPI driver related settings. */
505/*===========================================================================*/
506
507/**
508 * @brief Enables synchronous APIs.
509 * @note Disabling this option saves both code and data space.
510 */
511#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
512#define WSPI_USE_WAIT TRUE
513#endif
514
515/**
516 * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
517 * @note Disabling this option saves both code and data space.
518 */
519#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
520#define WSPI_USE_MUTUAL_EXCLUSION TRUE
521#endif
522
523#endif /* HALCONF_H */
524
525/** @} */
diff --git a/platforms/chibios/GENERIC_STM32_F303XC/configs/mcuconf.h b/platforms/chibios/GENERIC_STM32_F303XC/configs/mcuconf.h
new file mode 100644
index 000000000..3b1588348
--- /dev/null
+++ b/platforms/chibios/GENERIC_STM32_F303XC/configs/mcuconf.h
@@ -0,0 +1,273 @@
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 * STM32F3xx 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 STM32F3xx_MCUCONF
35#define STM32F303_MCUCONF
36
37/*
38 * HAL driver system settings.
39 */
40#define STM32_NO_INIT FALSE
41#define STM32_PVD_ENABLE FALSE
42#define STM32_PLS STM32_PLS_LEV0
43#define STM32_HSI_ENABLED TRUE
44#define STM32_LSI_ENABLED TRUE
45#define STM32_HSE_ENABLED TRUE
46#define STM32_LSE_ENABLED FALSE
47#define STM32_SW STM32_SW_PLL
48#define STM32_PLLSRC STM32_PLLSRC_HSE
49#define STM32_PREDIV_VALUE 1
50#define STM32_PLLMUL_VALUE 9
51#define STM32_HPRE STM32_HPRE_DIV1
52#define STM32_PPRE1 STM32_PPRE1_DIV2
53#define STM32_PPRE2 STM32_PPRE2_DIV2
54#define STM32_MCOSEL STM32_MCOSEL_NOCLOCK
55#define STM32_ADC12PRES STM32_ADC12PRES_DIV1
56#define STM32_ADC34PRES STM32_ADC34PRES_DIV1
57#define STM32_USART1SW STM32_USART1SW_PCLK
58#define STM32_USART2SW STM32_USART2SW_PCLK
59#define STM32_USART3SW STM32_USART3SW_PCLK
60#define STM32_UART4SW STM32_UART4SW_PCLK
61#define STM32_UART5SW STM32_UART5SW_PCLK
62#define STM32_I2C1SW STM32_I2C1SW_SYSCLK
63#define STM32_I2C2SW STM32_I2C2SW_SYSCLK
64#define STM32_TIM1SW STM32_TIM1SW_PCLK2
65#define STM32_TIM8SW STM32_TIM8SW_PCLK2
66#define STM32_RTCSEL STM32_RTCSEL_LSI
67#define STM32_USB_CLOCK_REQUIRED TRUE
68#define STM32_USBPRE STM32_USBPRE_DIV1P5
69
70/*
71 * IRQ system settings.
72 */
73#define STM32_IRQ_EXTI0_PRIORITY 6
74#define STM32_IRQ_EXTI1_PRIORITY 6
75#define STM32_IRQ_EXTI2_PRIORITY 6
76#define STM32_IRQ_EXTI3_PRIORITY 6
77#define STM32_IRQ_EXTI4_PRIORITY 6
78#define STM32_IRQ_EXTI5_9_PRIORITY 6
79#define STM32_IRQ_EXTI10_15_PRIORITY 6
80#define STM32_IRQ_EXTI16_PRIORITY 6
81#define STM32_IRQ_EXTI17_PRIORITY 15
82#define STM32_IRQ_EXTI18_PRIORITY 6
83#define STM32_IRQ_EXTI19_PRIORITY 15
84#define STM32_IRQ_EXTI20_PRIORITY 15
85#define STM32_IRQ_EXTI21_22_29_PRIORITY 6
86#define STM32_IRQ_EXTI30_32_PRIORITY 6
87#define STM32_IRQ_EXTI33_PRIORITY 6
88#define STM32_IRQ_TIM1_BRK_TIM15_PRIORITY 7
89#define STM32_IRQ_TIM1_UP_TIM16_PRIORITY 7
90#define STM32_IRQ_TIM1_TRGCO_TIM17_PRIORITY 7
91#define STM32_IRQ_TIM1_CC_PRIORITY 7
92
93/*
94 * ADC driver system settings.
95 */
96#define STM32_ADC_DUAL_MODE FALSE
97#define STM32_ADC_COMPACT_SAMPLES FALSE
98#define STM32_ADC_USE_ADC1 FALSE
99#define STM32_ADC_USE_ADC2 FALSE
100#define STM32_ADC_USE_ADC3 FALSE
101#define STM32_ADC_USE_ADC4 FALSE
102#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(1, 1)
103#define STM32_ADC_ADC2_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
104#define STM32_ADC_ADC3_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
105#define STM32_ADC_ADC4_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
106#define STM32_ADC_ADC1_DMA_PRIORITY 2
107#define STM32_ADC_ADC2_DMA_PRIORITY 2
108#define STM32_ADC_ADC3_DMA_PRIORITY 2
109#define STM32_ADC_ADC4_DMA_PRIORITY 2
110#define STM32_ADC_ADC12_IRQ_PRIORITY 5
111#define STM32_ADC_ADC3_IRQ_PRIORITY 5
112#define STM32_ADC_ADC4_IRQ_PRIORITY 5
113#define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 5
114#define STM32_ADC_ADC2_DMA_IRQ_PRIORITY 5
115#define STM32_ADC_ADC3_DMA_IRQ_PRIORITY 5
116#define STM32_ADC_ADC4_DMA_IRQ_PRIORITY 5
117#define STM32_ADC_ADC12_CLOCK_MODE ADC_CCR_CKMODE_AHB_DIV1
118#define STM32_ADC_ADC34_CLOCK_MODE ADC_CCR_CKMODE_AHB_DIV1
119
120/*
121 * CAN driver system settings.
122 */
123#define STM32_CAN_USE_CAN1 FALSE
124#define STM32_CAN_CAN1_IRQ_PRIORITY 11
125
126/*
127 * DAC driver system settings.
128 */
129#define STM32_DAC_DUAL_MODE FALSE
130#define STM32_DAC_USE_DAC1_CH1 TRUE
131#define STM32_DAC_USE_DAC1_CH2 TRUE
132#define STM32_DAC_DAC1_CH1_IRQ_PRIORITY 10
133#define STM32_DAC_DAC1_CH2_IRQ_PRIORITY 10
134#define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2
135#define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2
136
137/*
138 * GPT driver system settings.
139 */
140#define STM32_GPT_USE_TIM1 FALSE
141#define STM32_GPT_USE_TIM2 FALSE
142#define STM32_GPT_USE_TIM3 FALSE
143#define STM32_GPT_USE_TIM4 FALSE
144#define STM32_GPT_USE_TIM6 TRUE
145#define STM32_GPT_USE_TIM7 TRUE
146#define STM32_GPT_USE_TIM8 TRUE
147#define STM32_GPT_USE_TIM15 FALSE
148#define STM32_GPT_USE_TIM16 FALSE
149#define STM32_GPT_USE_TIM17 FALSE
150#define STM32_GPT_TIM1_IRQ_PRIORITY 7
151#define STM32_GPT_TIM2_IRQ_PRIORITY 7
152#define STM32_GPT_TIM3_IRQ_PRIORITY 7
153#define STM32_GPT_TIM4_IRQ_PRIORITY 7
154#define STM32_GPT_TIM6_IRQ_PRIORITY 7
155#define STM32_GPT_TIM7_IRQ_PRIORITY 7
156#define STM32_GPT_TIM8_IRQ_PRIORITY 7
157
158/*
159 * I2C driver system settings.
160 */
161#define STM32_I2C_USE_I2C1 TRUE
162#define STM32_I2C_USE_I2C2 FALSE
163#define STM32_I2C_BUSY_TIMEOUT 50
164#define STM32_I2C_I2C1_IRQ_PRIORITY 10
165#define STM32_I2C_I2C2_IRQ_PRIORITY 10
166#define STM32_I2C_USE_DMA TRUE
167#define STM32_I2C_I2C1_DMA_PRIORITY 1
168#define STM32_I2C_I2C2_DMA_PRIORITY 1
169#define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
170
171/*
172 * ICU driver system settings.
173 */
174#define STM32_ICU_USE_TIM1 FALSE
175#define STM32_ICU_USE_TIM2 FALSE
176#define STM32_ICU_USE_TIM3 FALSE
177#define STM32_ICU_USE_TIM4 FALSE
178#define STM32_ICU_USE_TIM8 FALSE
179#define STM32_ICU_USE_TIM15 FALSE
180#define STM32_ICU_TIM1_IRQ_PRIORITY 7
181#define STM32_ICU_TIM2_IRQ_PRIORITY 7
182#define STM32_ICU_TIM3_IRQ_PRIORITY 7
183#define STM32_ICU_TIM4_IRQ_PRIORITY 7
184#define STM32_ICU_TIM8_IRQ_PRIORITY 7
185
186/*
187 * PWM driver system settings.
188 */
189#define STM32_PWM_USE_ADVANCED FALSE
190#define STM32_PWM_USE_TIM1 FALSE
191#define STM32_PWM_USE_TIM2 FALSE
192#define STM32_PWM_USE_TIM3 TRUE
193#define STM32_PWM_USE_TIM4 TRUE
194#define STM32_PWM_USE_TIM8 FALSE
195#define STM32_PWM_USE_TIM15 FALSE
196#define STM32_PWM_USE_TIM16 FALSE
197#define STM32_PWM_USE_TIM17 FALSE
198#define STM32_PWM_TIM1_IRQ_PRIORITY 7
199#define STM32_PWM_TIM2_IRQ_PRIORITY 7
200#define STM32_PWM_TIM3_IRQ_PRIORITY 7
201#define STM32_PWM_TIM4_IRQ_PRIORITY 7
202#define STM32_PWM_TIM8_IRQ_PRIORITY 7
203
204/*
205 * RTC driver system settings.
206 */
207#define STM32_RTC_PRESA_VALUE 32
208#define STM32_RTC_PRESS_VALUE 1024
209#define STM32_RTC_CR_INIT 0
210#define STM32_RTC_TAMPCR_INIT 0
211
212/*
213 * SERIAL driver system settings.
214 */
215#define STM32_SERIAL_USE_USART1 FALSE
216#define STM32_SERIAL_USE_USART2 TRUE
217#define STM32_SERIAL_USE_USART3 FALSE
218#define STM32_SERIAL_USE_UART4 FALSE
219#define STM32_SERIAL_USE_UART5 FALSE
220#define STM32_SERIAL_USART1_PRIORITY 12
221#define STM32_SERIAL_USART2_PRIORITY 12
222#define STM32_SERIAL_USART3_PRIORITY 12
223#define STM32_SERIAL_UART4_PRIORITY 12
224#define STM32_SERIAL_UART5_PRIORITY 12
225
226/*
227 * SPI driver system settings.
228 */
229#define STM32_SPI_USE_SPI1 FALSE
230#define STM32_SPI_USE_SPI2 TRUE
231#define STM32_SPI_USE_SPI3 FALSE
232#define STM32_SPI_SPI1_DMA_PRIORITY 1
233#define STM32_SPI_SPI2_DMA_PRIORITY 1
234#define STM32_SPI_SPI3_DMA_PRIORITY 1
235#define STM32_SPI_SPI1_IRQ_PRIORITY 10
236#define STM32_SPI_SPI2_IRQ_PRIORITY 10
237#define STM32_SPI_SPI3_IRQ_PRIORITY 10
238#define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
239
240/*
241 * ST driver system settings.
242 */
243#define STM32_ST_IRQ_PRIORITY 8
244#define STM32_ST_USE_TIMER 2
245
246/*
247 * UART driver system settings.
248 */
249#define STM32_UART_USE_USART1 FALSE
250#define STM32_UART_USE_USART2 FALSE
251#define STM32_UART_USE_USART3 FALSE
252#define STM32_UART_USART1_IRQ_PRIORITY 12
253#define STM32_UART_USART2_IRQ_PRIORITY 12
254#define STM32_UART_USART3_IRQ_PRIORITY 12
255#define STM32_UART_USART1_DMA_PRIORITY 0
256#define STM32_UART_USART2_DMA_PRIORITY 0
257#define STM32_UART_USART3_DMA_PRIORITY 0
258#define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")
259
260/*
261 * USB driver system settings.
262 */
263#define STM32_USB_USE_USB1 TRUE
264#define STM32_USB_LOW_POWER_ON_SUSPEND FALSE
265#define STM32_USB_USB1_HP_IRQ_PRIORITY 13
266#define STM32_USB_USB1_LP_IRQ_PRIORITY 14
267
268/*
269 * WDG driver system settings.
270 */
271#define STM32_WDG_USE_IWDG FALSE
272
273#endif /* MCUCONF_H */
diff --git a/platforms/chibios/GENERIC_STM32_F303XC/configs/proton_c.mk b/platforms/chibios/GENERIC_STM32_F303XC/configs/proton_c.mk
new file mode 100644
index 000000000..23907c810
--- /dev/null
+++ b/platforms/chibios/GENERIC_STM32_F303XC/configs/proton_c.mk
@@ -0,0 +1,9 @@
1# Proton C MCU settings for converting AVR projects
2MCU = STM32F303
3
4# These are defaults based on what has been implemented for ARM boards
5AUDIO_ENABLE = yes
6WS2812_DRIVER = bitbang
7
8# Force task driven PWM until ARM can provide automatic configuration
9BACKLIGHT_DRIVER = software
diff --git a/platforms/chibios/IC_TEENSY_3_1/board/board.c b/platforms/chibios/IC_TEENSY_3_1/board/board.c
new file mode 100644
index 000000000..63e3f6492
--- /dev/null
+++ b/platforms/chibios/IC_TEENSY_3_1/board/board.c
@@ -0,0 +1,146 @@
1/*
2 ChibiOS - Copyright (C) 2015 RedoX https://github.com/RedoXyde
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#include "hal.h"
17
18#if HAL_USE_PAL || defined(__DOXYGEN__)
19/**
20 * @brief PAL setup.
21 * @details Digital I/O ports static configuration as defined in @p board.h.
22 * This variable is used by the HAL when initializing the PAL driver.
23 */
24const PALConfig pal_default_config = {
25 .ports =
26 {
27 {
28 /*
29 * PORTA setup.
30 *
31 * PTA4 - PIN33
32 * PTA5 - PIN24
33 * PTA12 - PIN3
34 * PTA13 - PIN4
35 *
36 * PTA18/19 crystal
37 * PTA0/3 SWD
38 */
39 .port = IOPORT1,
40 .pads =
41 {
42 PAL_MODE_ALTERNATIVE_7, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_ALTERNATIVE_7, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_INPUT_ANALOG, PAL_MODE_INPUT_ANALOG, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
43 },
44 },
45 {
46 /*
47 * PORTB setup.
48 *
49 * PTB0 - PIN16
50 * PTB1 - PIN17
51 * PTB2 - PIN19
52 * PTB3 - PIN18
53 * PTB16 - PIN0 - UART0_TX
54 * PTB17 - PIN1 - UART0_RX
55 * PTB18 - PIN32
56 * PTB19 - PIN25
57 */
58 .port = IOPORT2,
59 .pads =
60 {
61 PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_ALTERNATIVE_3, PAL_MODE_ALTERNATIVE_3, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
62 },
63 },
64 {
65 /*
66 * PORTC setup.
67 *
68 * PTC0 - PIN15
69 * PTC1 - PIN22
70 * PTC2 - PIN23
71 * PTC3 - PIN9
72 * PTC4 - PIN10
73 * PTC5 - PIN13
74 * PTC6 - PIN11
75 * PTC7 - PIN12
76 * PTC8 - PIN28
77 * PTC9 - PIN27
78 * PTC10 - PIN29
79 * PTC11 - PIN30
80 */
81 .port = IOPORT3,
82 .pads =
83 {
84 PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
85 },
86 },
87 {
88 /*
89 * PORTD setup.
90 *
91 * PTD0 - PIN2
92 * PTD1 - PIN14
93 * PTD2 - PIN7
94 * PTD3 - PIN8
95 * PTD4 - PIN6
96 * PTD5 - PIN20
97 * PTD6 - PIN21
98 * PTD7 - PIN5
99 */
100 .port = IOPORT4,
101 .pads =
102 {
103 PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
104 },
105 },
106 {
107 /*
108 * PORTE setup.
109 *
110 * PTE0 - PIN31
111 * PTE1 - PIN26
112 */
113 .port = IOPORT5,
114 .pads =
115 {
116 PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_OUTPUT_PUSHPULL, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED, PAL_MODE_UNCONNECTED,
117 },
118 },
119 },
120};
121#endif
122
123// NOTE: This value comes from kiibohd/controller and is the location of a value
124// which needs to be checked before disabling the watchdog (which happens in
125// k20x_clock_init)
126#define WDOG_TMROUTL *(volatile uint16_t *)0x40052012
127
128/**
129 * @brief Early initialization code.
130 * @details This initialization must be performed just after stack setup
131 * and before any other initialization.
132 */
133void __early_init(void) {
134 // This is a dirty hack and should only be used as a temporary fix until this
135 // is upstreamed.
136 while (WDOG_TMROUTL < 2)
137 ; // Must wait for WDOG timer if already running, before jumping
138
139 k20x_clock_init();
140}
141
142/**
143 * @brief Board-specific initialization code.
144 * @todo Add your board-specific code, if any.
145 */
146void boardInit(void) {}
diff --git a/platforms/chibios/IC_TEENSY_3_1/board/board.h b/platforms/chibios/IC_TEENSY_3_1/board/board.h
new file mode 100644
index 000000000..c8259ab0c
--- /dev/null
+++ b/platforms/chibios/IC_TEENSY_3_1/board/board.h
@@ -0,0 +1,295 @@
1/*
2 ChibiOS - Copyright (C) 2015 RedoX https://github.com/RedoXyde
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 _BOARD_H_
18#define _BOARD_H_
19
20/*
21 * Setup for the PJRC Teensy 3.1 board.
22 */
23
24/*
25 * Board identifier.
26 */
27#define BOARD_PJRC_TEENSY_3_1
28#define BOARD_NAME "PJRC Teensy 3.1"
29
30/* External 16 MHz crystal */
31#define KINETIS_XTAL_FREQUENCY 16000000UL
32
33/* Use internal capacitors for the crystal */
34#define KINETIS_BOARD_OSCILLATOR_SETTING OSC_CR_SC8P | OSC_CR_SC2P
35
36/*
37 * MCU type
38 */
39#define K20x7
40
41/*
42 * IO pins assignments.
43 */
44#define PORTA_PIN0 0
45#define PORTA_PIN1 1
46#define PORTA_PIN2 2
47#define PORTA_PIN3 3
48#define TEENSY_PIN33 4
49#define TEENSY_PIN24 5
50#define PORTA_PIN6 6
51#define PORTA_PIN7 7
52#define PORTA_PIN8 8
53#define PORTA_PIN9 9
54#define PORTA_PIN10 10
55#define PORTA_PIN11 11
56#define TEENSY_PIN3 12
57#define TEENSY_PIN4 13
58#define PORTA_PIN14 14
59#define PORTA_PIN15 15
60#define PORTA_PIN16 16
61#define PORTA_PIN17 17
62#define PORTA_PIN18 18
63#define PORTA_PIN19 19
64#define PORTA_PIN20 20
65#define PORTA_PIN21 21
66#define PORTA_PIN22 22
67#define PORTA_PIN23 23
68#define PORTA_PIN24 24
69#define PORTA_PIN25 25
70#define PORTA_PIN26 26
71#define PORTA_PIN27 27
72#define PORTA_PIN28 28
73#define PORTA_PIN29 29
74#define PORTA_PIN30 30
75#define PORTA_PIN31 31
76
77#define TEENSY_PIN3_IOPORT IOPORT1
78#define TEENSY_PIN4_IOPORT IOPORT1
79#define TEENSY_PIN24_IOPORT IOPORT1
80#define TEENSY_PIN33_IOPORT IOPORT1
81
82#define TEENSY_PIN16 0
83#define TEENSY_PIN17 1
84#define TEENSY_PIN19 2
85#define TEENSY_PIN18 3
86#define PORTB_PIN4 4
87#define PORTB_PIN5 5
88#define PORTB_PIN6 6
89#define PORTB_PIN7 7
90#define PORTB_PIN8 8
91#define PORTB_PIN9 9
92#define PORTB_PIN10 10
93#define PORTB_PIN11 11
94#define PORTB_PIN12 12
95#define PORTB_PIN13 13
96#define PORTB_PIN14 14
97#define PORTB_PIN15 15
98#define TEENSY_PIN0 16
99#define TEENSY_PIN1 17
100#define TEENSY_PIN32 18
101#define TEENSY_PIN25 19
102#define PORTB_PIN20 20
103#define PORTB_PIN21 21
104#define PORTB_PIN22 22
105#define PORTB_PIN23 23
106#define PORTB_PIN24 24
107#define PORTB_PIN25 25
108#define PORTB_PIN26 26
109#define PORTB_PIN27 27
110#define PORTB_PIN28 28
111#define PORTB_PIN29 29
112#define PORTB_PIN30 30
113#define PORTB_PIN31 31
114
115#define TEENSY_PIN0_IOPORT IOPORT2
116#define TEENSY_PIN1_IOPORT IOPORT2
117#define TEENSY_PIN16_IOPORT IOPORT2
118#define TEENSY_PIN17_IOPORT IOPORT2
119#define TEENSY_PIN18_IOPORT IOPORT2
120#define TEENSY_PIN19_IOPORT IOPORT2
121#define TEENSY_PIN25_IOPORT IOPORT2
122#define TEENSY_PIN32_IOPORT IOPORT2
123
124#define TEENSY_PIN15 0
125#define TEENSY_PIN22 1
126#define TEENSY_PIN23 2
127#define TEENSY_PIN9 3
128#define TEENSY_PIN10 4
129#define TEENSY_PIN13 5
130#define TEENSY_PIN11 6
131#define TEENSY_PIN12 7
132#define TEENSY_PIN28 8
133#define TEENSY_PIN27 9
134#define TEENSY_PIN29 10
135#define TEENSY_PIN30 11
136#define PORTC_PIN12 12
137#define PORTC_PIN13 13
138#define PORTC_PIN14 14
139#define PORTC_PIN15 15
140#define PORTC_PIN16 16
141#define PORTC_PIN17 17
142#define PORTC_PIN18 18
143#define PORTC_PIN19 19
144#define PORTC_PIN20 20
145#define PORTC_PIN21 21
146#define PORTC_PIN22 22
147#define PORTC_PIN23 23
148#define PORTC_PIN24 24
149#define PORTC_PIN25 25
150#define PORTC_PIN26 26
151#define PORTC_PIN27 27
152#define PORTC_PIN28 28
153#define PORTC_PIN29 29
154#define PORTC_PIN30 30
155#define PORTC_PIN31 31
156
157#define TEENSY_PIN9_IOPORT IOPORT3
158#define TEENSY_PIN10_IOPORT IOPORT3
159#define TEENSY_PIN11_IOPORT IOPORT3
160#define TEENSY_PIN12_IOPORT IOPORT3
161#define TEENSY_PIN13_IOPORT IOPORT3
162#define TEENSY_PIN15_IOPORT IOPORT3
163#define TEENSY_PIN22_IOPORT IOPORT3
164#define TEENSY_PIN23_IOPORT IOPORT3
165#define TEENSY_PIN27_IOPORT IOPORT3
166#define TEENSY_PIN28_IOPORT IOPORT3
167#define TEENSY_PIN29_IOPORT IOPORT3
168#define TEENSY_PIN30_IOPORT IOPORT3
169
170#define TEENSY_PIN2 0
171#define TEENSY_PIN14 1
172#define TEENSY_PIN7 2
173#define TEENSY_PIN8 3
174#define TEENSY_PIN6 4
175#define TEENSY_PIN20 5
176#define TEENSY_PIN21 6
177#define TEENSY_PIN5 7
178#define PORTD_PIN8 8
179#define PORTD_PIN9 9
180#define PORTD_PIN10 10
181#define PORTD_PIN11 11
182#define PORTD_PIN12 12
183#define PORTD_PIN13 13
184#define PORTD_PIN14 14
185#define PORTD_PIN15 15
186#define PORTD_PIN16 16
187#define PORTD_PIN17 17
188#define PORTD_PIN18 18
189#define PORTD_PIN19 19
190#define PORTD_PIN20 20
191#define PORTD_PIN21 21
192#define PORTD_PIN22 22
193#define PORTD_PIN23 23
194#define PORTD_PIN24 24
195#define PORTD_PIN25 25
196#define PORTD_PIN26 26
197#define PORTD_PIN27 27
198#define PORTD_PIN28 28
199#define PORTD_PIN29 29
200#define PORTD_PIN30 30
201#define PORTD_PIN31 31
202
203#define TEENSY_PIN2_IOPORT IOPORT4
204#define TEENSY_PIN5_IOPORT IOPORT4
205#define TEENSY_PIN6_IOPORT IOPORT4
206#define TEENSY_PIN7_IOPORT IOPORT4
207#define TEENSY_PIN8_IOPORT IOPORT4
208#define TEENSY_PIN14_IOPORT IOPORT4
209#define TEENSY_PIN20_IOPORT IOPORT4
210#define TEENSY_PIN21_IOPORT IOPORT4
211
212#define TEENSY_PIN31 0
213#define TEENSY_PIN26 1
214#define PORTE_PIN2 2
215#define PORTE_PIN3 3
216#define PORTE_PIN4 4
217#define PORTE_PIN5 5
218#define PORTE_PIN6 6
219#define PORTE_PIN7 7
220#define PORTE_PIN8 8
221#define PORTE_PIN9 9
222#define PORTE_PIN10 10
223#define PORTE_PIN11 11
224#define PORTE_PIN12 12
225#define PORTE_PIN13 13
226#define PORTE_PIN14 14
227#define PORTE_PIN15 15
228#define PORTE_PIN16 16
229#define PORTE_PIN17 17
230#define PORTE_PIN18 18
231#define PORTE_PIN19 19
232#define PORTE_PIN20 20
233#define PORTE_PIN21 21
234#define PORTE_PIN22 22
235#define PORTE_PIN23 23
236#define PORTE_PIN24 24
237#define PORTE_PIN25 25
238#define PORTE_PIN26 26
239#define PORTE_PIN27 27
240#define PORTE_PIN28 28
241#define PORTE_PIN29 29
242#define PORTE_PIN30 30
243#define PORTE_PIN31 31
244
245#define TEENSY_PIN26_IOPORT IOPORT5
246#define TEENSY_PIN31_IOPORT IOPORT5
247
248#define LINE_PIN1 PAL_LINE(TEENSY_PIN1_IOPORT, TEENSY_PIN1)
249#define LINE_PIN2 PAL_LINE(TEENSY_PIN2_IOPORT, TEENSY_PIN2)
250#define LINE_PIN3 PAL_LINE(TEENSY_PIN3_IOPORT, TEENSY_PIN3)
251#define LINE_PIN4 PAL_LINE(TEENSY_PIN4_IOPORT, TEENSY_PIN4)
252#define LINE_PIN5 PAL_LINE(TEENSY_PIN5_IOPORT, TEENSY_PIN5)
253#define LINE_PIN6 PAL_LINE(TEENSY_PIN6_IOPORT, TEENSY_PIN6)
254#define LINE_PIN7 PAL_LINE(TEENSY_PIN7_IOPORT, TEENSY_PIN7)
255#define LINE_PIN8 PAL_LINE(TEENSY_PIN8_IOPORT, TEENSY_PIN8)
256#define LINE_PIN9 PAL_LINE(TEENSY_PIN9_IOPORT, TEENSY_PIN9)
257#define LINE_PIN10 PAL_LINE(TEENSY_PIN10_IOPORT, TEENSY_PIN10)
258#define LINE_PIN11 PAL_LINE(TEENSY_PIN11_IOPORT, TEENSY_PIN11)
259#define LINE_PIN12 PAL_LINE(TEENSY_PIN12_IOPORT, TEENSY_PIN12)
260#define LINE_PIN13 PAL_LINE(TEENSY_PIN13_IOPORT, TEENSY_PIN13)
261#define LINE_PIN14 PAL_LINE(TEENSY_PIN14_IOPORT, TEENSY_PIN14)
262#define LINE_PIN15 PAL_LINE(TEENSY_PIN15_IOPORT, TEENSY_PIN15)
263#define LINE_PIN16 PAL_LINE(TEENSY_PIN16_IOPORT, TEENSY_PIN16)
264#define LINE_PIN17 PAL_LINE(TEENSY_PIN17_IOPORT, TEENSY_PIN17)
265#define LINE_PIN18 PAL_LINE(TEENSY_PIN18_IOPORT, TEENSY_PIN18)
266#define LINE_PIN19 PAL_LINE(TEENSY_PIN19_IOPORT, TEENSY_PIN19)
267#define LINE_PIN20 PAL_LINE(TEENSY_PIN20_IOPORT, TEENSY_PIN20)
268#define LINE_PIN21 PAL_LINE(TEENSY_PIN21_IOPORT, TEENSY_PIN21)
269#define LINE_PIN22 PAL_LINE(TEENSY_PIN22_IOPORT, TEENSY_PIN22)
270#define LINE_PIN23 PAL_LINE(TEENSY_PIN23_IOPORT, TEENSY_PIN23)
271#define LINE_PIN24 PAL_LINE(TEENSY_PIN24_IOPORT, TEENSY_PIN24)
272#define LINE_PIN25 PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25)
273#define LINE_PIN25 PAL_LINE(TEENSY_PIN25_IOPORT, TEENSY_PIN25)
274#define LINE_PIN26 PAL_LINE(TEENSY_PIN26_IOPORT, TEENSY_PIN26)
275#define LINE_PIN27 PAL_LINE(TEENSY_PIN27_IOPORT, TEENSY_PIN27)
276#define LINE_PIN28 PAL_LINE(TEENSY_PIN28_IOPORT, TEENSY_PIN28)
277#define LINE_PIN29 PAL_LINE(TEENSY_PIN29_IOPORT, TEENSY_PIN29)
278#define LINE_PIN30 PAL_LINE(TEENSY_PIN30_IOPORT, TEENSY_PIN30)
279#define LINE_PIN31 PAL_LINE(TEENSY_PIN31_IOPORT, TEENSY_PIN31)
280#define LINE_PIN32 PAL_LINE(TEENSY_PIN32_IOPORT, TEENSY_PIN32)
281#define LINE_PIN33 PAL_LINE(TEENSY_PIN33_IOPORT, TEENSY_PIN33)
282
283#define LINE_LED LINE_PIN13
284
285#if !defined(_FROM_ASM_)
286# ifdef __cplusplus
287extern "C" {
288# endif
289void boardInit(void);
290# ifdef __cplusplus
291}
292# endif
293#endif /* _FROM_ASM_ */
294
295#endif /* _BOARD_H_ */
diff --git a/platforms/chibios/IC_TEENSY_3_1/board/board.mk b/platforms/chibios/IC_TEENSY_3_1/board/board.mk
new file mode 100644
index 000000000..842e33590
--- /dev/null
+++ b/platforms/chibios/IC_TEENSY_3_1/board/board.mk
@@ -0,0 +1,9 @@
1# List of all the board related files.
2BOARDSRC = $(BOARD_PATH)/board/board.c
3
4# Required include directories
5BOARDINC = $(BOARD_PATH)/board
6
7# Shared variables
8ALLCSRC += $(BOARDSRC)
9ALLINC += $(BOARDINC)
diff --git a/platforms/chibios/STM32_F103_STM32DUINO/board/board.c b/platforms/chibios/STM32_F103_STM32DUINO/board/board.c
new file mode 100644
index 000000000..9135f6136
--- /dev/null
+++ b/platforms/chibios/STM32_F103_STM32DUINO/board/board.c
@@ -0,0 +1,59 @@
1/*
2 ChibiOS - Copyright (C) 2006..2015 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// Value to place in RTC backup register 10 for persistent bootloader mode
20#define RTC_BOOTLOADER_FLAG 0x424C
21
22/**
23 * @brief PAL setup.
24 * @details Digital I/O ports static configuration as defined in @p board.h.
25 * This variable is used by the HAL when initializing the PAL driver.
26 */
27#if HAL_USE_PAL || defined(__DOXYGEN__)
28const PALConfig pal_default_config =
29{
30 {VAL_GPIOAODR, VAL_GPIOACRL, VAL_GPIOACRH},
31 {VAL_GPIOBODR, VAL_GPIOBCRL, VAL_GPIOBCRH},
32 {VAL_GPIOCODR, VAL_GPIOCCRL, VAL_GPIOCCRH},
33 {VAL_GPIODODR, VAL_GPIODCRL, VAL_GPIODCRH},
34 {VAL_GPIOEODR, VAL_GPIOECRL, VAL_GPIOECRH},
35};
36#endif
37
38__attribute__((weak)) void enter_bootloader_mode_if_requested(void) {}
39
40/*
41 * Early initialization code.
42 * This initialization must be performed just after stack setup and before
43 * any other initialization.
44 */
45void __early_init(void) {
46 enter_bootloader_mode_if_requested();
47
48 stm32_clock_init();
49}
50
51/*
52 * Board-specific initialization code.
53 */
54void boardInit(void) {
55 //JTAG-DP Disabled and SW-DP Enabled
56 AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_JTAGDISABLE;
57 //Set backup register DR10 to enter bootloader on reset
58 BKP->DR10 = RTC_BOOTLOADER_FLAG;
59}
diff --git a/platforms/chibios/STM32_F103_STM32DUINO/board/board.h b/platforms/chibios/STM32_F103_STM32DUINO/board/board.h
new file mode 100644
index 000000000..09d182d6c
--- /dev/null
+++ b/platforms/chibios/STM32_F103_STM32DUINO/board/board.h
@@ -0,0 +1,166 @@
1/*
2 ChibiOS - Copyright (C) 2006..2015 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 _BOARD_H_
18#define _BOARD_H_
19
20/*
21 * Setup for a Generic STM32F103 board.
22 */
23
24/*
25 * Board identifier.
26 */
27#define BOARD_STM32_F103_STM32DUINO
28#define BOARD_NAME "GENERIC STM32F103C8T6 board - stm32duino bootloader"
29
30/*
31 * Board frequencies.
32 */
33#define STM32_LSECLK 32768
34#define STM32_HSECLK 8000000
35
36/*
37 * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
38 */
39#define STM32F103xB
40
41/*
42 * IO pins assignments
43 */
44
45/* on-board */
46
47#define GPIOA_LED 8
48#define GPIOD_OSC_IN 0
49#define GPIOD_OSC_OUT 1
50
51/* In case your board has a "USB enable" hardware
52 controlled by a pin, define it here. (It could be just
53 a 1.5k resistor connected to D+ line.)
54*/
55/*
56#define GPIOB_USB_DISC 10
57*/
58
59/*
60 * I/O ports initial setup, this configuration is established soon after reset
61 * in the initialization code.
62 *
63 * The digits have the following meaning:
64 * 0 - Analog input.
65 * 1 - Push Pull output 10MHz.
66 * 2 - Push Pull output 2MHz.
67 * 3 - Push Pull output 50MHz.
68 * 4 - Digital input.
69 * 5 - Open Drain output 10MHz.
70 * 6 - Open Drain output 2MHz.
71 * 7 - Open Drain output 50MHz.
72 * 8 - Digital input with PullUp or PullDown resistor depending on ODR.
73 * 9 - Alternate Push Pull output 10MHz.
74 * A - Alternate Push Pull output 2MHz.
75 * B - Alternate Push Pull output 50MHz.
76 * C - Reserved.
77 * D - Alternate Open Drain output 10MHz.
78 * E - Alternate Open Drain output 2MHz.
79 * F - Alternate Open Drain output 50MHz.
80 * Please refer to the STM32 Reference Manual for details.
81 */
82
83/*
84 * Port A setup.
85 * Everything input with pull-up except:
86 * PA2 - Alternate output (USART2 TX).
87 * PA3 - Normal input (USART2 RX).
88 * PA9 - Alternate output (USART1 TX).
89 * PA10 - Normal input (USART1 RX).
90 */
91#define VAL_GPIOACRL 0x88884B88 /* PA7...PA0 */
92#define VAL_GPIOACRH 0x888884B8 /* PA15...PA8 */
93#define VAL_GPIOAODR 0xFFFFFFFF
94
95/*
96 * Port B setup.
97 * Everything input with pull-up except:
98 * PB10 - Push Pull output (USB switch).
99 */
100#define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */
101#define VAL_GPIOBCRH 0x88888388 /* PB15...PB8 */
102#define VAL_GPIOBODR 0xFFFFFFFF
103
104/*
105 * Port C setup.
106 * Everything input with pull-up except:
107 * PC13 - Push Pull output (LED).
108 */
109#define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */
110#define VAL_GPIOCCRH 0x88388888 /* PC15...PC8 */
111#define VAL_GPIOCODR 0xFFFFFFFF
112
113/*
114 * Port D setup.
115 * Everything input with pull-up except:
116 * PD0 - Normal input (XTAL).
117 * PD1 - Normal input (XTAL).
118 */
119#define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */
120#define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */
121#define VAL_GPIODODR 0xFFFFFFFF
122
123/*
124 * Port E setup.
125 * Everything input with pull-up except:
126 */
127#define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */
128#define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */
129#define VAL_GPIOEODR 0xFFFFFFFF
130
131/*
132 * USB bus activation macro, required by the USB driver.
133 */
134/* The point is that most of the generic STM32F103* boards
135 have a 1.5k resistor connected on one end to the D+ line
136 and on the other end to some pin. Or even a slightly more
137 complicated "USB enable" circuit, controlled by a pin.
138 That should go here.
139
140 However on some boards (e.g. one that I have), there's no
141 such hardware. In which case it's better to not do anything.
142*/
143/*
144#define usb_lld_connect_bus(usbp) palClearPad(GPIOB, GPIOB_USB_DISC)
145*/
146#define usb_lld_connect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_INPUT);
147
148/*
149 * USB bus de-activation macro, required by the USB driver.
150 */
151/*
152#define usb_lld_disconnect_bus(usbp) palSetPad(GPIOB, GPIOB_USB_DISC)
153*/
154#define usb_lld_disconnect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_OUTPUT_PUSHPULL); palClearPad(GPIOA, 12);
155
156#if !defined(_FROM_ASM_)
157#ifdef __cplusplus
158extern "C" {
159#endif
160 void boardInit(void);
161#ifdef __cplusplus
162}
163#endif
164#endif /* _FROM_ASM_ */
165
166#endif /* _BOARD_H_ */
diff --git a/platforms/chibios/STM32_F103_STM32DUINO/board/board.mk b/platforms/chibios/STM32_F103_STM32DUINO/board/board.mk
new file mode 100644
index 000000000..842e33590
--- /dev/null
+++ b/platforms/chibios/STM32_F103_STM32DUINO/board/board.mk
@@ -0,0 +1,9 @@
1# List of all the board related files.
2BOARDSRC = $(BOARD_PATH)/board/board.c
3
4# Required include directories
5BOARDINC = $(BOARD_PATH)/board
6
7# Shared variables
8ALLCSRC += $(BOARDSRC)
9ALLINC += $(BOARDINC)
diff --git a/platforms/chibios/keyboard-config-templates/board.h b/platforms/chibios/keyboard-config-templates/board.h
new file mode 100644
index 000000000..967ec13a1
--- /dev/null
+++ b/platforms/chibios/keyboard-config-templates/board.h
@@ -0,0 +1,20 @@
1/* Copyright 2020 Nick Brassel (tzarc)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <https://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#include_next "board.h"
19
20// #undef STM32_HSE_BYPASS
diff --git a/platforms/chibios/keyboard-config-templates/chconf.h b/platforms/chibios/keyboard-config-templates/chconf.h
new file mode 100644
index 000000000..7c2af93f5
--- /dev/null
+++ b/platforms/chibios/keyboard-config-templates/chconf.h
@@ -0,0 +1,20 @@
1/* Copyright 2020 Nick Brassel (tzarc)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <https://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18// #define CH_CFG_OPTIMIZE_SPEED TRUE
19
20#include_next "chconf.h"
diff --git a/platforms/chibios/keyboard-config-templates/halconf.h b/platforms/chibios/keyboard-config-templates/halconf.h
new file mode 100644
index 000000000..ab5f738f9
--- /dev/null
+++ b/platforms/chibios/keyboard-config-templates/halconf.h
@@ -0,0 +1,20 @@
1/* Copyright 2020 Nick Brassel (tzarc)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <https://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18// #define HAL_USE_DAC TRUE
19
20#include_next "halconf.h"
diff --git a/platforms/chibios/keyboard-config-templates/mcuconf.h b/platforms/chibios/keyboard-config-templates/mcuconf.h
new file mode 100644
index 000000000..5b42747b9
--- /dev/null
+++ b/platforms/chibios/keyboard-config-templates/mcuconf.h
@@ -0,0 +1,21 @@
1/* Copyright 2020 Nick Brassel (tzarc)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <https://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#include_next "mcuconf.h"
19
20// #undef STM32_HSE_ENABLED
21// #define STM32_HSE_ENABLED FALSE
diff --git a/platforms/chibios/ld/MKL26Z64.ld b/platforms/chibios/ld/MKL26Z64.ld
new file mode 100644
index 000000000..c4ca8b874
--- /dev/null
+++ b/platforms/chibios/ld/MKL26Z64.ld
@@ -0,0 +1,105 @@
1/*
2 * Copyright (C) 2013-2016 Fabio Utzig, http://fabioutzig.com
3 * (C) 2016 flabbergast <s3+flabbergast@sdfeu.org>
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 */
23
24/*
25 * KL26Z64 memory setup.
26 */
27MEMORY
28{
29 flash0 : org = 0x00000000, len = 0x100
30 flash1 : org = 0x00000400, len = 0x10
31 flash2 : org = 0x00000410, len = 62k - 0x410
32 flash3 : org = 0x0000F800, len = 2k
33 flash4 : org = 0x00000000, len = 0
34 flash5 : org = 0x00000000, len = 0
35 flash6 : org = 0x00000000, len = 0
36 flash7 : org = 0x00000000, len = 0
37 ram0 : org = 0x1FFFF800, len = 8k
38 ram1 : org = 0x00000000, len = 0
39 ram2 : org = 0x00000000, len = 0
40 ram3 : org = 0x00000000, len = 0
41 ram4 : org = 0x00000000, len = 0
42 ram5 : org = 0x00000000, len = 0
43 ram6 : org = 0x00000000, len = 0
44 ram7 : org = 0x00000000, len = 0
45}
46
47/* Flash region for the configuration bytes.*/
48SECTIONS
49{
50 .cfmprotect : ALIGN(4) SUBALIGN(4)
51 {
52 KEEP(*(.cfmconfig))
53 } > flash1
54}
55
56/* For each data/text section two region are defined, a virtual region
57 and a load region (_LMA suffix).*/
58
59/* Flash region to be used for exception vectors.*/
60REGION_ALIAS("VECTORS_FLASH", flash0);
61REGION_ALIAS("VECTORS_FLASH_LMA", flash0);
62
63/* Flash region to be used for constructors and destructors.*/
64REGION_ALIAS("XTORS_FLASH", flash2);
65REGION_ALIAS("XTORS_FLASH_LMA", flash2);
66
67/* Flash region to be used for code text.*/
68REGION_ALIAS("TEXT_FLASH", flash2);
69REGION_ALIAS("TEXT_FLASH_LMA", flash2);
70
71/* Flash region to be used for read only data.*/
72REGION_ALIAS("RODATA_FLASH", flash2);
73REGION_ALIAS("RODATA_FLASH_LMA", flash2);
74
75/* Flash region to be used for various.*/
76REGION_ALIAS("VARIOUS_FLASH", flash2);
77REGION_ALIAS("VARIOUS_FLASH_LMA", flash2);
78
79/* Flash region to be used for RAM(n) initialization data.*/
80REGION_ALIAS("RAM_INIT_FLASH_LMA", flash2);
81
82/* RAM region to be used for Main stack. This stack accommodates the processing
83 of all exceptions and interrupts.*/
84REGION_ALIAS("MAIN_STACK_RAM", ram0);
85
86/* RAM region to be used for the process stack. This is the stack used by
87 the main() function.*/
88REGION_ALIAS("PROCESS_STACK_RAM", ram0);
89
90/* RAM region to be used for data segment.*/
91REGION_ALIAS("DATA_RAM", ram0);
92REGION_ALIAS("DATA_RAM_LMA", flash2);
93
94/* RAM region to be used for BSS segment.*/
95REGION_ALIAS("BSS_RAM", ram0);
96
97/* RAM region to be used for the default heap.*/
98REGION_ALIAS("HEAP_RAM", ram0);
99
100__eeprom_workarea_start__ = ORIGIN(flash3);
101__eeprom_workarea_size__ = LENGTH(flash3);
102__eeprom_workarea_end__ = __eeprom_workarea_start__ + __eeprom_workarea_size__;
103
104/* Generic rules inclusion.*/
105INCLUDE rules.ld
diff --git a/platforms/chibios/ld/STM32F103x8_stm32duino_bootloader.ld b/platforms/chibios/ld/STM32F103x8_stm32duino_bootloader.ld
new file mode 100644
index 000000000..d0688ef60
--- /dev/null
+++ b/platforms/chibios/ld/STM32F103x8_stm32duino_bootloader.ld
@@ -0,0 +1,88 @@
1/*
2 ChibiOS - Copyright (C) 2006..2016 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 * ST32F103xB memory setup for use with the maplemini bootloader.
19 * You will have to
20 * #define CORTEX_VTOR_INIT 0x5000
21 * in your projects chconf.h
22 */
23MEMORY
24{
25 flash0 : org = 0x08002000, len = 64k - 0x2000
26 flash1 : org = 0x00000000, len = 0
27 flash2 : org = 0x00000000, len = 0
28 flash3 : org = 0x00000000, len = 0
29 flash4 : org = 0x00000000, len = 0
30 flash5 : org = 0x00000000, len = 0
31 flash6 : org = 0x00000000, len = 0
32 flash7 : org = 0x00000000, len = 0
33 ram0 : org = 0x20000000, len = 20k
34 ram1 : org = 0x00000000, len = 0
35 ram2 : org = 0x00000000, len = 0
36 ram3 : org = 0x00000000, len = 0
37 ram4 : org = 0x00000000, len = 0
38 ram5 : org = 0x00000000, len = 0
39 ram6 : org = 0x00000000, len = 0
40 ram7 : org = 0x00000000, len = 0
41}
42
43/* For each data/text section two region are defined, a virtual region
44 and a load region (_LMA suffix).*/
45
46/* Flash region to be used for exception vectors.*/
47REGION_ALIAS("VECTORS_FLASH", flash0);
48REGION_ALIAS("VECTORS_FLASH_LMA", flash0);
49
50/* Flash region to be used for constructors and destructors.*/
51REGION_ALIAS("XTORS_FLASH", flash0);
52REGION_ALIAS("XTORS_FLASH_LMA", flash0);
53
54/* Flash region to be used for code text.*/
55REGION_ALIAS("TEXT_FLASH", flash0);
56REGION_ALIAS("TEXT_FLASH_LMA", flash0);
57
58/* Flash region to be used for read only data.*/
59REGION_ALIAS("RODATA_FLASH", flash0);
60REGION_ALIAS("RODATA_FLASH_LMA", flash0);
61
62/* Flash region to be used for various.*/
63REGION_ALIAS("VARIOUS_FLASH", flash0);
64REGION_ALIAS("VARIOUS_FLASH_LMA", flash0);
65
66/* Flash region to be used for RAM(n) initialization data.*/
67REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0);
68
69/* RAM region to be used for Main stack. This stack accommodates the processing
70 of all exceptions and interrupts.*/
71REGION_ALIAS("MAIN_STACK_RAM", ram0);
72
73/* RAM region to be used for the process stack. This is the stack used by
74 the main() function.*/
75REGION_ALIAS("PROCESS_STACK_RAM", ram0);
76
77/* RAM region to be used for data segment.*/
78REGION_ALIAS("DATA_RAM", ram0);
79REGION_ALIAS("DATA_RAM_LMA", flash0);
80
81/* RAM region to be used for BSS segment.*/
82REGION_ALIAS("BSS_RAM", ram0);
83
84/* RAM region to be used for the default heap.*/
85REGION_ALIAS("HEAP_RAM", ram0);
86
87/* Generic rules inclusion.*/
88INCLUDE rules.ld