Skip to content

Support new OPENOCD - #12268

Merged
sensei-hacker merged 1 commit into
iNavFlight:maintenance-11.xfrom
error414:error414/fix/compile/cfg
Nov 29, 2026
Merged

sensei-hacker merged 1 commit into
iNavFlight:maintenance-11.xfrom
error414:error414/fix/compile/cfg

Conversation

@error414

@error414 error414 commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

CFG files for openocd in inav set hla_swd for debuging. New opencod drops autoselection of protocol https://review.openocd.org/c/openocd/+/8692

So if we would like to use HLA for one core STM3 CPUs cfg should look like

source [find interface/stlink_hla.cfg]
transport select hla_swd
source [find target/stm32h7x_dual_bank.cfg]
reset_config none separate

This PR works with old openocd as well, for old opencd is slelected hla_swd, for new one is selected swd.

Moreover seems that HLA is deprecated
https://openocd.org/doc/html/Debug-Adapter-Configuration.html

The older API that requires HLA transport is deprecated and will be dropped from OpenOCD. In mean time it’s still available by using interface/stlink-hla.cfg. The HLA interface file can be put as first command line argument to force using is in place of the default DAP API

@qodo-code-review

Copy link
Copy Markdown
Contributor

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Add logging, sensor, UART and telemetry features plus OpenOCD compatibility

✨ Enhancement 🐞 Bug fix 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Select the correct OpenOCD transport for legacy HLA and newer ST-Link adapters.
• Improve SD logging, gyro sampling, UART routing, SITL timing and battery telemetry.
• Document the new behavior and add MAVLink and serial-pad tests.
Merge Risk 🟡 Medium

Blast radius 🟢 Low 💥 0 capabilities

  • Fault-specific containment limits risk to the originating changed behavior.
Behavioral complexity 🟡 Medium 🧩 Compatibility cases

  • Before: every supported board script selected hla_swd.
  • After: the scripts branch on the adapter identity and select hla_swd for hla or swd otherwise.
  • New correctness condition: each OpenOCD driver identity must be classified into a transport that the driver accepts, while retaining the correct MCU target configuration.
  • The branch is local and does not introduce persistent state, concurrency or coordinated invariants.
Potential damage 🟡 Medium 🩹 Temporary loss

  • Conservative damage bound for the originating changed behavior; downstream capabilities remain contained.
  • If transport selection fails, the affected debugging session cannot connect or operate for the selected board variant.
  • The source and configuration usage support containment to debugging rather than firmware behavior.
  • Reverting the scripts restores the prior transport selection.
  • No persistent firmware state or external flight-control effect requires repair; a user may need to restart OpenOCD after changing the configuration.
Assessed commit 2279d9e
Diagram

