targets: add BLADE_F4 (STM32F405) and BLADE_PRO_H7 (STM32H743)#48
targets: add BLADE_F4 (STM32F405) and BLADE_PRO_H7 (STM32H743)#48sensei-hacker wants to merge 6 commits intomaintenance-9.xfrom
Conversation
Code Review by Qodo
1. IMU2 busdev tag broken
|
| BUSDEV_REGISTER_SPI_TAG(busdev_mpu6000_1, DEVHW_MPU6000, MPU6000_SPI_BUS_1, MPU6000_CS_PIN_1, MPU6000_EXTI_PIN_1, DEVFLAGS_NONE, 0, IMU_MPU6000_ALIGN_1); | ||
| BUSDEV_REGISTER_SPI_TAG(busdev_mpu6000_2, DEVHW_MPU6000, MPU6000_SPI_BUS_2, MPU6000_CS_PIN_2, MPU6000_EXTI_PIN_2, DEVFLAGS_NONE, 1, IMU_MPU6000_ALIGN_2); | ||
|
|
||
| BUSDEV_REGISTER_SPI_TAG(busdev_icm42688_1, DEVHW_ICM42605, ICM42605_SPI_BUS_1, ICM42605_CS_PIN_1, ICM42605_EXTI_PIN_1, DEVFLAGS_NONE, 0, IMU_ICM42605_ALIGN_1); | ||
| BUSDEV_REGISTER_SPI_TAG(busdev_icm42688_2, DEVHW_ICM42605, ICM42605_SPI_BUS_2, ICM42605_CS_PIN_2, ICM42605_EXTI_PIN_2, DEVFLAGS_NONE, 1, IMU_ICM42605_ALIGN_2); | ||
|
|
||
| BUSDEV_REGISTER_SPI_TAG(busdev_bmi270_1, DEVHW_BMI270, BMI270_SPI_BUS_1, BMI270_CS_PIN_1, BMI270_EXTI_PIN_1, DEVFLAGS_NONE, 0, IMU_BMI270_ALIGN_1); | ||
| BUSDEV_REGISTER_SPI_TAG(busdev_bmi270_2, DEVHW_BMI270, BMI270_SPI_BUS_2, BMI270_CS_PIN_2, BMI270_EXTI_PIN_2, DEVFLAGS_NONE, 1, IMU_BMI270_ALIGN_2); |
There was a problem hiding this comment.
1. Imu2 busdev tag broken 🐞 Bug ✓ Correctness
BLADE_PRO_H7 registers IMU bus devices with BUSDEV_REGISTER_SPI_TAG using (DEVFLAGS_NONE, <index>) where the macro expects (<tag>, <flags>), causing both IMUs to have tag=0 and setting flags=1 for the *_2 devices. This can prevent IMU2 from being discovered and may enable DEVFLAGS_USE_RAW_REGISTERS on the second IMU, breaking SPI register access.
Agent Prompt
### Issue description
`BUSDEV_REGISTER_SPI_TAG` is called with `DEVFLAGS_NONE` in the `_tag` position and `0/1` in the `_flags` position. This breaks tag-based device selection (`tag==descriptor->tag`) and unintentionally enables `DEVFLAGS_USE_RAW_REGISTERS` for the second IMU descriptors.
### Issue Context
- `BUSDEV_REGISTER_SPI_TAG(..., _tag, _flags, _param)` stores `_tag` into `descriptor.tag` and `_flags` into `descriptor.flags`.
- IMU drivers call `busDeviceInit(..., gyro->imuSensorToUse, ...)` where `imuSensorToUse` is the IMU index (0 or 1).
### Fix Focus Areas
- src/main/target/BLADE_PRO_H7/target.c[29-36]
### Proposed change
For each of the six registrations, change:
- `..., DEVFLAGS_NONE, 0, ...` -> `..., 0, DEVFLAGS_NONE, ...`
- `..., DEVFLAGS_NONE, 1, ...` -> `..., 1, DEVFLAGS_NONE, ...`
(Repeat for MPU6000, ICM42605, BMI270 descriptors.)
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Summary
Adds two new flight controller targets from PR iNavFlight#9904 (hakrc1), with corrections applied before integration.
Changes
New targets:
BLADE_F4— STM32F405 flight controllerBLADE_PRO_H7— STM32H743 flight controller with dual IMU supportCorrections from code review:
MPU6000/ICM42605/BMI270 _BUS_2macros changed fromBUS_SPI1→BUS_SPI4(IMU2 is wired to SPI4 on PE11–PE14)TARGET_BOARD_IDENTIFIER:"BLF4"and"BLPH"(both were"RUSH")MAX_PWM_OUTPUT_PORTSto match actualtimerHardware[]entriestimerHardware[]comments to match actual pin order; remove dead commented-out duplicate blockFEATURE_SOFTSERIALfromBLADE_F4DEFAULT_FEATURES(no softserial port defined)USE_SPI_DEVICE_3and pin definitions fromBLADE_F4Testing
Both targets build successfully against maintenance-9.x.