Skip to content

docs: expand RAM/flash optimization guide, rewrite as rule-first reference - #11827

Open
sensei-hacker wants to merge 12 commits into
iNavFlight:maintenance-10.xfrom
sensei-hacker:docs/ram-flash-optimization-seed
Open

docs: expand RAM/flash optimization guide, rewrite as rule-first reference#11827
sensei-hacker wants to merge 12 commits into
iNavFlight:maintenance-10.xfrom
sensei-hacker:docs/ram-flash-optimization-seed

Conversation

@sensei-hacker

@sensei-hacker sensei-hacker commented Aug 26, 2026

Copy link
Copy Markdown
Member

Summary

Expand docs/development/ram-and-flash-optimization.md from the seed stub
into a rule-first guide to minimizing flash and RAM usage on
resource-constrained targets.

Changes

  • Reword every section from a per-PR anecdote to a stated rule with a short
    example. All techniques and concrete numbers are preserved (buffer-sizing
    audits, circular-buffer chunking, minimum-vs-maximum timing constraints,
    enum dispatch tables, state-vs-code duplication, LTO measurement, DMA
    width pitfalls, static-linkage duplication).
  • Reconcile two previously-contradictory sections on static-in-header
    linkage into one decision rule: be wary of static in a header
    (private copy per including TU, unmergeable by the linker — prefer
    extern + a single .c definition), with the exception that pure,
    stateless static inline functions are safe
    while the compiler inlines
    or discards them. The exception also states explicitly that inline
    multiplies copies with multiple callers (per call site, and per TU when
    not inlined).
  • Group sections by topic: buffer sizing, bounding work, sending data,
    functions/linkage/headers, state machines, duplication, measuring size,
    hardware width pitfalls.

Conflict resolution

This branch diverged from maintenance-10.x before the seed stub
(27e6322c2c) was added there, so both sides had independently added the
file. Merged upstream/maintenance-10.x in and kept this branch's full
guide — it supersedes the seed (same techniques, same numbers). The only
conflicted file was the doc itself; the branch touches nothing else.

Testing

  • Docs-only change; no firmware built.

Related

…nique

Stub only -- captures the buffer-decoupling and shrink-audit technique
from the MSP tunnel reply buffer fix before it's lost, ahead of the
tracked document-ram-flash-optimization-practices project writing the
full guide and linking it from Development.md.
Adds four techniques from shrink-ledstrip-dma-buffer: chunking a
one-shot DMA buffer into a small circular buffer with a refill
interrupt, exploiting minimum-vs-maximum protocol timing constraints
to avoid dedicating buffer space to them, bounding work/transfers to
the runtime-configured count instead of the theoretical maximum, and
verifying DMA element width against the destination register on real
hardware rather than by inspection alone.
…ss boards

The AOCODARCH7DUAL white-LED regression is a second-order instance of this
doc's own register-width lesson: a uint16_t element size validated on one
board's CCR width still routed DMA configuration through a different,
less-tested code path on H7, exposing an unrelated typo. Capture the
narrower point separately since it's about generalizing a verified fix,
not about the original verification step.
…ansition) review

Pure-inline-logic-header pattern, table-vs-if/else-chain confirmation,
bumpless-handoff full-state-duplication explanation, and a review
methodology note on CI's RAM delta spanning multiple linker regions
(RAM+CCM on F4/F7/H7).
…ion; condense doc for concision

Adds three new patterns found while tracing programmingFrameworkUpdateTask's
+5,168B growth: LTO merges unrelated functions into one symbol so a
size-diff can misattribute growth to the wrong nearby change; forcing
NOINLINE at both compare points isolates one function's real standalone
cost inside such a blob (NOINLINE is a no-op on F4 - USE_ITCM_RAM only);
and bisecting a long-lived branch should diff each commit against its own
parent, not a fixed base, since resync history isn't one consistent
timeline. Also adds a pattern distinguishing avoidable code duplication
(PID controller functions not yet parameterized) from necessary state
duplication (the existing bumpless-handoff entry).

Condensed every existing entry to be substantially shorter, matching the
terse header-plus-example style of the buffer-concatenation/inlining
entries, so the doc stays a fast reference rather than a narrative.
Internal-linkage definitions in headers are duplicated per translation
unit; the MAVLink helper CRC table was the concrete 8,088 B case on
BLUEBERRYF405. Prefer extern + single .c definition, and check for a
vendor's documented switch (MAVLINK_SEPARATE_HELPERS) before patching
generated files.
@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

@sensei-hacker
sensei-hacker changed the base branch from release/9.1 to maintenance-10.x August 26, 2026 14:58
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Aug 26, 2026

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. LED buffer sizes use wrong width ✓ Resolved 🐞 Bug ≡ Correctness
Description
The WS2812 example calculates both the old 6,230-byte array and the 384-byte circular buffer using
2-byte elements, but this codebase defines timerDMASafeType_t as 4 bytes on every supported
F4/F7/H7/AT32 family, making those buffers 12,460 and 768 bytes respectively. This also conflicts
with the guide's later instruction to retain timerDMASafeType_t, so contributors cannot reproduce
the stated RAM figures.
Code

docs/development/ram-and-flash-optimization.md[R53-54]