graph TD
  Core["Firmware core"] --> Logging["SD logging"] --> Fatfs["Async FAT filesystem"]
  Core --> Sensors["Gyro and SPI"]
  Core --> Routing["UART pad routing"]
  Core --> Telemetry["Battery telemetry"]
  Core --> Simulator["SITL lockstep"]
  Core --> Debug["OpenOCD configuration"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Split into focused PRs
  • ➕ Allows independent review and hardware validation of OpenOCD, logging, gyro, UART, telemetry and SITL changes.
  • ➕ Limits regression scope and makes rollback practical.
  • ➖ Requires separating shared build, initialization and documentation changes.
  • ➖ May delay landing the complete collection of features.

Recommendation: Split this into focused PRs, starting with the three OpenOCD configuration files described by the PR title. The other changes are substantial, mostly independent and require different hardware or simulator validation; reviewing them together obscures risk.

Files changed (101) +3874 / -205

Enhancement (45) +3100 / -53
blackbox.cPause and split SD logs safely +72/-5

Pause and split SD logs safely

• Pauses logging before SD cache exhaustion, resumes on an I-frame and supports starting another file when space is reclaimed. Tracks pause counts and missed iterations.

src/main/blackbox/blackbox.c

blackbox.hExpose Blackbox pause counters +2/-0

Expose Blackbox pause counters

• Declares the counters used to report SD-cache-induced logging pauses.

src/main/blackbox/blackbox.h

blackbox_io.cManage SD capacity and oldest-log reclamation +237/-3

Manage SD capacity and oldest-log reclamation

• Measures iteration write size to set cache pause thresholds. Scans and deletes eligible logs, relocates the freefile and allows logging to continue after card rollover.

src/main/blackbox/blackbox_io.c

blackbox_io.hExpose SD logging capacity controls +8/-0

Expose SD logging capacity controls

• Declares buffer-pressure, iteration measurement and new-log interfaces for Blackbox.

src/main/blackbox/blackbox_io.h

accgyro.cQueue data-ready gyro samples +33/-0

Queue data-ready gyro samples

• Adds bounded sample-queue operations used to transfer asynchronously captured gyro readings to the sensor task.

src/main/drivers/accgyro/accgyro.c

accgyro.hDefine asynchronous gyro sampling state +54/-0

Define asynchronous gyro sampling state

• Adds data-ready settings, driver hooks and sample-queue declarations to the gyro device interface.

src/main/drivers/accgyro/accgyro.h

accgyro_data_ready.cCapture gyro samples on data-ready interrupts +225/-0

Capture gyro samples on data-ready interrupts

• Starts SPI reads from IMU interrupts and queues parsed samples. Pauses on queue overflow and falls back to register polling when samples stop.

src/main/drivers/accgyro/accgyro_data_ready.c

accgyro_data_ready.hDefine the gyro data-ready driver interface +53/-0

Define the gyro data-ready driver interface

• Declares sample parsing, register-read fallback, initialization and suspension hooks.

src/main/drivers/accgyro/accgyro_data_ready.h

accgyro_icm42605.cSupport interrupt-driven ICM-426xx reads +54/-0

Support interrupt-driven ICM-426xx reads

• Adds combined gyro, accelerometer and temperature parsing and gyro-only reads, with fallback to existing register access.

src/main/drivers/accgyro/accgyro_icm42605.c

bus_busdev_spi.cArbitrate device SPI transfers +5/-0

Arbitrate device SPI transfers

• Wraps device bus access with the new SPI acquire and release coordination.

src/main/drivers/bus_busdev_spi.c

bus_spi.hDeclare SPI data-ready arbitration hooks +20/-0

Declare SPI data-ready arbitration hooks

• Adds interfaces for asynchronous SPI reads and bus ownership coordination.

src/main/drivers/bus_spi.h

bus_spi_data_ready.cCoordinate interrupt reads with main-loop SPI +188/-0

Coordinate interrupt reads with main-loop SPI

• Queues data-ready requests while the bus is occupied, bounds waits for in-flight reads and disables the path after repeated failures.

src/main/drivers/bus_spi_data_ready.c

bus_spi_data_ready_dma.cAllocate H7 DMA streams for gyro SPI +192/-0

Allocate H7 DMA streams for gyro SPI

• Finds unowned, non-UART-reserved DMA streams and manages transfer completion and shutdown for longer reads.

src/main/drivers/bus_spi_data_ready_dma.c

bus_spi_data_ready_impl.hDefine low-level data-ready SPI contracts +61/-0

Define low-level data-ready SPI contracts

• Declares the hardware and DMA helpers shared by the SPI data-ready modules.

src/main/drivers/bus_spi_data_ready_impl.h

bus_spi_hal_ll.cImplement H7 interrupt and DMA SPI reads +169/-0

Implement H7 interrupt and DMA SPI reads

• Uses SPI end-of-transfer interrupts for FIFO-sized samples and DMA for longer samples, then delivers completed reads to the queueing layer.

src/main/drivers/bus_spi_hal_ll.c

pwm_mapping.cPrevent UART-routed pads from driving outputs +71/-10

Prevent UART-routed pads from driving outputs

• Preserves original output numbering while excluding routed pads from LED and other uses; reports motor or servo conflicts as initialization errors.

src/main/drivers/pwm_mapping.c

pwm_mapping.hExpose output-pad usage and conflict state +5/-0

Expose output-pad usage and conflict state

• Adds PWM mapping interfaces and error information needed by serial-pad routing.

src/main/drivers/pwm_mapping.h

serial_uart.hDeclare UART alternate-pin routing +4/-0

Declare UART alternate-pin routing

• Exposes a pin-validation and application function for UART pad reassignment.

src/main/drivers/serial_uart.h

serial_uart_at32f43x.cAdd AT32 UART alternate-pin mappings +105/-0

Add AT32 UART alternate-pin mappings

• Lists supported TX and RX pins and alternate functions, then applies validated pad routing.

src/main/drivers/serial_uart_at32f43x.c

serial_uart_impl.hShare alternate-pin table definitions +13/-0

Share alternate-pin table definitions

• Defines UART alternate-pin entries and macros used by MCU-specific routing tables.

src/main/drivers/serial_uart_impl.h

serial_uart_stm32f4xx.cAdd F4 UART alternate-pin mappings +75/-0

Add F4 UART alternate-pin mappings

• Provides available F4 UART TX and RX choices and applies valid routing.

src/main/drivers/serial_uart_stm32f4xx.c

serial_uart_stm32f7xx.cAdd F7 UART alternate-pin mappings +108/-0

Add F7 UART alternate-pin mappings

• Provides device-specific F7 pin and alternate-function choices while excluding swapped UARTs.

src/main/drivers/serial_uart_stm32f7xx.c

serial_uart_stm32h7xx.cAdd H7 UART alternate-pin mappings +97/-0

Add H7 UART alternate-pin mappings

• Provides H7 TX and RX pad choices, per-pin alternate functions and swapped-port checks.

src/main/drivers/serial_uart_stm32h7xx.c

cli.cAdd serialpad and Smart Battery CLI commands +119/-0

Add serialpad and Smart Battery CLI commands

• Adds UART pad configuration and Smart Battery inspection commands. Extends sd_info with Blackbox pause diagnostics.

src/main/fc/cli.c

fc_init.cInitialize routed UARTs and gyro data-ready reads +8/-0

Initialize routed UARTs and gyro data-ready reads

• Applies serial-pad assignments before opening ports and starts interrupt-driven gyro reads after other DMA users initialize.

src/main/fc/fc_init.c

fc_msp.cExpose serial-pad MSP operations +23/-7

Expose serial-pad MSP operations

• Adds supported-pad listing and setter commands and removes the obsolete legacy Blackbox response.

src/main/fc/fc_msp.c

asyncfatfs.cSupport safe log eviction and freefile relocation +121/-3

Support safe log eviction and freefile relocation

• Serializes directory walks and avoids truncating an unallocated FAT chain. Adds directory-entry deletion, pending-write checks and freefile relocation for SD log rollover.

src/main/io/asyncfatfs/asyncfatfs.c

asyncfatfs.hExpose filesystem rollover operations +41/-0

Expose filesystem rollover operations

• Declares directory deletion, write-state and freefile location and relocation interfaces for Blackbox.

src/main/io/asyncfatfs/asyncfatfs.h

motor_srxl2.cReceive and retain SRXL2 Smart Battery pages +34/-6

Receive and retain SRXL2 Smart Battery pages

• Uses the receiver identity accepted by Avian battery replies, stores battery data per ESC and invalidates stale pages on link interruption.

src/main/io/motor_srxl2.c

motor_srxl2.hExpose SRXL2 Smart Battery readings +5/-0

Expose SRXL2 Smart Battery readings

• Declares decoded and raw Smart Battery accessors for telemetry and CLI consumers.

src/main/io/motor_srxl2.h

serial_pads.cImplement configurable UART output-pad routing +265/-0

Implement configurable UART output-pad routing

• Validates alternate pins and reservations, persists pad choices and publishes available pads and their current output use to MSP.

src/main/io/serial_pads.c

serial_pads.hDefine serial-pad configuration API +53/-0

Define serial-pad configuration API

• Declares UART pad settings, validation, initialization and list serialization.

src/main/io/serial_pads.h

srxl2_smart_battery.cDecode and expire Smart Battery pages +155/-0

Decode and expire Smart Battery pages

• Tracks up to two battery sources per ESC, assembles cells and temperature, and requires fresh capacity metadata before reporting values.

src/main/io/srxl2_smart_battery.c

srxl2_smart_battery.hDefine Smart Battery page and telemetry types +70/-0

Define Smart Battery page and telemetry types

• Declares source slots, page retention, freshness limits and decoded telemetry structures.

src/main/io/srxl2_smart_battery.h

main.cRun SITL lockstep synchronization each loop +3/-0

Run SITL lockstep synchronization each loop

• Invokes the simulated-clock coordination hook from the main loop.

src/main/main.c

msp_protocol_v2_inav.hAssign serial-pad MSP command IDs +3/-0

Assign serial-pad MSP command IDs

• Defines the list and setter IDs for UART output-pad configuration.

src/main/msp/msp_protocol_v2_inav.h

crsf.hDefine CRSF voltage telemetry frame +1/-0

Define CRSF voltage telemetry frame

• Adds the frame identifier needed to forward Smart Battery cell voltages.

src/main/rx/crsf.h

scheduler.cExpose task progress to SITL lockstep +16/-1

Expose task progress to SITL lockstep

• Counts task executions and avoids sleeping on simulated time while the simulator awaits a scheduler pass.

src/main/scheduler/scheduler.c

scheduler.hDeclare SITL task execution counter +3/-0

Declare SITL task execution counter

• Exposes scheduler progress to the simulator lockstep coordinator.

src/main/scheduler/scheduler.h

gyro.cConsume queued gyro samples at sensor rate +76/-15

Consume queued gyro samples at sensor rate

• Starts configured data-ready sampling and processes queued readings through calibration and the first low-pass filter, retaining polling fallback.

src/main/sensors/gyro.c

gyro.hExpose gyro data-ready configuration and startup +12/-0

Expose gyro data-ready configuration and startup

• Adds gyro data-ready setting storage and the startup interface.

src/main/sensors/gyro.h

realFlight.cDrive lockstep from simulator replies +18/-1

Drive lockstep from simulator replies

• Extracts physics time from ExchangeData responses, waits for due tasks before the next request and extends the timeout in lockstep mode.

src/main/target/SITL/sim/realFlight.c

target.cImplement physics-time SITL clock +137/-2

Implement physics-time SITL clock

• Adds --lockstep, a simulated micros clock and condition-variable coordination between simulator replies and completed scheduler passes.

src/main/target/SITL/target.c

target.hDeclare SITL lockstep clock hooks +7/-0

Declare SITL lockstep clock hooks

• Exposes clock activation, physics-time updates and scheduler synchronization functions.

src/main/target/SITL/target.h

crsf.cForward Smart Battery cells and temperature over CRSF +79/-0

Forward Smart Battery cells and temperature over CRSF

• Schedules native CRSF Voltage Group and Temperature frames for fresh battery sources, omitting incomplete or oversized cell packs.

src/main/telemetry/crsf.c

Bug fix (6) +38 / -8
config_eeprom.cSuspend asynchronous gyro reads before flash writes +5/-0

Suspend asynchronous gyro reads before flash writes

• Stops data-ready sampling during EEPROM writes so an in-flight SPI transfer cannot interfere with flash operations.

src/main/config/config_eeprom.c

adc_stm32f4xx.cClaim the F4 ADC DMA stream +7/-0

Claim the F4 ADC DMA stream

• Marks the ADC stream owned so runtime DMA allocation cannot take it for SPI sampling.

src/main/drivers/adc_stm32f4xx.c

adc_stm32f7xx.cClaim the F7 ADC DMA stream +6/-0

Claim the F7 ADC DMA stream

• Registers ADC DMA ownership to prevent conflicting allocations.

src/main/drivers/adc_stm32f7xx.c

adc_stm32h7xx.cClaim the H7 ADC DMA stream +6/-0

Claim the H7 ADC DMA stream

• Registers ADC DMA ownership before dynamic gyro SPI DMA selection.

src/main/drivers/adc_stm32h7xx.c

sdcard_spi.cArbitrate unselected SD-card SPI access +3/-0

Arbitrate unselected SD-card SPI access

• Acquires and releases the SPI bus around SD-card transfers that have no selected device.

src/main/drivers/sdcard/sdcard_spi.c

mavlink_streams.cReport absent battery as unknown +11/-8

Report absent battery as unknown

• Uses MAVLink unknown-voltage and unknown-capacity values in SYS_STATUS, BATTERY_STATUS and HIGH_LATENCY2 when no battery is present or VBAT is off.

src/main/mavlink/mavlink_streams.c

Refactor (1) +0 / -3
msp_protocol.hRemove obsolete MSP Blackbox identifier +0/-3

Remove obsolete MSP Blackbox identifier

• Removes the unsupported legacy Blackbox command definition.

src/main/msp/msp_protocol.h

Tests (4) +383 / -7
CMakeLists.txtRegister serial-pad unit tests +4/-0

Register serial-pad unit tests

• Adds the serial-pad test target and its required sources and feature definitions.

src/test/unit/CMakeLists.txt

mavlink_unittest.ccTest absent and present battery MAVLink values +88/-7

Test absent and present battery MAVLink values

• Checks unknown sentinels with no battery or disabled VBAT and verifies measured values for a present battery across three messages.

src/test/unit/mavlink_unittest.cc

platform.hProvide test platform feature definitions +4/-0

Provide test platform feature definitions

• Adds platform definitions needed to compile the new unit-test coverage.

src/test/unit/platform.h

serial_pads_unittest.ccTest UART output-pad routing +287/-0

Test UART output-pad routing

• Adds unit coverage for serial-pad eligibility, selection, pin conflicts and reported pad mappings.

src/test/unit/serial_pads_unittest.cc

Documentation (9) +226 / -85
Blackbox.mdDocument SD log rollover and pauses +14/-0

Document SD log rollover and pauses

• Explains oldest-log reclamation, split flight logs and skipped iterations when the SD cache falls behind.

docs/Blackbox.md

Cli.mdList the serialpad CLI command +1/-0

List the serialpad CLI command

• Adds the UART output-pad command to the CLI reference.

docs/Cli.md

Mavlink.mdDocument unknown battery telemetry +3/-2

Document unknown battery telemetry

• Describes the MAVLink voltage and percentage sent when no battery is detected or VBAT is disabled.

docs/Mavlink.md

SITL.mdDocument simulator lockstep mode +2/-0

Document simulator lockstep mode

• Explains the RealFlight-interface lockstep option, physics-driven time and extended SOAP timeout.

docs/SITL/SITL.md

Serial.mdExplain UART routing to output pads +18/-0

Explain UART routing to output pads

• Documents pad numbering, CLI and Ports-tab configuration, activation timing and output conflicts.

docs/Serial.md

Settings.mdDocument gyro data-ready setting +12/-0

Document gyro data-ready setting

• Explains AUTO, ON and OFF behavior and the supported IMU and interrupt-pin requirements.

docs/Settings.md

Spektrum Smart ESC.mdDocument Smart Battery telemetry +49/-2

Document Smart Battery telemetry

• Explains cell and temperature reporting, compatibility and stale-data safeguards; also notes UART TX pad routing.

docs/Spektrum Smart ESC.md

README.mdDescribe serial-pad MSP messages +36/-28

Describe serial-pad MSP messages

• Adds request and reply documentation for listing and choosing UART pads and adjusts Blackbox protocol documentation.

docs/development/msp/README.md

msp_messages.jsonUpdate MSP message definitions +91/-53

Update MSP message definitions

• Defines serial-pad list and setter messages and revises Blackbox message metadata.

docs/development/msp/msp_messages.json

Other (36) +127 / -49
f4fc.cfgSelect F4 debug transport by adapter +7/-1

Select F4 debug transport by adapter

• Selects hla_swd for an HLA adapter and swd otherwise, avoiding reliance on OpenOCD transport autoselection.

board/f4fc.cfg

f7fc.cfgSelect F7 debug transport by adapter +7/-1

Select F7 debug transport by adapter

• Selects the transport supported by either legacy HLA or newer ST-Link OpenOCD drivers.

board/f7fc.cfg

h7fc.cfgSelect H7 debug transport by adapter +7/-1

Select H7 debug transport by adapter

• Uses hla_swd for HLA and swd for the newer adapter driver.

board/h7fc.cfg

CMakeLists.txtBuild the new firmware modules +8/-0

Build the new firmware modules

• Includes the gyro data-ready, SPI, serial-pad and Smart Battery sources and headers.

src/main/CMakeLists.txt

parameter_group_ids.hReserve a serial-pad configuration group +2/-1

Reserve a serial-pad configuration group

• Adds the persistent parameter-group identifier for UART pad assignments.

src/main/config/parameter_group_ids.h

nvic.hAssign gyro data-ready interrupt priority +2/-0

Assign gyro data-ready interrupt priority

• Adds an interrupt priority for asynchronous gyro SPI activity.

src/main/drivers/nvic.h

settings.yamlDefine gyro data-ready setting +9/-0

Define gyro data-ready setting

• Adds the AUTO, ON and OFF setting and its feature guard.

src/main/fc/settings.yaml

target.cWire BrotherHobby IMU interrupt pins +2/-2

Wire BrotherHobby IMU interrupt pins

• Passes primary and secondary ICM-42605 interrupt pins to SPI device registration.

src/main/target/BROTHERHOBBYH743/target.c

target.hDeclare BrotherHobby IMU interrupt pins +2/-0

Declare BrotherHobby IMU interrupt pins

• Defines both ICM-42605 data-ready pin assignments.

src/main/target/BROTHERHOBBYH743/target.h

target.cWire DAKEFPV H743 IMU interrupts +5/-5

Wire DAKEFPV H743 IMU interrupts

• Passes the primary IMU interrupt pin to its SPI device registrations.

src/main/target/DAKEFPVH743/target.c

target.hDeclare DAKEFPV H743 IMU interrupt pin +1/-0

Declare DAKEFPV H743 IMU interrupt pin

• Defines the primary IMU data-ready pin.

src/main/target/DAKEFPVH743/target.h

target.cWire DAKEFPV Pro dual IMU interrupts +10/-10

Wire DAKEFPV Pro dual IMU interrupts

• Passes each IMU interrupt pin to the corresponding SPI registrations.

src/main/target/DAKEFPVH743PRO/target.c

target.hDeclare DAKEFPV Pro dual IMU pins +2/-0

Declare DAKEFPV Pro dual IMU pins

• Defines interrupt assignments for both IMU positions.

src/main/target/DAKEFPVH743PRO/target.h

target.cWire Flywoo dual IMU interrupts +2/-2

Wire Flywoo dual IMU interrupts

• Adds data-ready pins to both ICM-426xx SPI registrations.

src/main/target/FLYWOOH743PRO/target.c

target.hDeclare Flywoo dual IMU pins +2/-0

Declare Flywoo dual IMU pins

• Defines both ICM-426xx interrupt assignments.

src/main/target/FLYWOOH743PRO/target.h

target.cWire GEPRC dual IMU interrupts +4/-4

Wire GEPRC dual IMU interrupts

• Passes the board's two IMU interrupt pins to relevant SPI registrations.

src/main/target/GEPRC_TAKER_H743/target.c

target.hDeclare GEPRC dual IMU pins +2/-0

Declare GEPRC dual IMU pins

• Defines data-ready pins for primary and secondary IMUs.

src/main/target/GEPRC_TAKER_H743/target.h

target.cWire HAKRC dual IMU interrupts +2/-2

Wire HAKRC dual IMU interrupts

• Connects both ICM-426xx SPI devices to their interrupt pins.

src/main/target/HAKRCH743/target.c

target.hDeclare HAKRC dual IMU pins +2/-0

Declare HAKRC dual IMU pins

• Defines interrupt pins for both IMU positions.

src/main/target/HAKRCH743/target.h

target.hDeclare Blitz H7 Pro IMU interrupt +3/-0

Declare Blitz H7 Pro IMU interrupt

• Defines the ICM-42605 interrupt pin for the applicable board variant.

src/main/target/IFLIGHT_BLITZ_H7_PRO/target.h

target.hDeclare Kakute H7 IMU interrupt +1/-0

Declare Kakute H7 IMU interrupt

• Defines its ICM-42605 data-ready pin.

src/main/target/KAKUTEH7/target.h

target.cWire Mamba IMU interrupt +1/-1

Wire Mamba IMU interrupt

• Passes the configured ICM-42605 data-ready pin to SPI registration.

src/main/target/MAMBAH743/target.c

target.hDeclare Mamba variant IMU pins +2/-0

Declare Mamba variant IMU pins

• Defines the ICM-42605 interrupt assignment for supported variants.

src/main/target/MAMBAH743/target.h

target.cWire Matek IMU interrupts +3/-3

Wire Matek IMU interrupts

• Passes MPU and ICM-426xx interrupt assignments to their SPI registrations.

src/main/target/MATEKH743/target.c

target.hDeclare Matek IMU interrupts +2/-0

Declare Matek IMU interrupts

• Defines data-ready pins for the board's IMU locations.

src/main/target/MATEKH743/target.h

target.hDeclare Sequre IMU interrupt +1/-0

Declare Sequre IMU interrupt

• Defines its ICM-42605 data-ready pin.

src/main/target/SEQUREH7/target.h

target.cWire SimpliFly IMU interrupt +1/-1

Wire SimpliFly IMU interrupt

• Passes the ICM-42605 interrupt pin to device registration.

src/main/target/SIMPLIFLYH7/target.c

target.hDeclare SimpliFly IMU interrupt +1/-0

Declare SimpliFly IMU interrupt

• Defines its ICM-42605 data-ready pin.

src/main/target/SIMPLIFLYH7/target.h

target.cWire Spedix dual IMU interrupts +2/-2

Wire Spedix dual IMU interrupts

• Passes both ICM-426xx interrupt pins to SPI registrations.

src/main/target/SPEDIXH743/target.c

target.hDeclare Spedix dual IMU pins +2/-0

Declare Spedix dual IMU pins

• Defines both ICM-426xx data-ready pin assignments.

src/main/target/SPEDIXH743/target.h

target.cWire Lucid H7 dual IMU interrupts +6/-6

Wire Lucid H7 dual IMU interrupts

• Passes both gyro interrupt pins to the supported SPI IMU registrations.

src/main/target/TBS_LUCID_H7/target.c

target.hDeclare Lucid H7 gyro interrupt pins +2/-0

Declare Lucid H7 gyro interrupt pins

• Defines primary and secondary gyro data-ready pins.

src/main/target/TBS_LUCID_H7/target.h

target.cWire Lucid H7 Wing dual IMU interrupts +6/-6

Wire Lucid H7 Wing dual IMU interrupts

• Passes both gyro interrupt pins to supported SPI IMU registrations.

src/main/target/TBS_LUCID_H7_WING/target.c

target.hDeclare Lucid H7 Wing gyro pins +2/-0

Declare Lucid H7 Wing gyro pins

• Defines both gyro data-ready pin assignments.

src/main/target/TBS_LUCID_H7_WING/target.h

common.hEnable supported gyro and serial-pad features +10/-0

Enable supported gyro and serial-pad features

• Enables SPI data-ready on H7 and serial-pad routing on supported boards with more than 512 KB of flash.

src/main/target/common.h

common_hardware.cForward common ICM-42605 interrupt pin +4/-1

Forward common ICM-42605 interrupt pin

• Uses a declared IMU interrupt pin in common SPI registration, falling back to no pin when absent.

src/main/target/common_hardware.c

@error414
error414 changed the base branch from maintenance-10.x to maintenance-11.x November 29, 2026 08:12
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (1) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Gyro reads stall after DMA errors 🐞 Bug ☼ Reliability
Description
spiDataReadyDmaDone() returns when a DMA interrupt lacks the transfer-complete flag, leaving the
failed read marked as running. On a transfer-error interrupt, the SPI bus remains occupied until a
later main-loop acquisition waits up to 300 microseconds and stops it, delaying gyro reads and
deferring failure recovery.
Code

src/main/drivers/bus_spi_hal_ll.c[R543-545]

+    if (!spiDataReadyDmaEnded(rx)) {
+        // The read never ends: the main loop takes it off the bus when it next needs it
+        return;
Evidence
The new RX stream enables transfer-error interrupts, but its completion check returns false without
completing or stopping the read when transfer-complete is absent. The running flag is cleared only
by stopping the read; otherwise a subsequent main-loop acquisition must wait for it and perform the
timeout recovery.

src/main/drivers/bus_spi_data_ready_dma.c[169-185]
src/main/drivers/bus_spi_hal_ll.c[540-554]
src/main/drivers/bus_spi_data_ready.c[67-85]
src/main/drivers/bus_spi_data_ready.c[134-160]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A DMA transfer-error interrupt leaves the SPI data-ready read marked as running until a later main-loop acquisition times out.
## Fix Focus Areas
- src/main/drivers/bus_spi_hal_ll.c[540-554]
- src/main/drivers/bus_spi_data_ready_dma.c[169-185]
- src/main/drivers/bus_spi_data_ready.c[134-160]
## Recommended Fix
Distinguish transfer errors from incomplete transfers in the DMA callback. On an error, stop the transfer, release the bus, and record the failure through the data-ready recovery path immediately, preserving its existing threshold for disabling failed reads.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Card wraparound can overwrite other files 🐞 Bug ≡ Correctness
Description
The wraparound scan only treats LOG*.TXT entries as region boundaries, and it includes entries the
PC has already deleted. It then sizes the freefile as the whole span from the evicted log's first
cluster to the next log's start, and afatfs_freeFileRelocate() writes that span into the freefile
entry without checking the FAT. If a user deletes logs on a PC and the PC reuses those clusters, or
puts any non-log file between two log starts, the next logs are written over that file's clusters.
Code

src/main/blackbox/blackbox_io.c[R675-679]

+                if (nextBoundaryCluster != UINT32_MAX) {
+                    // Reclaim up to the next log's start: it is supercluster-aligned, so the next lap's boundary search matches again.
+                    // Size is in bytes.
+                    blackboxSDCard.oldestLogFileSize =
+                        (nextBoundaryCluster - blackboxSDCard.oldestLogFirstCluster) * afatfs_freeFileClusterSize();
Evidence
The scan matches only LOG/TXT names, deleted or not (632-634), so non-log files never act as
boundaries. The reclaimed size is computed as the distance between two log starts (675-679). The
relocation code assigns firstCluster and size directly and saves the directory entry without
checking FAT occupancy (asyncfatfs.c 2950-2966). afatfs_deleteDirectoryEntryAt only marks the
entry deleted and leaves the FAT chain as it was (2878-2890).

src/main/blackbox/blackbox_io.c[627-679]
src/main/io/asyncfatfs/asyncfatfs.c[2950-2966]
src/main/io/asyncfatfs/asyncfatfs.c[2878-2890]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
SD wraparound moves the freefile onto a cluster range computed from log directory entries only. It never checks whether other files (or clusters a PC reused after deleting a log) sit inside that range, so those files can get overwritten.
## Fix Focus Areas
- src/main/blackbox/blackbox_io.c[627-698]
- src/main/io/asyncfatfs/asyncfatfs.c[2950-2966]
## Recommended Fix
Do not use PC-deleted entries as eviction candidates, because their clusters may have been reused. Only reclaim the evicted log's own FAT chain length, rounded up to whole superclusters, rather than the full gap to the next log start. Alternatively, make `afatfs_freeFileRelocate` (or a step before it) walk the FAT across the new range and refuse it if any cluster belongs to a chain other than the deleted log's.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Configurator lacks documented pin controls 🔗 Cross-repo conflict ≡ Correctness
Description
docs/Serial.md tells users to move UART pins through a Pins column in the Configurator’s Ports
tab, but inav-configurator has no such column or pad controls. Users following that workflow
cannot select a pad or save the new routing, although the firmware provides a CLI alternative.
Code

docs/Serial.md[73]

+The Ports tab shows a Pins column for the UARTs that can move; choose the S pad for TX or RX there and save. In the CLI:
Evidence
The PR promises a Ports-tab Pins column, while the Configurator’s table has no such column and its
save path sends only ordinary serial-port configuration.

inav -> inav-configurator
docs/Serial.md[69-79]
src/main/msp/msp_protocol_v2_inav.h[169-170]
External repo: iNavFlight/inav-configurator, tabs/ports.html [11-19]
External repo: iNavFlight/inav-configurator, tabs/ports.html [37-67]
External repo: iNavFlight/inav-configurator, tabs/ports.js [278-289]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The firmware documentation promises UART pin controls in the Configurator’s Ports tab, but the current Configurator does not implement them.
## Fix Focus Areas
- docs/Serial.md[69-79]
- docs/Spektrum Smart ESC.md[46-49]
- /cross_repos/inav-configurator/tabs/ports.html[11-19]
- /cross_repos/inav-configurator/tabs/ports.js[278-289]
## Recommended Fix
Document the CLI as the available workflow for now, including in the Smart ESC guide. Coordinate a Configurator update that adds the Pins controls and uses the new serial-pad MSP commands before documenting the Ports-tab workflow.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

4. Some STM32F765 UART pin options never work 🐞 Bug ⚙ Maintainability
Description
uartRoutePin() accepts an alternate pin only when alt->af == uart->af. On F765, though, the
table lists USART1 PB14/PB15 (AF4), UART4 PA11/PA12 (AF6), UART5 PB5/PB6 (AF1) and UART7
PA8/PB3/PA15/PB4 (AF12) next to ports whose AF is AF7/AF8. Those entries can never match, so asking
for them always fails, even though the table and docs suggest they are supported.
Code

src/main/drivers/serial_uart_stm32f7xx.c[435]

+        if (alt->device == device && alt->tx == tx && alt->pin == pin && alt->af == uart->af) {
Evidence
The table entries carry an AF that differs from the port's single uart->af. The match condition
requires the AFs to be equal. serialUART sets up both pins with uart->af, so there is no per-pin
AF.

src/main/drivers/serial_uart_stm32f7xx.c[343-416]
src/main/drivers/serial_uart_stm32f7xx.c[418-446]
src/main/drivers/serial_uart_stm32f7xx.c[470-485]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
F765 alternate UART pins whose AF differs from the port's AF are listed in `uartAltPins` but can never be selected.
## Fix Focus Areas
- src/main/drivers/serial_uart_stm32f7xx.c[343-416]
- src/main/drivers/serial_uart_stm32f7xx.c[435-440]
## Recommended Fix
Either add separate txAf/rxAf fields to `uartDevice_t`, set them in `uartRoutePin` and use them in `serialUART`, or remove the table entries that cannot match so the table shows only what works.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can switch off images and animations for a plain-text comment

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@github-actions

Copy link
Copy Markdown

RAM / Flash usage vs. base commit bb4dd36 — commit 2279d9e

Target Flash Δ RAM Δ
MATEKF405 ⚠️ +10408 B (+1.45%) CCM: +16 B (+0.04%)
RAM: +1700 B (+1.69%)
MATEKF722 +1824 B (+0.39%) ITCM_RAM: ±0 B (±0.00%)
RAM: +56 B (+0.06%)
TCM: ±0 B (±0.00%)
MATEKF765 ⚠️ +7896 B (+1.05%) DTCM_RAM: ±0 B (±0.00%)
SRAM1: +120 B (+0.09%)
MATEKH743 ⚠️ +13748 B (+1.73%) D2_RAM: +256 B (+7.84%)
DTCM_RAM: ±0 B (±0.00%)
ITCM_RAM: +32 B (+0.21%)
RAM: +2236 B (+1.44%)

See RAM/flash optimization guide for techniques to reduce usage.

@sensei-hacker

Copy link
Copy Markdown
Member

Thanks

@github-actions

Copy link
Copy Markdown

Test firmware build ready — commit 2279d9e

Download firmware for PR #12268

252 targets built. Find your board's .hex file by name on that page (e.g. MATEKF405SE.hex). Files are individually downloadable — no GitHub login required.

Development build for testing only. Use Full Chip Erase when flashing.

@sensei-hacker
sensei-hacker merged commit 117d379 into iNavFlight:maintenance-11.x Nov 29, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants