2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
23 #define USE_PARAMETER_GROUPS
24 // type conversion warnings.
25 // -Wconversion can be turned on to enable the process of eliminating these warnings
26 //#pragma GCC diagnostic warning "-Wconversion"
27 #pragma GCC diagnostic ignored "-Wsign-conversion"
28 // -Wpadded can be turned on to check padding of structs
29 //#pragma GCC diagnostic warning "-Wpadded"
31 #if !defined(CLOUD_BUILD) && !defined(SITL)
36 #define USE_DSHOT_BITBANG
37 #define USE_DSHOT_TELEMETRY
38 #define USE_DSHOT_TELEMETRY_STATS
42 #if defined(STM32F40_41xxx)
46 #define USE_RPM_FILTER
48 #define USE_DYN_NOTCH_FILTER
49 #define USE_ADC_INTERNAL
50 #define USE_USB_CDC_HID
52 #define USE_PERSISTENT_MSC_RTC
55 #define USE_TIMER_MGMT
56 #define USE_PERSISTENT_OBJECTS
57 #define USE_CUSTOM_DEFAULTS_ADDRESS
58 #define USE_LATE_TASK_STATISTICS
60 #if defined(STM32F40_41xxx) || defined(STM32F411xE)
67 #define ITCM_RAM_OPTIMISATION "-O2", "-freorder-blocks-algorithm=simple"
69 #define USE_RPM_FILTER
71 #define USE_DYN_NOTCH_FILTER
73 #define USE_ADC_INTERNAL
74 #define USE_USB_CDC_HID
76 #define USE_PERSISTENT_MSC_RTC
79 #define USE_TIMER_MGMT
80 #define USE_PERSISTENT_OBJECTS
81 #define USE_CUSTOM_DEFAULTS_ADDRESS
82 #define USE_LATE_TASK_STATISTICS
88 #define USE_DSHOT_CACHE_MGMT
93 #define USE_RPM_FILTER
95 #define USE_DYN_NOTCH_FILTER
96 #define USE_ADC_INTERNAL
97 #define USE_USB_CDC_HID
99 #define USE_TIMER_MGMT
100 #define USE_PERSISTENT_OBJECTS
104 #define USE_PERSISTENT_MSC_RTC
105 #define USE_LATE_TASK_STATISTICS
109 #define USE_RPM_FILTER
111 #define USE_OVERCLOCK
112 #define USE_DYN_NOTCH_FILTER
113 #define USE_ADC_INTERNAL
115 #define USE_USB_CDC_HID
118 #define USE_TIMER_MGMT
119 #define USE_LATE_TASK_STATISTICS
122 #if defined(STM32F4) || defined(STM32F7) || defined(STM32H7) || defined(STM32G4)
123 #define TASK_GYROPID_DESIRED_PERIOD 125 // 125us = 8kHz
124 #define SCHEDULER_DELAY_LIMIT 10
126 #define TASK_GYROPID_DESIRED_PERIOD 1000 // 1000us = 1kHz
127 #define SCHEDULER_DELAY_LIMIT 100
130 #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
131 #define DEFAULT_AUX_CHANNEL_COUNT MAX_AUX_CHANNEL_COUNT
133 #define DEFAULT_AUX_CHANNEL_COUNT 6
136 // Set the default cpu_overclock to the first level (108MHz) for F411
137 // Helps with looptime stability as the CPU is borderline when running native gyro sampling
138 #if defined(USE_OVERCLOCK) && defined(STM32F411xE)
139 #define DEFAULT_CPU_OVERCLOCK 1
141 #define DEFAULT_CPU_OVERCLOCK 0
145 // Move ISRs to fast ram to avoid flash latency.
146 #define FAST_IRQ_HANDLER FAST_CODE
148 #define FAST_IRQ_HANDLER
153 #if defined(ITCM_RAM_OPTIMISATION) && !defined(DEBUG)
154 #define FAST_CODE __attribute__((section(".tcm_code"))) __attribute__((optimize(ITCM_RAM_OPTIMISATION)))
156 #define FAST_CODE __attribute__((section(".tcm_code")))
158 // Handle case where we'd prefer code to be in ITCM, but it won't fit on the F745
160 #define FAST_CODE_PREF
162 #define FAST_CODE_PREF __attribute__((section(".tcm_code")))
164 #define FAST_CODE_NOINLINE NOINLINE
167 #define FAST_CODE_PREF
168 #define FAST_CODE_NOINLINE
169 #endif // USE_ITCM_RAM
172 #define CCM_CODE __attribute__((section(".ccm_code")))
178 #define FAST_DATA_ZERO_INIT __attribute__ ((section(".fastram_bss"), aligned(4)))
179 #define FAST_DATA __attribute__ ((section(".fastram_data"), aligned(4)))
181 #define FAST_DATA_ZERO_INIT
183 #endif // USE_FAST_DATA
185 #if defined(STM32F4) || defined(STM32G4)
186 // F4 can't DMA to/from CCM (core coupled memory) SRAM (where the stack lives)
187 // On G4 there is no specific DMA target memory
188 #define DMA_DATA_ZERO_INIT
190 #define STATIC_DMA_DATA_AUTO static
191 #elif defined (STM32F7)
192 // F7 has no cache coherency issues DMAing to/from DTCM, otherwise buffers must be cache aligned
193 #define DMA_DATA_ZERO_INIT FAST_DATA_ZERO_INIT
194 #define DMA_DATA FAST_DATA
195 #define STATIC_DMA_DATA_AUTO static DMA_DATA
197 // DMA to/from any memory
198 #define DMA_DATA_ZERO_INIT __attribute__ ((section(".dmaram_bss"), aligned(32)))
199 #define DMA_DATA __attribute__ ((section(".dmaram_data"), aligned(32)))
200 #define STATIC_DMA_DATA_AUTO static DMA_DATA
203 #if defined(STM32F4) || defined (STM32H7)
204 // Data in RAM which is guaranteed to not be reset on hot reboot
205 #define PERSISTENT __attribute__ ((section(".persistent_data"), aligned(4)))
210 #define DMA_RAM __attribute__((section(".DMA_RAM"), aligned(32)))
211 #define DMA_RW_AXI __attribute__((section(".DMA_RW_AXI"), aligned(32)))
212 extern uint8_t _dmaram_start__
;
213 extern uint8_t _dmaram_end__
;
214 #elif defined(STM32G4)
215 #define DMA_RAM_R __attribute__((section(".DMA_RAM_R")))
216 #define DMA_RAM_W __attribute__((section(".DMA_RAM_W")))
217 #define DMA_RAM_RW __attribute__((section(".DMA_RAM_RW")))
232 #define USE_SERIAL_PASSTHROUGH
233 #define USE_GYRO_REGISTER_DUMP // Adds gyroregisters command to cli to dump configured register values
236 #if !defined(CLOUD_BUILD) && !defined(SITL)
244 #define USE_ACC_MPU6500
245 #define USE_GYRO_MPU6500
246 #define USE_ACC_SPI_MPU6000
247 #define USE_GYRO_SPI_MPU6000
248 #define USE_ACC_SPI_MPU6500
249 #define USE_GYRO_SPI_MPU6500
250 #define USE_ACC_SPI_ICM20689
251 #define USE_GYRO_SPI_ICM20689
252 #define USE_ACCGYRO_LSM6DSO
253 #define USE_ACCGYRO_BMI270
254 #define USE_GYRO_SPI_ICM42605
255 #define USE_GYRO_SPI_ICM42688P
256 #define USE_ACC_SPI_ICM42605
257 #define USE_ACC_SPI_ICM42688P
259 #if defined(STM32F405) || defined(STM32F745) || defined(STM32G4) || defined(STM32H7)
260 #define USE_ACC_MPU6050
261 #define USE_GYRO_MPU6050
262 #define USE_ACCGYRO_BMI160
266 #define USE_FLASH_TOOLS
267 #define USE_FLASH_M25P16
268 #define USE_FLASH_W25N01G // 1Gb NAND flash support
269 #define USE_FLASH_W25M // Stacked die support
270 #define USE_FLASH_W25M512 // 512Kb (256Kb x 2 stacked) NOR flash support
271 #define USE_FLASH_W25M02G // 2Gb (1Gb x 2 stacked) NAND flash support
272 #define USE_FLASH_W25Q128FV // 16MB Winbond 25Q128
277 #define USE_RX_CC2500
281 #if defined(STM32F405) || defined(STM32F745) || defined(STM32H7)
282 #define USE_VTX_RTC6705
283 #define USE_VTX_RTC6705_SOFTSPI
285 #define USE_TRANSPONDER
287 #define USE_RANGEFINDER
288 #define USE_RANGEFINDER_HCSR04
289 #define USE_RANGEFINDER_TF
291 #define USE_RX_EXPRESSLRS
292 #define USE_RX_SX1280
293 #define USE_RX_SX127X
298 #define USE_BRUSHED_ESC_AUTODETECT // Detect if brushed motors are connected and set defaults appropriately to avoid motors spinning on boot
304 #define USE_SERIALRX_CRSF // Team Black Sheep Crossfire protocol
305 #define USE_SERIALRX_GHST // ImmersionRC Ghost Protocol
306 #define USE_SERIALRX_IBUS // FlySky and Turnigy receivers
307 #define USE_SERIALRX_SBUS // Frsky and Futaba receivers
308 #define USE_SERIALRX_SPEKTRUM // SRXL, DSM2 and DSMX protocol
309 #define USE_SERIALRX_SUMD // Graupner Hott protocol
310 #define USE_TELEMETRY
311 #define USE_TELEMETRY_FRSKY_HUB
312 #define USE_TELEMETRY_SMARTPORT
313 #define USE_SERIALRX_FPORT // FrSky FPort
314 #define USE_TELEMETRY_CRSF
315 #define USE_TELEMETRY_GHST
316 #define USE_TELEMETRY_SRXL
322 #define USE_TELEMETRY_HOTT
323 #define USE_TELEMETRY_LTM
324 #define USE_SERIALRX_SUMH // Graupner legacy protocol
325 #define USE_SERIALRX_XBUS // JR
326 #define USE_CRSF_CMS_TELEMETRY
327 #define USE_CRSF_LINK_STATISTICS
329 #define USE_SERIALRX_JETIEXBUS
330 #define USE_TELEMETRY_IBUS
331 #define USE_TELEMETRY_IBUS_EXTENDED
332 #define USE_TELEMETRY_JETIEXBUS
333 #define USE_TELEMETRY_MAVLINK
334 #define USE_SERIALRX_SRXL2 // Spektrum SRXL2 protocol
338 #define USE_LED_STRIP
340 #if TARGET_FLASH_SIZE > 512
341 #define USE_BATTERY_CONTINUE
342 #define USE_DASHBOARD
343 #define USE_EMFAT_AUTORUN
344 #define USE_EMFAT_ICON
345 #define USE_ESCSERIAL_SIMONK
346 #define USE_GPS_PLUS_CODES
347 #define USE_SERIAL_4WAY_SK_BOOTLOADER
350 #endif // !defined(CLOUD_BUILD)
352 #ifndef LED_MAX_STRIP_LENGTH
353 #ifdef USE_LEDSTRIP_64
354 #define LED_MAX_STRIP_LENGTH 64
356 #define LED_MAX_STRIP_LENGTH 32
358 #endif // #ifndef LED_MAX_STRIP_LENGTH
360 #if defined(USE_SDCARD)
361 #define USE_SDCARD_SPI
362 #if defined(STM32F4) || defined(STM32F7) || defined(STM32H7)
363 #define USE_SDCARD_SDIO
367 #if defined(USE_PINIO)
369 #define USE_PIN_PULL_UP_DOWN
373 #define USE_VTX_COMMON
374 #define USE_VTX_CONTROL
375 #define USE_VTX_SMARTAUDIO
376 #define USE_VTX_TRAMP
378 #define USE_VTX_TABLE
383 #define PID_PROFILE_COUNT 4
384 #define CONTROL_RATE_PROFILE_COUNT 4
386 #define USE_ACRO_TRAINER
388 #define USE_CLI_BATCH
389 #define USE_RESOURCE_MGMT
390 #define USE_RUNAWAY_TAKEOFF // Runaway Takeoff Prevention (anti-taz)
392 #define USE_GYRO_OVERFLOW_CHECK
393 #define USE_YAW_SPIN_RECOVERY
396 #define USE_DSHOT_DMAR
399 #define USE_MSP_OVER_TELEMETRY
401 #define USE_VIRTUAL_CURRENT_METER
402 #define USE_CAMERA_CONTROL
403 #define USE_ESC_SENSOR
404 #define USE_SERIAL_4WAY_BLHELI_BOOTLOADER
407 #define USE_GYRO_LPF2
408 #define USE_LAUNCH_CONTROL
412 #define USE_THROTTLE_BOOST
413 #define USE_INTEGRATED_YAW_CONTROL
415 #define USE_ITERM_RELAX
416 #define USE_RC_SMOOTHING_FILTER
417 #define USE_THRUST_LINEARIZATION
420 #ifdef USE_SERIALRX_SPEKTRUM
421 #define USE_SPEKTRUM_BIND
422 #define USE_SPEKTRUM_BIND_PLUG
423 #define USE_SPEKTRUM_REAL_RSSI
424 #define USE_SPEKTRUM_FAKE_RSSI
425 #define USE_SPEKTRUM_RSSI_PERCENT_CONVERSION
426 #define USE_SPEKTRUM_VTX_CONTROL
427 #define USE_SPEKTRUM_VTX_TELEMETRY
428 #define USE_SPEKTRUM_CMS_TELEMETRY
429 #endif // USE_SERIALRX_SPEKTRUM
431 #define USE_BOARD_INFO
432 #define USE_EXTENDED_CMS_MENUS
434 #define USE_ESC_SENSOR_INFO
437 #define USE_RX_RSSI_DBM
439 #define USE_RX_LINK_QUALITY_INFO
440 #define USE_RX_MSP_OVERRIDE
441 #define USE_RX_LINK_UPLINK_POWER
443 #define USE_AIRMODE_LPF
446 #define USE_GYRO_DLPF_EXPERIMENTAL
447 #define USE_MULTI_GYRO
448 #define USE_SENSOR_NAMES
449 #define USE_UNCOMMON_MIXERS
450 #define USE_SIGNATURE
451 #define USE_ABSOLUTE_CONTROL
452 #define USE_HOTT_TEXTMODE
453 #define USE_LED_STRIP_STATUS_MODE
455 #define USE_ESC_SENSOR_TELEMETRY
456 #define USE_CMS_FAILSAFE_MENU
457 #define USE_CMS_GPS_RESCUE_MENU
458 #define USE_TELEMETRY_SENSORS_DISABLED_DETAILS
459 #define USE_PERSISTENT_STATS
460 #define USE_PROFILE_NAMES
461 #define USE_FEEDFORWARD
462 #define USE_CUSTOM_BOX_NAMES
463 #define USE_BATTERY_VOLTAGE_SAG_COMPENSATION
464 #define USE_SIMPLIFIED_TUNING
466 #define USE_CRAFTNAME_MSGS
470 #define USE_GPS_UBLOX
471 #define USE_GPS_RESCUE
474 #if defined(USE_OSD) || defined(USE_OSD_HD) || defined(USE_OSD_SD)
481 #define USE_MSP_DISPLAYPORT
482 #define USE_OSD_OVER_MSP_DISPLAYPORT
483 #define USE_OSD_ADJUSTMENTS
484 #define USE_OSD_PROFILES
485 #define USE_OSD_STICK_OVERLAY
486 #endif // defined(USE_OSD) || defined(USE_OSD_HD) || defined(USE_OSD_SD)
488 #if defined(CLOUD_BUILD)
489 // Handle the CRSF co-dependency requirements
490 #if defined(USE_TELEMETRY_CRSF)
492 // if both CRSF and CMS then enable CMS telemtry and link statistics
494 #define USE_CRSF_CMS_TELEMETRY
495 #define USE_CRSF_LINK_STATISTICS
498 #endif // USE_TELEMETRY_CRSF (CRSF co-dependency requirements).
500 #endif // CLOUD_BUILD