diff options
Diffstat (limited to 'lib/chibios/demos/AVR/NIL-ARDUINO-MINI')
-rw-r--r-- | lib/chibios/demos/AVR/NIL-ARDUINO-MINI/Makefile | 317 | ||||
-rw-r--r-- | lib/chibios/demos/AVR/NIL-ARDUINO-MINI/cfg/chconf.h | 479 | ||||
-rw-r--r-- | lib/chibios/demos/AVR/NIL-ARDUINO-MINI/cfg/halconf.h | 531 | ||||
-rw-r--r-- | lib/chibios/demos/AVR/NIL-ARDUINO-MINI/cfg/mcuconf.h | 115 | ||||
-rw-r--r-- | lib/chibios/demos/AVR/NIL-ARDUINO-MINI/main.c | 84 | ||||
-rw-r--r-- | lib/chibios/demos/AVR/NIL-ARDUINO-MINI/readme.txt | 18 |
6 files changed, 1544 insertions, 0 deletions
diff --git a/lib/chibios/demos/AVR/NIL-ARDUINO-MINI/Makefile b/lib/chibios/demos/AVR/NIL-ARDUINO-MINI/Makefile new file mode 100644 index 000000000..917802b46 --- /dev/null +++ b/lib/chibios/demos/AVR/NIL-ARDUINO-MINI/Makefile | |||
@@ -0,0 +1,317 @@ | |||
1 | |||
2 | ############################################################################## | ||
3 | # | ||
4 | # @file Makefile. | ||
5 | # | ||
6 | # @brief AVR Make file, it can be use to build, and program an application to | ||
7 | # an AVR MCU like atmega328p, atmega2560 and so on. | ||
8 | # | ||
9 | # @author Theodore Ateba, [email protected] | ||
10 | # | ||
11 | ############################################################################## | ||
12 | |||
13 | ############################################################################## | ||
14 | # Building and programming global options. | ||
15 | # NOTE: Can be overridden externally. | ||
16 | # | ||
17 | |||
18 | # Compiler options here. | ||
19 | ifeq ($(USE_OPT),) | ||
20 | USE_OPT = -O2 | ||
21 | endif | ||
22 | |||
23 | # C specific options here (added to USE_OPT). | ||
24 | ifeq ($(USE_COPT),) | ||
25 | USE_COPT = | ||
26 | endif | ||
27 | |||
28 | # C++ specific options here (added to USE_OPT). | ||
29 | ifeq ($(USE_CPPOPT),) | ||
30 | USE_CPPOPT = | ||
31 | endif | ||
32 | |||
33 | # Enable this if you want to see the full log while compiling. | ||
34 | ifeq ($(USE_VERBOSE_COMPILE),) | ||
35 | USE_VERBOSE_COMPILE = no | ||
36 | endif | ||
37 | |||
38 | # If enabled, this option makes the build process faster by not compiling | ||
39 | # modules not used in the current configuration. | ||
40 | ifeq ($(USE_SMART_BUILD),) | ||
41 | USE_SMART_BUILD = yes | ||
42 | endif | ||
43 | |||
44 | # If enable, this option arase the counter cycle after device programming. | ||
45 | ifeq ($(USE_AVRDUDE_ERASE_COUNTER),) | ||
46 | USE_AVRDUDE_ERASE_COUNTER = no | ||
47 | endif | ||
48 | |||
49 | # If enable, this option perform a verification after device programming. | ||
50 | ifeq ($(USE_AVRDUDE_NO_VERIFY),) | ||
51 | USE_AVRDUDE_NO_VERIFY = no | ||
52 | endif | ||
53 | |||
54 | # If enabled, this option increase the programming verbosity level. | ||
55 | ifeq ($(USE_VERBOSE_PROGRAMMATION),) | ||
56 | USE_VERBOSE_PROGRAMMATION = no | ||
57 | endif | ||
58 | |||
59 | # Enable this if you want to use AVRDUDE programmer. | ||
60 | ifeq ($(USE_AVRDUDE_PROGRAMMER),) | ||
61 | USE_AVRDUDE_PROGRAMMER = yes | ||
62 | endif | ||
63 | |||
64 | # Enable this if you want to use DFU programmer. | ||
65 | ifeq ($(USE_DFU_PROGRAMMER),) | ||
66 | USE_DFU_PROGRAMMER = no | ||
67 | endif | ||
68 | |||
69 | # Enable this if you want to use MICRONUCLEUS programmer. | ||
70 | ifeq ($(USE_MICRONUCLEUS_PROGRAMMER),) | ||
71 | USE_MICRONUCLEUS_PROGRAMMER = no | ||
72 | endif | ||
73 | |||
74 | # | ||
75 | # Building and programming global options. | ||
76 | ############################################################################## | ||
77 | |||
78 | ############################################################################## | ||
79 | # Project, sources and paths. | ||
80 | # | ||
81 | |||
82 | # Define project name here. | ||
83 | PROJECT = ch | ||
84 | |||
85 | # Imported source files and paths | ||
86 | CHIBIOS := ../../.. | ||
87 | CONFDIR := ./cfg | ||
88 | BUILDDIR := ./build | ||
89 | DEPDIR := ./.dep | ||
90 | |||
91 | # Licensing files. | ||
92 | include $(CHIBIOS)/os/license/license.mk | ||
93 | |||
94 | # HAL-OSAL files (optional). | ||
95 | include $(CHIBIOS)/os/hal/hal.mk | ||
96 | include $(CHIBIOS)/os/hal/boards/ARDUINO_MINI/board.mk | ||
97 | include $(CHIBIOS)/os/hal/ports/AVR/MEGA/ATMEGAxx/platform.mk | ||
98 | include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk | ||
99 | |||
100 | # RTOS files (optional). | ||
101 | include $(CHIBIOS)/os/nil/nil.mk | ||
102 | include $(CHIBIOS)/os/common/ports/AVR/compilers/GCC/mk/port.mk | ||
103 | |||
104 | # List C source files here. (C dependencies are automatically generated.) | ||
105 | CSRC = $(ALLCSRC) \ | ||
106 | main.c | ||
107 | |||
108 | # List C++ sources file here. | ||
109 | CPPSRC = $(ALLCPPSRC) | ||
110 | |||
111 | # Header files here. | ||
112 | INCDIR = $(CONFDIR) $(ALLINC) | ||
113 | |||
114 | # | ||
115 | # Project, sources and paths. | ||
116 | ############################################################################## | ||
117 | |||
118 | ############################################################################## | ||
119 | # Compiler settings. | ||
120 | # | ||
121 | |||
122 | # Micro-Controller Unit. | ||
123 | MCU = atmega328p | ||
124 | |||
125 | # MCU frequency (Hz). | ||
126 | F_CPU = 16000000 | ||
127 | |||
128 | # Output format. (can be srec, ihex, binary) | ||
129 | FORMAT = ihex | ||
130 | |||
131 | # C and C++ Compiler name. | ||
132 | TRGT = avr- | ||
133 | CC = $(TRGT)gcc | ||
134 | CPPC = $(TRGT)g++ | ||
135 | |||
136 | # Enable loading with g++ only if you need C++ runtime support. | ||
137 | # NOTE: You can use C++ even without C++ support if you are careful. C++ | ||
138 | # runtime support makes code size explode. | ||
139 | LD = $(TRGT)gcc | ||
140 | CP = $(TRGT)objcopy | ||
141 | AR = $(TRGT)ar rcs | ||
142 | OD = $(TRGT)objdump | ||
143 | NM = $(TRGT)nm | ||
144 | SZ = $(TRGT)size | ||
145 | HEX = $(CP) -O ihex | ||
146 | BIN = $(CP) -O binary | ||
147 | |||
148 | # AVR programming tool. | ||
149 | AVRDUDE = avrdude | ||
150 | |||
151 | # Size of the elf binary file. | ||
152 | ELFSIZE = $(SZ) --mcu=$(MCU) --format=avr $(BUILDDIR)/$(PROJECT).elf | ||
153 | |||
154 | # MCU specific options here. | ||
155 | MOPT = | ||
156 | |||
157 | # Define C warning options here. | ||
158 | CWARN = -Wall -Wstrict-prototypes | ||
159 | |||
160 | # Define C++ warning options here. | ||
161 | CPPWARN = | ||
162 | |||
163 | # | ||
164 | # Compiler settings. | ||
165 | ############################################################################## | ||
166 | |||
167 | ############################################################################## | ||
168 | # Start of user section. | ||
169 | # | ||
170 | |||
171 | # List all user C define here, like -D_DEBUG=1. | ||
172 | UDEFS = | ||
173 | |||
174 | # Define ASM defines here. | ||
175 | UADEFS = | ||
176 | |||
177 | # List all user directories here. | ||
178 | UINCDIR = | ||
179 | |||
180 | # List the user directory to look for the libraries here. | ||
181 | ULIBDIR = | ||
182 | |||
183 | # List all user libraries here. | ||
184 | ULIBS = | ||
185 | |||
186 | # | ||
187 | # End of user defines. | ||
188 | ############################################################################## | ||
189 | |||
190 | ############################################################################## | ||
191 | # Start of programming Options. | ||
192 | # | ||
193 | |||
194 | # List of available AVR programmer. | ||
195 | AVRDUDE_PROGRAMMER = avrdude | ||
196 | AVRDUDE_PROGRAMMER_ID = wiring | ||
197 | DFU_PROGRAMMER = dfu-programmer | ||
198 | MICRONUCLEUS = micronucleus | ||
199 | |||
200 | # Set the AVR programmer according to the selection.. | ||
201 | ifeq ($(USE_AVRDUDE_PROGRAMMER),yes) | ||
202 | AVR_PROGRAMMER = $(AVRDUDE_PROGRAMMER) | ||
203 | else ifeq ($(USE_DFU_PROGRAMMER),yes) | ||
204 | AVR_PROGRAMMER = $(DFU_PROGRAMMER) | ||
205 | else ifeq ($(USE_MICRONUCLEUS_PROGRAMMER),yes) | ||
206 | AVR_PROGRAMMER = $(MICRONUCLEUS_PROGRAMMER) | ||
207 | else | ||
208 | $(error ERROR: Please you need to configure the AVR programmer!) | ||
209 | endif | ||
210 | |||
211 | # AVR serial port. | ||
212 | AVRDUDE_PORT = /dev/ttyUSB0 | ||
213 | |||
214 | AVRDUDE_WRITE_FLASH = -D -U flash:w:$(BUILDDIR)/$(PROJECT).hex | ||
215 | |||
216 | # Check if the counter cycle erase must be performed after device programming. | ||
217 | ifeq ($(USE_AVRDUDE_ERASE_COUNTER),yes) | ||
218 | AVRDUDE_ERASE_COUNTER = -y | ||
219 | endif | ||
220 | |||
221 | # Check if a verification must be performed after device programming. | ||
222 | ifeq ($(USE_AVRDUDE_NO_VERIFY),no) | ||
223 | AVRDUDE_NO_VERIFY = -V | ||
224 | endif | ||
225 | |||
226 | # Check verbosity level activation. | ||
227 | ifeq ($(USE_VERBOSE_PROGRAMMATION),yes) | ||
228 | AVRDUDE_VERBOSE = -v -v | ||
229 | endif | ||
230 | |||
231 | # AVR programmer flags for AVRDUDE programmer. | ||
232 | ifeq ($(AVR_PROGRAMMER),$(AVRDUDE_PROGRAMMER)) | ||
233 | AVRDUDE_FLAGS = -p $(MCU) | ||
234 | AVRDUDE_FLAGS += -P $(AVRDUDE_PORT) | ||
235 | AVRDUDE_FLAGS += -b 115200 | ||
236 | AVRDUDE_FLAGS += -c $(AVRDUDE_PROGRAMMER_ID) | ||
237 | AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) | ||
238 | AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) | ||
239 | AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) | ||
240 | endif | ||
241 | |||
242 | # AVR programmer flags for DFU programmer. | ||
243 | ifeq ($(AVR_PROGRAMMER),$(DFU_PROGRAMMER)) | ||
244 | DFU_WRITE_FLASH = flash --force | ||
245 | DFU_ERASE_FLASH = erase | ||
246 | DFU_RESET=reset | ||
247 | endif | ||
248 | |||
249 | # AVR programmer flags for MICRONUCLEUS programmer. | ||
250 | ifeq ($(AVR_PROGRAMMER),$(MICRONUCLEUS_PROGRAMMER)) | ||
251 | MICRONUCLEUS_TIMEOUT_ARG = --timeout 60 | ||
252 | MICRONUCLEUS_RUN_ARG = --run | ||
253 | MICRONUCLEUS_TYPE_ARG = --type raw | ||
254 | MICRONUCLEUS_DUMP_PROGRESS = --dump-progress | ||
255 | MICRONUCLEUS_FLAGS=$(MICRONUCLEUS_TYPE_ARG) | ||
256 | MICRONUCLEUS_FLAGS+=$(MICRONUCLEUS_TIMEOUT_ARG) | ||
257 | MICRONUCLEUS_FLAGS+=$(MICRONUCLEUS_RUN_ARG) | ||
258 | endif | ||
259 | |||
260 | # | ||
261 | # End of Programming Options. | ||
262 | ############################################################################## | ||
263 | |||
264 | ############################################################################## | ||
265 | # Include file. | ||
266 | # | ||
267 | |||
268 | RULESPATH = $(CHIBIOS)/os/common/ports/AVR/compilers/GCC | ||
269 | include $(RULESPATH)/rules.mk | ||
270 | |||
271 | # | ||
272 | # End of include file. | ||
273 | ############################################################################## | ||
274 | |||
275 | ############################################################################## | ||
276 | # Programming rules | ||
277 | # | ||
278 | |||
279 | # AVRDUDE programming rules. | ||
280 | ifeq ($(AVR_PROGRAMMER),$(AVRDUDE_PROGRAMMER)) | ||
281 | program: $(BUILDDIR)/$(PROJECT).hex | ||
282 | @echo | ||
283 | @echo Programming $(MCU) device. | ||
284 | $(AVR_PROGRAMMER) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $< | ||
285 | @echo Done. | ||
286 | endif | ||
287 | |||
288 | # DFU programming rules. | ||
289 | ifeq ($(AVR_PROGRAMMER),$(DFU_PROGRAMMER)) | ||
290 | program: $(BUILDDIR)/$(PROJECT).hex | ||
291 | @echo | ||
292 | @echo Programming $(MCU) device. | ||
293 | $(AVR_PROGRAMMER) $(MCU) $(DFU_WRITE_FLASH) $< | ||
294 | $(AVR_PROGRAMMER) $(MCU) $(DFU_RESET) | ||
295 | @echo Done. | ||
296 | |||
297 | erase: | ||
298 | @echo | ||
299 | @echo Erasing $(MCU) device. | ||
300 | $(AVR_PROGRAMMER) $(MCU) $(DFU_ERASE_FLASH) | ||
301 | @echo Done. | ||
302 | endif | ||
303 | |||
304 | # MICRONUCLEUS programming rules. | ||
305 | ifeq ($(AVR_PROGRAMMER),$(MICRONUCLEUS_PROGRAMMER)) | ||
306 | program: $(BUILDDIR)/$(PROJECT).bin | ||
307 | @echo | ||
308 | @echo Programming $(MCU) device. | ||
309 | $(AVR_PROGRAMMER) $(MICRONUCLEUS_FLAGS) $< | ||
310 | @echo Done. | ||
311 | endif | ||
312 | |||
313 | # | ||
314 | # End of programming rules. | ||
315 | ############################################################################## | ||
316 | |||
317 | # EOF | ||
diff --git a/lib/chibios/demos/AVR/NIL-ARDUINO-MINI/cfg/chconf.h b/lib/chibios/demos/AVR/NIL-ARDUINO-MINI/cfg/chconf.h new file mode 100644 index 000000000..4436ada17 --- /dev/null +++ b/lib/chibios/demos/AVR/NIL-ARDUINO-MINI/cfg/chconf.h | |||
@@ -0,0 +1,479 @@ | |||
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 nil/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 NIL_CONFIG | ||
24 | * @details Kernel related settings and hooks. | ||
25 | * @{ | ||
26 | */ | ||
27 | |||
28 | #ifndef CHCONF_H | ||
29 | #define CHCONF_H | ||
30 | |||
31 | #define _CHIBIOS_NIL_CONF_ | ||
32 | #define _CHIBIOS_NIL_CONF_VER_4_0_ | ||
33 | |||
34 | /*===========================================================================*/ | ||
35 | /** | ||
36 | * @name Kernel parameters and options | ||
37 | * @{ | ||
38 | */ | ||
39 | /*===========================================================================*/ | ||
40 | |||
41 | /** | ||
42 | * @brief Maximum number of user threads in the application. | ||
43 | * @note This number is not inclusive of the idle thread which is | ||
44 | * implicitly handled. | ||
45 | * @note Set this value to be exactly equal to the number of threads you | ||
46 | * will use or you would be wasting RAM and cycles. | ||
47 | * @note This values also defines the number of available priorities | ||
48 | * (0..CH_CFG_MAX_THREADS-1). | ||
49 | */ | ||
50 | #if !defined(CH_CFG_MAX_THREADS) | ||
51 | #define CH_CFG_MAX_THREADS 4 | ||
52 | #endif | ||
53 | |||
54 | /** | ||
55 | * @brief Auto starts threads when @p chSysInit() is invoked. | ||
56 | */ | ||
57 | #if !defined(CH_CFG_AUTOSTART_THREADS) | ||
58 | #define CH_CFG_AUTOSTART_THREADS TRUE | ||
59 | #endif | ||
60 | |||
61 | /** @} */ | ||
62 | |||
63 | /*===========================================================================*/ | ||
64 | /** | ||
65 | * @name System timer settings | ||
66 | * @{ | ||
67 | */ | ||
68 | /*===========================================================================*/ | ||
69 | |||
70 | /** | ||
71 | * @brief System time counter resolution. | ||
72 | * @note Allowed values are 16 or 32 bits. | ||
73 | */ | ||
74 | #if !defined(CH_CFG_ST_RESOLUTION) | ||
75 | #define CH_CFG_ST_RESOLUTION 16 | ||
76 | #endif | ||
77 | |||
78 | /** | ||
79 | * @brief System tick frequency. | ||
80 | * @note This value together with the @p CH_CFG_ST_RESOLUTION | ||
81 | * option defines the maximum amount of time allowed for | ||
82 | * timeouts. | ||
83 | */ | ||
84 | #if !defined(CH_CFG_ST_FREQUENCY) | ||
85 | #define CH_CFG_ST_FREQUENCY 15624 | ||
86 | #endif | ||
87 | |||
88 | /** | ||
89 | * @brief Time delta constant for the tick-less mode. | ||
90 | * @note If this value is zero then the system uses the classic | ||
91 | * periodic tick. This value represents the minimum number | ||
92 | * of ticks that is safe to specify in a timeout directive. | ||
93 | * The value one is not valid, timeouts are rounded up to | ||
94 | * this value. | ||
95 | */ | ||
96 | #if !defined(CH_CFG_ST_TIMEDELTA) | ||
97 | #define CH_CFG_ST_TIMEDELTA 2 | ||
98 | #endif | ||
99 | |||
100 | /** @} */ | ||
101 | |||
102 | /*===========================================================================*/ | ||
103 | /** | ||
104 | * @name Subsystem options | ||
105 | * @{ | ||
106 | */ | ||
107 | /*===========================================================================*/ | ||
108 | |||
109 | /** | ||
110 | * @brief Threads synchronization APIs. | ||
111 | * @details If enabled then the @p chThdWait() function is included in | ||
112 | * the kernel. | ||
113 | * | ||
114 | * @note The default is @p TRUE. | ||
115 | */ | ||
116 | #if !defined(CH_CFG_USE_WAITEXIT) | ||
117 | #define CH_CFG_USE_WAITEXIT TRUE | ||
118 | #endif | ||
119 | |||
120 | /** | ||
121 | * @brief Semaphores APIs. | ||
122 | * @details If enabled then the Semaphores APIs are included in the kernel. | ||
123 | * | ||
124 | * @note The default is @p TRUE. | ||
125 | */ | ||
126 | #if !defined(CH_CFG_USE_SEMAPHORES) | ||
127 | #define CH_CFG_USE_SEMAPHORES TRUE | ||
128 | #endif | ||
129 | |||
130 | /** | ||
131 | * @brief Mutexes APIs. | ||
132 | * @details If enabled then the mutexes APIs are included in the kernel. | ||
133 | * | ||
134 | * @note Feature not currently implemented. | ||
135 | * @note The default is @p FALSE. | ||
136 | */ | ||
137 | #if !defined(CH_CFG_USE_MUTEXES) | ||
138 | #define CH_CFG_USE_MUTEXES FALSE | ||
139 | #endif | ||
140 | |||
141 | /** | ||
142 | * @brief Events Flags APIs. | ||
143 | * @details If enabled then the event flags APIs are included in the kernel. | ||
144 | * | ||
145 | * @note The default is @p TRUE. | ||
146 | */ | ||
147 | #if !defined(CH_CFG_USE_EVENTS) | ||
148 | #define CH_CFG_USE_EVENTS TRUE | ||
149 | #endif | ||
150 | |||
151 | /** | ||
152 | * @brief Synchronous Messages APIs. | ||
153 | * @details If enabled then the synchronous messages APIs are included | ||
154 | * in the kernel. | ||
155 | * | ||
156 | * @note The default is @p TRUE. | ||
157 | */ | ||
158 | #if !defined(CH_CFG_USE_MESSAGES) | ||
159 | #define CH_CFG_USE_MESSAGES TRUE | ||
160 | #endif | ||
161 | |||
162 | /** @} */ | ||
163 | |||
164 | /*===========================================================================*/ | ||
165 | /** | ||
166 | * @name OSLIB options | ||
167 | * @{ | ||
168 | */ | ||
169 | /*===========================================================================*/ | ||
170 | |||
171 | /** | ||
172 | * @brief Mailboxes APIs. | ||
173 | * @details If enabled then the asynchronous messages (mailboxes) APIs are | ||
174 | * included in the kernel. | ||
175 | * | ||
176 | * @note The default is @p TRUE. | ||
177 | * @note Requires @p CH_CFG_USE_SEMAPHORES. | ||
178 | */ | ||
179 | #if !defined(CH_CFG_USE_MAILBOXES) | ||
180 | #define CH_CFG_USE_MAILBOXES TRUE | ||
181 | #endif | ||
182 | |||
183 | /** | ||
184 | * @brief Core Memory Manager APIs. | ||
185 | * @details If enabled then the core memory manager APIs are included | ||
186 | * in the kernel. | ||
187 | * | ||
188 | * @note The default is @p TRUE. | ||
189 | */ | ||
190 | #if !defined(CH_CFG_USE_MEMCORE) | ||
191 | #define CH_CFG_USE_MEMCORE TRUE | ||
192 | #endif | ||
193 | |||
194 | /** | ||
195 | * @brief Managed RAM size. | ||
196 | * @details Size of the RAM area to be managed by the OS. If set to zero | ||
197 | * then the whole available RAM is used. The core memory is made | ||
198 | * available to the heap allocator and/or can be used directly through | ||
199 | * the simplified core memory allocator. | ||
200 | * | ||
201 | * @note In order to let the OS manage the whole RAM the linker script must | ||
202 | * provide the @p __heap_base__ and @p __heap_end__ symbols. | ||
203 | * @note Requires @p CH_CFG_USE_MEMCORE. | ||
204 | */ | ||
205 | #if !defined(CH_CFG_MEMCORE_SIZE) | ||
206 | #define CH_CFG_MEMCORE_SIZE 128 | ||
207 | #endif | ||
208 | |||
209 | /** | ||
210 | * @brief Heap Allocator APIs. | ||
211 | * @details If enabled then the memory heap allocator APIs are included | ||
212 | * in the kernel. | ||
213 | * | ||
214 | * @note The default is @p TRUE. | ||
215 | */ | ||
216 | #if !defined(CH_CFG_USE_HEAP) | ||
217 | #define CH_CFG_USE_HEAP TRUE | ||
218 | #endif | ||
219 | |||
220 | /** | ||
221 | * @brief Memory Pools Allocator APIs. | ||
222 | * @details If enabled then the memory pools allocator APIs are included | ||
223 | * in the kernel. | ||
224 | * | ||
225 | * @note The default is @p TRUE. | ||
226 | */ | ||
227 | #if !defined(CH_CFG_USE_MEMPOOLS) | ||
228 | #define CH_CFG_USE_MEMPOOLS TRUE | ||
229 | #endif | ||
230 | |||
231 | /** | ||
232 | * @brief Objects FIFOs APIs. | ||
233 | * @details If enabled then the objects FIFOs APIs are included | ||
234 | * in the kernel. | ||
235 | * | ||
236 | * @note The default is @p TRUE. | ||
237 | */ | ||
238 | #if !defined(CH_CFG_USE_OBJ_FIFOS) | ||
239 | #define CH_CFG_USE_OBJ_FIFOS TRUE | ||
240 | #endif | ||
241 | |||
242 | /** | ||
243 | * @brief Pipes APIs. | ||
244 | * @details If enabled then the pipes APIs are included | ||
245 | * in the kernel. | ||
246 | * | ||
247 | * @note The default is @p TRUE. | ||
248 | */ | ||
249 | #if !defined(CH_CFG_USE_PIPES) | ||
250 | #define CH_CFG_USE_PIPES TRUE | ||
251 | #endif | ||
252 | |||
253 | /** | ||
254 | * @brief Objects Caches APIs. | ||
255 | * @details If enabled then the objects caches APIs are included | ||
256 | * in the kernel. | ||
257 | * | ||
258 | * @note The default is @p TRUE. | ||
259 | */ | ||
260 | #if !defined(CH_CFG_USE_OBJ_CACHES) | ||
261 | #define CH_CFG_USE_OBJ_CACHES TRUE | ||
262 | #endif | ||
263 | |||
264 | /** | ||
265 | * @brief Delegate threads APIs. | ||
266 | * @details If enabled then the delegate threads APIs are included | ||
267 | * in the kernel. | ||
268 | * | ||
269 | * @note The default is @p TRUE. | ||
270 | */ | ||
271 | #if !defined(CH_CFG_USE_DELEGATES) | ||
272 | #define CH_CFG_USE_DELEGATES TRUE | ||
273 | #endif | ||
274 | |||
275 | /** | ||
276 | * @brief Jobs Queues APIs. | ||
277 | * @details If enabled then the jobs queues APIs are included | ||
278 | * in the kernel. | ||
279 | * | ||
280 | * @note The default is @p TRUE. | ||
281 | */ | ||
282 | #if !defined(CH_CFG_USE_JOBS) | ||
283 | #define CH_CFG_USE_JOBS TRUE | ||
284 | #endif | ||
285 | |||
286 | /** @} */ | ||
287 | |||
288 | /*===========================================================================*/ | ||
289 | /** | ||
290 | * @name Objects factory options | ||
291 | * @{ | ||
292 | */ | ||
293 | /*===========================================================================*/ | ||
294 | |||
295 | /** | ||
296 | * @brief Objects Factory APIs. | ||
297 | * @details If enabled then the objects factory APIs are included in the | ||
298 | * kernel. | ||
299 | * | ||
300 | * @note The default is @p FALSE. | ||
301 | */ | ||
302 | #if !defined(CH_CFG_USE_FACTORY) | ||
303 | #define CH_CFG_USE_FACTORY FALSE | ||
304 | #endif | ||
305 | |||
306 | /** | ||
307 | * @brief Maximum length for object names. | ||
308 | * @details If the specified length is zero then the name is stored by | ||
309 | * pointer but this could have unintended side effects. | ||
310 | */ | ||
311 | #if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) | ||
312 | #define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 | ||
313 | #endif | ||
314 | |||
315 | /** | ||
316 | * @brief Enables the registry of generic objects. | ||
317 | */ | ||
318 | #if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) | ||
319 | #define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE | ||
320 | #endif | ||
321 | |||
322 | /** | ||
323 | * @brief Enables factory for generic buffers. | ||
324 | */ | ||
325 | #if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) | ||
326 | #define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE | ||
327 | #endif | ||
328 | |||
329 | /** | ||
330 | * @brief Enables factory for semaphores. | ||
331 | */ | ||
332 | #if !defined(CH_CFG_FACTORY_SEMAPHORES) | ||
333 | #define CH_CFG_FACTORY_SEMAPHORES TRUE | ||
334 | #endif | ||
335 | |||
336 | /** | ||
337 | * @brief Enables factory for mailboxes. | ||
338 | */ | ||
339 | #if !defined(CH_CFG_FACTORY_MAILBOXES) | ||
340 | #define CH_CFG_FACTORY_MAILBOXES TRUE | ||
341 | #endif | ||
342 | |||
343 | /** | ||
344 | * @brief Enables factory for objects FIFOs. | ||
345 | */ | ||
346 | #if !defined(CH_CFG_FACTORY_OBJ_FIFOS) | ||
347 | #define CH_CFG_FACTORY_OBJ_FIFOS TRUE | ||
348 | #endif | ||
349 | |||
350 | /** | ||
351 | * @brief Enables factory for Pipes. | ||
352 | */ | ||
353 | #if !defined(CH_CFG_FACTORY_PIPES) | ||
354 | #define CH_CFG_FACTORY_PIPES TRUE | ||
355 | #endif | ||
356 | |||
357 | /** @} */ | ||
358 | |||
359 | /*===========================================================================*/ | ||
360 | /** | ||
361 | * @name Debug options | ||
362 | * @{ | ||
363 | */ | ||
364 | /*===========================================================================*/ | ||
365 | |||
366 | /** | ||
367 | * @brief Debug option, kernel statistics. | ||
368 | * | ||
369 | * @note Feature not currently implemented. | ||
370 | * @note The default is @p FALSE. | ||
371 | */ | ||
372 | #if !defined(CH_DBG_STATISTICS) | ||
373 | #define CH_DBG_STATISTICS FALSE | ||
374 | #endif | ||
375 | |||
376 | /** | ||
377 | * @brief Debug option, system state check. | ||
378 | * | ||
379 | * @note The default is @p FALSE. | ||
380 | */ | ||
381 | #if !defined(CH_DBG_SYSTEM_STATE_CHECK) | ||
382 | #define CH_DBG_SYSTEM_STATE_CHECK FALSE | ||
383 | #endif | ||
384 | |||
385 | /** | ||
386 | * @brief Debug option, parameters checks. | ||
387 | * | ||
388 | * @note The default is @p FALSE. | ||
389 | */ | ||
390 | #if !defined(CH_DBG_ENABLE_CHECKS) | ||
391 | #define CH_DBG_ENABLE_CHECKS FALSE | ||
392 | #endif | ||
393 | |||
394 | /** | ||
395 | * @brief System assertions. | ||
396 | * | ||
397 | * @note The default is @p FALSE. | ||
398 | */ | ||
399 | #if !defined(CH_DBG_ENABLE_ASSERTS) | ||
400 | #define CH_DBG_ENABLE_ASSERTS FALSE | ||
401 | #endif | ||
402 | |||
403 | /** | ||
404 | * @brief Stack check. | ||
405 | * | ||
406 | * @note The default is @p FALSE. | ||
407 | */ | ||
408 | #if !defined(CH_DBG_ENABLE_STACK_CHECK) | ||
409 | #define CH_DBG_ENABLE_STACK_CHECK FALSE | ||
410 | #endif | ||
411 | |||
412 | /** @} */ | ||
413 | |||
414 | /*===========================================================================*/ | ||
415 | /** | ||
416 | * @name Kernel hooks | ||
417 | * @{ | ||
418 | */ | ||
419 | /*===========================================================================*/ | ||
420 | |||
421 | /** | ||
422 | * @brief System initialization hook. | ||
423 | */ | ||
424 | #define CH_CFG_SYSTEM_INIT_HOOK() { \ | ||
425 | } | ||
426 | |||
427 | /** | ||
428 | * @brief Threads descriptor structure extension. | ||
429 | * @details User fields added to the end of the @p thread_t structure. | ||
430 | */ | ||
431 | #define CH_CFG_THREAD_EXT_FIELDS \ | ||
432 | /* Add threads custom fields here.*/ | ||
433 | |||
434 | /** | ||
435 | * @brief Threads initialization hook. | ||
436 | */ | ||
437 | #define CH_CFG_THREAD_EXT_INIT_HOOK(tr) { \ | ||
438 | /* Add custom threads initialization code here.*/ \ | ||
439 | } | ||
440 | |||
441 | /** | ||
442 | * @brief Threads finalization hook. | ||
443 | * @details User finalization code added to the @p chThdExit() API. | ||
444 | */ | ||
445 | #define CH_CFG_THREAD_EXIT_HOOK(tp) {} | ||
446 | |||
447 | /** | ||
448 | * @brief Idle thread enter hook. | ||
449 | * @note This hook is invoked within a critical zone, no OS functions | ||
450 | * should be invoked from here. | ||
451 | * @note This macro can be used to activate a power saving mode. | ||
452 | */ | ||
453 | #define CH_CFG_IDLE_ENTER_HOOK() { \ | ||
454 | } | ||
455 | |||
456 | /** | ||
457 | * @brief Idle thread leave hook. | ||
458 | * @note This hook is invoked within a critical zone, no OS functions | ||
459 | * should be invoked from here. | ||
460 | * @note This macro can be used to deactivate a power saving mode. | ||
461 | */ | ||
462 | #define CH_CFG_IDLE_LEAVE_HOOK() { \ | ||
463 | } | ||
464 | |||
465 | /** | ||
466 | * @brief System halt hook. | ||
467 | */ | ||
468 | #define CH_CFG_SYSTEM_HALT_HOOK(reason) { \ | ||
469 | } | ||
470 | |||
471 | /** @} */ | ||
472 | |||
473 | /*===========================================================================*/ | ||
474 | /* Port-specific settings (override port settings defaulted in nilcore.h). */ | ||
475 | /*===========================================================================*/ | ||
476 | |||
477 | #endif /* CHCONF_H */ | ||
478 | |||
479 | /** @} */ | ||
diff --git a/lib/chibios/demos/AVR/NIL-ARDUINO-MINI/cfg/halconf.h b/lib/chibios/demos/AVR/NIL-ARDUINO-MINI/cfg/halconf.h new file mode 100644 index 000000000..5e342d8c6 --- /dev/null +++ b/lib/chibios/demos/AVR/NIL-ARDUINO-MINI/cfg/halconf.h | |||
@@ -0,0 +1,531 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /** | ||
18 | * @file templates/halconf.h | ||
19 | * @brief HAL configuration header. | ||
20 | * @details HAL configuration file, this file allows to enable or disable the | ||
21 | * various device drivers from your application. You may also use | ||
22 | * this file in order to override the device drivers default settings. | ||
23 | * | ||
24 | * @addtogroup HAL_CONF | ||
25 | * @{ | ||
26 | */ | ||
27 | |||
28 | #ifndef HALCONF_H | ||
29 | #define HALCONF_H | ||
30 | |||
31 | #define _CHIBIOS_HAL_CONF_ | ||
32 | #define _CHIBIOS_HAL_CONF_VER_7_1_ | ||
33 | |||
34 | #include "mcuconf.h" | ||
35 | |||
36 | /** | ||
37 | * @brief Enables the PAL subsystem. | ||
38 | */ | ||
39 | #if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) | ||
40 | #define HAL_USE_PAL TRUE | ||
41 | #endif | ||
42 | |||
43 | /** | ||
44 | * @brief Enables the ADC subsystem. | ||
45 | */ | ||
46 | #if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) | ||
47 | #define HAL_USE_ADC FALSE | ||
48 | #endif | ||
49 | |||
50 | /** | ||
51 | * @brief Enables the CAN subsystem. | ||
52 | */ | ||
53 | #if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) | ||
54 | #define HAL_USE_CAN FALSE | ||
55 | #endif | ||
56 | |||
57 | /** | ||
58 | * @brief Enables the cryptographic subsystem. | ||
59 | */ | ||
60 | #if !defined(HAL_USE_CRY) || defined(__DOXYGEN__) | ||
61 | #define HAL_USE_CRY FALSE | ||
62 | #endif | ||
63 | |||
64 | /** | ||
65 | * @brief Enables the DAC subsystem. | ||
66 | */ | ||
67 | #if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) | ||
68 | #define HAL_USE_DAC FALSE | ||
69 | #endif | ||
70 | |||
71 | /** | ||
72 | * @brief Enables the EFlash subsystem. | ||
73 | */ | ||
74 | #if !defined(HAL_USE_EFL) || defined(__DOXYGEN__) | ||
75 | #define HAL_USE_EFL FALSE | ||
76 | #endif | ||
77 | |||
78 | /** | ||
79 | * @brief Enables the GPT subsystem. | ||
80 | */ | ||
81 | #if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) | ||
82 | #define HAL_USE_GPT FALSE | ||
83 | #endif | ||
84 | |||
85 | /** | ||
86 | * @brief Enables the I2C subsystem. | ||
87 | */ | ||
88 | #if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) | ||
89 | #define HAL_USE_I2C FALSE | ||
90 | #endif | ||
91 | |||
92 | /** | ||
93 | * @brief Enables the I2S subsystem. | ||
94 | */ | ||
95 | #if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) | ||
96 | #define HAL_USE_I2S FALSE | ||
97 | #endif | ||
98 | |||
99 | /** | ||
100 | * @brief Enables the ICU subsystem. | ||
101 | */ | ||
102 | #if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) | ||
103 | #define HAL_USE_ICU FALSE | ||
104 | #endif | ||
105 | |||
106 | /** | ||
107 | * @brief Enables the MAC subsystem. | ||
108 | */ | ||
109 | #if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) | ||
110 | #define HAL_USE_MAC FALSE | ||
111 | #endif | ||
112 | |||
113 | /** | ||
114 | * @brief Enables the MMC_SPI subsystem. | ||
115 | */ | ||
116 | #if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) | ||
117 | #define HAL_USE_MMC_SPI FALSE | ||
118 | #endif | ||
119 | |||
120 | /** | ||
121 | * @brief Enables the PWM subsystem. | ||
122 | */ | ||
123 | #if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) | ||
124 | #define HAL_USE_PWM FALSE | ||
125 | #endif | ||
126 | |||
127 | /** | ||
128 | * @brief Enables the RTC subsystem. | ||
129 | */ | ||
130 | #if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) | ||
131 | #define HAL_USE_RTC FALSE | ||
132 | #endif | ||
133 | |||
134 | /** | ||
135 | * @brief Enables the SDC subsystem. | ||
136 | */ | ||
137 | #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) | ||
138 | #define HAL_USE_SDC FALSE | ||
139 | #endif | ||
140 | |||
141 | /** | ||
142 | * @brief Enables the SERIAL subsystem. | ||
143 | */ | ||
144 | #if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) | ||
145 | #define HAL_USE_SERIAL TRUE | ||
146 | #endif | ||
147 | |||
148 | /** | ||
149 | * @brief Enables the SERIAL over USB subsystem. | ||
150 | */ | ||
151 | #if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) | ||
152 | #define HAL_USE_SERIAL_USB FALSE | ||
153 | #endif | ||
154 | |||
155 | /** | ||
156 | * @brief Enables the SIO subsystem. | ||
157 | */ | ||
158 | #if !defined(HAL_USE_SIO) || defined(__DOXYGEN__) | ||
159 | #define HAL_USE_SIO FALSE | ||
160 | #endif | ||
161 | |||
162 | /** | ||
163 | * @brief Enables the SPI subsystem. | ||
164 | */ | ||
165 | #if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) | ||
166 | #define HAL_USE_SPI FALSE | ||
167 | #endif | ||
168 | |||
169 | /** | ||
170 | * @brief Enables the TRNG subsystem. | ||
171 | */ | ||
172 | #if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__) | ||
173 | #define HAL_USE_TRNG FALSE | ||
174 | #endif | ||
175 | |||
176 | /** | ||
177 | * @brief Enables the UART subsystem. | ||
178 | */ | ||
179 | #if !defined(HAL_USE_UART) || defined(__DOXYGEN__) | ||
180 | #define HAL_USE_UART FALSE | ||
181 | #endif | ||
182 | |||
183 | /** | ||
184 | * @brief Enables the USB subsystem. | ||
185 | */ | ||
186 | #if !defined(HAL_USE_USB) || defined(__DOXYGEN__) | ||
187 | #define HAL_USE_USB FALSE | ||
188 | #endif | ||
189 | |||
190 | /** | ||
191 | * @brief Enables the WDG subsystem. | ||
192 | */ | ||
193 | #if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) | ||
194 | #define HAL_USE_WDG FALSE | ||
195 | #endif | ||
196 | |||
197 | /** | ||
198 | * @brief Enables the WSPI subsystem. | ||
199 | */ | ||
200 | #if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__) | ||
201 | #define HAL_USE_WSPI FALSE | ||
202 | #endif | ||
203 | |||
204 | /*===========================================================================*/ | ||
205 | /* PAL driver related settings. */ | ||
206 | /*===========================================================================*/ | ||
207 | |||
208 | /** | ||
209 | * @brief Enables synchronous APIs. | ||
210 | * @note Disabling this option saves both code and data space. | ||
211 | */ | ||
212 | #if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__) | ||
213 | #define PAL_USE_CALLBACKS FALSE | ||
214 | #endif | ||
215 | |||
216 | /** | ||
217 | * @brief Enables synchronous APIs. | ||
218 | * @note Disabling this option saves both code and data space. | ||
219 | */ | ||
220 | #if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__) | ||
221 | #define PAL_USE_WAIT FALSE | ||
222 | #endif | ||
223 | |||
224 | /*===========================================================================*/ | ||
225 | /* ADC driver related settings. */ | ||
226 | /*===========================================================================*/ | ||
227 | |||
228 | /** | ||
229 | * @brief Enables synchronous APIs. | ||
230 | * @note Disabling this option saves both code and data space. | ||
231 | */ | ||
232 | #if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) | ||
233 | #define ADC_USE_WAIT TRUE | ||
234 | #endif | ||
235 | |||
236 | /** | ||
237 | * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. | ||
238 | * @note Disabling this option saves both code and data space. | ||
239 | */ | ||
240 | #if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
241 | #define ADC_USE_MUTUAL_EXCLUSION TRUE | ||
242 | #endif | ||
243 | |||
244 | /*===========================================================================*/ | ||
245 | /* CAN driver related settings. */ | ||
246 | /*===========================================================================*/ | ||
247 | |||
248 | /** | ||
249 | * @brief Sleep mode related APIs inclusion switch. | ||
250 | */ | ||
251 | #if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) | ||
252 | #define CAN_USE_SLEEP_MODE TRUE | ||
253 | #endif | ||
254 | |||
255 | /** | ||
256 | * @brief Enforces the driver to use direct callbacks rather than OSAL events. | ||
257 | */ | ||
258 | #if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__) | ||
259 | #define CAN_ENFORCE_USE_CALLBACKS FALSE | ||
260 | #endif | ||
261 | |||
262 | /*===========================================================================*/ | ||
263 | /* CRY driver related settings. */ | ||
264 | /*===========================================================================*/ | ||
265 | |||
266 | /** | ||
267 | * @brief Enables the SW fall-back of the cryptographic driver. | ||
268 | * @details When enabled, this option, activates a fall-back software | ||
269 | * implementation for algorithms not supported by the underlying | ||
270 | * hardware. | ||
271 | * @note Fall-back implementations may not be present for all algorithms. | ||
272 | */ | ||
273 | #if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__) | ||
274 | #define HAL_CRY_USE_FALLBACK FALSE | ||
275 | #endif | ||
276 | |||
277 | /** | ||
278 | * @brief Makes the driver forcibly use the fall-back implementations. | ||
279 | */ | ||
280 | #if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__) | ||
281 | #define HAL_CRY_ENFORCE_FALLBACK FALSE | ||
282 | #endif | ||
283 | |||
284 | /*===========================================================================*/ | ||
285 | /* DAC driver related settings. */ | ||
286 | /*===========================================================================*/ | ||
287 | |||
288 | /** | ||
289 | * @brief Enables synchronous APIs. | ||
290 | * @note Disabling this option saves both code and data space. | ||
291 | */ | ||
292 | #if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__) | ||
293 | #define DAC_USE_WAIT TRUE | ||
294 | #endif | ||
295 | |||
296 | /** | ||
297 | * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs. | ||
298 | * @note Disabling this option saves both code and data space. | ||
299 | */ | ||
300 | #if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
301 | #define DAC_USE_MUTUAL_EXCLUSION TRUE | ||
302 | #endif | ||
303 | |||
304 | /*===========================================================================*/ | ||
305 | /* I2C driver related settings. */ | ||
306 | /*===========================================================================*/ | ||
307 | |||
308 | /** | ||
309 | * @brief Enables the mutual exclusion APIs on the I2C bus. | ||
310 | */ | ||
311 | #if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
312 | #define I2C_USE_MUTUAL_EXCLUSION TRUE | ||
313 | #endif | ||
314 | |||
315 | /*===========================================================================*/ | ||
316 | /* MAC driver related settings. */ | ||
317 | /*===========================================================================*/ | ||
318 | |||
319 | /** | ||
320 | * @brief Enables the zero-copy API. | ||
321 | */ | ||
322 | #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) | ||
323 | #define MAC_USE_ZERO_COPY FALSE | ||
324 | #endif | ||
325 | |||
326 | /** | ||
327 | * @brief Enables an event sources for incoming packets. | ||
328 | */ | ||
329 | #if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) | ||
330 | #define MAC_USE_EVENTS TRUE | ||
331 | #endif | ||
332 | |||
333 | /*===========================================================================*/ | ||
334 | /* MMC_SPI driver related settings. */ | ||
335 | /*===========================================================================*/ | ||
336 | |||
337 | /** | ||
338 | * @brief Delays insertions. | ||
339 | * @details If enabled this options inserts delays into the MMC waiting | ||
340 | * routines releasing some extra CPU time for the threads with | ||
341 | * lower priority, this may slow down the driver a bit however. | ||
342 | * This option is recommended also if the SPI driver does not | ||
343 | * use a DMA channel and heavily loads the CPU. | ||
344 | */ | ||
345 | #if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) | ||
346 | #define MMC_NICE_WAITING TRUE | ||
347 | #endif | ||
348 | |||
349 | /*===========================================================================*/ | ||
350 | /* SDC driver related settings. */ | ||
351 | /*===========================================================================*/ | ||
352 | |||
353 | /** | ||
354 | * @brief Number of initialization attempts before rejecting the card. | ||
355 | * @note Attempts are performed at 10mS intervals. | ||
356 | */ | ||
357 | #if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) | ||
358 | #define SDC_INIT_RETRY 100 | ||
359 | #endif | ||
360 | |||
361 | /** | ||
362 | * @brief Include support for MMC cards. | ||
363 | * @note MMC support is not yet implemented so this option must be kept | ||
364 | * at @p FALSE. | ||
365 | */ | ||
366 | #if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) | ||
367 | #define SDC_MMC_SUPPORT FALSE | ||
368 | #endif | ||
369 | |||
370 | /** | ||
371 | * @brief Delays insertions. | ||
372 | * @details If enabled this options inserts delays into the MMC waiting | ||
373 | * routines releasing some extra CPU time for the threads with | ||
374 | * lower priority, this may slow down the driver a bit however. | ||
375 | */ | ||
376 | #if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) | ||
377 | #define SDC_NICE_WAITING TRUE | ||
378 | #endif | ||
379 | |||
380 | /** | ||
381 | * @brief OCR initialization constant for V20 cards. | ||
382 | */ | ||
383 | #if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__) | ||
384 | #define SDC_INIT_OCR_V20 0x50FF8000U | ||
385 | #endif | ||
386 | |||
387 | /** | ||
388 | * @brief OCR initialization constant for non-V20 cards. | ||
389 | */ | ||
390 | #if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__) | ||
391 | #define SDC_INIT_OCR 0x80100000U | ||
392 | #endif | ||
393 | |||
394 | /*===========================================================================*/ | ||
395 | /* SERIAL driver related settings. */ | ||
396 | /*===========================================================================*/ | ||
397 | |||
398 | /** | ||
399 | * @brief Default bit rate. | ||
400 | * @details Configuration parameter, this is the baud rate selected for the | ||
401 | * default configuration. | ||
402 | */ | ||
403 | #if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) | ||
404 | #define SERIAL_DEFAULT_BITRATE 38400 | ||
405 | #endif | ||
406 | |||
407 | /** | ||
408 | * @brief Serial buffers size. | ||
409 | * @details Configuration parameter, you can change the depth of the queue | ||
410 | * buffers depending on the requirements of your application. | ||
411 | * @note The default is 16 bytes for both the transmission and receive | ||
412 | * buffers. | ||
413 | */ | ||
414 | #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) | ||
415 | #define SERIAL_BUFFERS_SIZE 16 | ||
416 | #endif | ||
417 | |||
418 | /*===========================================================================*/ | ||
419 | /* SERIAL_USB driver related setting. */ | ||
420 | /*===========================================================================*/ | ||
421 | |||
422 | /** | ||
423 | * @brief Serial over USB buffers size. | ||
424 | * @details Configuration parameter, the buffer size must be a multiple of | ||
425 | * the USB data endpoint maximum packet size. | ||
426 | * @note The default is 256 bytes for both the transmission and receive | ||
427 | * buffers. | ||
428 | */ | ||
429 | #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) | ||
430 | #define SERIAL_USB_BUFFERS_SIZE 256 | ||
431 | #endif | ||
432 | |||
433 | /** | ||
434 | * @brief Serial over USB number of buffers. | ||
435 | * @note The default is 2 buffers. | ||
436 | */ | ||
437 | #if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__) | ||
438 | #define SERIAL_USB_BUFFERS_NUMBER 2 | ||
439 | #endif | ||
440 | |||
441 | /*===========================================================================*/ | ||
442 | /* SPI driver related settings. */ | ||
443 | /*===========================================================================*/ | ||
444 | |||
445 | /** | ||
446 | * @brief Enables synchronous APIs. | ||
447 | * @note Disabling this option saves both code and data space. | ||
448 | */ | ||
449 | #if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) | ||
450 | #define SPI_USE_WAIT TRUE | ||
451 | #endif | ||
452 | |||
453 | /** | ||
454 | * @brief Enables circular transfers APIs. | ||
455 | * @note Disabling this option saves both code and data space. | ||
456 | */ | ||
457 | #if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__) | ||
458 | #define SPI_USE_CIRCULAR FALSE | ||
459 | #endif | ||
460 | |||
461 | /** | ||
462 | * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. | ||
463 | * @note Disabling this option saves both code and data space. | ||
464 | */ | ||
465 | #if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
466 | #define SPI_USE_MUTUAL_EXCLUSION TRUE | ||
467 | #endif | ||
468 | |||
469 | /** | ||
470 | * @brief Handling method for SPI CS line. | ||
471 | * @note Disabling this option saves both code and data space. | ||
472 | */ | ||
473 | #if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__) | ||
474 | #define SPI_SELECT_MODE SPI_SELECT_MODE_PAD | ||
475 | #endif | ||
476 | |||
477 | /*===========================================================================*/ | ||
478 | /* UART driver related settings. */ | ||
479 | /*===========================================================================*/ | ||
480 | |||
481 | /** | ||
482 | * @brief Enables synchronous APIs. | ||
483 | * @note Disabling this option saves both code and data space. | ||
484 | */ | ||
485 | #if !defined(UART_USE_WAIT) || defined(__DOXYGEN__) | ||
486 | #define UART_USE_WAIT FALSE | ||
487 | #endif | ||
488 | |||
489 | /** | ||
490 | * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs. | ||
491 | * @note Disabling this option saves both code and data space. | ||
492 | */ | ||
493 | #if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
494 | #define UART_USE_MUTUAL_EXCLUSION FALSE | ||
495 | #endif | ||
496 | |||
497 | /*===========================================================================*/ | ||
498 | /* USB driver related settings. */ | ||
499 | /*===========================================================================*/ | ||
500 | |||
501 | /** | ||
502 | * @brief Enables synchronous APIs. | ||
503 | * @note Disabling this option saves both code and data space. | ||
504 | */ | ||
505 | #if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) | ||
506 | #define USB_USE_WAIT FALSE | ||
507 | #endif | ||
508 | |||
509 | /*===========================================================================*/ | ||
510 | /* WSPI driver related settings. */ | ||
511 | /*===========================================================================*/ | ||
512 | |||
513 | /** | ||
514 | * @brief Enables synchronous APIs. | ||
515 | * @note Disabling this option saves both code and data space. | ||
516 | */ | ||
517 | #if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__) | ||
518 | #define WSPI_USE_WAIT TRUE | ||
519 | #endif | ||
520 | |||
521 | /** | ||
522 | * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs. | ||
523 | * @note Disabling this option saves both code and data space. | ||
524 | */ | ||
525 | #if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
526 | #define WSPI_USE_MUTUAL_EXCLUSION TRUE | ||
527 | #endif | ||
528 | |||
529 | #endif /* HALCONF_H */ | ||
530 | |||
531 | /** @} */ | ||
diff --git a/lib/chibios/demos/AVR/NIL-ARDUINO-MINI/cfg/mcuconf.h b/lib/chibios/demos/AVR/NIL-ARDUINO-MINI/cfg/mcuconf.h new file mode 100644 index 000000000..1cb5be6cf --- /dev/null +++ b/lib/chibios/demos/AVR/NIL-ARDUINO-MINI/cfg/mcuconf.h | |||
@@ -0,0 +1,115 @@ | |||
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 | * AVR 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 driver | ||
25 | * is enabled in halconf.h. | ||
26 | */ | ||
27 | |||
28 | /* | ||
29 | * ADC driver system settings. | ||
30 | */ | ||
31 | #define AVR_ADC_USE_ADC1 FALSE | ||
32 | |||
33 | /* | ||
34 | * EXT drivers system settings. | ||
35 | */ | ||
36 | #define AVR_EXT_USE_INT0 FALSE | ||
37 | #define AVR_EXT_USE_INT1 FALSE | ||
38 | #define AVR_EXT_USE_INT2 FALSE | ||
39 | #define AVR_EXT_USE_INT3 FALSE | ||
40 | #define AVR_EXT_USE_INT4 FALSE | ||
41 | #define AVR_EXT_USE_INT5 FALSE | ||
42 | |||
43 | /* | ||
44 | * PCINT driver system settings. | ||
45 | */ | ||
46 | #define AVR_EXT_USE_PCINT0 FALSE | ||
47 | #define AVR_EXT_USE_PCINT1 FALSE | ||
48 | #define AVR_EXT_USE_PCINT2 FALSE | ||
49 | #define AVR_EXT_USE_PCINT3 FALSE | ||
50 | #define AVR_EXT_USE_PCINT4 FALSE | ||
51 | #define AVR_EXT_USE_PCINT5 FALSE | ||
52 | #define AVR_EXT_USE_PCINT6 FALSE | ||
53 | #define AVR_EXT_USE_PCINT7 FALSE | ||
54 | #define AVR_EXT_USE_PCINT8 FALSE | ||
55 | #define AVR_EXT_USE_PCINT9 FALSE | ||
56 | #define AVR_EXT_USE_PCINT10 FALSE | ||
57 | |||
58 | /* | ||
59 | * CAN driver system settings. | ||
60 | */ | ||
61 | |||
62 | /* | ||
63 | * MAC driver system settings. | ||
64 | */ | ||
65 | |||
66 | /* | ||
67 | * PWM driver system settings. | ||
68 | */ | ||
69 | #define AVR_PWM_USE_TIM1 FALSE | ||
70 | #define AVR_PWM_USE_TIM2 FALSE | ||
71 | #define AVR_PWM_USE_TIM3 FALSE | ||
72 | #define AVR_PWM_USE_TIM4 FALSE | ||
73 | #define AVR_PWM_USE_TIM5 FALSE | ||
74 | |||
75 | /* | ||
76 | * ICU driver system settings. | ||
77 | */ | ||
78 | #define AVR_ICU_USE_TIM1 FALSE | ||
79 | #define AVR_ICU_USE_TIM3 FALSE | ||
80 | #define AVR_ICU_USE_TIM4 FALSE | ||
81 | #define AVR_ICU_USE_TIM5 FALSE | ||
82 | |||
83 | /* | ||
84 | * GPT driver system settings. | ||
85 | */ | ||
86 | #define AVR_GPT_USE_TIM1 FALSE | ||
87 | #define AVR_GPT_USE_TIM2 FALSE | ||
88 | #define AVR_GPT_USE_TIM3 FALSE | ||
89 | #define AVR_GPT_USE_TIM4 FALSE | ||
90 | #define AVR_GPT_USE_TIM5 FALSE | ||
91 | |||
92 | /* | ||
93 | * SERIAL driver system settings. | ||
94 | */ | ||
95 | #define AVR_SERIAL_USE_USART0 TRUE | ||
96 | #define AVR_SERIAL_USE_USART1 FALSE | ||
97 | |||
98 | /* | ||
99 | * I2C driver system settings. | ||
100 | */ | ||
101 | #define AVR_I2C_USE_I2C1 FALSE | ||
102 | |||
103 | /* | ||
104 | * SPI driver system settings. | ||
105 | */ | ||
106 | #define AVR_SPI_USE_SPI1 FALSE | ||
107 | #define AVR_SPI_USE_16BIT_POLLED_EXCHANGE FALSE | ||
108 | |||
109 | /* | ||
110 | * USB driver system settings. | ||
111 | */ | ||
112 | #define AVR_USB_USE_USB1 FALSE | ||
113 | #define AVR_USB_USE_NAMED_ADDRESS_SPACES FALSE | ||
114 | |||
115 | #endif /* MCUCONF_H */ | ||
diff --git a/lib/chibios/demos/AVR/NIL-ARDUINO-MINI/main.c b/lib/chibios/demos/AVR/NIL-ARDUINO-MINI/main.c new file mode 100644 index 000000000..5a5dc2491 --- /dev/null +++ b/lib/chibios/demos/AVR/NIL-ARDUINO-MINI/main.c | |||
@@ -0,0 +1,84 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | #include "ch.h" | ||
19 | |||
20 | /* | ||
21 | * Thread 1. | ||
22 | */ | ||
23 | THD_WORKING_AREA(waThread1, 128); | ||
24 | THD_FUNCTION(Thread1, arg) { | ||
25 | |||
26 | (void)arg; | ||
27 | |||
28 | while (true) { | ||
29 | palTogglePad(IOPORT2, PORTB_LED1); | ||
30 | chThdSleepMilliseconds(500); | ||
31 | } | ||
32 | } | ||
33 | |||
34 | /* | ||
35 | * Thread 2. | ||
36 | */ | ||
37 | THD_WORKING_AREA(waThread2, 128); | ||
38 | THD_FUNCTION(Thread2, arg) { | ||
39 | |||
40 | (void)arg; | ||
41 | |||
42 | /* | ||
43 | * Activates the serial driver 1 using the driver default configuration. | ||
44 | * PD0(RX) and PD1(TX) are routed to USART0. | ||
45 | */ | ||
46 | sdStart(&SD1, NULL); | ||
47 | |||
48 | while (true) { | ||
49 | chnWrite(&SD1, (const uint8_t *)"Hello World!\r\n", 14); | ||
50 | chThdSleepMilliseconds(2000); | ||
51 | } | ||
52 | } | ||
53 | |||
54 | /* | ||
55 | * Threads static table, one entry per thread. The number of entries must | ||
56 | * match NIL_CFG_NUM_THREADS. | ||
57 | */ | ||
58 | THD_TABLE_BEGIN | ||
59 | THD_TABLE_THREAD(1, "blinker", waThread1, Thread1, NULL) | ||
60 | THD_TABLE_THREAD(0, "hello", waThread2, Thread2, NULL) | ||
61 | THD_TABLE_END | ||
62 | |||
63 | /* | ||
64 | * Application entry point. | ||
65 | */ | ||
66 | int main(void) { | ||
67 | |||
68 | /* | ||
69 | * System initializations. | ||
70 | * - HAL initialization, this also initializes the configured device drivers | ||
71 | * and performs the board-specific initializations. | ||
72 | * - Kernel initialization, the main() function becomes a thread and the | ||
73 | * RTOS is active. | ||
74 | */ | ||
75 | halInit(); | ||
76 | chSysInit(); | ||
77 | |||
78 | /* This is now the idle thread loop, you may perform here a low priority | ||
79 | task but you must never try to sleep or wait in this loop. Note that | ||
80 | this tasks runs at the lowest priority level so any instruction added | ||
81 | here will be executed after all other tasks have been started.*/ | ||
82 | while (true) { | ||
83 | } | ||
84 | } | ||
diff --git a/lib/chibios/demos/AVR/NIL-ARDUINO-MINI/readme.txt b/lib/chibios/demos/AVR/NIL-ARDUINO-MINI/readme.txt new file mode 100644 index 000000000..785fa6204 --- /dev/null +++ b/lib/chibios/demos/AVR/NIL-ARDUINO-MINI/readme.txt | |||
@@ -0,0 +1,18 @@ | |||
1 | ***************************************************************************** | ||
2 | ** ChibiOS/NIL port for Atmel AVR ATmega328p. ** | ||
3 | ***************************************************************************** | ||
4 | |||
5 | ** TARGET ** | ||
6 | |||
7 | The demo runs on an Arduino Mini board. | ||
8 | |||
9 | ** The Demo ** | ||
10 | |||
11 | One thread prints a message to the serial console, which is available on | ||
12 | the board USB connector (FT232 converter). | ||
13 | |||
14 | Another thread toggles the LED on PB5 (pin 13 on Arduino IDE) every 500ms. | ||
15 | |||
16 | ** Build Procedure ** | ||
17 | |||
18 | The demo was built using the GCC AVR toolchain. | ||