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/>.
21 #include "stm32h7xx.h"
22 #include "stm32h7xx_hal.h"
23 #include "system_stm32h7xx.h"
25 #include "stm32h7xx_ll_spi.h"
26 #include "stm32h7xx_ll_gpio.h"
27 #include "stm32h7xx_ll_dma.h"
28 #include "stm32h7xx_ll_rcc.h"
29 #include "stm32h7xx_ll_bus.h"
30 #include "stm32h7xx_ll_tim.h"
31 #include "stm32h7xx_ll_system.h"
33 // Chip Unique ID on H7
34 #define U_ID_0 (*(uint32_t*)UID_BASE)
35 #define U_ID_1 (*(uint32_t*)(UID_BASE + 4))
36 #define U_ID_2 (*(uint32_t*)(UID_BASE + 8))
38 #elif defined(STM32F7)
39 #include "stm32f7xx.h"
40 #include "stm32f7xx_hal.h"
41 #include "stm32f7xx_hal_rtc.h"
42 #include "stm32f7xx_ll_spi.h"
43 #include "stm32f7xx_ll_gpio.h"
44 #include "stm32f7xx_ll_dma.h"
45 #include "stm32f7xx_ll_rcc.h"
46 #include "stm32f7xx_ll_bus.h"
47 #include "stm32f7xx_ll_tim.h"
49 // Chip Unique ID on F7
50 #if defined(STM32F722xx)
51 #define U_ID_0 (*(uint32_t*)0x1ff07a10)
52 #define U_ID_1 (*(uint32_t*)0x1ff07a14)
53 #define U_ID_2 (*(uint32_t*)0x1ff07a18)
55 #define U_ID_0 (*(uint32_t*)0x1ff0f420)
56 #define U_ID_1 (*(uint32_t*)0x1ff0f424)
57 #define U_ID_2 (*(uint32_t*)0x1ff0f428)
60 #elif defined(AT32F43x)
61 #include "at32f435_437.h"
63 #define U_ID_0 (*(uint32_t*)0x1FFFF7E8)
64 #define U_ID_1 (*(uint32_t*)0x1FFFF7EC)
65 #define U_ID_2 (*(uint32_t*)0x1FFFF7F0)
71 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
73 #elif defined(STM32F4)
74 #include "stm32f4xx.h"
76 // Chip Unique ID on F405
77 #define U_ID_0 (*(uint32_t*)0x1fff7a10)
78 #define U_ID_1 (*(uint32_t*)0x1fff7a14)
79 #define U_ID_2 (*(uint32_t*)0x1fff7a18)
83 #include "target/common.h"
85 #include "target/sanity_check.h"
86 #include "target/common_post.h"
88 // Remove the unaligned packed structure member pointer access warning
89 // The compiler guarantees that unaligned access is safe for packed structures.
92 #pragma GCC diagnostic ignored "-Waddress-of-packed-member"