.. _rigs4zephyr_reference_diagnostics: Diagnostic codes ================== Every diagnostic the :term:`expander` can print, by code. **Forty-four** today — thirty ``lang-*`` and fourteen ``phys-*`` — derived straight from ``scripts/rigc/``'s own construction sites (every ``error(...)``/ ``warning(...)`` call in production source, never the golden test fixtures, whose *directory names* happen to reuse some of the same strings). ``test_diagnostics_reference_drift.py`` keeps this page and that source in sync, in both directions: a new call site with no entry here fails the test suite, and so does an entry naming a code no source line raises any more. Each entry names the pipeline stage that raises it (see :ref:`rigs4zephyr_reference_api_index` for what each stage does) and what to check first. The severity in ``error[code]``/``warning[code]`` is fixed per call site, not per code — a handful of codes below are raised as a warning at one site; that is called out where it applies. .. contents:: :local: :depth: 1 The two ways a rig can be wrong ---------------------------------- :ref:`rigs4zephyr_explanation_architecture` explains *why* the pipeline is cut where it is; the short version a diagnostic code encodes directly: a ``lang-*`` code is something wrong with the rig's or shield's *files* — a dangling reference, an illegal axis, a shape YAML never declared — caught by the :ref:`rigs4zephyr_reference_api_loader` before a board is ever read. A ``phys-*`` code is something wrong with the *hardware* the files describe — two devices at one address, a connector that doesn't mate, a chip-select pool with nothing left — caught by the :ref:`rigs4zephyr_reference_api_board` reader or the :ref:`rigs4zephyr_reference_api_analyzer` once a real board devicetree is in hand. Neither check can substitute for the other: a ``lang-*`` pass never sees a board, and a ``phys-*`` pass never re-derives a fact the loader already settled. ``lang-*`` — an authoring error in the rig or shield source ---------------------------------------------------------------- .. list-table:: :widths: 20 12 68 :header-rows: 1 * - Code - Stage - Meaning, and what to check * - ``lang-addr-authority`` - :ref:`rigs4zephyr_reference_api_loader` - An addressable-bus (I2C) device carries both ``reg`` and ``shield,addr-from``, or neither — exactly one is required (the address-authority rule: copper-fixed, or rig-selectable, never both, never neither). Check the device node's ``reg``/ ``shield,addr-from`` pair. * - ``lang-addr-from`` - :ref:`rigs4zephyr_reference_api_loader` - A device's ``shield,addr-from`` phandle does not point at a config strap of the same shield. Check the phandle's target node. * - ``lang-config`` - :ref:`rigs4zephyr_reference_api_loader` - An instance's ``config:`` block names a config element (strap or jumper) the shield does not declare. Check the label against the shield's own straps/jumpers, listed in the message. * - ``lang-connector-root`` - :ref:`rigs4zephyr_reference_api_loader` - No ``--connector-dir`` was given and the built-in dev/test fallback directory does not exist. A real build always threads ``--connector-dir`` explicitly (see :ref:`rigs4zephyr_reference_commands`); this fires only for a standalone invocation missing it, or a workspace where ``rigc``'s own source has moved. Check that ``--connector-dir`` is passed. * - ``lang-content`` - :ref:`rigs4zephyr_reference_api_loader` - No content file (``.yml``) exists beside ``rig.yml``. Check the path the message names. * - ``lang-cpp`` - :ref:`rigs4zephyr_reference_api_loader` - The C preprocessor failed (non-zero exit) while building a shield's translation unit — an unresolvable ``#include``, a macro error. Check gcc's own stderr, embedded verbatim in the message, and the ``--include-dir`` search path. * - ``lang-dt-include`` - :ref:`rigs4zephyr_reference_api_loader` - Either a ``shield,param-includes`` header named on a device does not exist or fails to preprocess, or a ``params:``/``config:`` value does not resolve against any header the device's ``shield,param-includes`` actually lists. Check the header name on the device node, and that the assigned token is genuinely defined there. * - ``lang-exposed`` - :ref:`rigs4zephyr_reference_api_loader` - A carrier's exposed-socket declaration is malformed: a gpio-map/pwm-map/adc-map/bus-proxy row's phandle does not target one of the carrier's own plugs, a ``#-cells`` declaration is missing its matching ``-map`` property (or vice versa), a row is truncated, or a bus-proxy names a bus the exposed connector type does not declare. Check the exposed socket node's map/cells properties and phandle targets. * - ``lang-instance-shield`` - :ref:`rigs4zephyr_reference_api_loader` - An instance's ``shield:`` reference names a shield the library never scanned. Check the name against the message's own "known shields" list, and the ``--shield-dir`` roots actually searched. * - ``lang-instance-socket`` - :ref:`rigs4zephyr_reference_api_loader` - An instance's ``socket:``/``sockets:`` key is malformed: both given at once, ``socket:`` used on a multi-plug shield (or ``sockets:`` on a single-plug one), or a ``sockets:`` map naming a slot the shield does not declare. Check the key against the shield's own plug count. * - ``lang-parse`` - :ref:`rigs4zephyr_reference_api_loader` - ``dtlib`` itself failed to parse the preprocessed shield translation unit — a devicetree syntax error in the shield's own ``.shield`` source, or in something it ``#include``\ s. Check the file dtlib flagged and the line the message names; a plain syntax mistake (a missing brace, a stray property) is the common cause. * - ``lang-pad-role`` - :ref:`rigs4zephyr_reference_api_loader` - A pad's ``shield,role`` is not one of ``driver``/``listener``/ ``bidir``. Check the role value. * - ``lang-param`` - :ref:`rigs4zephyr_reference_api_loader` - A ``params:`` block names a device the shield does not have, or a property the device does not declare (``shield,params``); a required parameter (no default) was left unassigned; or a delta supplies some of a device's params without restating one the effective topology already assigns. Check the device label and property name against the shield's own declared parameters, both listed in the message. * - ``lang-pos-ref`` - :ref:`rigs4zephyr_reference_api_loader` - A ``gpios``/``pwms``/``io-channels`` reference is malformed (wrong cell count), or its phandle does not target one of the shield's own plug nodes (or a jumper, for gpio). Check the phandle target. * - ``lang-position`` - :ref:`rigs4zephyr_reference_api_loader` - A claimed position index does not exist on the plug's connector type, or names bus copper rather than a claimable position (electrical realization is not modeled). Check the index against the connector type's declared positions. * - ``lang-promote-opts`` - :ref:`rigs4zephyr_reference_api_cli` - A ``--promote``/``-DRIG=`` promotion target's option grammar failed to parse — the ``;``-separated list, or the ``:``-separated ``socket=``/``config.