rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
efifeatures.h
Go to the documentation of this file.
1/**
2 * @file efifeatures.h
3 *
4 * @brief In this header we can configure which firmware modules are used.
5 * See config/boards which are often overriding some of the defaults via .mk and/or .env files
6 *
7 * @date Aug 29, 2013
8 * @author Andrey Belomutskiy, (c) 2012-2020
9 */
10
11#pragma once
12
13#include <rusefi/true_false.h>
14
15#define EFI_GPIO_HARDWARE TRUE
16
17#ifndef SENT_CHANNELS_NUM
18#define SENT_CHANNELS_NUM 1
19#endif
20
21#ifndef EFI_BOOST_CONTROL
22#define EFI_BOOST_CONTROL TRUE
23#endif
24
25#ifndef EFI_BOSCH_YAW
26#define EFI_BOSCH_YAW FALSE
27#endif
28
29#ifndef EFI_WIFI
30#define EFI_WIFI FALSE
31#endif
32
33#ifndef EFI_WS2812
34#define EFI_WS2812 FALSE
35#endif
36
37#ifndef EFI_DAC
38#define EFI_DAC FALSE
39#endif
40
41#ifndef EFI_LAUNCH_CONTROL
42#define EFI_LAUNCH_CONTROL TRUE
43#endif
44
45/* Long Term Fuel Trims */
46#ifndef EFI_LTFT_CONTROL
47#define EFI_LTFT_CONTROL TRUE
48#endif
49
50#ifndef EFI_STORAGE_SD
51// Lets try saving LTFT trims on SD card by default
52#define EFI_STORAGE_SD TRUE
53#endif
54
55#ifndef EFI_ANTILAG_SYSTEM
56#define EFI_ANTILAG_SYSTEM TRUE
57#endif
58
59#ifndef EFI_BACKUP_SRAM
60#define EFI_BACKUP_SRAM TRUE
61#endif
62
63#ifndef EFI_HELLA_OIL
64#define EFI_HELLA_OIL FALSE
65#endif
66
67#ifndef EFI_USE_OPENBLT
68#define EFI_USE_OPENBLT FALSE
69#endif
70
71#ifndef EFI_ETHERNET
72#define EFI_ETHERNET FALSE
73#endif
74
75#ifndef EFI_DFU_JUMP
76#define EFI_DFU_JUMP TRUE
77#endif
78
79#ifndef EFI_BOR_LEVEL
80#define EFI_BOR_LEVEL TRUE
81#endif
82
83#ifndef EFI_DYNO_VIEW
84#define EFI_DYNO_VIEW TRUE
85#endif
86
87#ifndef EFI_CDM_INTEGRATION
88#define EFI_CDM_INTEGRATION FALSE
89#endif
90
91#ifndef EFI_TOOTH_LOGGER
92#define EFI_TOOTH_LOGGER TRUE
93#endif
94
95#ifndef EFI_TEXT_LOGGING
96#define EFI_TEXT_LOGGING TRUE
97#endif
98
99#define EFI_ACTIVE_CONFIGURATION_IN_FLASH FALSE
100
101#ifndef EFI_MC33816
102#define EFI_MC33816 FALSE
103#endif
104
105#ifndef EFI_HPFP
106#define EFI_HPFP TRUE
107#endif
108
109#ifndef EFI_HD_ACR
110#define EFI_HD_ACR FALSE
111#endif
112
113
114/**
115 * if you have a 60-2 trigger, or if you just want better performance, you
116 * probably want EFI_ENABLE_ASSERTS to be FALSE. Also you would probably want to FALSE
117 * CH_DBG_ENABLE_CHECKS
118 * CH_DBG_ENABLE_ASSERTS
119 * in chconf.h
120 *
121 */
122#if !defined(EFI_ENABLE_ASSERTS)
123 #define EFI_ENABLE_ASSERTS TRUE
124#endif /* EFI_ENABLE_ASSERTS */
125
126#ifndef EFI_CLOCK_LOCKS
127#define EFI_CLOCK_LOCKS TRUE
128#endif
129
130//#define EFI_UART_ECHO_TEST_MODE TRUE
131
132/**
133 * Build-in logic analyzer support. Logic analyzer viewer is one of the java console panes.
134 */
135#ifndef EFI_LOGIC_ANALYZER
136#define EFI_LOGIC_ANALYZER TRUE
137#endif
138
139#ifndef HAL_TRIGGER_USE_PAL
140#define HAL_TRIGGER_USE_PAL TRUE
141#endif /* HAL_TRIGGER_USE_PAL */
142
143#ifndef HAL_TRIGGER_USE_ADC
144#define HAL_TRIGGER_USE_ADC FALSE
145#endif /* HAL_TRIGGER_USE_ADC */
146
147/**
148 * TunerStudio support.
149 */
150#ifndef EFI_TUNER_STUDIO
151#define EFI_TUNER_STUDIO TRUE
152#endif
153
154#ifndef EFI_TS_SCATTER
155#define EFI_TS_SCATTER TRUE
156#endif
157
158/**
159 * Bluetooth UART setup support.
160 */
161#ifndef EFI_BLUETOOTH_SETUP
162#define EFI_BLUETOOTH_SETUP TRUE
163#endif /* EFI_BLUETOOTH_SETUP */
164
165/**
166 * TunerStudio debug output
167 */
168#define EFI_TUNER_STUDIO_VERBOSE TRUE
169
170#define EFI_DETAILED_LOGGING FALSE
171
172/**
173 * Dev console support.
174 */
175#ifndef EFI_CLI_SUPPORT
176#define EFI_CLI_SUPPORT TRUE
177#endif
178
179#ifndef EFI_RTC
180#define EFI_RTC TRUE
181#endif
182
183#ifndef EFI_ALTERNATOR_CONTROL
184#define EFI_ALTERNATOR_CONTROL TRUE
185#endif
186
187#ifndef EFI_VVT_PID
188#define EFI_VVT_PID TRUE
189#endif
190
191#define EFI_SIGNAL_EXECUTOR_SLEEP FALSE
192#define EFI_SIGNAL_EXECUTOR_ONE_TIMER TRUE
193
194#define FUEL_MATH_EXTREME_LOGGING FALSE
195
196#define SPARK_EXTREME_LOGGING FALSE
197
198#define TRIGGER_EXTREME_LOGGING FALSE
199
200/**
201 * Store configuration as raw binary to internal flash (two copies if there is enough flash)
202 * No wear leveling, one copy occupie whole sector erased on each update
203 * Legacy, should be replaced with EFI_STORAGE_MFS
204 */
205#ifndef EFI_STORAGE_INT_FLASH
206// historically we've started with low-level flash access with our own redundancy logic
207// todo: migrate to EFI_STORAGE_MFS which provides same functionality and more!
208#define EFI_STORAGE_INT_FLASH TRUE
209#endif
210
211/**
212 * ChibiOS Managed Flash Storage
213 * Can store finite number of records, can update/add while there is free space in bank.
214 * Recover from power loss
215 */
216#ifndef EFI_STORAGE_MFS
217// todo: this higher level API should replace EFI_STORAGE_INT_FLASH legacy implementation
218#define EFI_STORAGE_MFS FALSE
219#endif
220
221/**
222 * Store settings/calibrations/learning to SD card as a files
223 */
224#ifndef EFI_STORAGE_SD
225#define EFI_STORAGE_SD FALSE
226#endif
227
228/**
229 * Controlled defined to TRUE by USE_FATFS=yes in board mk file
230 */
231#ifndef EFI_SUPPORT_FATFS
232#define EFI_SUPPORT_FATFS FALSE
233#endif
234
235/**
236 * Usually you need shaft position input, but maybe you do not need it?
237 */
238#ifndef EFI_SHAFT_POSITION_INPUT
239#define EFI_SHAFT_POSITION_INPUT TRUE
240#endif
241
242/**
243 * Maybe we are just sniffing what's going on?
244 * EFI_ENGINE_CONTROL is covering injectors and spark control
245 */
246#ifndef EFI_ENGINE_CONTROL
247#define EFI_ENGINE_CONTROL TRUE
248#endif
249
250/**
251 * MCP42010 digital potentiometer support. This could be useful if you are stimulating some
252 * stock ECU
253 */
254#ifndef EFI_POTENTIOMETER
255#define EFI_POTENTIOMETER FALSE
256#endif
257
258#ifndef BOARD_TLE6240_COUNT
259#define BOARD_TLE6240_COUNT 0
260#endif
261
262#ifndef BOARD_MC33972_COUNT
263#define BOARD_MC33972_COUNT 0
264#endif
265
266#ifndef BOARD_TLE8888_COUNT
267#define BOARD_TLE8888_COUNT 0
268#endif
269
270#ifndef BOARD_L9779_COUNT
271#define BOARD_L9779_COUNT 0
272#endif
273
274#ifndef BOARD_DRV8860_COUNT
275#define BOARD_DRV8860_COUNT 0
276#endif
277
278#ifndef BOARD_MC33810_COUNT
279#define BOARD_MC33810_COUNT 0
280#endif
281
282#ifndef BOARD_TLE9104_COUNT
283#define BOARD_TLE9104_COUNT 0
284#endif
285
286#ifndef BOARD_TLE9201_COUNT
287#define BOARD_TLE9201_COUNT 0
288#endif
289
290#define EFI_ANALOG_SENSORS TRUE
291
292#ifndef EFI_MAX_31855
293#define EFI_MAX_31855 FALSE
294#endif
295
296#define EFI_MCP_3208 FALSE
297
298#if !defined(EFI_ONBOARD_MEMS)
299 #define EFI_ONBOARD_MEMS FALSE
300#endif
301
302#ifndef EFI_INTERNAL_ADC
303#define EFI_INTERNAL_ADC TRUE
304#endif
305
306#define EFI_USE_FAST_ADC TRUE
307
308#ifndef EFI_CAN_SUPPORT
309#define EFI_CAN_SUPPORT TRUE
310#endif
311
312#if !defined(EFI_CAN_SERIAL) && EFI_CAN_SUPPORT
313#define EFI_CAN_SERIAL TRUE
314#endif
315
316#if !defined(EFI_CAN_GPIO) && EFI_CAN_SUPPORT
317// see CAN_PIN_0
318#define EFI_CAN_GPIO TRUE
319#endif
320
321#ifndef EFI_WIDEBAND_FIRMWARE_UPDATE
322#define EFI_WIDEBAND_FIRMWARE_UPDATE TRUE
323#endif
324
325#ifndef EFI_IDLE_CONTROL
326#define EFI_IDLE_CONTROL TRUE
327#endif
328
329#ifndef EFI_IDLE_PID_CIC
330#define EFI_IDLE_PID_CIC TRUE
331#endif
332
333/**
334 * Control the main power relay based on measured ignition voltage (Vbatt)
335 */
336#ifndef EFI_MAIN_RELAY_CONTROL
337#define EFI_MAIN_RELAY_CONTROL TRUE
338#endif
339
340#ifndef EFI_VEHICLE_SPEED
341#define EFI_VEHICLE_SPEED TRUE
342#endif
343
344#ifndef EFI_TCU
345#define EFI_TCU FALSE
346#endif
347
348#ifndef EFI_ENGINE_EMULATOR
349#define EFI_ENGINE_EMULATOR TRUE
350#endif
351
352#ifndef EFI_EMULATE_POSITION_SENSORS
353#define EFI_EMULATE_POSITION_SENSORS TRUE
354#endif
355
356/**
357 * Do we need file logging (like SD card) logic?
358 * See also USE_FATFS
359 */
360#ifndef EFI_FILE_LOGGING
361#define EFI_FILE_LOGGING TRUE
362#endif
363
364#ifndef EFI_EMBED_INI_MSD
365#define EFI_EMBED_INI_MSD TRUE
366#endif
367
368#ifndef EFI_USB_SERIAL
369#define EFI_USB_SERIAL TRUE
370#endif
371
372#define EFI_CONSOLE_USB_DEVICE SDU1
373
374#if defined(EFI_HAS_EXT_SDRAM)
375 #ifndef ENABLE_PERF_TRACE
376 #define ENABLE_PERF_TRACE TRUE
377 #endif // ENABLE_PERF_TRACE
378 #define LUA_EXTRA_HEAP (1 * 1024 * 1024)
379#elif defined(EFI_IS_F42x)
380 // F42x has more memory, so we can:
381 // - use compressed USB MSD image (requires 32k of memory)
382 // - use perf trace (requires ~16k of memory)
383 // - use spectorgram (requires ~12k of memory), need disable perf trace or compressed USB MSD image
384 #ifndef KNOCK_SPECTROGRAM
385 #ifndef EFI_USE_COMPRESSED_INI_MSD
386 #define EFI_USE_COMPRESSED_INI_MSD TRUE
387 #endif
388 #endif
389 #define ENABLE_PERF_TRACE TRUE
390#else
391 #ifndef ENABLE_PERF_TRACE
392 // small memory F40x can't fit perf trace
393 #define ENABLE_PERF_TRACE FALSE
394 #endif // ENABLE_PERF_TRACE
395#endif
396
397#ifndef EFI_USE_COMPRESSED_INI_MSD
398#define EFI_USE_COMPRESSED_INI_MSD FALSE
399#endif
400
401#ifndef EFI_LUA
402#define EFI_LUA TRUE
403#endif
404
405#ifndef FULL_SD_LOGS
406// reduce RAM usage? todo: optimize RAM consumption so that all builds have full logs?
407#define FULL_SD_LOGS FALSE
408#endif
409
410#ifndef EFI_LUA_LOOKUP
411#define EFI_LUA_LOOKUP TRUE
412#endif
413
414#ifndef EFI_ENGINE_SNIFFER
415#define EFI_ENGINE_SNIFFER TRUE
416#endif
417
418#define EFI_HISTOGRAMS FALSE
419
420
421#ifndef EFI_PERF_METRICS
422#define EFI_PERF_METRICS FALSE
423#endif
424
425#ifndef DL_OUTPUT_BUFFER
426#define DL_OUTPUT_BUFFER 6500
427#endif
428
429/**
430 * Do we need GPS logic?
431 */
432#ifndef EFI_UART_GPS
433#define EFI_UART_GPS FALSE
434#endif
435
436#ifndef EFI_ELECTRONIC_THROTTLE_BODY
437#define EFI_ELECTRONIC_THROTTLE_BODY TRUE
438#endif
439
440/**
441 * Do we need Malfunction Indicator blinking logic?
442 */
443#ifndef EFI_MALFUNCTION_INDICATOR
444#define EFI_MALFUNCTION_INDICATOR FALSE
445#endif
446
447#ifndef CONSOLE_MAX_ACTIONS
448#define CONSOLE_MAX_ACTIONS 180
449#endif
450
451#ifndef EFI_MAP_AVERAGING
452#define EFI_MAP_AVERAGING TRUE
453#endif
454
455// todo: most of this should become configurable
456
457// TODO: switch to continuous ADC conversion for fast ADC?
458// NOTE: GPT mode triggers ADC convertion through IRQ
459#define EFI_INTERNAL_FAST_ADC_GPT &GPTD6
460// NOTE: PWM mode triggers ADC convertion through hardware ADC trigger
461//#define EFI_INTERNAL_FAST_ADC_PWM &PWMD8
462
463// Continuously run internal ADC in background for all channels
464// Do averaging in thread with no sync with convertion end
465#define EFI_INTERNAL_SLOW_ADC_BACKGROUND TRUE
466
467#define EFI_SPI1_AF 5
468#define EFI_SPI2_AF 5
469#define EFI_SPI3_AF 6
470#define EFI_SPI4_AF 5
471#define EFI_SPI5_AF 5
472#define EFI_SPI6_AF 6
473
474/**
475 * Patched version of ChibiOS/RT support extra details in the system error messages
476 */
477#define EFI_CUSTOM_PANIC_METHOD TRUE
478
479#define ADC_CHANNEL_VREF ADC_CHANNEL_IN14
480
481/**
482 * currently ChibiOS uses only first and second channels of each timer for input capture
483 *
484 * So, our options are:
485 *
486 * TIM2_CH1
487 * PA5
488 *
489 * TIM4_CH1
490 * PB6
491 * PD12
492 *
493 * TIM9_CH1
494 * PE5
495 */
496
497#ifndef EFI_USE_UART_DMA
498#define EFI_USE_UART_DMA TRUE
499#endif
500
501#ifndef AUX_SERIAL_DEVICE
502#define AUX_SERIAL_DEVICE (&SD6)
503#endif
504
505#ifndef EFI_CONSOLE_TX_BRAIN_PIN
506#define EFI_CONSOLE_TX_BRAIN_PIN Gpio::C10
507#endif
508
509#ifndef EFI_CONSOLE_RX_BRAIN_PIN
510#define EFI_CONSOLE_RX_BRAIN_PIN Gpio::C11
511#endif
512// todo: this should be detected automatically based on pin selection
513// https://github.com/rusefi/rusefi/issues/3536
514#ifndef EFI_CONSOLE_AF
515#define EFI_CONSOLE_AF 7
516#endif
517
518// Rx pin should have either internal either external pull up to avoid floating and receiving random garbage
519#ifndef EFI_CONSOLE_RX_BRAIN_PIN_MODE
520#define EFI_CONSOLE_RX_BRAIN_PIN_MODE (PAL_MODE_ALTERNATE(EFI_CONSOLE_AF) | PAL_STM32_PUPDR_PULLUP)
521#endif
522
523#ifndef EFI_CONSOLE_TX_BRAIN_PIN_MODE
524#define EFI_CONSOLE_TX_BRAIN_PIN_MODE (PAL_MODE_ALTERNATE(EFI_CONSOLE_AF))
525#endif
526
527// todo: this should be detected automatically based on pin selection
528// https://github.com/rusefi/rusefi/issues/3536
529#ifndef TS_SERIAL_AF
530#define TS_SERIAL_AF 7
531#endif
532
533#ifndef TS_SERIAL_RX_BRAIN_PIN_MODE
534#define TS_SERIAL_RX_BRAIN_PIN_MODE (PAL_MODE_ALTERNATE(TS_SERIAL_AF) | PAL_STM32_PUPDR_PULLUP)
535#endif
536
537#ifndef TS_SERIAL_TX_BRAIN_PIN_MODE
538#define TS_SERIAL_TX_BRAIN_PIN_MODE (PAL_MODE_ALTERNATE(TS_SERIAL_AF))
539#endif
540
541#ifndef LED_CRITICAL_ERROR_BRAIN_PIN
542#define LED_CRITICAL_ERROR_BRAIN_PIN Gpio::D14
543#endif
544
545// USART1 -> check defined STM32_SERIAL_USE_USART1
546// For GPS we have USART1. We can start with PB7 USART1_RX and PB6 USART1_TX
547#define GPS_SERIAL_DEVICE &SD1
548#define GPS_SERIAL_SPEED 38400
549
550#ifndef EFI_SENT_SUPPORT
551#define EFI_SENT_SUPPORT FALSE
552#endif