+array (6,230 B) for a single DMA burst; a circular buffer holding 2 groups
+of 4 LEDs (384 B), refilled from the DMA interrupt as each group finishes,
Evidence
The driver allocates 42 reset elements plus 24 elements for each of 128 LEDs plus one tail element,
and declares that array with timerDMASafeType_t. All platform timer definitions make that type
uint32_t, so the documented byte counts are exactly half of the codebase-safe allocation sizes.

src/main/drivers/light_ws2811strip.h[24-33]
src/main/drivers/light_ws2811strip.c[48-52]
src/main/drivers/timer_def_stm32f4xx.h[20-20]
src/main/drivers/timer_def_stm32f7xx.h[20-20]
src/main/drivers/timer_def_stm32h7xx.h[20-20]
src/main/drivers/timer_def_at32f43x.h[20-20]

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 WS2812 RAM figures assume 2-byte DMA elements even though the supported timer DMA-safe type is 4 bytes.
## Issue Context
The full array has 3,115 elements and the proposed 2×4-LED circular buffer has 192 elements. Keep the stated byte counts consistent with the guide's later requirement to use `timerDMASafeType_t`.
## Fix Focus Areas
- docs/development/ram-and-flash-optimization.md[52-55]

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


2. Fixed reply called unbounded 🐞 Bug ≡ Correctness
Description
MSP_LED_STRIP_CONFIG is not unbounded: it always writes one 32-bit value for each of the
compile-time-bounded 128 LED slots, yielding the cited 512-byte reply. Calling it unbounded obscures
the actual sizing rule and can lead readers to conclude that no finite tunnel buffer is safe.
Code

docs/development/ram-and-flash-optimization.md[R41-43]

+Example: a first pass on the tunnel buffer checked only MSP2 handlers
+(432 B largest reply); MSP1 legacy handlers reachable through the same
+buffer needed 512 B (`MSP_LED_STRIP_CONFIG`, unbounded).
Evidence
The handler's loop bound is LED_MAX_STRIP_LENGTH, defined as 128, and each iteration calls
sbufWriteU32; therefore its reply is deterministically bounded at 512 bytes.

src/main/fc/fc_msp.c[1271-1288]
src/main/io/ledstrip.h[24-24]

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 guide incorrectly labels `MSP_LED_STRIP_CONFIG` as unbounded even though its output is fixed at 512 bytes.
## Issue Context
The handler loops over the compile-time `LED_MAX_STRIP_LENGTH` of 128 and emits one four-byte configuration value per slot.
## Fix Focus Areas
- docs/development/ram-and-flash-optimization.md[41-43]

ⓘ 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 start a comment with 'qodo' or '@qodo' to chat about any finding

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread docs/development/ram-and-flash-optimization.md Outdated
Comment on lines +41 to +43
Example: a first pass on the tunnel buffer checked only MSP2 handlers
(432 B largest reply); MSP1 legacy handlers reachable through the same
buffer needed 512 B (`MSP_LED_STRIP_CONFIG`, unbounded).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

2. Fixed reply called unbounded 🐞 Bug ≡ Correctness

MSP_LED_STRIP_CONFIG is not unbounded: it always writes one 32-bit value for each of the
compile-time-bounded 128 LED slots, yielding the cited 512-byte reply. Calling it unbounded obscures
the actual sizing rule and can lead readers to conclude that no finite tunnel buffer is safe.
Agent Prompt
## Issue description
The guide incorrectly labels `MSP_LED_STRIP_CONFIG` as unbounded even though its output is fixed at 512 bytes.

## Issue Context
The handler loops over the compile-time `LED_MAX_STRIP_LENGTH` of 128 and emits one four-byte configuration value per slot.

## Fix Focus Areas
- docs/development/ram-and-flash-optimization.md[41-43]

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

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

Copy link
Copy Markdown

PR Summary by Qodo

Integrate multi-protocol I/O, output assignment, and platform updates

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

Grey Divider

AI Description

• Adds modular MAVLink, DroneCAN, CRSF sensors, and firmware-authoritative output assignment.
• Unifies PINIO PWM and timer allocation while reducing memory-heavy LED processing.
• Refreshes platform dependencies, build configuration, tests, automation, and developer
 documentation.
Diagram

graph TD
  BUILD["Build and Targets"] --> CORE["Firmware Core"] --> NAV["Navigation"]
  CORE --> MSP["MSP API"] --> OUTPUT["Output Mapping"]
  CORE --> MAV["MAVLink Runtime"] --> LINKS["Telemetry Links"]
  CORE --> CAN["DroneCAN and CRSF"] --> LINKS
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Split by subsystem
  • ➕ Makes protocol, output, dependency, and documentation changes independently reviewable.
  • ➕ Allows targeted hardware and integration validation before merging each capability.
  • ➕ Reduces regression bisecting and rollback scope.
  • ➖ Requires rebasing shared settings, build, and target changes.
  • ➖ Delays a single synchronized integration point.
2. Separate generated dependencies
  • ➕ Keeps MAVLink, DroneCAN, CMSIS, and HAL regeneration mechanically reviewable.
  • ➕ Lets reviewers focus on hand-written firmware behavior.
  • ➖ Requires explicit version-ordering between dependency and feature PRs.
  • ➖ May temporarily leave generated code unused.
3. Keep the integrated change
  • ➕ Preserves the exact tested combination of firmware and generated dependencies.
  • ➕ Avoids temporary compatibility shims across intermediate merges.
  • ➖ The review surface is exceptionally large and mixes unrelated concerns.
  • ➖ Failures are harder to isolate across protocols, targets, and hardware families.

