Revision b93c5d98
modules/NUCLEO-F401RE/Makefile | ||
---|---|---|
1 |
################################################################################ |
|
2 |
# AMiRo-OS is an operating system designed for the Autonomous Mini Robot # |
|
3 |
# (AMiRo) platform. # |
|
4 |
# Copyright (C) 2016..2019 Thomas Schöpping et al. # |
|
5 |
# # |
|
6 |
# This program is free software: you can redistribute it and/or modify # |
|
7 |
# it under the terms of the GNU General Public License as published by # |
|
8 |
# the Free Software Foundation, either version 3 of the License, or # |
|
9 |
# (at your option) any later version. # |
|
10 |
# # |
|
11 |
# This program is distributed in the hope that it will be useful, # |
|
12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of # |
|
13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # |
|
14 |
# GNU General Public License for more details. # |
|
15 |
# # |
|
16 |
# You should have received a copy of the GNU General Public License # |
|
17 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. # |
|
18 |
# # |
|
19 |
# This research/work was supported by the Cluster of Excellence Cognitive # |
|
20 |
# Interaction Technology 'CITEC' (EXC 277) at Bielefeld University, which is # |
|
21 |
# funded by the German Research Foundation (DFG). # |
|
22 |
################################################################################ |
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
################################################################################ |
|
27 |
# Build global options # |
|
28 |
# NOTE: Can be overridden externally. # |
|
29 |
# # |
|
30 |
|
|
31 |
# Compiler options here. |
|
32 |
ifeq ($(USE_OPT),) |
|
33 |
USE_OPT = -O2 -fomit-frame-pointer -falign-functions=16 -fstack-usage |
|
34 |
endif |
|
35 |
|
|
36 |
# C specific options here (added to USE_OPT). |
|
37 |
ifeq ($(USE_COPT),) |
|
38 |
USE_COPT = -std=c17 |
|
39 |
endif |
|
40 |
|
|
41 |
# C++ specific options here (added to USE_OPT). |
|
42 |
ifeq ($(USE_CPPOPT),) |
|
43 |
USE_CPPOPT = -fno-rtti -std=c++17 |
|
44 |
endif |
|
45 |
|
|
46 |
# Enable this if you want the linker to remove unused code and data. |
|
47 |
ifeq ($(USE_LINK_GC),) |
|
48 |
USE_LINK_GC = yes |
|
49 |
endif |
|
50 |
|
|
51 |
# Linker extra options here. |
|
52 |
ifeq ($(USE_LDOPT),) |
|
53 |
USE_LDOPT = |
|
54 |
endif |
|
55 |
|
|
56 |
# Enable this if you want link time optimizations (LTO). |
|
57 |
ifeq ($(USE_LTO),) |
|
58 |
USE_LTO = yes |
|
59 |
endif |
|
60 |
|
|
61 |
# Enable this if you want to see the full log while compiling. |
|
62 |
ifeq ($(USE_VERBOSE_COMPILE),) |
|
63 |
USE_VERBOSE_COMPILE = no |
|
64 |
endif |
|
65 |
|
|
66 |
# If enabled, this option makes the build process faster by not compiling |
|
67 |
# modules not used in the current configuration. |
|
68 |
ifeq ($(USE_SMART_BUILD),) |
|
69 |
USE_SMART_BUILD = no |
|
70 |
endif |
|
71 |
|
|
72 |
# # |
|
73 |
# Build global options # |
|
74 |
################################################################################ |
|
75 |
|
|
76 |
################################################################################ |
|
77 |
# Architecture or project specific options # |
|
78 |
# # |
|
79 |
|
|
80 |
# Stack size to be allocated to the Cortex-M process stack. This stack is |
|
81 |
# the stack used by the main() thread. |
|
82 |
ifeq ($(USE_PROCESS_STACKSIZE),) |
|
83 |
USE_PROCESS_STACKSIZE = 0x400 |
|
84 |
endif |
|
85 |
|
|
86 |
# Stack size to the allocated to the Cortex-M main/exceptions stack. This |
|
87 |
# stack is used for processing interrupts and exceptions. |
|
88 |
ifeq ($(USE_EXCEPTIONS_STACKSIZE),) |
|
89 |
USE_EXCEPTIONS_STACKSIZE = 0x400 |
|
90 |
endif |
|
91 |
|
|
92 |
# Enables the use of FPU. |
|
93 |
# Possible selections are: |
|
94 |
# no - no FPU is used (probably equals 'soft') |
|
95 |
# soft - does not use the FPU, thus all floating point operations are emulated |
|
96 |
# softfp - uses the FPU, but uses the integer registers only |
|
97 |
# hard - uses the FPU and passes data via the FPU registers |
|
98 |
ifeq ($(USE_FPU),) |
|
99 |
USE_FPU = softfp |
|
100 |
endif |
|
101 |
|
|
102 |
# FPU-related options. |
|
103 |
ifeq ($(USE_FPU_OPT),) |
|
104 |
USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16 |
|
105 |
endif |
|
106 |
|
|
107 |
# # |
|
108 |
# Architecture or project specific options # |
|
109 |
################################################################################ |
|
110 |
|
|
111 |
################################################################################ |
|
112 |
# Project, target, sources and paths # |
|
113 |
# # |
|
114 |
|
|
115 |
# Absolute path to the project |
|
116 |
PROJECT_PATH := $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))) |
|
117 |
|
|
118 |
# Define project name here |
|
119 |
PROJECT := $(patsubst $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST))))..)/%,%,$(PROJECT_PATH)) |
|
120 |
|
|
121 |
# Target settings. |
|
122 |
MCU = cortex-m4 |
|
123 |
|
|
124 |
# Imported source files and paths. |
|
125 |
include ../../kernel/kernel.mk |
|
126 |
CHIBIOS := $(AMIROOS_KERNEL) |
|
127 |
CONFDIR := . |
|
128 |
ifeq ($(BUILDDIR),) |
|
129 |
BUILDDIR := $(PROJECT_PATH)/build |
|
130 |
endif |
|
131 |
DEPDIR := $(dir $(BUILDDIR)).dep |
|
132 |
AMIROOS := ../.. |
|
133 |
# Licensing files. |
|
134 |
include $(CHIBIOS)/os/license/license.mk |
|
135 |
# Startup files. |
|
136 |
include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.mk |
|
137 |
# HAL-OSAL files (optional). |
|
138 |
include $(CHIBIOS)/os/hal/hal.mk |
|
139 |
include $(CHIBIOS)/os/hal/ports/STM32/STM32F4xx/platform.mk |
|
140 |
include $(CHIBIOS)/os/hal/osal/rt/osal.mk |
|
141 |
include $(CHIBIOS)/os/hal/lib/streams/streams.mk |
|
142 |
# RTOS files (optional). |
|
143 |
include $(CHIBIOS)/os/rt/rt.mk |
|
144 |
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk |
|
145 |
# Auto-build files in ./source recursively. |
|
146 |
include $(CHIBIOS)/tools/mk/autobuild.mk |
|
147 |
# Other files (optional). |
|
148 |
include $(CHIBIOS)/test/lib/test.mk |
|
149 |
include $(CHIBIOS)/test/rt/rt_test.mk |
|
150 |
include $(CHIBIOS)/test/oslib/oslib_test.mk |
|
151 |
# AMiRo-BLT files |
|
152 |
include ../../bootloader/bootloader.mk |
|
153 |
# AMiRo-LLD files |
|
154 |
include ../../periphery-lld/periphery-lld.mk |
|
155 |
# AMiRo-OS files |
|
156 |
include ../modules.mk |
|
157 |
include $(AMIROOS)/core/core.mk |
|
158 |
include $(AMIROOS)/unittests/unittests.mk |
|
159 |
|
|
160 |
# Define linker script file here |
|
161 |
LDSCRIPT= STM32F401xE.ld |
|
162 |
|
|
163 |
# C sources that can be compiled in ARM or THUMB mode depending on the global |
|
164 |
# setting. |
|
165 |
CSRC = $(ALLCSRC) \ |
|
166 |
$(CHIBIOS)/os/various/syscalls.c \ |
|
167 |
$(CHIBIOS)/os/various/evtimer.c \ |
|
168 |
$(TESTSRC) \ |
|
169 |
board.c \ |
|
170 |
$(PERIPHERYLLDCSRC) \ |
|
171 |
$(UNITTESTSCSRC) \ |
|
172 |
$(AMIROOSCORECSRC) \ |
|
173 |
$(MODULESCSRC) \ |
|
174 |
module.c \ |
|
175 |
$(APPSCSRC) |
|
176 |
|
|
177 |
# C++ sources that can be compiled in ARM or THUMB mode depending on the global |
|
178 |
# setting. |
|
179 |
CPPSRC = $(ALLCPPSRC) \ |
|
180 |
$(CHIBIOS)/os/various/cpp_wrappers/syscalls_cpp.cpp \ |
|
181 |
$(AMIROOSCORECPPSRC) \ |
|
182 |
$(APPSCPPSRC) |
|
183 |
|
|
184 |
# List ASM source files here. |
|
185 |
ASMSRC = $(ALLASMSRC) \ |
|
186 |
$(APPSASMSRC) |
|
187 |
|
|
188 |
# List ASM with preprocessor source files here. |
|
189 |
ASMXSRC = $(ALLXASMSRC) \ |
|
190 |
$(APPSASMXSRC) |
|
191 |
|
|
192 |
# Inclusion directories. |
|
193 |
INCDIR = $(CONFDIR) \ |
|
194 |
$(ALLINC) \ |
|
195 |
$(TESTINC) \ |
|
196 |
$(CHIBIOS)/os/hal/lib/streams \ |
|
197 |
$(BOOTLOADERINC) \ |
|
198 |
$(PERIPHERYLLDINC) \ |
|
199 |
$(AMIROOS) \ |
|
200 |
$(UNITTESTSINC) \ |
|
201 |
$(AMIROOSCOREINC) \ |
|
202 |
$(MODULESINC) \ |
|
203 |
$(APPSINC) |
|
204 |
|
|
205 |
# Define C warning options here. |
|
206 |
CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes |
|
207 |
|
|
208 |
# Define C++ warning options here. |
|
209 |
CPPWARN = -Wall -Wextra -Wundef |
|
210 |
|
|
211 |
# # |
|
212 |
# Project, target, sources and paths # |
|
213 |
################################################################################ |
|
214 |
|
|
215 |
################################################################################ |
|
216 |
# Start of user section # |
|
217 |
# # |
|
218 |
|
|
219 |
# List all user C define here, like -D_DEBUG=1 |
|
220 |
UDEFS += |
|
221 |
|
|
222 |
# Define ASM defines here |
|
223 |
UADEFS += |
|
224 |
|
|
225 |
# List all user directories here |
|
226 |
UINCDIR += |
|
227 |
|
|
228 |
# List the user directory to look for the libraries here |
|
229 |
ULIBDIR += |
|
230 |
|
|
231 |
# List all user libraries here |
|
232 |
ULIBS += |
|
233 |
|
|
234 |
# # |
|
235 |
# End of user section # |
|
236 |
################################################################################ |
|
237 |
|
|
238 |
################################################################################ |
|
239 |
# Common rules # |
|
240 |
# # |
|
241 |
|
|
242 |
RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk |
|
243 |
include $(RULESPATH)/arm-none-eabi.mk |
|
244 |
include $(RULESPATH)/rules.mk |
|
245 |
|
|
246 |
# # |
|
247 |
# Common rules # |
|
248 |
################################################################################ |
|
249 |
|
|
250 |
################################################################################ |
|
251 |
# Custom rules # |
|
252 |
# # |
|
253 |
|
|
254 |
flash: $(BUILDDIR)/$(PROJECT).elf |
|
255 |
openocd -f interface/stlink-v2-1.cfg -c "set WORKAREASIZE 0x2000" -f target/stm32f4x.cfg -c "program $(BUILDDIR)/$(PROJECT).elf verify reset exit" |
|
256 |
|
|
257 |
# # |
|
258 |
# Custom rules # |
|
259 |
################################################################################ |
|
260 |
|
modules/NUCLEO-F401RE/STM32F401xE.ld | ||
---|---|---|
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 |
* STM32F401xE memory setup. |
|
19 |
*/ |
|
20 |
MEMORY |
|
21 |
{ |
|
22 |
flash0 : org = 0x08000000, len = 512k |
|
23 |
flash1 : org = 0x00000000, len = 0 |
|
24 |
flash2 : org = 0x00000000, len = 0 |
|
25 |
flash3 : org = 0x00000000, len = 0 |
|
26 |
flash4 : org = 0x00000000, len = 0 |
|
27 |
flash5 : org = 0x00000000, len = 0 |
|
28 |
flash6 : org = 0x00000000, len = 0 |
|
29 |
flash7 : org = 0x00000000, len = 0 |
|
30 |
ram0 : org = 0x20000000, len = 96k |
|
31 |
ram1 : org = 0x00000000, len = 0 |
|
32 |
ram2 : org = 0x00000000, len = 0 |
|
33 |
ram3 : org = 0x00000000, len = 0 |
|
34 |
ram4 : org = 0x00000000, len = 0 |
|
35 |
ram5 : org = 0x00000000, len = 0 |
|
36 |
ram6 : org = 0x00000000, len = 0 |
|
37 |
ram7 : org = 0x00000000, len = 0 |
|
38 |
} |
|
39 |
|
|
40 |
/* For each data/text section two region are defined, a virtual region |
|
41 |
and a load region (_LMA suffix).*/ |
|
42 |
|
|
43 |
/* Flash region to be used for exception vectors.*/ |
|
44 |
REGION_ALIAS("VECTORS_FLASH", flash0); |
|
45 |
REGION_ALIAS("VECTORS_FLASH_LMA", flash0); |
|
46 |
|
|
47 |
/* Flash region to be used for constructors and destructors.*/ |
|
48 |
REGION_ALIAS("XTORS_FLASH", flash0); |
|
49 |
REGION_ALIAS("XTORS_FLASH_LMA", flash0); |
|
50 |
|
|
51 |
/* Flash region to be used for code text.*/ |
|
52 |
REGION_ALIAS("TEXT_FLASH", flash0); |
|
53 |
REGION_ALIAS("TEXT_FLASH_LMA", flash0); |
|
54 |
|
|
55 |
/* Flash region to be used for read only data.*/ |
|
56 |
REGION_ALIAS("RODATA_FLASH", flash0); |
|
57 |
REGION_ALIAS("RODATA_FLASH_LMA", flash0); |
|
58 |
|
|
59 |
/* Flash region to be used for various.*/ |
|
60 |
REGION_ALIAS("VARIOUS_FLASH", flash0); |
|
61 |
REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); |
|
62 |
|
|
63 |
/* Flash region to be used for RAM(n) initialization data.*/ |
|
64 |
REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); |
|
65 |
|
|
66 |
/* RAM region to be used for Main stack. This stack accommodates the processing |
|
67 |
of all exceptions and interrupts.*/ |
|
68 |
REGION_ALIAS("MAIN_STACK_RAM", ram0); |
|
69 |
|
|
70 |
/* RAM region to be used for the process stack. This is the stack used by |
|
71 |
the main() function.*/ |
|
72 |
REGION_ALIAS("PROCESS_STACK_RAM", ram0); |
|
73 |
|
|
74 |
/* RAM region to be used for data segment.*/ |
|
75 |
REGION_ALIAS("DATA_RAM", ram0); |
|
76 |
REGION_ALIAS("DATA_RAM_LMA", flash0); |
|
77 |
|
|
78 |
/* RAM region to be used for BSS segment.*/ |
|
79 |
REGION_ALIAS("BSS_RAM", ram0); |
|
80 |
|
|
81 |
/* RAM region to be used for the default heap.*/ |
|
82 |
REGION_ALIAS("HEAP_RAM", ram0); |
|
83 |
|
|
84 |
/* Generic rules inclusion.*/ |
|
85 |
INCLUDE rules.ld |
modules/NUCLEO-F401RE/alldconf.h | ||
---|---|---|
1 |
/* |
|
2 |
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform. |
|
3 |
Copyright (C) 2016..2019 Thomas Schöpping et al. |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU General Public License as published by |
|
7 |
the Free Software Foundation, either version 3 of the License, or |
|
8 |
(at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU General Public License |
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
|
|
19 |
/** |
|
20 |
* @file |
|
21 |
* @brief AMiRo-LLD configuration file for the NUCLEO-F401RE board. |
|
22 |
* @details Contains the application specific AMiRo-LLD settings. |
|
23 |
* |
|
24 |
* @addtogroup NUCLEO-F401RE_lld_config |
|
25 |
* @{ |
|
26 |
*/ |
|
27 |
|
|
28 |
#ifndef ALLDCONF_H |
|
29 |
#define ALLDCONF_H |
|
30 |
|
|
31 |
/* |
|
32 |
* compatibility guards |
|
33 |
*/ |
|
34 |
#define _AMIRO_LLD_CFG_ |
|
35 |
#define AMIRO_LLD_CFG_VERSION_MAJOR 1 |
|
36 |
#define AMIRO_LLD_CFG_VERSION_MINOR 0 |
|
37 |
|
|
38 |
/** |
|
39 |
* @brief Width of the apalTime_t data type. |
|
40 |
* |
|
41 |
* @details Possible values are 8, 16, 32, and 64 bits. |
|
42 |
* By definition time is represented at microsecond precision. |
|
43 |
*/ |
|
44 |
#define AMIROLLD_CFG_TIME_SIZE 32 |
|
45 |
|
|
46 |
#endif /* ALLDCONF_H */ |
|
47 |
|
|
48 |
/** @} */ |
modules/NUCLEO-F401RE/aosconf.h | ||
---|---|---|
1 |
/* |
|
2 |
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform. |
|
3 |
Copyright (C) 2016..2019 Thomas Schöpping et al. |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU General Public License as published by |
|
7 |
the Free Software Foundation, either version 3 of the License, or |
|
8 |
(at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU General Public License |
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
|
|
19 |
/** |
|
20 |
* @file |
|
21 |
* @brief AMiRo-OS Configuration file for the NUCLEO-F401RE module. |
|
22 |
* @details Contains the application specific AMiRo-OS settings. |
|
23 |
* |
|
24 |
* @addtogroup NUCLEO-F401RE_aos_config |
|
25 |
* @{ |
|
26 |
*/ |
|
27 |
|
|
28 |
#ifndef AOSCONF_H |
|
29 |
#define AOSCONF_H |
|
30 |
|
|
31 |
/* |
|
32 |
* compatibility guards |
|
33 |
*/ |
|
34 |
#define _AMIRO_OS_CFG_ |
|
35 |
#define AMIRO_OS_CFG_VERSION_MAJOR 2 |
|
36 |
#define AMIRO_OS_CFG_VERSION_MINOR 0 |
|
37 |
|
|
38 |
#include <stdbool.h> |
|
39 |
|
|
40 |
/* |
|
41 |
* Include an external configuration file to override the following default settings only if required. |
|
42 |
*/ |
|
43 |
#if defined(AMIRO_APPS) && (AMIRO_APPS == true) |
|
44 |
#include <osconf.h> |
|
45 |
#endif /* defined(AMIRO_APPS) && (AMIRO_APPS == true) */ |
|
46 |
|
|
47 |
/*===========================================================================*/ |
|
48 |
/** |
|
49 |
* @name Kernel parameters and options |
|
50 |
* @{ |
|
51 |
*/ |
|
52 |
/*===========================================================================*/ |
|
53 |
|
|
54 |
/** |
|
55 |
* @brief Flag to enable/disable debug API and logic. |
|
56 |
*/ |
|
57 |
#if !defined(OS_CFG_DBG) |
|
58 |
#define AMIROOS_CFG_DBG true |
|
59 |
#else /* !defined(OS_CFG_DBG) */ |
|
60 |
#define AMIROOS_CFG_DBG OS_CFG_DBG |
|
61 |
#endif /* !defined(OS_CFG_DBG) */ |
|
62 |
|
|
63 |
/** |
|
64 |
* @brief Flag to enable/disable unit tests. |
|
65 |
* @note Setting this flag will implicitely enable the shell. |
|
66 |
*/ |
|
67 |
#if !defined(OS_CFG_TESTS_ENABLE) |
|
68 |
#define AMIROOS_CFG_TESTS_ENABLE true |
|
69 |
#else /* !defined(OS_CFG_TESTS_ENABLE) */ |
|
70 |
#define AMIROOS_CFG_TESTS_ENABLE OS_CFG_TESTS_ENABLE |
|
71 |
#endif /* !defined(OS_CFG_TESTS_ENABLE) */ |
|
72 |
|
|
73 |
/** |
|
74 |
* @brief Flag to enable/disable profiling API and logic. |
|
75 |
*/ |
|
76 |
#if !defined(OS_CFG_PROFILE) |
|
77 |
#define AMIROOS_CFG_PROFILE true |
|
78 |
#else /* !defined(OS_CFG_PROFILE) */ |
|
79 |
#define AMIROOS_CFG_PROFILE OS_CFG_PROFILE |
|
80 |
#endif /* !defined(OS_CFG_PROFILE) */ |
|
81 |
|
|
82 |
/** |
|
83 |
* @brief Mask for the control thread to listen to certain IO events. |
|
84 |
* @note Any mandatory events (e.g. for SSSP) are enabled implicitely despite this configuration. |
|
85 |
*/ |
|
86 |
#if !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) |
|
87 |
#define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK MODULE_OS_IOEVENTFLAGS_USERBUTTON |
|
88 |
#else /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */ |
|
89 |
#define AMIROOS_CFG_MAIN_LOOP_IOEVENT_MASK OS_CFG_MAIN_LOOP_IOEVENT_MASK |
|
90 |
#endif /* !defined(OS_CFG_MAIN_LOOP_IOEVENT_MASK) */ |
|
91 |
|
|
92 |
/** |
|
93 |
* @brief Timeout value when waiting for events in the main loop in microseconds. |
|
94 |
* @details A value of 0 deactivates the timeout. |
|
95 |
*/ |
|
96 |
#if !defined(OS_CFG_MAIN_LOOP_TIMEOUT) |
|
97 |
#define AMIROOS_CFG_MAIN_LOOP_TIMEOUT 0 |
|
98 |
#else /* !defined(OS_CFG_MAIN_LOOP_TIMEOUT) */ |
|
99 |
#define AMIROOS_CFG_MAIN_LOOP_TIMEOUT OS_CFG_MAIN_LOOP_TIMEOUT |
|
100 |
#endif /* !defined(OS_CFG_MAIN_LOOP_TIMEOUT) */ |
|
101 |
|
|
102 |
/** @} */ |
|
103 |
|
|
104 |
/*===========================================================================*/ |
|
105 |
/** |
|
106 |
* @name SSSP (Startup Shutdown Synchronization Protocol) configuration. |
|
107 |
* @{ |
|
108 |
*/ |
|
109 |
/*===========================================================================*/ |
|
110 |
|
|
111 |
/** |
|
112 |
* @brief Flag to enable SSSP. |
|
113 |
*/ |
|
114 |
#if !defined(OS_CFG_SSSP_ENABLE) |
|
115 |
#define AMIROOS_CFG_SSSP_ENABLE false |
|
116 |
#else /* !defined(OS_CFG_SSSP_ENABLE) */ |
|
117 |
#define AMIROOS_CFG_SSSP_ENABLE OS_CFG_SSSP_ENABLE |
|
118 |
#endif /* !defined(OS_CFG_SSSP_ENABLE) */ |
|
119 |
|
|
120 |
/** |
|
121 |
* @brief Flag to set the module as SSSP master. |
|
122 |
* @details There must be only one module with this flag set to true in a system. |
|
123 |
*/ |
|
124 |
#if !defined(OS_CFG_SSSP_MASTER) |
|
125 |
#define AMIROOS_CFG_SSSP_MASTER false |
|
126 |
#else /* !defined(OS_CFG_SSSP_MASTER) */ |
|
127 |
#define AMIROOS_CFG_SSSP_MASTER OS_CFG_SSSP_MASTER |
|
128 |
#endif /* !defined(OS_CFG_SSSP_MASTER) */ |
|
129 |
|
|
130 |
/** |
|
131 |
* @brief Flag to set the module to be the first in the stack. |
|
132 |
* @details There must be only one module with this flag set to true in a system. |
|
133 |
*/ |
|
134 |
#if !defined(OS_CFG_SSSP_STACK_START) |
|
135 |
#define AMIROOS_CFG_SSSP_STACK_START false |
|
136 |
#else /* !defined(OS_CFG_SSSP_STACK_START) */ |
|
137 |
#define AMIROOS_CFG_SSSP_STACK_START OS_CFG_SSSP_STACK_START |
|
138 |
#endif /* !defined(OS_CFG_SSSP_STACK_START) */ |
|
139 |
|
|
140 |
/** |
|
141 |
* @brief Flag to set the module to be the last in the stack. |
|
142 |
* @details There must be only one module with this flag set to true in a system. |
|
143 |
*/ |
|
144 |
#if !defined(OS_CFG_SSSP_STACK_END) |
|
145 |
#define AMIROOS_CFG_SSSP_STACK_END false |
|
146 |
#else /* !defined(OS_CFG_SSSP_STACK_END) */ |
|
147 |
#define AMIROOS_CFG_SSSP_STACK_END OS_CFG_SSSP_STACK_END |
|
148 |
#endif /* !defined(OS_CFG_SSSP_STACK_END) */ |
|
149 |
|
|
150 |
/** |
|
151 |
* @brief Delay time (in microseconds) how long a SSSP signal must be active. |
|
152 |
*/ |
|
153 |
#if !defined(OS_CFG_SSSP_SIGNALDELAY) |
|
154 |
#define AMIROOS_CFG_SSSP_SIGNALDELAY 1000 |
|
155 |
#else /* !defined(OS_CFG_SSSP_SIGNALDELAY) */ |
|
156 |
#define AMIROOS_CFG_SSSP_SIGNALDELAY OS_CFG_SSSP_SIGNALDELAY |
|
157 |
#endif /* !defined(OS_CFG_SSSP_SIGNALDELAY) */ |
|
158 |
|
|
159 |
/** |
|
160 |
* @brief Time boundary for robot wide clock synchronization in microseconds. |
|
161 |
* @details Whenever the SSSP S (snychronization) signal gets logically deactivated, |
|
162 |
* All modules need to align their local uptime to the nearest multiple of this value. |
|
163 |
*/ |
|
164 |
#if !defined(OS_CFG_SSSP_SYSSYNCPERIOD) |
|
165 |
#define AMIROOS_CFG_SSSP_SYSSYNCPERIOD 1000000 |
|
166 |
#else /* !defined(OS_CFG_SSSP_SYSSYNCPERIOD) */ |
|
167 |
#define AMIROOS_CFG_SSSP_SYSSYNCPERIOD OS_CFG_SSSP_SYSSYNCPERIOD |
|
168 |
#endif /* !defined(OS_CFG_SSSP_SYSSYNCPERIOD) */ |
|
169 |
|
|
170 |
/** @} */ |
|
171 |
|
|
172 |
/*===========================================================================*/ |
|
173 |
/** |
|
174 |
* @name System shell options |
|
175 |
* @{ |
|
176 |
*/ |
|
177 |
/*===========================================================================*/ |
|
178 |
|
|
179 |
/** |
|
180 |
* @brief Shell enable flag. |
|
181 |
*/ |
|
182 |
#if !defined(OS_CFG_SHELL_ENABLE) |
|
183 |
#define AMIROOS_CFG_SHELL_ENABLE true |
|
184 |
#else /* !defined(OS_CFG_SHELL_ENABLE) */ |
|
185 |
#define AMIROOS_CFG_SHELL_ENABLE OS_CFG_SHELL_ENABLE |
|
186 |
#endif /* !defined(OS_CFG_SHELL_ENABLE) */ |
|
187 |
|
|
188 |
/** |
|
189 |
* @brief Shell thread stack size. |
|
190 |
*/ |
|
191 |
#if !defined(OS_CFG_SHELL_STACKSIZE) |
|
192 |
#define AMIROOS_CFG_SHELL_STACKSIZE 1024 |
|
193 |
#else /* !defined(OS_CFG_SHELL_STACKSIZE) */ |
|
194 |
#define AMIROOS_CFG_SHELL_STACKSIZE OS_CFG_SHELL_STACKSIZE |
|
195 |
#endif /* !defined(OS_CFG_SHELL_STACKSIZE) */ |
|
196 |
|
|
197 |
/** |
|
198 |
* @brief Shell thread priority. |
|
199 |
* @details Thread priorities are specified as an integer value. |
|
200 |
* Predefined ranges are: |
|
201 |
* lowest ┌ THD_LOWPRIO_MIN |
|
202 |
* │ ... |
|
203 |
* â”” THD_LOWPRIO_MAX |
|
204 |
* ┌ THD_NORMALPRIO_MIN |
|
205 |
* │ ... |
|
206 |
* â”” THD_NORMALPRIO_MAX |
|
207 |
* ┌ THD_HIGHPRIO_MIN |
|
208 |
* │ ... |
|
209 |
* â”” THD_HIGHPRIO_MAX |
|
210 |
* ┌ THD_RTPRIO_MIN |
|
211 |
* │ ... |
|
212 |
* highest â”” THD_RTPRIO_MAX |
|
213 |
*/ |
|
214 |
#if !defined(OS_CFG_SHELL_THREADPRIO) |
|
215 |
#define AMIROOS_CFG_SHELL_THREADPRIO AOS_THD_NORMALPRIO_MIN |
|
216 |
#else /* !defined(OS_CFG_SHELL_THREADPRIO) */ |
|
217 |
#define AMIROOS_CFG_SHELL_THREADPRIO OS_CFG_SHELL_THREADPRIO |
|
218 |
#endif /* !defined(OS_CFG_SHELL_THREADPRIO) */ |
|
219 |
|
|
220 |
/** |
|
221 |
* @brief Shell maximum input line length. |
|
222 |
*/ |
|
223 |
#if !defined(OS_CFG_SHELL_LINEWIDTH) |
|
224 |
#define AMIROOS_CFG_SHELL_LINEWIDTH 128 |
|
225 |
#else /* !defined(OS_CFG_SHELL_LINEWIDTH) */ |
|
226 |
#define AMIROOS_CFG_SHELL_LINEWIDTH OS_CFG_SHELL_LINEWIDTH |
|
227 |
#endif /* !defined(OS_CFG_SHELL_LINEWIDTH) */ |
|
228 |
|
|
229 |
/** |
|
230 |
* @brief Shell maximum number of arguments. |
|
231 |
*/ |
|
232 |
#if !defined(OS_CFG_SHELL_MAXARGS) |
|
233 |
#define AMIROOS_CFG_SHELL_MAXARGS 16 |
|
234 |
#else /* !defined(OS_CFG_SHELL_MAXARGS) */ |
|
235 |
#define AMIROOS_CFG_SHELL_MAXARGS OS_CFG_SHELL_MAXARGS |
|
236 |
#endif /* !defined(OS_CFG_SHELL_MAXARGS) */ |
|
237 |
|
|
238 |
/** @} */ |
|
239 |
|
|
240 |
#endif /* AOSCONF_H */ |
|
241 |
|
|
242 |
/** @} */ |
modules/NUCLEO-F401RE/board.c | ||
---|---|---|
1 |
/* |
|
2 |
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform. |
|
3 |
Copyright (C) 2016..2019 Thomas Schöpping et al. |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU General Public License as published by |
|
7 |
the Free Software Foundation, either version 3 of the License, or |
|
8 |
(at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU General Public License |
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
|
|
19 |
#include "hal.h" |
|
20 |
#include "stm32_gpio.h" |
|
21 |
|
|
22 |
/*===========================================================================*/ |
|
23 |
/* Driver local definitions. */ |
|
24 |
/*===========================================================================*/ |
|
25 |
|
|
26 |
/*===========================================================================*/ |
|
27 |
/* Driver exported variables. */ |
|
28 |
/*===========================================================================*/ |
|
29 |
|
|
30 |
/*===========================================================================*/ |
|
31 |
/* Driver local variables and types. */ |
|
32 |
/*===========================================================================*/ |
|
33 |
|
|
34 |
/** |
|
35 |
* @brief Type of STM32 GPIO port setup. |
|
36 |
*/ |
|
37 |
typedef struct { |
|
38 |
uint32_t moder; |
|
39 |
uint32_t otyper; |
|
40 |
uint32_t ospeedr; |
|
41 |
uint32_t pupdr; |
|
42 |
uint32_t odr; |
|
43 |
uint32_t afrl; |
|
44 |
uint32_t afrh; |
|
45 |
} gpio_setup_t; |
|
46 |
|
|
47 |
/** |
|
48 |
* @brief Type of STM32 GPIO initialization data. |
|
49 |
*/ |
|
50 |
typedef struct { |
|
51 |
#if STM32_HAS_GPIOA || defined(__DOXYGEN__) |
|
52 |
gpio_setup_t PAData; |
|
53 |
#endif |
|
54 |
#if STM32_HAS_GPIOB || defined(__DOXYGEN__) |
|
55 |
gpio_setup_t PBData; |
|
56 |
#endif |
|
57 |
#if STM32_HAS_GPIOC || defined(__DOXYGEN__) |
|
58 |
gpio_setup_t PCData; |
|
59 |
#endif |
|
60 |
#if STM32_HAS_GPIOD || defined(__DOXYGEN__) |
|
61 |
gpio_setup_t PDData; |
|
62 |
#endif |
|
63 |
#if STM32_HAS_GPIOE || defined(__DOXYGEN__) |
|
64 |
gpio_setup_t PEData; |
|
65 |
#endif |
|
66 |
#if STM32_HAS_GPIOF || defined(__DOXYGEN__) |
|
67 |
gpio_setup_t PFData; |
|
68 |
#endif |
|
69 |
#if STM32_HAS_GPIOG || defined(__DOXYGEN__) |
|
70 |
gpio_setup_t PGData; |
|
71 |
#endif |
|
72 |
#if STM32_HAS_GPIOH || defined(__DOXYGEN__) |
|
73 |
gpio_setup_t PHData; |
|
74 |
#endif |
|
75 |
#if STM32_HAS_GPIOI || defined(__DOXYGEN__) |
|
76 |
gpio_setup_t PIData; |
|
77 |
#endif |
|
78 |
#if STM32_HAS_GPIOJ || defined(__DOXYGEN__) |
|
79 |
gpio_setup_t PJData; |
|
80 |
#endif |
|
81 |
#if STM32_HAS_GPIOK || defined(__DOXYGEN__) |
|
82 |
gpio_setup_t PKData; |
|
83 |
#endif |
|
84 |
} gpio_config_t; |
|
85 |
|
|
86 |
/** |
|
87 |
* @brief STM32 GPIO static initialization data. |
|
88 |
*/ |
|
89 |
static const gpio_config_t gpio_default_config = { |
|
90 |
#if STM32_HAS_GPIOA |
|
91 |
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, |
|
92 |
VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, |
|
93 |
#endif |
|
94 |
#if STM32_HAS_GPIOB |
|
95 |
{VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, |
|
96 |
VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH}, |
|
97 |
#endif |
|
98 |
#if STM32_HAS_GPIOC |
|
99 |
{VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, |
|
100 |
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, |
|
104 |
VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH}, |
|
105 |
#endif |
|
106 |
#if STM32_HAS_GPIOE |
|
107 |
{VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, |
|
108 |
VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH}, |
|
109 |
#endif |
|
110 |
#if STM32_HAS_GPIOF |
|
111 |
{VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, |
|
112 |
VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH}, |
|
113 |
#endif |
|
114 |
#if STM32_HAS_GPIOG |
|
115 |
{VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, |
|
116 |
VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH}, |
|
117 |
#endif |
|
118 |
#if STM32_HAS_GPIOH |
|
119 |
{VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, |
|
120 |
VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH}, |
|
121 |
#endif |
|
122 |
#if STM32_HAS_GPIOI |
|
123 |
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, |
|
124 |
VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH}, |
|
125 |
#endif |
|
126 |
#if STM32_HAS_GPIOJ |
|
127 |
{VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR, |
|
128 |
VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH}, |
|
129 |
#endif |
|
130 |
#if STM32_HAS_GPIOK |
|
131 |
{VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR, |
|
132 |
VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH} |
|
133 |
#endif |
|
134 |
}; |
|
135 |
|
|
136 |
/*===========================================================================*/ |
|
137 |
/* Driver local functions. */ |
|
138 |
/*===========================================================================*/ |
|
139 |
|
|
140 |
static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) { |
|
141 |
|
|
142 |
gpiop->OTYPER = config->otyper; |
|
143 |
gpiop->OSPEEDR = config->ospeedr; |
|
144 |
gpiop->PUPDR = config->pupdr; |
|
145 |
gpiop->ODR = config->odr; |
|
146 |
gpiop->AFRL = config->afrl; |
|
147 |
gpiop->AFRH = config->afrh; |
|
148 |
gpiop->MODER = config->moder; |
|
149 |
} |
|
150 |
|
|
151 |
static void stm32_gpio_init(void) { |
|
152 |
|
|
153 |
/* Enabling GPIO-related clocks, the mask comes from the |
|
154 |
registry header file.*/ |
|
155 |
rccResetAHB1(STM32_GPIO_EN_MASK); |
|
156 |
rccEnableAHB1(STM32_GPIO_EN_MASK, true); |
|
157 |
|
|
158 |
/* Initializing all the defined GPIO ports.*/ |
|
159 |
#if STM32_HAS_GPIOA |
|
160 |
gpio_init(GPIOA, &gpio_default_config.PAData); |
|
161 |
#endif |
|
162 |
#if STM32_HAS_GPIOB |
|
163 |
gpio_init(GPIOB, &gpio_default_config.PBData); |
|
164 |
#endif |
|
165 |
#if STM32_HAS_GPIOC |
|
166 |
gpio_init(GPIOC, &gpio_default_config.PCData); |
|
167 |
#endif |
|
168 |
#if STM32_HAS_GPIOD |
|
169 |
gpio_init(GPIOD, &gpio_default_config.PDData); |
|
170 |
#endif |
|
171 |
#if STM32_HAS_GPIOE |
|
172 |
gpio_init(GPIOE, &gpio_default_config.PEData); |
|
173 |
#endif |
|
174 |
#if STM32_HAS_GPIOF |
|
175 |
gpio_init(GPIOF, &gpio_default_config.PFData); |
|
176 |
#endif |
|
177 |
#if STM32_HAS_GPIOG |
|
178 |
gpio_init(GPIOG, &gpio_default_config.PGData); |
|
179 |
#endif |
|
180 |
#if STM32_HAS_GPIOH |
|
181 |
gpio_init(GPIOH, &gpio_default_config.PHData); |
|
182 |
#endif |
|
183 |
#if STM32_HAS_GPIOI |
|
184 |
gpio_init(GPIOI, &gpio_default_config.PIData); |
|
185 |
#endif |
|
186 |
#if STM32_HAS_GPIOJ |
|
187 |
gpio_init(GPIOJ, &gpio_default_config.PJData); |
|
188 |
#endif |
|
189 |
#if STM32_HAS_GPIOK |
|
190 |
gpio_init(GPIOK, &gpio_default_config.PKData); |
|
191 |
#endif |
|
192 |
} |
|
193 |
|
|
194 |
/*===========================================================================*/ |
|
195 |
/* Driver interrupt handlers. */ |
|
196 |
/*===========================================================================*/ |
|
197 |
|
|
198 |
/*===========================================================================*/ |
|
199 |
/* Driver exported functions. */ |
|
200 |
/*===========================================================================*/ |
|
201 |
|
|
202 |
/** |
|
203 |
* @brief Early initialization code. |
|
204 |
* @details GPIO ports and system clocks are initialized before everything |
|
205 |
* else. |
|
206 |
*/ |
|
207 |
void __early_init(void) { |
|
208 |
|
|
209 |
stm32_gpio_init(); |
|
210 |
stm32_clock_init(); |
|
211 |
} |
|
212 |
|
|
213 |
#if HAL_USE_SDC || defined(__DOXYGEN__) |
|
214 |
/** |
|
215 |
* @brief SDC card detection. |
|
216 |
*/ |
|
217 |
bool sdc_lld_is_card_inserted(SDCDriver *sdcp) { |
|
218 |
|
|
219 |
(void)sdcp; |
|
220 |
/* TODO: Fill the implementation.*/ |
|
221 |
return true; |
|
222 |
} |
|
223 |
|
|
224 |
/** |
|
225 |
* @brief SDC card write protection detection. |
|
226 |
*/ |
|
227 |
bool sdc_lld_is_write_protected(SDCDriver *sdcp) { |
|
228 |
|
|
229 |
(void)sdcp; |
|
230 |
/* TODO: Fill the implementation.*/ |
|
231 |
return false; |
|
232 |
} |
|
233 |
#endif /* HAL_USE_SDC */ |
|
234 |
|
|
235 |
#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) |
|
236 |
/** |
|
237 |
* @brief MMC_SPI card detection. |
|
238 |
*/ |
|
239 |
bool mmc_lld_is_card_inserted(MMCDriver *mmcp) { |
|
240 |
|
|
241 |
(void)mmcp; |
|
242 |
/* TODO: Fill the implementation.*/ |
|
243 |
return true; |
|
244 |
} |
|
245 |
|
|
246 |
/** |
|
247 |
* @brief MMC_SPI card write protection detection. |
|
248 |
*/ |
|
249 |
bool mmc_lld_is_write_protected(MMCDriver *mmcp) { |
|
250 |
|
|
251 |
(void)mmcp; |
|
252 |
/* TODO: Fill the implementation.*/ |
|
253 |
return false; |
|
254 |
} |
|
255 |
#endif |
|
256 |
|
|
257 |
/** |
|
258 |
* @brief Board-specific initialization code. |
|
259 |
* @todo Add your board-specific code, if any. |
|
260 |
*/ |
|
261 |
void boardInit(void) { |
|
262 |
|
|
263 |
} |
modules/NUCLEO-F401RE/board.h | ||
---|---|---|
1 |
/* |
|
2 |
AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform. |
|
3 |
Copyright (C) 2016..2019 Thomas Schöpping et al. |
|
4 |
|
|
5 |
This program is free software: you can redistribute it and/or modify |
|
6 |
it under the terms of the GNU General Public License as published by |
|
7 |
the Free Software Foundation, either version 3 of the License, or |
|
8 |
(at your option) any later version. |
|
9 |
|
|
10 |
This program is distributed in the hope that it will be useful, |
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 |
GNU General Public License for more details. |
|
14 |
|
|
15 |
You should have received a copy of the GNU General Public License |
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 |
*/ |
|
18 |
|
|
19 |
#ifndef BOARD_H |
|
20 |
#define BOARD_H |
|
21 |
|
|
22 |
/*===========================================================================*/ |
|
23 |
/* Driver constants. */ |
|
24 |
/*===========================================================================*/ |
|
25 |
|
|
26 |
/* |
|
27 |
* Setup for STMicroelectronics STM32 Nucleo64-F401RE board. |
|
28 |
*/ |
|
29 |
|
|
30 |
/* |
|
31 |
* Board identifier. |
|
32 |
*/ |
|
33 |
#define BOARD_ST_NUCLEO64_F401RE |
|
34 |
#define BOARD_NAME "STMicroelectronics STM32 Nucleo64-F401RE" |
|
35 |
|
|
36 |
/* |
|
37 |
* Board oscillators-related settings. |
|
38 |
* NOTE: LSE not fitted. |
|
39 |
*/ |
|
40 |
#if !defined(STM32_LSECLK) |
|
41 |
#define STM32_LSECLK 0U |
|
42 |
#endif |
|
43 |
|
|
44 |
#if !defined(STM32_HSECLK) |
|
45 |
#define STM32_HSECLK 8000000U |
|
46 |
#endif |
|
47 |
|
|
48 |
#define STM32_HSE_BYPASS |
|
49 |
|
|
50 |
/* |
|
51 |
* Board voltages. |
|
52 |
* Required for performance limits calculation. |
|
53 |
*/ |
|
54 |
#define STM32_VDD 300U |
|
55 |
|
|
56 |
/* |
|
57 |
* MCU type as defined in the ST header. |
|
58 |
*/ |
|
59 |
#define STM32F401xE |
|
60 |
|
|
61 |
/* |
|
62 |
* IO pins assignments. |
|
63 |
*/ |
|
64 |
#define GPIOA_ARD_A0 0U |
|
65 |
#define GPIOA_ADC1_IN0 0U |
|
66 |
#define GPIOA_ARD_A1 1U |
|
67 |
#define GPIOA_ADC1_IN1 1U |
|
68 |
#define GPIOA_ARD_D1 2U |
|
69 |
#define GPIOA_USART2_TX 2U |
|
70 |
#define GPIOA_ARD_D0 3U |
|
71 |
#define GPIOA_USART2_RX 3U |
|
72 |
#define GPIOA_ARD_A2 4U |
|
73 |
#define GPIOA_ADC1_IN4 4U |
|
74 |
#define GPIOA_LED_GREEN 5U |
|
75 |
#define GPIOA_ARD_D13 5U |
|
76 |
#define GPIOA_ARD_D12 6U |
|
77 |
#define GPIOA_ARD_D11 7U |
|
78 |
#define GPIOA_ARD_D7 8U |
|
79 |
#define GPIOA_ARD_D8 9U |
|
80 |
#define GPIOA_ARD_D2 10U |
|
81 |
#define GPIOA_OTG_FS_DM 11U |
|
82 |
#define GPIOA_OTG_FS_DP 12U |
|
83 |
#define GPIOA_SWDIO 13U |
|
84 |
#define GPIOA_SWCLK 14U |
|
85 |
#define GPIOA_PIN15 15U |
|
86 |
|
|
87 |
#define GPIOB_ARD_A3 0U |
|
88 |
#define GPIOB_ADC1_IN8 0U |
|
89 |
#define GPIOB_PIN1 1U |
|
90 |
#define GPIOB_PIN2 2U |
|
91 |
#define GPIOB_SWO 3U |
|
92 |
#define GPIOB_ARD_D3 3U |
|
93 |
#define GPIOB_ARD_D5 4U |
|
94 |
#define GPIOB_ARD_D4 5U |
|
95 |
#define GPIOB_ARD_D10 6U |
|
96 |
#define GPIOB_PIN7 7U |
|
97 |
#define GPIOB_ARD_D15 8U |
|
98 |
#define GPIOB_ARD_D14 9U |
|
99 |
#define GPIOB_ARD_D6 10U |
|
100 |
#define GPIOB_PIN11 11U |
|
101 |
#define GPIOB_PIN12 12U |
|
102 |
#define GPIOB_PIN13 13U |
|
103 |
#define GPIOB_PIN14 14U |
|
104 |
#define GPIOB_PIN15 15U |
|
105 |
|
|
106 |
#define GPIOC_ARD_A5 0U |
|
107 |
#define GPIOC_ADC1_IN10 0U |
|
108 |
#define GPIOC_ARD_A4 1U |
|
109 |
#define GPIOC_ADC1_IN11 1U |
|
110 |
#define GPIOC_PIN2 2U |
|
111 |
#define GPIOC_PIN3 3U |
|
112 |
#define GPIOC_PIN4 4U |
|
113 |
#define GPIOC_PIN5 5U |
|
114 |
#define GPIOC_PIN6 6U |
|
115 |
#define GPIOC_ARD_D9 7U |
|
116 |
#define GPIOC_PIN8 8U |
|
117 |
#define GPIOC_PIN9 9U |
|
118 |
#define GPIOC_PIN10 10U |
|
119 |
#define GPIOC_PIN11 11U |
|
120 |
#define GPIOC_PIN12 12U |
|
121 |
#define GPIOC_BUTTON 13U |
|
122 |
#define GPIOC_OSC32_IN 14U |
|
123 |
#define GPIOC_OSC32_OUT 15U |
|
124 |
|
|
125 |
#define GPIOD_PIN0 0U |
|
126 |
#define GPIOD_PIN1 1U |
|
127 |
#define GPIOD_PIN2 2U |
|
128 |
#define GPIOD_PIN3 3U |
|
129 |
#define GPIOD_PIN4 4U |
|
130 |
#define GPIOD_PIN5 5U |
|
131 |
#define GPIOD_PIN6 6U |
|
132 |
#define GPIOD_PIN7 7U |
|
133 |
#define GPIOD_PIN8 8U |
|
134 |
#define GPIOD_PIN9 9U |
|
135 |
#define GPIOD_PIN10 10U |
|
136 |
#define GPIOD_PIN11 11U |
|
137 |
#define GPIOD_PIN12 12U |
|
138 |
#define GPIOD_PIN13 13U |
|
139 |
#define GPIOD_PIN14 14U |
|
140 |
#define GPIOD_PIN15 15U |
|
141 |
|
|
142 |
#define GPIOE_PIN0 0U |
|
143 |
#define GPIOE_PIN1 1U |
|
144 |
#define GPIOE_PIN2 2U |
|
145 |
#define GPIOE_PIN3 3U |
|
146 |
#define GPIOE_PIN4 4U |
|
147 |
#define GPIOE_PIN5 5U |
|
148 |
#define GPIOE_PIN6 6U |
|
149 |
#define GPIOE_PIN7 7U |
|
150 |
#define GPIOE_PIN8 8U |
|
151 |
#define GPIOE_PIN9 9U |
|
152 |
#define GPIOE_PIN10 10U |
|
153 |
#define GPIOE_PIN11 11U |
|
154 |
#define GPIOE_PIN12 12U |
|
155 |
#define GPIOE_PIN13 13U |
|
156 |
#define GPIOE_PIN14 14U |
|
157 |
#define GPIOE_PIN15 15U |
|
158 |
|
|
159 |
#define GPIOF_PIN0 0U |
|
160 |
#define GPIOF_PIN1 1U |
|
161 |
#define GPIOF_PIN2 2U |
|
162 |
#define GPIOF_PIN3 3U |
|
163 |
#define GPIOF_PIN4 4U |
|
164 |
#define GPIOF_PIN5 5U |
|
165 |
#define GPIOF_PIN6 6U |
|
166 |
#define GPIOF_PIN7 7U |
|
167 |
#define GPIOF_PIN8 8U |
|
168 |
#define GPIOF_PIN9 9U |
|
169 |
#define GPIOF_PIN10 10U |
|
170 |
#define GPIOF_PIN11 11U |
|
171 |
#define GPIOF_PIN12 12U |
|
172 |
#define GPIOF_PIN13 13U |
|
173 |
#define GPIOF_PIN14 14U |
|
174 |
#define GPIOF_PIN15 15U |
|
175 |
|
|
176 |
#define GPIOG_PIN0 0U |
|
177 |
#define GPIOG_PIN1 1U |
|
178 |
#define GPIOG_PIN2 2U |
|
179 |
#define GPIOG_PIN3 3U |
|
180 |
#define GPIOG_PIN4 4U |
|
181 |
#define GPIOG_PIN5 5U |
|
182 |
#define GPIOG_PIN6 6U |
|
183 |
#define GPIOG_PIN7 7U |
|
184 |
#define GPIOG_PIN8 8U |
|
185 |
#define GPIOG_PIN9 9U |
|
186 |
#define GPIOG_PIN10 10U |
|
187 |
#define GPIOG_PIN11 11U |
|
188 |
#define GPIOG_PIN12 12U |
|
189 |
#define GPIOG_PIN13 13U |
|
190 |
#define GPIOG_PIN14 14U |
|
191 |
#define GPIOG_PIN15 15U |
|
192 |
|
|
193 |
#define GPIOH_OSC_IN 0U |
|
194 |
#define GPIOH_OSC_OUT 1U |
|
195 |
#define GPIOH_PIN2 2U |
|
196 |
#define GPIOH_PIN3 3U |
|
197 |
#define GPIOH_PIN4 4U |
|
198 |
#define GPIOH_PIN5 5U |
|
199 |
#define GPIOH_PIN6 6U |
|
200 |
#define GPIOH_PIN7 7U |
|
201 |
#define GPIOH_PIN8 8U |
|
202 |
#define GPIOH_PIN9 9U |
|
203 |
#define GPIOH_PIN10 10U |
|
204 |
#define GPIOH_PIN11 11U |
|
205 |
#define GPIOH_PIN12 12U |
|
206 |
#define GPIOH_PIN13 13U |
|
207 |
#define GPIOH_PIN14 14U |
|
208 |
#define GPIOH_PIN15 15U |
|
209 |
|
|
210 |
#define GPIOI_PIN0 0U |
|
211 |
#define GPIOI_PIN1 1U |
|
212 |
#define GPIOI_PIN2 2U |
|
213 |
#define GPIOI_PIN3 3U |
|
214 |
#define GPIOI_PIN4 4U |
|
215 |
#define GPIOI_PIN5 5U |
|
216 |
#define GPIOI_PIN6 6U |
|
217 |
#define GPIOI_PIN7 7U |
|
218 |
#define GPIOI_PIN8 8U |
|
219 |
#define GPIOI_PIN9 9U |
|
220 |
#define GPIOI_PIN10 10U |
|
221 |
#define GPIOI_PIN11 11U |
|
222 |
#define GPIOI_PIN12 12U |
|
223 |
#define GPIOI_PIN13 13U |
|
224 |
#define GPIOI_PIN14 14U |
|
225 |
#define GPIOI_PIN15 15U |
|
226 |
|
|
227 |
/* |
|
228 |
* IO lines assignments. |
|
229 |
*/ |
|
230 |
#define LINE_ARD_A0 PAL_LINE(GPIOA, 0U) |
|
231 |
#define LINE_ADC1_IN0 PAL_LINE(GPIOA, 0U) |
|
232 |
#define LINE_ARD_A1 PAL_LINE(GPIOA, 1U) |
|
233 |
#define LINE_ADC1_IN1 PAL_LINE(GPIOA, 1U) |
|
234 |
#define LINE_ARD_D1 PAL_LINE(GPIOA, 2U) |
|
235 |
#define LINE_USART2_TX PAL_LINE(GPIOA, 2U) |
|
236 |
#define LINE_ARD_D0 PAL_LINE(GPIOA, 3U) |
|
237 |
#define LINE_USART2_RX PAL_LINE(GPIOA, 3U) |
|
238 |
#define LINE_ARD_A2 PAL_LINE(GPIOA, 4U) |
|
239 |
#define LINE_ADC1_IN4 PAL_LINE(GPIOA, 4U) |
|
240 |
#define LINE_LED_GREEN PAL_LINE(GPIOA, 5U) |
|
241 |
#define LINE_ARD_D13 PAL_LINE(GPIOA, 5U) |
|
242 |
#define LINE_ARD_D12 PAL_LINE(GPIOA, 6U) |
|
243 |
#define LINE_ARD_D11 PAL_LINE(GPIOA, 7U) |
|
244 |
#define LINE_ARD_D7 PAL_LINE(GPIOA, 8U) |
|
245 |
#define LINE_ARD_D8 PAL_LINE(GPIOA, 9U) |
|
246 |
#define LINE_ARD_D2 PAL_LINE(GPIOA, 10U) |
|
247 |
#define LINE_OTG_FS_DM PAL_LINE(GPIOA, 11U) |
|
248 |
#define LINE_OTG_FS_DP PAL_LINE(GPIOA, 12U) |
|
249 |
#define LINE_SWDIO PAL_LINE(GPIOA, 13U) |
|
250 |
#define LINE_SWCLK PAL_LINE(GPIOA, 14U) |
|
251 |
#define LINE_ARD_A3 PAL_LINE(GPIOB, 0U) |
|
252 |
#define LINE_ADC1_IN8 PAL_LINE(GPIOB, 0U) |
|
253 |
#define LINE_SWO PAL_LINE(GPIOB, 3U) |
|
254 |
#define LINE_ARD_D3 PAL_LINE(GPIOB, 3U) |
|
255 |
#define LINE_ARD_D5 PAL_LINE(GPIOB, 4U) |
|
256 |
#define LINE_ARD_D4 PAL_LINE(GPIOB, 5U) |
|
257 |
#define LINE_ARD_D10 PAL_LINE(GPIOB, 6U) |
|
258 |
#define LINE_ARD_D15 PAL_LINE(GPIOB, 8U) |
|
259 |
#define LINE_ARD_D14 PAL_LINE(GPIOB, 9U) |
|
260 |
#define LINE_ARD_D6 PAL_LINE(GPIOB, 10U) |
|
261 |
#define LINE_ARD_A5 PAL_LINE(GPIOC, 0U) |
|
262 |
#define LINE_ADC1_IN10 PAL_LINE(GPIOC, 0U) |
|
263 |
#define LINE_ARD_A4 PAL_LINE(GPIOC, 1U) |
|
264 |
#define LINE_ADC1_IN11 PAL_LINE(GPIOC, 1U) |
|
265 |
#define LINE_ARD_D9 PAL_LINE(GPIOC, 7U) |
|
266 |
#define LINE_BUTTON PAL_LINE(GPIOC, 13U) |
|
267 |
#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U) |
|
268 |
#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U) |
|
269 |
#define LINE_OSC_IN PAL_LINE(GPIOH, 0U) |
|
270 |
#define LINE_OSC_OUT PAL_LINE(GPIOH, 1U) |
|
271 |
|
|
272 |
/*===========================================================================*/ |
|
273 |
/* Driver pre-compile time settings. */ |
|
274 |
/*===========================================================================*/ |
|
275 |
|
|
276 |
/*===========================================================================*/ |
|
277 |
/* Derived constants and error checks. */ |
|
278 |
/*===========================================================================*/ |
|
279 |
|
|
280 |
/*===========================================================================*/ |
|
281 |
/* Driver data structures and types. */ |
|
282 |
/*===========================================================================*/ |
|
283 |
|
|
284 |
/*===========================================================================*/ |
|
285 |
/* Driver macros. */ |
|
286 |
/*===========================================================================*/ |
|
287 |
|
|
288 |
/* |
|
289 |
* I/O ports initial setup, this configuration is established soon after reset |
|
290 |
* in the initialization code. |
|
291 |
* Please refer to the STM32 Reference Manual for details. |
|
292 |
*/ |
|
293 |
#define PIN_MODE_INPUT(n) (0U << ((n) * 2U)) |
|
294 |
#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U)) |
|
295 |
#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U)) |
|
296 |
#define PIN_MODE_ANALOG(n) (3U << ((n) * 2U)) |
|
297 |
#define PIN_ODR_LOW(n) (0U << (n)) |
|
298 |
#define PIN_ODR_HIGH(n) (1U << (n)) |
|
299 |
#define PIN_OTYPE_PUSHPULL(n) (0U << (n)) |
|
300 |
#define PIN_OTYPE_OPENDRAIN(n) (1U << (n)) |
|
301 |
#define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U)) |
|
302 |
#define PIN_OSPEED_LOW(n) (1U << ((n) * 2U)) |
|
303 |
#define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U)) |
|
304 |
#define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U)) |
|
305 |
#define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U)) |
|
306 |
#define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U)) |
|
307 |
#define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U)) |
|
308 |
#define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U)) |
|
309 |
|
|
310 |
/* |
|
311 |
* GPIOA setup: |
|
312 |
* |
|
313 |
* PA0 - ARD_A0 ADC1_IN0 (input pullup). |
|
314 |
* PA1 - ARD_A1 ADC1_IN1 (input pullup). |
|
315 |
* PA2 - ARD_D1 USART2_TX (alternate 7). |
|
316 |
* PA3 - ARD_D0 USART2_RX (alternate 7). |
|
317 |
* PA4 - ARD_A2 ADC1_IN4 (input pullup). |
|
318 |
* PA5 - LED_GREEN ARD_D13 (output pushpull high). |
|
319 |
* PA6 - ARD_D12 (input pullup). |
|
320 |
* PA7 - ARD_D11 (input pullup). |
|
321 |
* PA8 - ARD_D7 (input pullup). |
|
322 |
* PA9 - ARD_D8 (input pullup). |
|
323 |
* PA10 - ARD_D2 (input pullup). |
|
324 |
* PA11 - OTG_FS_DM (alternate 10). |
|
325 |
* PA12 - OTG_FS_DP (alternate 10). |
|
326 |
* PA13 - SWDIO (alternate 0). |
|
327 |
* PA14 - SWCLK (alternate 0). |
|
328 |
* PA15 - PIN15 (input pullup). |
|
329 |
*/ |
|
330 |
#define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_ARD_A0) | \ |
|
331 |
PIN_MODE_INPUT(GPIOA_ARD_A1) | \ |
|
332 |
PIN_MODE_ALTERNATE(GPIOA_ARD_D1) | \ |
|
333 |
PIN_MODE_ALTERNATE(GPIOA_ARD_D0) | \ |
|
334 |
PIN_MODE_INPUT(GPIOA_ARD_A2) | \ |
|
335 |
PIN_MODE_OUTPUT(GPIOA_LED_GREEN) | \ |
|
336 |
PIN_MODE_INPUT(GPIOA_ARD_D12) | \ |
|
337 |
PIN_MODE_INPUT(GPIOA_ARD_D11) | \ |
|
338 |
PIN_MODE_INPUT(GPIOA_ARD_D7) | \ |
|
339 |
PIN_MODE_INPUT(GPIOA_ARD_D8) | \ |
|
340 |
PIN_MODE_INPUT(GPIOA_ARD_D2) | \ |
|
341 |
PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DM) | \ |
|
342 |
PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DP) | \ |
|
343 |
PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \ |
|
344 |
PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \ |
|
345 |
PIN_MODE_INPUT(GPIOA_PIN15)) |
|
346 |
#define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_ARD_A0) | \ |
|
347 |
PIN_OTYPE_PUSHPULL(GPIOA_ARD_A1) | \ |
|
348 |
PIN_OTYPE_PUSHPULL(GPIOA_ARD_D1) | \ |
|
349 |
PIN_OTYPE_PUSHPULL(GPIOA_ARD_D0) | \ |
|
350 |
PIN_OTYPE_PUSHPULL(GPIOA_ARD_A2) | \ |
|
351 |
PIN_OTYPE_PUSHPULL(GPIOA_LED_GREEN) | \ |
|
352 |
PIN_OTYPE_PUSHPULL(GPIOA_ARD_D12) | \ |
|
353 |
PIN_OTYPE_PUSHPULL(GPIOA_ARD_D11) | \ |
|
354 |
PIN_OTYPE_PUSHPULL(GPIOA_ARD_D7) | \ |
|
355 |
PIN_OTYPE_PUSHPULL(GPIOA_ARD_D8) | \ |
|
356 |
PIN_OTYPE_PUSHPULL(GPIOA_ARD_D2) | \ |
|
357 |
PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DM) | \ |
|
358 |
PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DP) | \ |
|
359 |
PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | \ |
|
360 |
PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \ |
|
361 |
PIN_OTYPE_PUSHPULL(GPIOA_PIN15)) |
|
362 |
#define VAL_GPIOA_OSPEEDR (PIN_OSPEED_HIGH(GPIOA_ARD_A0) | \ |
|
363 |
PIN_OSPEED_HIGH(GPIOA_ARD_A1) | \ |
|
364 |
PIN_OSPEED_MEDIUM(GPIOA_ARD_D1) | \ |
|
365 |
PIN_OSPEED_MEDIUM(GPIOA_ARD_D0) | \ |
|
366 |
PIN_OSPEED_HIGH(GPIOA_ARD_A2) | \ |
|
367 |
PIN_OSPEED_MEDIUM(GPIOA_LED_GREEN) | \ |
|
368 |
PIN_OSPEED_HIGH(GPIOA_ARD_D12) | \ |
|
369 |
PIN_OSPEED_HIGH(GPIOA_ARD_D11) | \ |
|
370 |
PIN_OSPEED_HIGH(GPIOA_ARD_D7) | \ |
|
371 |
PIN_OSPEED_HIGH(GPIOA_ARD_D8) | \ |
|
372 |
PIN_OSPEED_HIGH(GPIOA_ARD_D2) | \ |
|
373 |
PIN_OSPEED_HIGH(GPIOA_OTG_FS_DM) | \ |
|
374 |
PIN_OSPEED_HIGH(GPIOA_OTG_FS_DP) | \ |
|
375 |
PIN_OSPEED_HIGH(GPIOA_SWDIO) | \ |
|
376 |
PIN_OSPEED_HIGH(GPIOA_SWCLK) | \ |
|
377 |
PIN_OSPEED_HIGH(GPIOA_PIN15)) |
|
378 |
#define VAL_GPIOA_PUPDR (PIN_PUPDR_PULLUP(GPIOA_ARD_A0) | \ |
|
379 |
PIN_PUPDR_PULLUP(GPIOA_ARD_A1) | \ |
|
380 |
PIN_PUPDR_FLOATING(GPIOA_ARD_D1) | \ |
|
381 |
PIN_PUPDR_FLOATING(GPIOA_ARD_D0) | \ |
|
382 |
PIN_PUPDR_PULLUP(GPIOA_ARD_A2) | \ |
|
383 |
PIN_PUPDR_FLOATING(GPIOA_LED_GREEN) | \ |
|
384 |
PIN_PUPDR_PULLUP(GPIOA_ARD_D12) | \ |
|
385 |
PIN_PUPDR_PULLUP(GPIOA_ARD_D11) | \ |
|
386 |
PIN_PUPDR_PULLUP(GPIOA_ARD_D7) | \ |
|
387 |
PIN_PUPDR_PULLUP(GPIOA_ARD_D8) | \ |
|
388 |
PIN_PUPDR_PULLUP(GPIOA_ARD_D2) | \ |
|
389 |
PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DM) | \ |
|
390 |
PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DP) | \ |
|
391 |
PIN_PUPDR_PULLUP(GPIOA_SWDIO) | \ |
|
392 |
PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | \ |
|
393 |
PIN_PUPDR_PULLUP(GPIOA_PIN15)) |
|
394 |
#define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_ARD_A0) | \ |
|
395 |
PIN_ODR_HIGH(GPIOA_ARD_A1) | \ |
|
396 |
PIN_ODR_HIGH(GPIOA_ARD_D1) | \ |
|
397 |
PIN_ODR_HIGH(GPIOA_ARD_D0) | \ |
|
398 |
PIN_ODR_HIGH(GPIOA_ARD_A2) | \ |
|
399 |
PIN_ODR_LOW(GPIOA_LED_GREEN) | \ |
|
400 |
PIN_ODR_HIGH(GPIOA_ARD_D12) | \ |
|
401 |
PIN_ODR_HIGH(GPIOA_ARD_D11) | \ |
|
402 |
PIN_ODR_HIGH(GPIOA_ARD_D7) | \ |
|
403 |
PIN_ODR_HIGH(GPIOA_ARD_D8) | \ |
|
404 |
PIN_ODR_HIGH(GPIOA_ARD_D2) | \ |
|
405 |
PIN_ODR_HIGH(GPIOA_OTG_FS_DM) | \ |
|
406 |
PIN_ODR_HIGH(GPIOA_OTG_FS_DP) | \ |
|
407 |
PIN_ODR_HIGH(GPIOA_SWDIO) | \ |
|
408 |
PIN_ODR_HIGH(GPIOA_SWCLK) | \ |
|
409 |
PIN_ODR_HIGH(GPIOA_PIN15)) |
|
410 |
#define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_ARD_A0, 0U) | \ |
|
411 |
PIN_AFIO_AF(GPIOA_ARD_A1, 0U) | \ |
|
412 |
PIN_AFIO_AF(GPIOA_ARD_D1, 7U) | \ |
|
413 |
PIN_AFIO_AF(GPIOA_ARD_D0, 7U) | \ |
|
414 |
PIN_AFIO_AF(GPIOA_ARD_A2, 0U) | \ |
|
415 |
PIN_AFIO_AF(GPIOA_LED_GREEN, 0U) | \ |
|
416 |
PIN_AFIO_AF(GPIOA_ARD_D12, 0U) | \ |
|
417 |
PIN_AFIO_AF(GPIOA_ARD_D11, 0U)) |
|
418 |
#define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_ARD_D7, 0U) | \ |
|
419 |
PIN_AFIO_AF(GPIOA_ARD_D8, 0U) | \ |
|
420 |
PIN_AFIO_AF(GPIOA_ARD_D2, 0U) | \ |
|
421 |
PIN_AFIO_AF(GPIOA_OTG_FS_DM, 10U) | \ |
|
422 |
PIN_AFIO_AF(GPIOA_OTG_FS_DP, 10U) | \ |
|
423 |
PIN_AFIO_AF(GPIOA_SWDIO, 0U) | \ |
|
424 |
PIN_AFIO_AF(GPIOA_SWCLK, 0U) | \ |
|
425 |
PIN_AFIO_AF(GPIOA_PIN15, 0U)) |
|
426 |
|
|
427 |
/* |
|
428 |
* GPIOB setup: |
|
429 |
* |
|
430 |
* PB0 - ARD_A3 ADC1_IN8 (input pullup). |
|
431 |
* PB1 - PIN1 (input pullup). |
|
432 |
* PB2 - PIN2 (input pullup). |
|
433 |
* PB3 - SWO ARD_D3 (alternate 0). |
|
434 |
* PB4 - ARD_D5 (input pullup). |
|
435 |
* PB5 - ARD_D4 (input pullup). |
|
436 |
* PB6 - ARD_D10 (input pullup). |
|
437 |
* PB7 - PIN7 (input pullup). |
|
438 |
* PB8 - ARD_D15 (input pullup). |
|
439 |
* PB9 - ARD_D14 (input pullup). |
|
440 |
* PB10 - ARD_D6 (input pullup). |
|
441 |
* PB11 - PIN11 (input pullup). |
|
442 |
* PB12 - PIN12 (input pullup). |
|
443 |
* PB13 - PIN13 (input pullup). |
|
444 |
* PB14 - PIN14 (input pullup). |
|
445 |
* PB15 - PIN15 (input pullup). |
|
446 |
*/ |
|
447 |
#define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_ARD_A3) | \ |
|
448 |
PIN_MODE_INPUT(GPIOB_PIN1) | \ |
|
449 |
PIN_MODE_INPUT(GPIOB_PIN2) | \ |
|
450 |
PIN_MODE_ALTERNATE(GPIOB_SWO) | \ |
|
451 |
PIN_MODE_INPUT(GPIOB_ARD_D5) | \ |
|
452 |
PIN_MODE_INPUT(GPIOB_ARD_D4) | \ |
|
453 |
PIN_MODE_INPUT(GPIOB_ARD_D10) | \ |
|
454 |
PIN_MODE_INPUT(GPIOB_PIN7) | \ |
|
455 |
PIN_MODE_INPUT(GPIOB_ARD_D15) | \ |
|
456 |
PIN_MODE_INPUT(GPIOB_ARD_D14) | \ |
|
457 |
PIN_MODE_INPUT(GPIOB_ARD_D6) | \ |
|
458 |
PIN_MODE_INPUT(GPIOB_PIN11) | \ |
|
459 |
PIN_MODE_INPUT(GPIOB_PIN12) | \ |
|
460 |
PIN_MODE_INPUT(GPIOB_PIN13) | \ |
|
461 |
PIN_MODE_INPUT(GPIOB_PIN14) | \ |
|
462 |
PIN_MODE_INPUT(GPIOB_PIN15)) |
|
463 |
#define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_ARD_A3) | \ |
|
464 |
PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | \ |
|
465 |
PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | \ |
|
466 |
PIN_OTYPE_PUSHPULL(GPIOB_SWO) | \ |
|
467 |
PIN_OTYPE_PUSHPULL(GPIOB_ARD_D5) | \ |
|
468 |
PIN_OTYPE_PUSHPULL(GPIOB_ARD_D4) | \ |
|
469 |
PIN_OTYPE_PUSHPULL(GPIOB_ARD_D10) | \ |
|
470 |
PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \ |
|
471 |
PIN_OTYPE_PUSHPULL(GPIOB_ARD_D15) | \ |
|
472 |
PIN_OTYPE_PUSHPULL(GPIOB_ARD_D14) | \ |
|
473 |
PIN_OTYPE_PUSHPULL(GPIOB_ARD_D6) | \ |
|
474 |
PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \ |
|
475 |
PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | \ |
|
476 |
PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | \ |
|
477 |
PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | \ |
|
478 |
PIN_OTYPE_PUSHPULL(GPIOB_PIN15)) |
|
479 |
#define VAL_GPIOB_OSPEEDR (PIN_OSPEED_HIGH(GPIOB_ARD_A3) | \ |
|
480 |
PIN_OSPEED_HIGH(GPIOB_PIN1) | \ |
|
481 |
PIN_OSPEED_HIGH(GPIOB_PIN2) | \ |
|
482 |
PIN_OSPEED_HIGH(GPIOB_SWO) | \ |
|
483 |
PIN_OSPEED_HIGH(GPIOB_ARD_D5) | \ |
|
484 |
PIN_OSPEED_HIGH(GPIOB_ARD_D4) | \ |
|
485 |
PIN_OSPEED_HIGH(GPIOB_ARD_D10) | \ |
|
486 |
PIN_OSPEED_HIGH(GPIOB_PIN7) | \ |
|
487 |
PIN_OSPEED_HIGH(GPIOB_ARD_D15) | \ |
|
488 |
PIN_OSPEED_HIGH(GPIOB_ARD_D14) | \ |
|
489 |
PIN_OSPEED_HIGH(GPIOB_ARD_D6) | \ |
|
490 |
PIN_OSPEED_HIGH(GPIOB_PIN11) | \ |
|
491 |
PIN_OSPEED_HIGH(GPIOB_PIN12) | \ |
|
492 |
PIN_OSPEED_HIGH(GPIOB_PIN13) | \ |
|
493 |
PIN_OSPEED_HIGH(GPIOB_PIN14) | \ |
|
494 |
PIN_OSPEED_HIGH(GPIOB_PIN15)) |
|
495 |
#define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_ARD_A3) | \ |
|
496 |
PIN_PUPDR_PULLUP(GPIOB_PIN1) | \ |
|
497 |
PIN_PUPDR_PULLUP(GPIOB_PIN2) | \ |
|
498 |
PIN_PUPDR_PULLUP(GPIOB_SWO) | \ |
|
499 |
PIN_PUPDR_PULLUP(GPIOB_ARD_D5) | \ |
|
500 |
PIN_PUPDR_PULLUP(GPIOB_ARD_D4) | \ |
|
501 |
PIN_PUPDR_PULLUP(GPIOB_ARD_D10) | \ |
|
502 |
PIN_PUPDR_PULLUP(GPIOB_PIN7) | \ |
|
503 |
PIN_PUPDR_PULLUP(GPIOB_ARD_D15) | \ |
|
504 |
PIN_PUPDR_PULLUP(GPIOB_ARD_D14) | \ |
|
505 |
PIN_PUPDR_PULLUP(GPIOB_ARD_D6) | \ |
|
506 |
PIN_PUPDR_PULLUP(GPIOB_PIN11) | \ |
|
507 |
PIN_PUPDR_PULLUP(GPIOB_PIN12) | \ |
|
508 |
PIN_PUPDR_PULLUP(GPIOB_PIN13) | \ |
|
509 |
PIN_PUPDR_PULLUP(GPIOB_PIN14) | \ |
|
510 |
PIN_PUPDR_PULLUP(GPIOB_PIN15)) |
|
511 |
#define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_ARD_A3) | \ |
|
512 |
PIN_ODR_HIGH(GPIOB_PIN1) | \ |
|
513 |
PIN_ODR_HIGH(GPIOB_PIN2) | \ |
|
514 |
PIN_ODR_HIGH(GPIOB_SWO) | \ |
|
515 |
PIN_ODR_HIGH(GPIOB_ARD_D5) | \ |
|
516 |
PIN_ODR_HIGH(GPIOB_ARD_D4) | \ |
|
517 |
PIN_ODR_HIGH(GPIOB_ARD_D10) | \ |
|
518 |
PIN_ODR_HIGH(GPIOB_PIN7) | \ |
|
519 |
PIN_ODR_HIGH(GPIOB_ARD_D15) | \ |
|
520 |
PIN_ODR_HIGH(GPIOB_ARD_D14) | \ |
|
521 |
PIN_ODR_HIGH(GPIOB_ARD_D6) | \ |
|
522 |
PIN_ODR_HIGH(GPIOB_PIN11) | \ |
|
523 |
PIN_ODR_HIGH(GPIOB_PIN12) | \ |
|
524 |
PIN_ODR_HIGH(GPIOB_PIN13) | \ |
|
525 |
PIN_ODR_HIGH(GPIOB_PIN14) | \ |
|
526 |
PIN_ODR_HIGH(GPIOB_PIN15)) |
|
527 |
#define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_ARD_A3, 0U) | \ |
|
528 |
PIN_AFIO_AF(GPIOB_PIN1, 0U) | \ |
|
529 |
PIN_AFIO_AF(GPIOB_PIN2, 0U) | \ |
|
530 |
PIN_AFIO_AF(GPIOB_SWO, 0U) | \ |
|
531 |
PIN_AFIO_AF(GPIOB_ARD_D5, 0U) | \ |
|
532 |
PIN_AFIO_AF(GPIOB_ARD_D4, 0U) | \ |
|
533 |
PIN_AFIO_AF(GPIOB_ARD_D10, 0U) | \ |
|
534 |
PIN_AFIO_AF(GPIOB_PIN7, 0U)) |
|
535 |
#define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_ARD_D15, 0U) | \ |
|
536 |
PIN_AFIO_AF(GPIOB_ARD_D14, 0U) | \ |
|
537 |
PIN_AFIO_AF(GPIOB_ARD_D6, 0U) | \ |
|
538 |
PIN_AFIO_AF(GPIOB_PIN11, 0U) | \ |
|
539 |
PIN_AFIO_AF(GPIOB_PIN12, 0U) | \ |
|
540 |
PIN_AFIO_AF(GPIOB_PIN13, 0U) | \ |
|
541 |
PIN_AFIO_AF(GPIOB_PIN14, 0U) | \ |
|
542 |
PIN_AFIO_AF(GPIOB_PIN15, 0U)) |
|
543 |
|
|
544 |
/* |
|
545 |
* GPIOC setup: |
|
546 |
* |
|
547 |
* PC0 - ARD_A5 ADC1_IN10 (input pullup). |
|
548 |
* PC1 - ARD_A4 ADC1_IN11 (input pullup). |
|
549 |
* PC2 - PIN2 (input pullup). |
|
550 |
* PC3 - PIN3 (input pullup). |
|
551 |
* PC4 - PIN4 (input pullup). |
|
552 |
* PC5 - PIN5 (input pullup). |
|
553 |
* PC6 - PIN6 (input pullup). |
|
554 |
* PC7 - ARD_D9 (input pullup). |
|
555 |
* PC8 - PIN8 (input pullup). |
|
556 |
* PC9 - PIN9 (input pullup). |
|
557 |
* PC10 - PIN10 (input pullup). |
|
558 |
* PC11 - PIN11 (input pullup). |
|
559 |
* PC12 - PIN12 (input pullup). |
|
560 |
* PC13 - BUTTON (input floating). |
|
561 |
* PC14 - OSC32_IN (input floating). |
Also available in: Unified diff