From b0d089ec7061584ba99ff70e92d8d912eb5f1255 Mon Sep 17 00:00:00 2001 From: Steve Evans Date: Fri, 10 Jun 2022 17:32:01 +0100 Subject: [PATCH] Add STM32F411SX1280 unified target (cherry picked from commit 6d17f3f765208bbf5d4add55efd485ea6f5f4e7e) --- make/targets_list.mk | 3 +- src/main/rx/rx.c | 2 +- .../target/STM32_UNIFIED/STM32F411SX1280.mk | 0 src/main/target/STM32_UNIFIED/target.h | 81 ++++++++++++++----- src/main/target/STM32_UNIFIED/target.mk | 63 +++++++++------ 5 files changed, 104 insertions(+), 45 deletions(-) create mode 100644 src/main/target/STM32_UNIFIED/STM32F411SX1280.mk diff --git a/make/targets_list.mk b/make/targets_list.mk index b28320f053..3778bc1eb2 100644 --- a/make/targets_list.mk +++ b/make/targets_list.mk @@ -84,7 +84,8 @@ UNIFIED_TARGETS := STM32F405 \ STM32F7X2 \ STM32F745 \ STM32G47X \ - STM32H743 + STM32H743 \ + STM32F411SX1280 # Legacy targets are targets that have been replaced by Unified Target configurations LEGACY_TARGETS := MATEKF405 \ diff --git a/src/main/rx/rx.c b/src/main/rx/rx.c index fba097c5cd..e04443d44f 100644 --- a/src/main/rx/rx.c +++ b/src/main/rx/rx.c @@ -963,4 +963,4 @@ timeDelta_t rxGetFrameDelta(timeDelta_t *frameAgeUs) timeUs_t rxFrameTimeUs(void) { return rxRuntimeState.lastRcFrameTimeUs; -} \ No newline at end of file +} diff --git a/src/main/target/STM32_UNIFIED/STM32F411SX1280.mk b/src/main/target/STM32_UNIFIED/STM32F411SX1280.mk new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/main/target/STM32_UNIFIED/target.h b/src/main/target/STM32_UNIFIED/target.h index 48f1632090..057dcd0bfb 100644 --- a/src/main/target/STM32_UNIFIED/target.h +++ b/src/main/target/STM32_UNIFIED/target.h @@ -78,6 +78,29 @@ #define TARGET_IO_PORTD 0xffff #define TARGET_IO_PORTE 0xffff +#elif defined(STM32F411SX1280) +#define TARGET_BOARD_IDENTIFIER "S4SX" + +#define USBD_PRODUCT_STRING "Betaflight STM32F411SX1280" + +#define USE_UART1 +#define USE_UART2 +#define USE_UART6 + +#define SERIAL_PORT_COUNT (UNIFIED_SERIAL_PORT_COUNT + 3) + +#define USE_INVERTER + +#define USE_SPI_DEVICE_1 +#define USE_SPI_DEVICE_2 +#define USE_SPI_DEVICE_3 + +#define TARGET_IO_PORTA 0xffff +#define TARGET_IO_PORTB 0xffff +#define TARGET_IO_PORTC 0xffff +#define TARGET_IO_PORTD 0xffff +#define TARGET_IO_PORTE 0xffff + #elif defined(STM32F7X2) #define TARGET_BOARD_IDENTIFIER "S7X2" @@ -218,6 +241,40 @@ // to be supplied when the board is configured for the first time #define USE_UNIFIED_TARGET +// Only enable ELRS support on STM32F411SX1280 target +#if defined(STM32F411SX1280) +#define DEFAULT_RX_FEATURE FEATURE_RX_SPI +#define RX_SPI_DEFAULT_PROTOCOL RX_SPI_EXPRESSLRS + +#define USE_RX_EXPRESSLRS +#define USE_RX_EXPRESSLRS_TELEMETRY +#define USE_RX_SX1280 +#define RX_EXPRESSLRS_TIMER_INSTANCE TIM5 +#define RX_CHANNELS_AETR + +#else // STM32F411SX1280 +#define USE_RX_FRSKY_SPI_D +#define USE_RX_FRSKY_SPI_X +#define USE_RX_SFHSS_SPI +#define USE_RX_REDPINE_SPI +#define USE_RX_FRSKY_SPI_TELEMETRY +#define USE_RX_CC2500_SPI_PA_LNA +#define USE_RX_CC2500_SPI_DIVERSITY + +#define USE_RX_FLYSKY +#define USE_RX_FLYSKY_SPI_LED + +#define USE_RX_SPEKTRUM +#define USE_RX_SPEKTRUM_TELEMETRY + +#define USE_I2C +#define I2C_FULL_RECONFIGURABILITY + +#define USE_MAG +#define USE_BARO + +#endif // STM32F411SX1280 + #define USE_BEEPER // MPU interrupt @@ -243,7 +300,7 @@ #define USE_ACC_SPI_ICM42605 #define USE_ACC_SPI_ICM42688P -#define USE_MAG +#ifdef USE_MAG #define USE_MAG_DATA_READY_SIGNAL #define USE_MAG_HMC5883 #define USE_MAG_SPI_HMC5883 @@ -253,8 +310,9 @@ #define USE_MAG_MPU925X_AK8963 #define USE_MAG_SPI_AK8963 #define USE_MAG_AK8975 +#endif -#define USE_BARO +#ifdef USE_BARO #define USE_BARO_MS5611 #define USE_BARO_SPI_MS5611 #define USE_BARO_BMP280 @@ -267,6 +325,7 @@ #define USE_BARO_SPI_QMP6988 #define USE_BARO_DPS310 #define USE_BARO_SPI_DPS310 +#endif #define USE_SDCARD #define USE_SDCARD_SPI @@ -289,9 +348,6 @@ #define USE_SPI #define SPI_FULL_RECONFIGURABILITY -#define USE_I2C -#define I2C_FULL_RECONFIGURABILITY - #define USE_VCP #define USE_SOFTSERIAL1 @@ -307,20 +363,6 @@ #define USE_RX_SPI -#define USE_RX_FRSKY_SPI_D -#define USE_RX_FRSKY_SPI_X -#define USE_RX_SFHSS_SPI -#define USE_RX_REDPINE_SPI -#define USE_RX_FRSKY_SPI_TELEMETRY -#define USE_RX_CC2500_SPI_PA_LNA -#define USE_RX_CC2500_SPI_DIVERSITY - -#define USE_RX_FLYSKY -#define USE_RX_FLYSKY_SPI_LED - -#define USE_RX_SPEKTRUM -#define USE_RX_SPEKTRUM_TELEMETRY - #define USE_CUSTOM_DEFAULTS // Additional drivers included for targets with > 512KB of flash @@ -340,6 +382,7 @@ #define USE_RANGEFINDER_TF #define USE_RX_EXPRESSLRS +#define RX_EXPRESSLRS_TIMER_INSTANCE TIM5 #define USE_RX_SX1280 #define USE_RX_SX127X diff --git a/src/main/target/STM32_UNIFIED/target.mk b/src/main/target/STM32_UNIFIED/target.mk index 3cfe8b5af4..c5e6a16f17 100644 --- a/src/main/target/STM32_UNIFIED/target.mk +++ b/src/main/target/STM32_UNIFIED/target.mk @@ -1,3 +1,22 @@ +RX_SRC = \ + rx/cc2500_common.c \ + rx/cc2500_frsky_shared.c \ + rx/cc2500_frsky_d.c \ + rx/cc2500_frsky_x.c \ + rx/cc2500_sfhss.c \ + rx/cc2500_redpine.c \ + rx/a7105_flysky.c \ + rx/cyrf6936_spektrum.c \ + drivers/rx/expresslrs_driver.c \ + rx/expresslrs.c \ + rx/expresslrs_common.c \ + rx/expresslrs_telemetry.c \ + drivers/rx/rx_cc2500.c \ + drivers/rx/rx_a7105.c \ + drivers/rx/rx_cyrf6936.c \ + drivers/rx/rx_sx127x.c \ + drivers/rx/rx_sx1280.c \ + ifeq ($(TARGET), STM32F405) F405_TARGETS += $(TARGET) @@ -5,6 +24,17 @@ else ifeq ($(TARGET), STM32F411) F411_TARGETS += $(TARGET) +else +ifeq ($(TARGET), STM32F411SX1280) +F411_TARGETS += $(TARGET) +RX_SRC = \ + drivers/rx/expresslrs_driver.c \ + drivers/rx/rx_sx127x.c \ + drivers/rx/rx_sx1280.c \ + rx/expresslrs_telemetry.c \ + rx/expresslrs_common.c \ + rx/expresslrs.c \ + else ifeq ($(TARGET), STM32F7X2) F7X2RE_TARGETS += $(TARGET) @@ -25,6 +55,7 @@ endif endif endif endif +endif ifeq ($(TARGET), $(filter $(TARGET), STM32F405 STM32F745 STM32H743)) # Use a full block (16 kB) of flash for custom defaults - with 1 MB flash we have more than we know how to use anyway @@ -39,27 +70,11 @@ FEATURES += VCP SDCARD_SPI SDCARD_SDIO ONBOARDFLASH endif TARGET_SRC = \ - $(addprefix drivers/accgyro/,$(notdir $(wildcard $(SRC_DIR)/drivers/accgyro/*.c))) \ - $(ROOT)/lib/main/BoschSensortec/BMI270-Sensor-API/bmi270_maximum_fifo.c \ - $(addprefix drivers/barometer/,$(notdir $(wildcard $(SRC_DIR)/drivers/barometer/*.c))) \ - $(addprefix drivers/compass/,$(notdir $(wildcard $(SRC_DIR)/drivers/compass/*.c))) \ - drivers/max7456.c \ - drivers/vtx_rtc6705.c \ - drivers/vtx_rtc6705_soft_spi.c \ - rx/cc2500_common.c \ - rx/cc2500_frsky_shared.c \ - rx/cc2500_frsky_d.c \ - rx/cc2500_frsky_x.c \ - rx/cc2500_sfhss.c \ - rx/cc2500_redpine.c \ - rx/a7105_flysky.c \ - rx/cyrf6936_spektrum.c \ - drivers/rx/expresslrs_driver.c \ - rx/expresslrs.c \ - rx/expresslrs_common.c \ - rx/expresslrs_telemetry.c \ - drivers/rx/rx_cc2500.c \ - drivers/rx/rx_a7105.c \ - drivers/rx/rx_cyrf6936.c \ - drivers/rx/rx_sx127x.c \ - drivers/rx/rx_sx1280.c \ + $(addprefix drivers/accgyro/,$(notdir $(wildcard $(SRC_DIR)/drivers/accgyro/*.c))) \ + $(ROOT)/lib/main/BoschSensortec/BMI270-Sensor-API/bmi270_maximum_fifo.c \ + $(addprefix drivers/barometer/,$(notdir $(wildcard $(SRC_DIR)/drivers/barometer/*.c))) \ + $(addprefix drivers/compass/,$(notdir $(wildcard $(SRC_DIR)/drivers/compass/*.c))) \ + drivers/max7456.c \ + drivers/vtx_rtc6705.c \ + drivers/vtx_rtc6705_soft_spi.c \ + $(RX_SRC)