Recommendation: Split this change into at least output/PINIO, MAVLink, DroneCAN/CRSF, vendor dependency, documentation, and CI automation PRs. If preserving the integrated branch is required, review and validate those same areas as explicit commits, with generated trees isolated from hand-written code.

Files changed (144) +27142 / -4340

Enhancement (46) +9651 / -1007
stm32f7.cmakeEnable F7 CAN and DroneCAN drivers +12/-1

Enable F7 CAN and DroneCAN drivers

• Builds the F7 CAN HAL and libcanard transport, while treating vendor headers as system includes.

cmake/stm32f7.cmake

stm32h7.cmakeEnable H7 DroneCAN transport +4/-2

Enable H7 DroneCAN transport

• Adds H7 libcanard driver sources and aligns vendor include handling.

cmake/stm32h7.cmake

blackbox.cExpand blackbox telemetry state +11/-2

Expand blackbox telemetry state

• Logs additional control and navigation values introduced by the updated flight stack.

src/main/blackbox/blackbox.c

barometer_crsf.cAdd CRSF barometer backend +109/-0

Add CRSF barometer backend

• Exposes CRSF altitude and variometer data through the barometer abstraction.

src/main/drivers/barometer/barometer_crsf.c

dronecan.cAdd DroneCAN node runtime +547/-0

Add DroneCAN node runtime

• Implements CAN initialization, node discovery, heartbeat/status handling, subscriptions, sensor dispatch, and periodic processing.

src/main/drivers/dronecan/dronecan.c

canard_sitl_driver.cAdd SITL CAN transport +404/-0

Add SITL CAN transport

• Provides a simulator-compatible libcanard transport implementation.

src/main/drivers/dronecan/libcanard/canard_sitl_driver.c

canard_stm32f7xx_driver.cAdd STM32F7 CAN transport +457/-0

Add STM32F7 CAN transport

• Implements libcanard frame I/O over the F7 CAN HAL.

src/main/drivers/dronecan/libcanard/canard_stm32f7xx_driver.c

canard_stm32h7xx_driver.cAdd STM32H7 CAN transport +408/-0

Add STM32H7 CAN transport

• Implements libcanard frame I/O over H7 FDCAN.

src/main/drivers/dronecan/libcanard/canard_stm32h7xx_driver.c

light_ws2811strip.cStream WS2811 DMA data in bounded chunks +14/-73

Stream WS2811 DMA data in bounded chunks

• Replaces the full-strip static DMA buffer with interrupt-refilled chunks and limits work to configured LEDs, substantially reducing RAM usage.

src/main/drivers/light_ws2811strip.c

pinio.cAdd timer-backed PINIO PWM duty control +144/-19

Add timer-backed PINIO PWM duty control

• Supports 24 kHz duty-cycle output, mixer-assigned PINIO pads, inversion, mode-box gating, and safe GPIO fallback on fixed-period timers.

src/main/drivers/pinio.c

pwm_mapping.cMake output assignment firmware-authoritative +175/-97

Make output assignment firmware-authoritative

• Uses dedicated-first two-pass motor/servo allocation, recognizes PINIO/beeper/LED overrides, preserves shared-timer constraints, and exposes finalized assignments.

src/main/drivers/pwm_mapping.c

sound_beeper.cIntegrate beeper timer overrides +30/-1

Integrate beeper timer overrides

• Allows canonical beeper output selection while protecting sibling timer channels.

src/main/drivers/sound_beeper.c

cli.cExpand CLI diagnostics and settings handling +70/-13

Expand CLI diagnostics and settings handling

• Adds protocol and output-related reporting while consolidating serialization logic.

src/main/fc/cli.c

fc_init.cInitialize new protocol and output runtimes +13/-0

Initialize new protocol and output runtimes

• Adds startup sequencing for DroneCAN, modular MAVLink, CRSF sensors, and revised PINIO ownership.

src/main/fc/fc_init.c

fc_mavlink.cAdd flight-controller MAVLink integration +297/-0

Add flight-controller MAVLink integration

• Bridges MAVLink commands, flight state, navigation, RC input, and telemetry into the core runtime.

src/main/fc/fc_mavlink.c

fc_msp.cExpand MSP APIs and remove serialization duplication +462/-106

Expand MSP APIs and remove serialization duplication

• Adds output assignment/query, DroneCAN nodes, ADS-B alerts, navigation targets, and RC override support while extracting repeated mixer and calibration serializers.

src/main/fc/fc_msp.c

fc_tasks.cSchedule protocol and sensor processing +47/-13

Schedule protocol and sensor processing

• Adds task execution for DroneCAN, MAVLink, and CRSF sensor input and updates scheduler diagnostics.

src/main/fc/fc_tasks.c

mixer.cExpose mixer data for output simulation +35/-3

Expose mixer data for output simulation

• Adds profile-aware mixer accessors and servo counting needed by firmware output assignment previews.

src/main/flight/mixer.c

pid.cExtend PID control outputs +62/-27

Extend PID control outputs

• Adds heading and speed control support and factors repeated controller calculations.

src/main/flight/pid.c

wind_estimator.cImprove wind estimation lifecycle +86/-38

Improve wind estimation lifecycle

• Refines estimator state, validity, and update behavior for navigation and telemetry consumers.

src/main/flight/wind_estimator.c

adsb.cImprove ADS-B tracking and alert selection +195/-113

Improve ADS-B tracking and alert selection

