add SPL06 in Matek targets
[inav/snaewe.git] / src / main / target / common_post.h
blob0ca2ff4c9a838de4ab596781bde7af05209ffa66
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 // Touch up configuration
20 #pragma once
22 // Config storage in memory-mapped flash
23 extern uint8_t __config_start;
24 extern uint8_t __config_end;
26 // Backward compatibility for I2C OLED display
27 #if !defined(USE_I2C)
28 # undef USE_DASHBOARD
29 # undef USE_OLED_UG2864
30 #endif
32 // Enable MSP_DISPLAYPORT for F3 targets without builtin OSD,
33 // since it's used to display CMS on MWOSD
34 #if !defined(USE_MSP_DISPLAYPORT) && (MCU_FLASH_SIZE > 128) && !defined(USE_OSD)
35 #define USE_MSP_DISPLAYPORT
36 #endif
38 #if defined(USE_OSD) && (MCU_FLASH_SIZE > 256)
39 #define USE_CANVAS
40 #endif
42 // Enable MSP BARO & MAG drivers if BARO and MAG sensors are compiled in
43 #if defined(USE_MAG)
44 #define USE_MAG_MSP
45 #endif
47 #if defined(USE_BARO)
48 #define USE_BARO_MSP
49 #endif
51 #ifdef USE_ESC_SENSOR
52 #define USE_RPM_FILTER
53 #endif
55 #ifdef STM32F3
56 #undef USE_WIND_ESTIMATOR
57 #undef USE_SERIALRX_SUMD
58 #undef USE_SERIALRX_SUMH
59 #undef USE_SERIALRX_XBUS
60 #undef USE_SERIALRX_JETIEXBUS
61 #endif
63 #ifndef BEEPER_PWM_FREQUENCY
64 #define BEEPER_PWM_FREQUENCY 2500
65 #endif
67 #define USE_ARM_MATH // try to use FPU functions
69 #if defined(SIMULATOR_BUILD) || defined(UNIT_TEST)
70 // This feature uses 'arm_math.h', which does not exist for x86.
71 #undef USE_DYNAMIC_FILTERS
72 #undef USE_ARM_MATH
73 #endif
75 //Defines for compiler optimizations
76 #ifndef STM32F3
77 #define FUNCTION_COMPILE_FOR_SIZE __attribute__((optimize("-Os")))
78 #define FUNCTION_COMPILE_NORMAL __attribute__((optimize("-O2")))
79 #define FUNCTION_COMPILE_FOR_SPEED __attribute__((optimize("-Ofast")))
80 #define FILE_COMPILE_FOR_SIZE _Pragma("GCC optimize(\"Os\")")
81 #define FILE_COMPILE_NORMAL _Pragma("GCC optimize(\"O2\")")
82 #define FILE_COMPILE_FOR_SPEED _Pragma("GCC optimize(\"Ofast\")")
83 #else
84 #define FUNCTION_COMPILE_FOR_SIZE
85 #define FUNCTION_COMPILE_NORMAL
86 #define FUNCTION_COMPILE_FOR_SPEED
87 #define FILE_COMPILE_FOR_SIZE
88 #define FILE_COMPILE_NORMAL
89 #define FILE_COMPILE_FOR_SPEED
90 #endif
92 #if defined(CONFIG_IN_RAM) || defined(CONFIG_IN_EXTERNAL_FLASH)
93 #ifndef EEPROM_SIZE
94 #define EEPROM_SIZE 8192
95 #endif
96 extern uint8_t eepromData[EEPROM_SIZE];
97 #define __config_start (*eepromData)
98 #define __config_end (*ARRAYEND(eepromData))
99 #else
100 #ifndef CONFIG_IN_FLASH
101 #define CONFIG_IN_FLASH
102 #endif
103 extern uint8_t __config_start; // configured via linker script when building binaries.
104 extern uint8_t __config_end;
105 #endif