Move FLASH_PAGE_SIZE definition to CPU specific target.h files (#12394)
[betaflight.git] / src / main / target / STM32H730 / target.h
blob35ca8b289a05702b6cf4e68e2c1c378529cf0177
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/>.
22 * This target won't actually build a target that you can boot, it is meant as
23 * a base target ONLY.
25 * When defining a target that uses this as a base you currently:
27 * 1) *must* define ALL the SPI instances that the target has, including their pins.
28 * 2) *must* define the storage subsystem used to boot, e.g. see CONFIG_IN_xxx.
29 * 3) *must* define all the settings required for the config storage system to
30 * be able to load the config at boot time BEFORE it has actually loaded a config.
31 * e.g. for OCTOQSPI define the QSPI instance, pins, mode, etc,
32 * for SDCARD define the SD card bus (SPI/SDIO), pins, etc.
36 #pragma once
38 #include "drivers/stm32/platform_stm32.h"
40 #ifndef TARGET_BOARD_IDENTIFIER
41 #define TARGET_BOARD_IDENTIFIER "S730"
42 #endif
44 #ifndef USBD_PRODUCT_STRING
45 #define USBD_PRODUCT_STRING "Betaflight STM32H730"
46 #endif
48 #if !defined(USE_I2C)
49 #define USE_I2C
50 #define USE_I2C_DEVICE_1
51 #define USE_I2C_DEVICE_2
52 #define USE_I2C_DEVICE_3
53 #define USE_I2C_DEVICE_4
54 #define I2C_FULL_RECONFIGURABILITY
55 #endif
57 // Provide a default so that this target builds on the build server.
58 #if !defined(USE_SPI)
59 #define USE_SPI
60 #define USE_SPI_DEVICE_1
61 #define USE_SPI_DEVICE_2
62 #define USE_SPI_DEVICE_3
63 #define USE_SPI_DEVICE_4
64 #define USE_SPI_DEVICE_5
65 #define USE_SPI_DEVICE_6
66 #define SPI_FULL_RECONFIGURABILITY
67 #endif
69 #define USE_SPI_DMA_ENABLE_LATE
71 #define USE_UART1
72 #define USE_UART2
73 #define USE_UART3
74 #define USE_UART4
75 #define USE_UART5
76 #define USE_UART6
77 #define USE_UART7
78 #define USE_UART8
79 #define USE_UART9
80 #define USE_UART10
81 #define USE_LPUART1
83 #define SERIAL_PORT_COUNT (UNIFIED_SERIAL_PORT_COUNT + 11)
85 // Disable OCTOSPI pins PB2/CLK, PB6/NCS, PD11/IO0, PD12/IO1, PD13/IO3, PE2/IO2
86 // PE7/IO4, PE8/IO5, PE9/IO6, PE10/IO7
88 #define TARGET_IO_PORTA 0xffff
89 #define TARGET_IO_PORTB (0xffff & ~(BIT(2)|BIT(6)))
90 #define TARGET_IO_PORTC 0xffff
91 #define TARGET_IO_PORTD (0xffff & ~(BIT(11)|BIT(12)|BIT(13)))
92 #define TARGET_IO_PORTE (0xffff & ~(BIT(2)|BIT(7)|BIT(8)|BIT(9)|BIT(10)))
93 #define TARGET_IO_PORTF 0xffff
94 #define TARGET_IO_PORTG 0xffff
95 #define TARGET_IO_PORTH 0xffff
97 #define USE_BEEPER
99 #define USE_VCP
101 #define UNIFIED_SERIAL_PORT_COUNT 1
103 #define USE_USB_ID
104 #define USE_USB_DETECT
106 #define USE_ESCSERIAL
108 #define USE_ADC
110 // Provide a default so that this target builds on the build server.
111 #if !defined(CONFIG_IN_RAM) && !defined(CONFIG_IN_SDCARD) && !defined(CONFIG_IN_EXTERNAL_FLASH)
112 #define CONFIG_IN_RAM
113 #endif
115 #define USE_EXTI
116 #define USE_TIMER_UP_CONFIG
118 #if !(defined(CONFIG_IN_EXTERNAL_FLASH) || defined(CONFIG_IN_MEMORY_MAPPED_FLASH) || defined(CONFIG_IN_RAM) || defined(CONFIG_IN_SDCARD))
119 #error "The configured MCU only has one flash page which contains the bootloader, no spare flash pages available, use external storage for persistent config or ram for target testing"
120 #endif
122 #define FLASH_PAGE_SIZE ((uint32_t)0x20000) // 128K sectors