• Adds vehicle lookup, warning/alert prioritization, limits, and richer data handling for OSD and MSP clients.

src/main/io/adsb.c

crsf_sensor.cAdd CRSF sensor input parser +340/-0

Add CRSF sensor input parser

• Parses CRC-protected CRSF GPS, barometer, variometer, voltage, current, and capacity frames from a dedicated sensor port.

src/main/io/crsf_sensor.c

gps.cSupport CRSF and DroneCAN GPS providers +33/-11

Support CRSF and DroneCAN GPS providers

• Extends provider selection, state handling, and shared GPS update behavior.

src/main/io/gps.c

gps_crsf.cAdd CRSF GPS backend +56/-0

Add CRSF GPS backend

• Maps CRSF sensor frames into the common GPS solution.

src/main/io/gps_crsf.c

gps_dronecan.cAdd DroneCAN GPS backend +196/-0

Add DroneCAN GPS backend

• Consumes UAVCAN GNSS fix and auxiliary messages and publishes a common GPS solution.

src/main/io/gps_dronecan.c

gps_ublox.cExpand UBlox configuration and diagnostics +87/-2

Expand UBlox configuration and diagnostics

• Adds message/configuration handling and related state needed by the updated GPS subsystem.

src/main/io/gps_ublox.c

osd.cRefactor OSD rendering and ADS-B warnings +271/-313

Refactor OSD rendering and ADS-B warnings

• Reworks display update flow, adds refreshed ADS-B warning behavior, and reduces duplicated rendering paths.

src/main/io/osd.c

mavlink_command.cAdd MAVLink command handling +295/-0

Add MAVLink command handling

• Implements command dispatch, acknowledgements, parameter validation, and flight/navigation actions.

src/main/mavlink/mavlink_command.c

mavlink_guided.cAdd MAVLink guided targets +62/-0

Add MAVLink guided targets

• Translates local/global target messages and axis overrides into INAV navigation commands.

src/main/mavlink/mavlink_guided.c

mavlink_mission.cAdd robust MAVLink mission transfer +1321/-0

Add robust MAVLink mission transfer

• Implements upload/download, retries, partner tracking, mission conversion, snapshots, and waypoint-reached delivery across routed ports.

src/main/mavlink/mavlink_mission.c

mavlink_modes.cAdd MAVLink mode management +327/-0

Add MAVLink mode management

• Maps MAVLink base/custom modes to INAV arming and navigation state and reports available modes.

src/main/mavlink/mavlink_modes.c

mavlink_ports.cAdd MAVLink port abstraction +70/-0

Add MAVLink port abstraction

• Manages serial port opening, sharing, send masks, and per-port transmission state.

src/main/mavlink/mavlink_ports.c

mavlink_routing.cAdd MAVLink message routing +173/-0

Add MAVLink message routing

• Learns endpoints and forwards messages across multiple active telemetry links without loops.

src/main/mavlink/mavlink_routing.c

mavlink_runtime.cAdd multi-port MAVLink runtime +329/-0

Add multi-port MAVLink runtime

• Owns protocol configuration, active-port context, receive processing, state transitions, and scheduled transmission.

src/main/mavlink/mavlink_runtime.c

mavlink_streams.cModularize MAVLink telemetry streams +1533/-0

Modularize MAVLink telemetry streams

• Implements stream scheduling and message generation for flight, sensor, navigation, radio, and status data.

src/main/mavlink/mavlink_streams.c

mavlink_types.hDefine MAVLink runtime state types +154/-0

Define MAVLink runtime state types

• Introduces common port, route, mission, radio, stream, and context structures.

src/main/mavlink/mavlink_types.h

msp_protocol_v2_inav.hAllocate new MSP v2 commands +15/-0

Allocate new MSP v2 commands

• Defines IDs for output assignment, DroneCAN discovery, ADS-B limits, and guided navigation targets.

src/main/msp/msp_protocol_v2_inav.h

navigation.cAdd guided target and mission reporting hooks +145/-48

Add guided target and mission reporting hooks

• Exposes local/global target control, waypoint completion reporting, and revised navigation state transitions.

src/main/navigation/navigation.c

navigation_fixedwing.cExpand fixed-wing pitch and throttle control +205/-61

Expand fixed-wing pitch and throttle control

• Adds configurable pitch-to-throttle compensation and refines landing, speed, and heading behavior.

src/main/navigation/navigation_fixedwing.c

logic_condition.cAdd programmable PINIO duty operands +63/-18

Add programmable PINIO duty operands

• Extends logic-condition outputs so programming rules can set PINIO and LED duty levels.

src/main/programming/logic_condition.c

msp_override.cAdd MSP RC channel override +115/-0

Add MSP RC channel override

• Implements bounded, timed external RC overrides consumed by navigation and control APIs.

src/main/rx/msp_override.c

battery.cSupport CRSF and DroneCAN battery meters +56/-8

Support CRSF and DroneCAN battery meters

• Integrates external voltage/current providers and updates meter selection and health handling.

src/main/sensors/battery.c

battery_sensor_crsf.cAdd CRSF battery sensor backend +72/-0

Add CRSF battery sensor backend

• Publishes CRSF voltage, current, consumption, and freshness through the battery abstraction.

src/main/sensors/battery_sensor_crsf.c

battery_sensor_dronecan.cAdd DroneCAN battery sensor backend +55/-0

Add DroneCAN battery sensor backend

• Maps UAVCAN battery information into firmware voltage and current meter readings.

