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(STM32F4)
61 #include "stm32f4xx.h"
63 // Chip Unique ID on F405
64 #define U_ID_0 (*(uint32_t*)0x1fff7a10)
65 #define U_ID_1 (*(uint32_t*)0x1fff7a14)
66 #define U_ID_2 (*(uint32_t*)0x1fff7a18)
68 #elif defined(STM32F3)
69 #include "stm32f30x_conf.h"
70 #include "stm32f30x_rcc.h"
71 #include "stm32f30x_gpio.h"
74 // Chip Unique ID on F303
75 #define U_ID_0 (*(uint32_t*)0x1FFFF7AC)
76 #define U_ID_1 (*(uint32_t*)0x1FFFF7B0)
77 #define U_ID_2 (*(uint32_t*)0x1FFFF7B4)
81 #include "target/common.h"
83 #include "target/sanity_check.h"
84 #include "target/common_post.h"
86 // Remove the unaligned packed structure member pointer access warning
87 // The compiler guarantees that unaligned access is safe for packed structures.
90 #pragma GCC diagnostic ignored "-Waddress-of-packed-member"