Skip to content

Add WireForge (C++17/C99) to the external generators - #798

Merged
hamishwillee merged 2 commits into
mavlink:masterfrom
oguzhankynk:add-wireforge
Oct 29, 2026
Merged

hamishwillee merged 2 commits into
mavlink:masterfrom
oguzhankynk:add-wireforge

Conversation

@oguzhankynk

Copy link
Copy Markdown
Contributor

This adds WireForge to the list of external generators.

WireForge generates allocation-free C++17 or C99 code (no heap, no exceptions) for MAVLink 2 from the XML message definitions (wireforge import-mavlink common.xml ...), including payload truncation and extension fields. Every generated library comes with a GoogleTest project that checks it against a reference codec. The importer is tested against pymavlink: every dialect pymavlink ships imports with the same CRC_EXTRA bytes and field order, and every message of common.xml encodes to the bytes pymavlink packs, with and without trailing zero bytes (test). MAVLink 1 frames and message signing are not supported, which the row states.

Licensing, so that the entry is not misleading: the generated code and its runtime are MIT. The generator itself is source-available under BUSL-1.1 (free for development, evaluation and CI; production use of the generator needs a commercial license; it converts to MIT in 2036). If that does not fit the list, I understand.

wireforge is added to the cspell word list for the command name in the row. I maintain the project and will keep the entry up to date.

Comment thread en/index.md Resolved
@hamishwillee

Copy link
Copy Markdown
Collaborator

Thank you! Happy to take this with the suggested trim of the notes applied.


BTW, this is the Claude review of your site:

What "allocation-free" means here: the runtime and generated code never request memory at run time (no new/delete and no malloc/free); all storage has a fixed size known at compile time (std::array, StaticVector, FixedString, rings, the buffers in Link that are set up in advance).

Does the evidence support it? The design does. The runtime headers and the code generators only use non-allocating types, and std::string/std::vector appear only in the generated test helpers. But the automated evidence doesn't cover the case this PR advertises, code from wireforge import-mavlink, or the C99 output:

  1. quality/check_no_heap.py only checks examples/*/ and protocols/*/. That covers the hand-written 6-message protocols/mavlink2, but not tests/models/mavlink_import or any other import-mavlink output. Adding tests/models/*/ (or a full common.xml import) would cover it.
  2. Most units in that check only #include a header. Inline and template functions that are never called produce no object code, so they can't show forbidden symbols. Only the selftest units actually exercise the code. A unit that encodes, decodes and dispatches every message would make the header units count.
  3. check_no_heap.py compiles C++ only (g++ -std=c++17). I couldn't find an equivalent symbol check for the --language c output.
  4. The allocation trap is used in the runtime suites and tests/generated/basic_telemetry_test.cpp, but the generated GoogleTest suites don't use it. Generating an AllocationTrap assertion into those suites would back the claim for every user project, MAVLink imports included.

Other assertions:

  • docs/COMPARISON.md calls WireForge "allocation-free" in the mavgen paragraph, as if that sets it apart. The mavgen C library doesn't use the heap either (messages and parser state are caller-owned structs), so this isn't a difference between the two.
  • The same paragraph says "every message, checked byte for byte against pymavlink". That's true of WireForge's Python reference codec (tests/python/test_mavlink_xml.py), but the generated C++ is gated on the 10 messages in tests/models/mavlink_import, checked against that reference codec. docs/IMPORT.md already says this accurately; worth making COMPARISON.md (and the README/PR wording) equally precise.
  • The licence statements (BUSL-1.1 generator with an Additional Use Grant for CI, MIT runtime and generated code) match LICENSE and runtime/LICENSE.

@hamishwillee
hamishwillee merged commit 226d443 into mavlink:master Oct 29, 2026
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