src/main/sensors/battery_sensor_dronecan.c

crsf.cCoordinate CRSF telemetry and sensor input +43/-26

Coordinate CRSF telemetry and sensor input

• Updates framing and port behavior to coexist with CRSF sensor ingestion.

src/main/telemetry/crsf.c

telemetry.cManage expanded telemetry runtimes +53/-12

Manage expanded telemetry runtimes

• Coordinates MAVLink, CRSF, and shared-port activation with the central telemetry lifecycle.

src/main/telemetry/telemetry.c

Refactor (4) +162 / -1477
filter.cReduce filter duplication and state +20/-38

Reduce filter duplication and state

• Refactors filter setup and execution to reduce code and memory overhead while preserving behavior.

src/main/common/filter.c

fp_pid.cRefine fixed-point PID calculations +12/-10

Refine fixed-point PID calculations

• Consolidates arithmetic and updates controller behavior used by flight and navigation loops.

src/main/common/fp_pid.c

mavlink_internal.hDefine shared MAVLink internals +123/-0

Define shared MAVLink internals

• Centralizes runtime dependencies, helpers, message state, and feature guards for modular MAVLink components.

src/main/mavlink/mavlink_internal.h

mavlink.cReplace monolithic MAVLink implementation +7/-1429

Replace monolithic MAVLink implementation

• Reduces the legacy telemetry file to an adapter over the new modular MAVLink runtime.

src/main/telemetry/mavlink.c

Documentation (47) +8417 / -424
AGENTS.mdReplace repository agent guidance +475/-0

Replace repository agent guidance

• Renames and expands contributor guidance for automated coding agents; the former AGENT.md is deleted.

AGENTS.md

readme.mdDocument ADS-B development tooling +87/-0

Document ADS-B development tooling

• Explains setup and usage for injecting test aircraft over UART.

dev/adsb/readme.md

Battery.mdDocument CAN and CRSF battery sources +9/-3

Document CAN and CRSF battery sources

• Updates battery source guidance for newly supported external sensor transports.

docs/Battery.md

Cli.mdLink expanded settings guidance +1/-0

Link expanded settings guidance

• Adds navigation to the updated CLI/settings documentation.

docs/Cli.md

DroneCAN-Driver.mdDocument DroneCAN driver internals +920/-0

Document DroneCAN driver internals

• Adds comprehensive implementation, transport, message, configuration, and troubleshooting guidance.

docs/DroneCAN-Driver.md

DroneCAN.mdAdd DroneCAN user guide +401/-0

Add DroneCAN user guide

• Documents setup, supported sensors, node discovery, and operational constraints.

docs/DroneCAN.md

Fixed Wing Landing.mdCorrect fixed-wing landing reference +1/-1

Correct fixed-wing landing reference

• Updates a landing documentation reference for the revised navigation guidance.

docs/Fixed Wing Landing.md

Fixed Wing Pitch To Throttle Tuning.mdAdd pitch-to-throttle tuning guide +139/-0

Add pitch-to-throttle tuning guide

• Documents fixed-wing pitch compensation concepts and tuning procedures.

docs/Fixed Wing Pitch To Throttle Tuning.md

Navigation.mdRefresh navigation behavior documentation +5/-5

Refresh navigation behavior documentation

• Aligns navigation descriptions with updated target and fixed-wing control behavior.

docs/Navigation.md

OSD Joystick.mdClarify OSD joystick controls +9/-9

Clarify OSD joystick controls

• Updates control mappings and usage text for current joystick behavior.

docs/OSD Joystick.md

PINIO PWM.mdDocument PINIO duty-cycle control +93/-0

Document PINIO duty-cycle control

• Explains timer-backed PINIO PWM, programming operands, mixer assignment, inversion, and shared-timer constraints.

docs/PINIO PWM.md

Programming Framework.mdDocument programmable PINIO duty output +4/-1

Document programmable PINIO duty output

• Adds programming-framework guidance for driving PINIO and LED duty levels.

docs/Programming Framework.md

X-Plane.mdDocument X-Plane simulation updates +4/-0

Document X-Plane simulation updates

• Adds setup notes for revised SITL integration behavior.

docs/SITL/X-Plane.md

Settings.mdRegenerate firmware settings reference +855/-277

Regenerate firmware settings reference

• Refreshes generated settings for DroneCAN, CRSF sensors, MAVLink, navigation, ADS-B, PINIO, and related defaults.

docs/Settings.md

Converting Betaflight Targets.mdExpand target conversion guidance +49/-0

Expand target conversion guidance

• Adds feature-selection and hardware-mapping guidance for converted targets.

docs/development/Converting Betaflight Targets.md

Development.mdExpand development documentation index +70/-22

Expand development documentation index

• Reorganizes and links new build, debugging, target, settings, protocol, and release guides.

docs/development/Development.md

at32-flash-recovery.mdAdd AT32 flash recovery guide +196/-0

Add AT32 flash recovery guide

• Documents recovery workflows and troubleshooting for inaccessible AT32 targets.

docs/development/at32-flash-recovery.md

bootlog-debugging.mdAdd boot-log debugging guide +130/-0

Add boot-log debugging guide

• Describes collecting and interpreting early firmware diagnostics.

docs/development/bootlog-debugging.md

build-system.mdDocument the CMake build system +230/-0

Document the CMake build system

• Explains source registration, target configuration, options, and common build workflows.

