Merge pull request #9453 from etracer65/use_blackbox_compiler_warning
[betaflight.git] / src / main / platform.h
blobd8a3a4b99e995a55b1277beedad3400e26cdac6f
1 /*
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)
8 * any later version.
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/>.
21 #pragma once
23 #define NOINLINE __attribute__((noinline))
25 #if !defined(UNIT_TEST) && !defined(SIMULATOR_BUILD) && !(USBD_DEBUG_LEVEL > 0)
26 #pragma GCC poison sprintf snprintf
27 #endif
29 #if defined(STM32H743xx) || defined(STM32H750xx)
30 #include "stm32h7xx.h"
31 #include "stm32h7xx_hal.h"
32 #include "system_stm32h7xx.h"
34 #include "stm32h7xx_ll_spi.h"
35 #include "stm32h7xx_ll_gpio.h"
36 #include "stm32h7xx_ll_dma.h"
37 #include "stm32h7xx_ll_rcc.h"
38 #include "stm32h7xx_ll_bus.h"
39 #include "stm32h7xx_ll_tim.h"
40 #include "stm32h7xx_ll_system.h"
41 #include "drivers/stm32h7xx_ll_ex.h"
43 // Chip Unique ID on H7
44 #define U_ID_0 (*(uint32_t*)0x1FF1E800)
45 #define U_ID_1 (*(uint32_t*)0x1FF1E804)
46 #define U_ID_2 (*(uint32_t*)0x1FF1E808)
48 #ifndef STM32H7
49 #define STM32H7
50 #endif
52 #elif defined(STM32F722xx) || defined(STM32F745xx) || defined(STM32F746xx) || defined(STM32F765xx)
53 #include "stm32f7xx.h"
54 #include "stm32f7xx_hal.h"
55 #include "system_stm32f7xx.h"
57 #include "stm32f7xx_ll_spi.h"
58 #include "stm32f7xx_ll_gpio.h"
59 #include "stm32f7xx_ll_dma.h"
60 #include "stm32f7xx_ll_rcc.h"
61 #include "stm32f7xx_ll_bus.h"
62 #include "stm32f7xx_ll_tim.h"
63 #include "stm32f7xx_ll_system.h"
64 #include "drivers/stm32f7xx_ll_ex.h"
66 // Chip Unique ID on F7
67 #if defined(STM32F722xx)
68 #define U_ID_0 (*(uint32_t*)0x1ff07a10)
69 #define U_ID_1 (*(uint32_t*)0x1ff07a14)
70 #define U_ID_2 (*(uint32_t*)0x1ff07a18)
71 #else
72 #define U_ID_0 (*(uint32_t*)0x1ff0f420)
73 #define U_ID_1 (*(uint32_t*)0x1ff0f424)
74 #define U_ID_2 (*(uint32_t*)0x1ff0f428)
75 #endif
77 #ifndef STM32F7
78 #define STM32F7
79 #endif
81 #elif defined(STM32F40_41xxx) || defined (STM32F411xE) || defined (STM32F446xx)
83 #include "stm32f4xx.h"
85 // Chip Unique ID on F405
86 #define U_ID_0 (*(uint32_t*)0x1fff7a10)
87 #define U_ID_1 (*(uint32_t*)0x1fff7a14)
88 #define U_ID_2 (*(uint32_t*)0x1fff7a18)
90 #ifndef STM32F4
91 #define STM32F4
92 #endif
94 #elif defined(STM32F303xC)
95 #include "stm32f30x_conf.h"
96 #include "stm32f30x_rcc.h"
97 #include "stm32f30x_gpio.h"
98 #include "core_cm4.h"
100 // Chip Unique ID on F303
101 #define U_ID_0 (*(uint32_t*)0x1FFFF7AC)
102 #define U_ID_1 (*(uint32_t*)0x1FFFF7B0)
103 #define U_ID_2 (*(uint32_t*)0x1FFFF7B4)
105 #ifndef STM32F3
106 #define STM32F3
107 #endif
109 #elif defined(STM32F10X)
111 #include "stm32f10x_conf.h"
112 #include "stm32f10x_gpio.h"
113 #include "core_cm3.h"
115 // Chip Unique ID on F103
116 #define U_ID_0 (*(uint32_t*)0x1FFFF7E8)
117 #define U_ID_1 (*(uint32_t*)0x1FFFF7EC)
118 #define U_ID_2 (*(uint32_t*)0x1FFFF7F0)
120 #ifndef STM32F1
121 #define STM32F1
122 #endif
124 #elif defined(SIMULATOR_BUILD)
126 // Nop
128 #else // STM32F10X
129 #error "Invalid chipset specified. Update platform.h"
130 #endif
132 // MCU type names and IDs.
133 // IDs are permanent as it has dependency to configurator through MSP reporting
135 #if defined(SIMULATOR_BUILD)
136 #define MCU_TYPE_ID 0
137 #define MCU_TYPE_NAME "SIMULATOR"
138 #elif defined(STM32F1)
139 #define MCU_TYPE_ID 1
140 #define MCU_TYPE_NAME "F103"
141 #elif defined(STM32F3)
142 #define MCU_TYPE_ID 2
143 #define MCU_TYPE_NAME "F303"
144 #elif defined(STM32F40_41xxx)
145 #define MCU_TYPE_ID 3
146 #define MCU_TYPE_NAME "F40X"
147 #elif defined(STM32F411xE)
148 #define MCU_TYPE_ID 4
149 #define MCU_TYPE_NAME "F411"
150 #elif defined(STM32F446xx)
151 #define MCU_TYPE_ID 5
152 #define MCU_TYPE_NAME "F446"
153 #elif defined(STM32F722xx)
154 #define MCU_TYPE_ID 6
155 #define MCU_TYPE_NAME "F722"
156 #elif defined(STM32F745xx)
157 #define MCU_TYPE_ID 7
158 #define MCU_TYPE_NAME "F745"
159 #elif defined(STM32F746xx)
160 #define MCU_TYPE_ID 8
161 #define MCU_TYPE_NAME "F746"
162 #elif defined(STM32F765xx)
163 #define MCU_TYPE_ID 9
164 #define MCU_TYPE_NAME "F765"
165 #elif defined(STM32H750xx)
166 #define MCU_TYPE_ID 10
167 #define MCU_TYPE_NAME "H750"
168 #elif defined(STM32H743xx)
169 #define MCU_TYPE_ID 11
170 #define MCU_TYPE_NAME "H743"
171 #else
172 #define MCU_TYPE_ID 255
173 #define MCU_TYPE_NAME "Unknown MCU"
174 #endif
176 #include "target/common_pre.h"
177 #include "target.h"
178 #include "target/common_deprecated_post.h"
179 #include "target/common_post.h"
180 #include "target/common_defaults_post.h"