Some separation in the Makefile
[betaflight.git] / src / main / platform.h
blob1af328b40f709c3467a2c85057117ef7964c8a36
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 #pragma once
20 #if !defined(UNIT_TEST) && !defined(SITL) && !(USBD_DEBUG_LEVEL > 0)
21 #pragma GCC poison sprintf snprintf
22 #endif
24 #if defined(STM32F745xx) || defined(STM32F746xx) || defined(STM32F722xx)
25 #include "stm32f7xx.h"
26 #include "stm32f7xx_hal.h"
28 // Chip Unique ID on F7
29 #if defined(STM32F722xx)
30 #define U_ID_0 (*(uint32_t*)0x1ff07a10)
31 #define U_ID_1 (*(uint32_t*)0x1ff07a14)
32 #define U_ID_2 (*(uint32_t*)0x1ff07a18)
33 #else
34 #define U_ID_0 (*(uint32_t*)0x1ff0f420)
35 #define U_ID_1 (*(uint32_t*)0x1ff0f424)
36 #define U_ID_2 (*(uint32_t*)0x1ff0f428)
37 #endif
39 #ifndef STM32F7
40 #define STM32F7
41 #endif
43 #elif defined(STM32F40_41xxx) || defined (STM32F411xE) || defined (STM32F446xx)
45 #include "stm32f4xx_conf.h"
46 #include "stm32f4xx_rcc.h"
47 #include "stm32f4xx_gpio.h"
48 #include "core_cm4.h"
50 // Chip Unique ID on F405
51 #define U_ID_0 (*(uint32_t*)0x1fff7a10)
52 #define U_ID_1 (*(uint32_t*)0x1fff7a14)
53 #define U_ID_2 (*(uint32_t*)0x1fff7a18)
55 #ifndef STM32F4
56 #define STM32F4
57 #endif
59 #elif defined(STM32F303xC)
60 #include "stm32f30x_conf.h"
61 #include "stm32f30x_rcc.h"
62 #include "stm32f30x_gpio.h"
63 #include "core_cm4.h"
65 // Chip Unique ID on F303
66 #define U_ID_0 (*(uint32_t*)0x1FFFF7AC)
67 #define U_ID_1 (*(uint32_t*)0x1FFFF7B0)
68 #define U_ID_2 (*(uint32_t*)0x1FFFF7B4)
70 #ifndef STM32F3
71 #define STM32F3
72 #endif
74 #elif defined(STM32F10X)
76 #include "stm32f10x_conf.h"
77 #include "stm32f10x_gpio.h"
78 #include "core_cm3.h"
80 // Chip Unique ID on F103
81 #define U_ID_0 (*(uint32_t*)0x1FFFF7E8)
82 #define U_ID_1 (*(uint32_t*)0x1FFFF7EC)
83 #define U_ID_2 (*(uint32_t*)0x1FFFF7F0)
85 #ifndef STM32F1
86 #define STM32F1
87 #endif
89 #elif defined(SITL)
91 // Nop
93 #else // STM32F10X
94 #error "Invalid chipset specified. Update platform.h"
95 #endif
97 #ifdef USE_OSD_SLAVE
98 #include "target/common_osd_slave.h"
99 #include "target.h"
100 #else
101 #include "target/common_fc_pre.h"
102 #include "target.h"
103 #include "target/common_fc_post.h"
104 #endif