docs/development/build-system.md

cleanup-pr-test-builds.mdDocument PR build cleanup automation +100/-0

Document PR build cleanup automation

• Covers workflow behavior, authentication, manual cleanup, and troubleshooting.

docs/development/cleanup-pr-test-builds.md

fixed-wing-pitch2thr-tuning.mdAdd developer pitch-to-throttle analysis +192/-0

Add developer pitch-to-throttle analysis

• Provides detailed tuning rationale and diagnostics for fixed-wing compensation.

docs/development/fixed-wing-pitch2thr-tuning.md

merging-release-into-next-version.mdDocument release-forward merge procedure +82/-0

Document release-forward merge procedure

• Adds a repeatable process for carrying release work into the next development branch.

docs/development/merging-release-into-next-version.md

README.mdExpand MSP developer reference +223/-32

Expand MSP developer reference

• Refreshes message coverage and generation guidance for new MSP APIs.

docs/development/msp/README.md

docs_v2_header.mdRefresh MSP v2 documentation header +14/-1

Refresh MSP v2 documentation header

• Updates generated protocol documentation metadata and framing notes.

docs/development/msp/docs_v2_header.md

format.mdClarify MSP framing formats +42/-28

Clarify MSP framing formats

• Reworks protocol format descriptions for routing and versioned messages.

docs/development/msp/format.md

inav_enums_ref.mdRegenerate INAV enum reference +116/-36

Regenerate INAV enum reference

• Adds new sensor, output, protocol, and navigation enum values.

docs/development/msp/inav_enums_ref.md

msp-message-routing-architecture.mdDocument MSP routing architecture +367/-0

Document MSP routing architecture

• Explains message dispatch, transport routing, buffering, and extension points.

docs/development/msp/msp-message-routing-architecture.md

msp_messages.checksumRefresh MSP documentation checksum +0/-1

Refresh MSP documentation checksum

• Records the checksum for the regenerated protocol reference.

docs/development/msp/msp_messages.checksum

revAdvance MSP documentation revision +0/-1

Advance MSP documentation revision

• Updates generated documentation revision metadata.

docs/development/msp/rev

performance-debugging.mdAdd performance debugging guide +63/-0

Add performance debugging guide

• Documents scheduler, timing, and profiling techniques.

docs/development/performance-debugging.md

pid-to-servo-computation.mdDocument PID-to-servo calculations +186/-0

Document PID-to-servo calculations

• Explains the fixed-wing control path from PID terms to actuator outputs.

docs/development/pid-to-servo-computation.md

ram-and-flash-optimization.mdSeed RAM and flash optimization guidance +253/-0

Seed RAM and flash optimization guidance

• Adds a draft guide covering buffer sizing, DMA streaming, linkage duplication, LTO measurement, and hardware-width pitfalls.

docs/development/ram-and-flash-optimization.md

release-create.mdRefresh release creation procedure +12/-7

Refresh release creation procedure

• Updates commands and sequencing for current release workflows.

docs/development/release-create.md

serial_printf_debugging.mdExpand serial printf debugging notes +2/-0

Expand serial printf debugging notes

• Adds usage caveats and links to complementary debugging guidance.

docs/development/serial_printf_debugging.md

case-study-pr11236.mdAdd settings migration case study +318/-0

Add settings migration case study

• Analyzes a representative settings change and its compatibility implications.

docs/development/settings/case-study-pr11236.md

registration-guide.mdAdd settings registration guide +522/-0

Add settings registration guide

• Documents defining, validating, generating, and exposing firmware settings.

docs/development/settings/registration-guide.md

versioning-rules.mdDocument settings versioning rules +367/-0

Document settings versioning rules

• Defines compatibility, migration, ordering, and release expectations for settings changes.

docs/development/settings/versioning-rules.md

when-to-add-a-setting.mdAdd settings design guidance +73/-0

Add settings design guidance

• Explains when persistent configuration is appropriate and when alternatives are preferable.

docs/development/settings/when-to-add-a-setting.md

at32f435-mux-defaults.mdDocument AT32F435 mux defaults +30/-0

Document AT32F435 mux defaults

• Records default peripheral multiplexing behavior for target authors.

docs/development/targets/at32f435-mux-defaults.md

common-issues.mdAdd target common-issues reference +474/-0

Add target common-issues reference

• Catalogs recurring target-definition, resource, build, and hardware integration problems.

docs/development/targets/common-issues.md

creating-targets.mdAdd target creation guide +234/-0

Add target creation guide

• Documents the end-to-end process for adding a flight-controller target.

docs/development/targets/creating-targets.md

examples.mdAdd target definition examples +292/-0

Add target definition examples

• Provides annotated target configuration patterns.

docs/development/targets/examples.md

overview.mdAdd target architecture overview +218/-0

Add target architecture overview

• Explains target files, feature flags, timers, resources, and build integration.

docs/development/targets/overview.md

timer-dma-conflicts.mdDocument timer and DMA conflicts +164/-0

Document timer and DMA conflicts

• Explains conflict detection and debugging for shared timer resources.

docs/development/targets/timer-dma-conflicts.md

troubleshooting-guide.mdAdd target troubleshooting guide +274/-0

Add target troubleshooting guide

• Provides structured diagnosis for build, boot, peripheral, and resource failures.

docs/development/targets/troubleshooting-guide.md

usb-msc-debugging.mdAdd USB mass-storage debugging guide +58/-0

