rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
hw_layer
ports
stm32
cfg
chconf_stm32.h
Go to the documentation of this file.
1
/*
2
ChibiOS - Copyright (C) 2006..2017 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/chconf.h
19
* @brief Configuration file template.
20
* @details A copy of this file must be placed in each project directory, it
21
* contains the application specific kernel settings.
22
*
23
* @addtogroup config
24
* @details Kernel related settings and hooks.
25
* @{
26
*/
27
28
#ifndef CHCONF_H
29
#define CHCONF_H
30
31
#include "
chconf_common.h
"
32
33
/*===========================================================================*/
34
/**
35
* @name System settings
36
* @{
37
*/
38
/*===========================================================================*/
39
40
/**
41
* @brief Handling of instances.
42
* @note If enabled then threads assigned to various instances can
43
* interact each other using the same synchronization objects.
44
* If disabled then each OS instance is a separate world, no
45
* direct interactions are handled by the OS.
46
*/
47
#if !defined(CH_CFG_SMP_MODE)
48
#define CH_CFG_SMP_MODE FALSE
49
#endif
50
51
/** @} */
52
53
/*===========================================================================*/
54
/**
55
* @name System timers settings
56
* @{
57
*/
58
/*===========================================================================*/
59
60
/**
61
* @brief System time counter resolution.
62
* @note Allowed values are 16, 32 or 64 bits.
63
*/
64
#if !defined(CH_CFG_ST_RESOLUTION)
65
#define CH_CFG_ST_RESOLUTION 32
66
#endif
67
68
/**
69
* @brief System tick frequency.
70
* @details Frequency of the system timer that drives the system ticks. This
71
* setting also defines the system tick time unit.
72
*/
73
#if !defined(CH_CFG_ST_FREQUENCY)
74
#define CH_CFG_ST_FREQUENCY 1000
75
#endif
76
77
/**
78
* @brief Time intervals data size.
79
* @note Allowed values are 16, 32 or 64 bits.
80
*/
81
#if !defined(CH_CFG_INTERVALS_SIZE)
82
#define CH_CFG_INTERVALS_SIZE 32
83
#endif
84
85
/**
86
* @brief Time types data size.
87
* @note Allowed values are 16 or 32 bits.
88
*/
89
#if !defined(CH_CFG_TIME_TYPES_SIZE)
90
#define CH_CFG_TIME_TYPES_SIZE 32
91
#endif
92
93
/**
94
* @brief Time delta constant for the tick-less mode.
95
* @note If this value is zero then the system uses the classic
96
* periodic tick. This value represents the minimum number
97
* of ticks that is safe to specify in a timeout directive.
98
* The value one is not valid, timeouts are rounded up to
99
* this value.
100
*/
101
// rusEfi currently uses tick mode, see CH_CFG_ST_FREQUENCY
102
// ST requires TIM2 or another 32 bit timer and we currently use it for ICU
103
// but! there is no reason to use it for ICU as we've recently realized
104
// so todo: migrate trigger to EXTI and try tick-less mode
105
// see also CH_CFG_TIME_QUANTUM
106
#if !defined(CH_CFG_ST_TIMEDELTA)
107
#define CH_CFG_ST_TIMEDELTA 0
108
#endif
109
110
/** @} */
111
112
/*===========================================================================*/
113
/**
114
* @name Kernel parameters and options
115
* @{
116
*/
117
/*===========================================================================*/
118
119
/**
120
* @brief Round robin interval.
121
* @details This constant is the number of system ticks allowed for the
122
* threads before preemption occurs. Setting this value to zero
123
* disables the preemption for threads with equal priority and the
124
* round robin becomes cooperative. Note that higher priority
125
* threads can still preempt, the kernel is always preemptive.
126
* @note Disabling the round robin preemption makes the kernel more compact
127
* and generally faster.
128
* @note The round robin preemption is not supported in tickless mode and
129
* must be set to zero in that case.
130
*/
131
#if !defined(CH_CFG_TIME_QUANTUM)
132
#define CH_CFG_TIME_QUANTUM 0
133
#endif
134
135
/**
136
* @brief Idle thread automatic spawn suppression.
137
* @details When this option is activated the function @p chSysInit()
138
* does not spawn the idle thread. The application @p main()
139
* function becomes the idle thread and must implement an
140
* infinite loop.
141
*/
142
#if !defined(CH_CFG_NO_IDLE_THREAD)
143
#define CH_CFG_NO_IDLE_THREAD FALSE
144
#endif
145
146
/** @} */
147
148
/*===========================================================================*/
149
/**
150
* @name Performance options
151
* @{
152
*/
153
/*===========================================================================*/
154
155
/**
156
* @brief OS optimization.
157
* @details If enabled then time efficient rather than space efficient code
158
* is used when two possible implementations exist.
159
*
160
* @note This is not related to the compiler optimization options.
161
* @note The default is @p TRUE.
162
*/
163
#if !defined(CH_CFG_OPTIMIZE_SPEED)
164
#define CH_CFG_OPTIMIZE_SPEED TRUE
165
#endif
166
167
/** @} */
168
169
/*===========================================================================*/
170
/**
171
* @name Subsystem options
172
* @{
173
*/
174
/*===========================================================================*/
175
176
/**
177
* @brief Time Measurement APIs.
178
* @details If enabled then the time measurement APIs are included in
179
* the kernel.
180
*
181
* @note The default is @p TRUE.
182
*/
183
#if !defined(CH_CFG_USE_TM)
184
#define CH_CFG_USE_TM TRUE
185
#endif
186
187
/**
188
* @brief Time Stamps APIs.
189
* @details If enabled then the time stamps APIs are included in the kernel.
190
*
191
* @note The default is @p TRUE.
192
*/
193
#if !defined(CH_CFG_USE_TIMESTAMP)
194
#define CH_CFG_USE_TIMESTAMP TRUE
195
#endif
196
197
/**
198
* @brief Threads registry APIs.
199
* @details If enabled then the registry APIs are included in the kernel.
200
*
201
* @note The default is @p TRUE.
202
*/
203
#if !defined(CH_CFG_USE_REGISTRY)
204
#define CH_CFG_USE_REGISTRY TRUE
205
#endif
206
207
/**
208
* @brief Threads synchronization APIs.
209
* @details If enabled then the @p chThdWait() function is included in
210
* the kernel.
211
*
212
* @note The default is @p TRUE.
213
*/
214
#if !defined(CH_CFG_USE_WAITEXIT)
215
#define CH_CFG_USE_WAITEXIT TRUE
216
#endif
217
218
/**
219
* @brief Semaphores APIs.
220
* @details If enabled then the Semaphores APIs are included in the kernel.
221
*
222
* @note The default is @p TRUE.
223
*/
224
#if !defined(CH_CFG_USE_SEMAPHORES)
225
#define CH_CFG_USE_SEMAPHORES TRUE
226
#endif
227
228
/**
229
* @brief Semaphores queuing mode.
230
* @details If enabled then the threads are enqueued on semaphores by
231
* priority rather than in FIFO order.
232
*
233
* @note The default is @p FALSE. Enable this if you have special
234
* requirements.
235
* @note Requires @p CH_CFG_USE_SEMAPHORES.
236
*/
237
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
238
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
239
#endif
240
241
/**
242
* @brief Mutexes APIs.
243
* @details If enabled then the mutexes APIs are included in the kernel.
244
*
245
* @note The default is @p TRUE.
246
*/
247
#if !defined(CH_CFG_USE_MUTEXES)
248
#define CH_CFG_USE_MUTEXES TRUE
249
#endif
250
251
/**
252
* @brief Enables recursive behavior on mutexes.
253
* @note Recursive mutexes are heavier and have an increased
254
* memory footprint.
255
*
256
* @note The default is @p FALSE.
257
* @note Requires @p CH_CFG_USE_MUTEXES.
258
*/
259
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
260
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
261
#endif
262
263
/**
264
* @brief Conditional Variables APIs.
265
* @details If enabled then the conditional variables APIs are included
266
* in the kernel.
267
*
268
* @note The default is @p TRUE.
269
* @note Requires @p CH_CFG_USE_MUTEXES.
270
*/
271
#if !defined(CH_CFG_USE_CONDVARS)
272
#define CH_CFG_USE_CONDVARS TRUE
273
#endif
274
275
/**
276
* @brief Conditional Variables APIs with timeout.
277
* @details If enabled then the conditional variables APIs with timeout
278
* specification are included in the kernel.
279
*
280
* @note The default is @p TRUE.
281
* @note Requires @p CH_CFG_USE_CONDVARS.
282
*/
283
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
284
#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
285
#endif
286
287
/**
288
* @brief Events Flags APIs.
289
* @details If enabled then the event flags APIs are included in the kernel.
290
*
291
* @note The default is @p TRUE.
292
*/
293
#if !defined(CH_CFG_USE_EVENTS)
294
#define CH_CFG_USE_EVENTS TRUE
295
#endif
296
297
/**
298
* @brief Events Flags APIs with timeout.
299
* @details If enabled then the events APIs with timeout specification
300
* are included in the kernel.
301
*
302
* @note The default is @p TRUE.
303
* @note Requires @p CH_CFG_USE_EVENTS.
304
*/
305
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
306
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE
307
#endif
308
309
/**
310
* @brief Synchronous Messages APIs.
311
* @details If enabled then the synchronous messages APIs are included
312
* in the kernel.
313
*
314
* @note The default is @p TRUE.
315
*/
316
#if !defined(CH_CFG_USE_MESSAGES)
317
#define CH_CFG_USE_MESSAGES TRUE
318
#endif
319
320
/**
321
* @brief Synchronous Messages queuing mode.
322
* @details If enabled then messages are served by priority rather than in
323
* FIFO order.
324
*
325
* @note The default is @p FALSE. Enable this if you have special
326
* requirements.
327
* @note Requires @p CH_CFG_USE_MESSAGES.
328
*/
329
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
330
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE
331
#endif
332
333
/**
334
* @brief Dynamic Threads APIs.
335
* @details If enabled then the dynamic threads creation APIs are included
336
* in the kernel.
337
*
338
* @note The default is @p TRUE.
339
* @note Requires @p CH_CFG_USE_WAITEXIT.
340
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
341
*/
342
#if !defined(CH_CFG_USE_DYNAMIC)
343
#define CH_CFG_USE_DYNAMIC FALSE
344
#endif
345
346
/** @} */
347
348
/*===========================================================================*/
349
/**
350
* @name OSLIB options
351
* @{
352
*/
353
/*===========================================================================*/
354
355
/**
356
* @brief Mailboxes APIs.
357
* @details If enabled then the asynchronous messages (mailboxes) APIs are
358
* included in the kernel.
359
*
360
* @note The default is @p TRUE.
361
* @note Requires @p CH_CFG_USE_SEMAPHORES.
362
*/
363
#if !defined(CH_CFG_USE_MAILBOXES)
364
#define CH_CFG_USE_MAILBOXES TRUE
365
#endif
366
367
/**
368
* @brief Core Memory Manager APIs.
369
* @details If enabled then the core memory manager APIs are included
370
* in the kernel.
371
*
372
* @note The default is @p TRUE.
373
*/
374
#if !defined(CH_CFG_USE_MEMCORE)
375
#define CH_CFG_USE_MEMCORE TRUE
376
#endif
377
378
/**
379
* @brief Managed RAM size.
380
* @details Size of the RAM area to be managed by the OS. If set to zero
381
* then the whole available RAM is used. The core memory is made
382
* available to the heap allocator and/or can be used directly through
383
* the simplified core memory allocator.
384
*
385
* @note In order to let the OS manage the whole RAM the linker script must
386
* provide the @p __heap_base__ and @p __heap_end__ symbols.
387
* @note Requires @p CH_CFG_USE_MEMCORE.
388
*/
389
#if !defined(CH_CFG_MEMCORE_SIZE)
390
#define CH_CFG_MEMCORE_SIZE 0
391
#endif
392
393
/**
394
* @brief Heap Allocator APIs.
395
* @details If enabled then the memory heap allocator APIs are included
396
* in the kernel.
397
*
398
* @note The default is @p TRUE.
399
* @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or
400
* @p CH_CFG_USE_SEMAPHORES.
401
* @note Mutexes are recommended.
402
*/
403
#if !defined(CH_CFG_USE_HEAP)
404
// everything is allocated statically, the only exception in production code is CH_HEAP_AREA
405
#define CH_CFG_USE_HEAP TRUE
406
#endif
407
408
/**
409
* @brief Memory Pools Allocator APIs.
410
* @details If enabled then the memory pools allocator APIs are included
411
* in the kernel.
412
*
413
* @note The default is @p TRUE.
414
*/
415
#if !defined(CH_CFG_USE_MEMPOOLS)
416
#define CH_CFG_USE_MEMPOOLS FALSE
417
#endif
418
419
/**
420
* @brief Objects FIFOs APIs.
421
* @details If enabled then the objects FIFOs APIs are included
422
* in the kernel.
423
*
424
* @note The default is @p TRUE.
425
*/
426
#if !defined(CH_CFG_USE_OBJ_FIFOS)
427
#define CH_CFG_USE_OBJ_FIFOS FALSE
428
#endif
429
430
/**
431
* @brief Pipes APIs.
432
* @details If enabled then the pipes APIs are included
433
* in the kernel.
434
*
435
* @note The default is @p TRUE.
436
*/
437
#if !defined(CH_CFG_USE_PIPES)
438
#define CH_CFG_USE_PIPES FALSE
439
#endif
440
441
/**
442
* @brief Objects Caches APIs.
443
* @details If enabled then the objects caches APIs are included
444
* in the kernel.
445
*
446
* @note The default is @p TRUE.
447
*/
448
#if !defined(CH_CFG_USE_OBJ_CACHES)
449
#define CH_CFG_USE_OBJ_CACHES FALSE
450
#endif
451
452
/**
453
* @brief Delegate threads APIs.
454
* @details If enabled then the delegate threads APIs are included
455
* in the kernel.
456
*
457
* @note The default is @p TRUE.
458
*/
459
#if !defined(CH_CFG_USE_DELEGATES)
460
#define CH_CFG_USE_DELEGATES FALSE
461
#endif
462
463
/**
464
* @brief Jobs Queues APIs.
465
* @details If enabled then the jobs queues APIs are included
466
* in the kernel.
467
*
468
* @note The default is @p TRUE.
469
*/
470
#if !defined(CH_CFG_USE_JOBS)
471
#define CH_CFG_USE_JOBS FALSE
472
#endif
473
474
/** @} */
475
476
/*===========================================================================*/
477
/**
478
* @name Objects factory options
479
* @{
480
*/
481
/*===========================================================================*/
482
483
/**
484
* @brief Objects Factory APIs.
485
* @details If enabled then the objects factory APIs are included in the
486
* kernel.
487
*
488
* @note The default is @p FALSE.
489
*/
490
#if !defined(CH_CFG_USE_FACTORY)
491
#define CH_CFG_USE_FACTORY FALSE
492
#endif
493
494
/**
495
* @brief Maximum length for object names.
496
* @details If the specified length is zero then the name is stored by
497
* pointer but this could have unintended side effects.
498
*/
499
#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
500
#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8
501
#endif
502
503
/**
504
* @brief Enables the registry of generic objects.
505
*/
506
#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
507
#define CH_CFG_FACTORY_OBJECTS_REGISTRY FALSE
508
#endif
509
510
/**
511
* @brief Enables factory for generic buffers.
512
*/
513
#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
514
#define CH_CFG_FACTORY_GENERIC_BUFFERS FALSE
515
#endif
516
517
/**
518
* @brief Enables factory for semaphores.
519
*/
520
#if !defined(CH_CFG_FACTORY_SEMAPHORES)
521
#define CH_CFG_FACTORY_SEMAPHORES FALSE
522
#endif
523
524
/**
525
* @brief Enables factory for mailboxes.
526
*/
527
#if !defined(CH_CFG_FACTORY_MAILBOXES)
528
#define CH_CFG_FACTORY_MAILBOXES FALSE
529
#endif
530
531
/**
532
* @brief Enables factory for objects FIFOs.
533
*/
534
#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
535
#define CH_CFG_FACTORY_OBJ_FIFOS FALSE
536
#endif
537
538
/**
539
* @brief Enables factory for Pipes.
540
*/
541
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
542
#define CH_CFG_FACTORY_PIPES FALSE
543
#endif
544
545
/** @} */
546
547
/*===========================================================================*/
548
/**
549
* @name Debug options
550
* @{
551
*/
552
/*===========================================================================*/
553
554
/**
555
* @brief Debug option, kernel statistics.
556
*
557
* @note The default is @p FALSE.
558
*/
559
#if !defined(CH_DBG_STATISTICS)
560
#define CH_DBG_STATISTICS FALSE
561
#endif
562
563
/**
564
* @brief Debug option, system state check.
565
* @details If enabled the correct call protocol for system APIs is checked
566
* at runtime.
567
*
568
* @note The default is @p FALSE.
569
*/
570
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
571
#define CH_DBG_SYSTEM_STATE_CHECK TRUE
572
#endif
573
574
/**
575
* @brief Debug option, parameters checks.
576
* @details If enabled then the checks on the API functions input
577
* parameters are activated.
578
*
579
* @note The default is @p FALSE.
580
*/
581
#if !defined(CH_DBG_ENABLE_CHECKS)
582
#define CH_DBG_ENABLE_CHECKS TRUE
583
#endif
584
585
/**
586
* @brief Debug option, consistency checks.
587
* @details If enabled then all the assertions in the kernel code are
588
* activated. This includes consistency checks inside the kernel,
589
* runtime anomalies and port-defined checks.
590
*
591
* @note The default is @p FALSE.
592
*/
593
#if !defined(CH_DBG_ENABLE_ASSERTS)
594
#define CH_DBG_ENABLE_ASSERTS TRUE
595
#endif
596
597
/**
598
* @brief Debug option, trace buffer.
599
* @details If enabled then the trace buffer is activated.
600
*
601
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
602
*/
603
#if !defined(CH_DBG_TRACE_MASK)
604
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
605
#endif
606
607
/**
608
* @brief Trace buffer entries.
609
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
610
* different from @p CH_DBG_TRACE_MASK_DISABLED.
611
*/
612
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
613
#define CH_DBG_TRACE_BUFFER_SIZE 128
614
#endif
615
616
/**
617
* @brief Debug option, stack checks.
618
* @details If enabled then a runtime stack check is performed.
619
*
620
* @note The default is @p FALSE.
621
* @note The stack check is performed in a architecture/port dependent way.
622
* It may not be implemented or some ports.
623
* @note The default failure mode is to halt the system with the global
624
* @p panic_msg variable set to @p NULL.
625
*/
626
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
627
#define CH_DBG_ENABLE_STACK_CHECK TRUE
628
#endif
629
630
/**
631
* @brief Debug option, stacks initialization.
632
* @details If enabled then the threads working area is filled with a byte
633
* value when a thread is created. This can be useful for the
634
* runtime measurement of the used stack.
635
*
636
* @note The default is @p FALSE.
637
*/
638
// see also CH_DBG_STACK_FILL_VALUE
639
#if !defined(CH_DBG_FILL_THREADS)
640
#define CH_DBG_FILL_THREADS TRUE
641
#endif
642
643
/**
644
* @brief Debug option, threads profiling.
645
* @details If enabled then a field is added to the @p thread_t structure that
646
* counts the system ticks occurred while executing the thread.
647
*
648
* @note The default is @p FALSE.
649
* @note This debug option is not currently compatible with the
650
* tickless mode.
651
*/
652
#if !defined(CH_DBG_THREADS_PROFILING)
653
#define CH_DBG_THREADS_PROFILING TRUE
654
#endif
655
656
/** @} */
657
658
/*===========================================================================*/
659
/**
660
* @name Kernel hooks
661
* @{
662
*/
663
/*===========================================================================*/
664
665
/* See chconf_common.h */
666
667
/** @} */
668
669
/*===========================================================================*/
670
/* Port-specific settings (override port settings defaulted in chcore.h). */
671
/*===========================================================================*/
672
673
/**
674
* @brief Sleep at idle.
675
* @details This option enables call to __WFI() from idle thread to save power.
676
*/
677
#if !defined(CORTEX_ENABLE_WFI_IDLE)
678
#define CORTEX_ENABLE_WFI_IDLE TRUE
679
#endif
680
681
#endif
/* CHCONF_H */
682
683
/** @} */
chconf_common.h
Generated on Sat Sep 27 2025 00:10:07 for rusEFI by
1.9.8