Add USB mass-storage debugging guide

• Documents diagnostics for USB MSC enumeration and transfer failures.

docs/development/usb-msc-debugging.md

README_mavlink_mission_tester.mdDocument MAVLink mission tests +63/-0

Document MAVLink mission tests

• Explains mission test prerequisites, scenarios, and expected results.

src/test/mavlink/missions/README_mavlink_mission_tester.md

Other (47) +8912 / -1432
cleanup-old-pr-test-builds.pyAdd stale PR build release cleanup utility +135/-0

Add stale PR build release cleanup utility

• Adds a gh-based sweep that deletes merged or age-expired PR test releases, with dry-run reporting and failure handling.

.github/scripts/cleanup-old-pr-test-builds.py

cleanup-pr-test-builds-scheduled.ymlSchedule stale PR build cleanup +28/-0

Schedule stale PR build cleanup

• Adds recurring automation for sweeping obsolete test-build releases.

.github/workflows/cleanup-pr-test-builds-scheduled.yml

cleanup-pr-test-builds.ymlClean test releases when PRs close +58/-0

Clean test releases when PRs close

• Adds event-driven cleanup for per-PR test-build releases and tags.

.github/workflows/cleanup-pr-test-builds.yml

.gitmodulesRefresh dependency submodule references +0/-0

Refresh dependency submodule references

• Updates repository dependency metadata associated with the vendor library refresh.

.gitmodules

tasks.jsonAlign VS Code build tasks +4/-4

Align VS Code build tasks

• Adjusts local development task arguments to the current build workflow.

.vscode/tasks.json

CMakeLists.txtRegister generated DroneCAN build definitions +1/-0

Register generated DroneCAN build definitions

• Includes generated DSDL source configuration in the root build.

CMakeLists.txt

cortex-m4f.cmakeTune Cortex-M4F compilation flags +1/-1

Tune Cortex-M4F compilation flags

• Adjusts architecture build options for the refreshed toolchain and libraries.

cmake/cortex-m4f.cmake

cortex-m7.cmakeTune Cortex-M7 compilation flags +1/-1

Tune Cortex-M7 compilation flags

• Adjusts architecture build options for the refreshed toolchain and libraries.

cmake/cortex-m7.cmake

dsdlc_generated.cmakeBuild generated DroneCAN codecs +132/-0

Build generated DroneCAN codecs

• Registers generated DroneCAN/UAVCAN serialization sources and include paths.

cmake/dsdlc_generated.cmake

main.cmakeWire protocol sources into firmware builds +2/-0

Wire protocol sources into firmware builds

• Extends shared source configuration for the new protocol modules.

cmake/main.cmake

sitl.cmakeEnable protocol support in SITL +2/-0

Enable protocol support in SITL

• Adds simulator build integration needed by the new CAN and telemetry paths.

cmake/sitl.cmake

stm32.cmakeSupport system include directories +7/-2

Support system include directories

• Adds SYSTEM include propagation so vendor headers can be compiled without project warning policy noise.

cmake/stm32.cmake

stm32f4.cmakeRefresh STM32F4 dependency wiring +1/-1

Refresh STM32F4 dependency wiring

• Aligns F4 include and source configuration with the updated vendor dependency layout.

cmake/stm32f4.cmake

adsb_uart_sender.pyAdd ADS-B UART development sender +82/-0

Add ADS-B UART development sender

• Provides a development utility for replaying aircraft data into firmware ADS-B input.

dev/adsb/adsb_uart_sender.py

aircraft.jsonAdd sample ADS-B aircraft scenarios +52/-0

Add sample ADS-B aircraft scenarios

• Supplies representative aircraft records for the ADS-B sender utility.

dev/adsb/aircraft.json

gen_docs.shImprove MSP documentation generation +22/-15

Improve MSP documentation generation

• Updates the generation pipeline to collect current firmware metadata and references.

docs/development/msp/gen_docs.sh

gen_enum_md.pyImprove MSP enum documentation generator +23/-4

Improve MSP enum documentation generator

• Handles updated enum extraction and generated reference formatting.

docs/development/msp/gen_enum_md.py

gen_msp_md.pyRefresh MSP message generator +10/-10

Refresh MSP message generator

• Aligns generated message documentation with current headers and metadata.

docs/development/msp/gen_msp_md.py

get_fc_build_info.shAdd firmware build metadata collector +17/-0

Add firmware build metadata collector

• Extracts build information used by MSP documentation generation.

docs/development/msp/get_fc_build_info.sh

dronecan_msgs.hAdd generated DroneCAN message registry +102/-0

Add generated DroneCAN message registry

• Provides the umbrella registry for generated DroneCAN and UAVCAN data types. The accompanying generated include and source trees add codecs for protocol, sensor, actuator, GNSS, power, Remote ID, file, parameter, and tunnel messages.

lib/main/Dronecan/dsdlc_generated/include/dronecan_msgs.h

ardupilotmega.hAdd generated ArduPilotMega dialect +874/-0

Add generated ArduPilotMega dialect

• Adds the generated ArduPilotMega MAVLink dialect and its message/test headers.

lib/main/MAVLink/ardupilotmega/ardupilotmega.h

common.hRefresh generated MAVLink common dialect +194/-318

Refresh generated MAVLink common dialect

• Updates common message metadata and incorporates newly generated messages and field definitions.

lib/main/MAVLink/common/common.h

testsuite.hRefresh MAVLink common generated tests +1231/-893

Refresh MAVLink common generated tests

• Updates generated serialization tests for the revised common dialect.

lib/main/MAVLink/common/testsuite.h

csAirLink.hAdd generated csAirLink dialect +77/-0

Add generated csAirLink dialect

• Adds csAirLink messages, version metadata, and generated tests.

lib/main/MAVLink/csAirLink/csAirLink.h

cubepilot.hAdd generated CubePilot dialect +70/-0

Add generated CubePilot dialect

• Adds CubePilot messages, version metadata, and generated tests.

lib/main/MAVLink/cubepilot/cubepilot.h

generate.shRefresh MAVLink generation script +10/-7

Refresh MAVLink generation script

• Updates dialect generation commands and selected output sets.

lib/main/MAVLink/generate.sh

generate.batRefresh Windows MAVLink generation +5/-7

Refresh Windows MAVLink generation

• Aligns Windows generation commands with the Unix script.

lib/main/MAVLink/generate.bat

icarous.hAdd generated Icarous dialect +93/-0

Add generated Icarous dialect

• Adds Icarous messages, version metadata, and generated tests.

lib/main/MAVLink/icarous/icarous.h

loweheiser.hAdd generated Loweheiser dialect +66/-0

Add generated Loweheiser dialect

• Adds Loweheiser messages, version metadata, and generated tests.

lib/main/MAVLink/loweheiser/loweheiser.h

minimal.hRefresh MAVLink minimal dialect +4/-5

Refresh MAVLink minimal dialect

• Updates generated minimal dialect metadata and removes obsolete generated test coverage.

lib/main/MAVLink/minimal/minimal.h

standard.hRefresh MAVLink standard dialect +6/-5

Refresh MAVLink standard dialect

• Updates the standard dialect and generated global-position support.

lib/main/MAVLink/standard/standard.h

storm32.hAdd generated Storm32 dialect expansion +552/-0

Add generated Storm32 dialect expansion

• Adds Storm32 and mLRS message definitions plus generated tests.

lib/main/MAVLink/storm32/storm32.h

uAvionix.hAdd generated uAvionix dialect +282/-0

Add generated uAvionix dialect

• Adds uAvionix ADS-B messages, version metadata, and generated tests.

lib/main/MAVLink/uAvionix/uAvionix.h

stm32f7xx.hUpgrade STM32F7 CMSIS device package +100/-57

Upgrade STM32F7 CMSIS device package

• Refreshes F7 device headers, startup files, linker templates, documentation, and adds F730/F750 support.

lib/main/STM32F7/Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f7xx.h

stm32f7xx_hal.hUpgrade STM32F7 HAL package +50/-28

Upgrade STM32F7 HAL package

• Refreshes F7 HAL/LL interfaces and implementations, including CAN, EXTI, UART extensions, SPI extensions, and legacy compatibility sources.

lib/main/STM32F7/Drivers/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h

stm32h7xx.hRefresh STM32H7 CMSIS package +6/-6

Refresh STM32H7 CMSIS package

• Updates H7 device definitions, startup templates, linker scripts, and generated register aliases.

lib/main/STM32H7/Drivers/CMSIS/Device/ST/STM32H7xx/Include/stm32h7xx.h

stm32h7xx_hal_qspi.hRefresh STM32H7 HAL package +21/-0

Refresh STM32H7 HAL package

• Updates H7 HAL and LL drivers across USB, RTC, Ethernet, QSPI, SDIO, timers, and related peripherals.

lib/main/STM32H7/Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal_qspi.h

CMakeLists.txtRegister new protocol and sensor modules +41/-0

Register new protocol and sensor modules

• Adds DroneCAN, modular MAVLink, CRSF sensor, and CAN battery sources to firmware builds.

src/main/CMakeLists.txt

canard.cVendor libcanard transport core +1960/-0

Vendor libcanard transport core

• Adds DroneCAN transfer serialization, memory-pool management, RX reassembly, and TX queueing.

src/main/drivers/dronecan/libcanard/canard.c

settings.yamlRegister protocol, sensor, and navigation settings +203/-62

Register protocol, sensor, and navigation settings

• Adds DroneCAN, CRSF, CAN battery, expanded MAVLink, ADS-B, fixed-wing, and debug settings while removing legacy LED pin PWM configuration.

src/main/fc/settings.yaml

common.hMake common feat...

…m-flash-optimization-seed

# Conflicts:
#	docs/development/ram-and-flash-optimization.md
@sensei-hacker sensei-hacker added this to the 10.0 milestone Aug 26, 2026
@sensei-hacker sensei-hacker changed the title Docs/ram flash optimization seed docs: expand RAM/flash optimization guide, rewrite as rule-first reference Aug 26, 2026
The WS2812 DMA buffer element is timerDMASafeType_t (uint32_t) on every
F4/F7/H7/AT32 family since 2019 (4427b87), so the full 3,115-element
buffer is 12,460 B and the 2x4-LED circular design is 768 B, not the
2-byte-element figures previously stated (6,230 B / 384 B). The >16x
reduction ratio is unchanged.
…review

Three new generalizable rules from the terrain_nav layer review:
- budget speculative cache reads against the shared cache's size
  (lookahead capped at (CACHE_SIZE - 3) * 540 m plus a time horizon)
- consume an existing cache in place, never a private copy
- keep a feature's whole static state in one caller-owned struct
  (the entire hold state machine is ~100 B of static RAM)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant