Skip to content

SN-8894 SN-8930 Regenerate CBOR registry sources: domain DIDs and RMC served_by - #1398

Open
kylemallory wants to merge 20 commits into
developfrom
SN-8930_cbor_domain_registry
Open

kylemallory wants to merge 20 commits into
developfrom
SN-8930_cbor_domain_registry

Conversation

@kylemallory

@kylemallory kylemallory commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Generated sources from the CBOR key registry in is-common, for SN-8894 and SN-8930. Also carries develop, merged into the branch on 2026-11-24. No hand-written code changes.

  • RMC_STORED and RMC served_by (SN-8894): RMC_STORED is served by IMX-5 and IMX-6 only (the GPX keeps it in storage but does not serve it), and the runtime RMC by no device until phase 2. Only doc comments change.
  • Domain DIDs (SN-8930): CONFIG_SYSTEM (0x0102), CONFIG_INS (0x0103), CONFIG_MAG (0x0104), CONFIG_GROUND_VEHICLE (0x0105), CONFIG_PORTS (0x0106), CONFIG_SENSORS (0x0107), CONFIG_IO (0x0108), CONFIG_GNSS (0x0109), CONFIG_CAN (0x010A) and STATE (0x010B). A domain DID has no struct of its own, and no existing DID struct changes. Each generated pair holds:
    • a view struct with one member per key (e.g. cbor_config_system_t);
    • the schema of every key over it (g_cborSchema_<DID>), which hosts use; the schema lookup now includes domain DIDs;
    • the registry's defaults as a view (g_cborDefaults_<DID>, g_cborDefaultFixed_<DID>).
  • Instance maps and key sets: Port[port_id], Receiver[receiver_id], Imu[imu_slot] and so on are arrays of a shared key-set struct (cbor_keyset_<name>_t), indexed by the enum's CBOR_<ENUM>_<NAME> constants; the plural (Ports, Receivers) holds the values common to every instance.
  • Key macros of nested fields are qualified by their map (CBOR_CONFIG_SYSTEM__PLATFORM_TYPE). No other DID's generated sources change.
  • A struct initializer with no members is { 0 }, because MSVC rejects empty braces as C11.

Merge before the is-common PR on SN-8930_cbor_domain_registry (https://github.com/inertialsense/imx/pull/1843), which carries the registry and points at this branch; generate --check needs both.

Replaces #1358, which GitHub closed when its branch (SN-8894_cbor-docs) was renamed; the commits are the same.

🤖 Generated with Claude Code

kylemallory and others added 7 commits October 28, 2026 18:02
The registry now lists the devices that serve each DID over the wire: RMC_STORED is served by IMX-5 and IMX-6 (the GPX stores it but does not serve it), and RMC by none until phase 2. Only the generated comments change.
…main DID

CONFIG_SYSTEM (0x0102) is the first domain DID: it has no struct of its own. Its generated pair holds a view struct with one member per key (cbor_config_system_t), the schema of every key over it (g_cborSchema_CONFIG_SYSTEM), and the registry's defaults as a view (g_cborDefaults_CONFIG_SYSTEM, g_cborDefaultFixed_CONFIG_SYSTEM). The schema lookup now includes domain DIDs.

Key macros of nested fields are qualified by their map (CBOR_CONFIG_SYSTEM__PLATFORM_TYPE). No existing DID's generated sources change.
…CONFIG_GROUND_VEHICLE

Three more domain DIDs, each with its view struct, full schema and recorded defaults:

- CONFIG_INS (0x0103): frames, dynamics, fusion, zero-velocity updates, shock and fault rejection, and the complementary-filter gains.
- CONFIG_MAG (0x0104): magnetometer recalibration, quality thresholds and declination.
- CONFIG_GROUND_VEHICLE (0x0105): wheel geometry, the IMU-to-wheel transform and the encoder.

All three are served by IMX-5 and IMX-6. No existing DID's generated sources change.
kylemallory and others added 4 commits November 24, 2026 19:07
…PORTS

- Shared key sets are typedef'd once in cbor_registry.h (cbor_keyset_<name>_t), ahead of the DID headers that use them. The first is `port` (baudRate, gsvBands).
- The `port_id` enum names a device's ports (SER0, SER1, SER2, USB, SPI).
- CONFIG_PORTS (0x0106): Ports, the values common to every port, and Port[port_id], one copy of the key set per port.

No other DID's generated sources change; the schema-lookup doc comment now says it covers domain DIDs.
…ey sets

- Key sets nested in key sets: `imu` holds Gyr[] and Acc[] maps of `channel`, keyed by imu_channel (PRIMARY, HIGH_G). Each key set is typedef'd after the ones it uses.
- Enums imu_slot, imu_channel, mag_id and baro_id.
- CONFIG_SENSORS (0x0107): rotation, Imus and Imu[imu_slot] (<imu>), Mags and Mag[] (<aux>), Baros and Baro[] (<aux>). Served by IMX-5 and IMX-6.
CONFIG_IO (0x0108): strobeActiveHigh, and Pin[pin_id] with each pin's function. The pin_id enum names the pins and pin pairs configured together (G1G2, G5G8, G6G7, G9, G11, G12, G13, G15). Served by IMX-5 and IMX-6.
CONFIG_GNSS (0x0109): the GNSS period, primary receiver, time sync and external-aiding latency; receiver settings common to every receiver and per receiver (type, port, PPS pin, startup configuration, fusion); antenna settings common and per antenna (offset, offset estimation, antenna power); and RTK mode, base position and flags, with each base correction stream's output ports. Adds the receiver_id, antenna_id and base_stream enums and the receiver, antenna and base_output key sets. Served by IMX-5, IMX-6 and GPX-1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The RTK base-output port fields are now ser0, ser1, ser2 and usb, and the RTK map is Rtk. A struct member named USB is replaced by the STM32L4 CMSIS `#define USB`, which broke the IMX-5 firmware build.
CONFIG_CAN (0x010A): bitRateKbps, fdEnabled, receiveAddress, and Message[can_message] with each broadcast message's periodMultiple and transmitAddress. The can_message enum numbers the slots as can_cid_t. Served by IMX-5 and IMX-6.
STATE (0x010B): lastPosition (lla, timeOfWeekMs, week), and Mag[mag_id] with each magnetometer's coverage map (grid, counts, sampleCount) and solver accumulator (dtd). Adds the mag_state key set. Served by IMX-5 and IMX-6.
…zer is valid C11

CONFIG_IO's defaults all come from firmware logic, so its defaults initializer has no members; it is now `{ 0 }` rather than empty braces, which MSVC rejects as C11.
…nals

The receiver key set's signals field is now satSignals. Qt, which the EvalTool compiles these headers beside, defines `signals` as a macro, which replaced the struct member and broke the EvalTool build.
Field keys are scoped to their map, so key 0 is a different field at every level of a domain DID (CONFIG_SYSTEM's navPeriodMs at the top, platform.type inside platform), but the name lookups searched a DID's whole name table by key, so cltool and the YAML and diagnostic output named a nested key after the first top-level field with the same key. Writes resolved names the same way and only came out right because the names happened to be unique.

- The generated name tables gain a parallel parents array (g_cborNameParents_<DID>): each entry's enclosing map, or 0xFFFF at the root of a field set. New lookups: cbor_registry_field_index(), cbor_registry_field_index_by_name() and cbor_registry_field_at().
- ISCborFormat's Scope tracks the name-table index of the map it is in, so each key is named, and each name resolved, within its own map. A rule or port index, or a DID used as a key, starts a new field set; a map the registry cannot place falls back to the DID-wide lookups.
- Tests: CborFormat.NestedKeysAreNamedWithinTheirMap and NestedNamesWriteTheirOwnKeys, including an instance map (CONFIG_PORTS Port.SER2.baudRate).
…cy DIDs on the wire

A DID_CBOR message addresses domains: keyed maps such as CONFIG_SYSTEM, STATE or RMC_STORED. A DID is a legacy Data ID with one fixed struct, and in CBOR it now appears only as a mapping of that struct to domain keys. FLASH_CFG, CAN_CONFIG and GPX_FLASH_CFG, which copied DID_FLASH_CONFIG, DID_CAN_CONFIG and DID_GPX_FLASH_CFG field by field under the legacy DID numbers, are no longer domains and are not served. Their settings are in the domains they map to.

Generated sources, without the prefix the path already gives:
- src/cbor/domain/<domain>.{h,c}: each domain's keys, names, view types, schema, defaults, and the schema of the keys each device family stores (g_cborSchema_<DOMAIN>_imx, _gpx).
- src/cbor/did/<did>.{h,c}: the mappings of the public DID structs (flash_config, can_config, gpx_flash_cfg): cbor_<did>_to_<domain>(), cbor_<did>_fits_<domain>() and cbor_<did>_from_<domain>(), with compile-time checks of every member, mask and index.

Host side:
- ISCborFormat resolves a root key to a domain only (cborDomainFromString()). A legacy DID name is a key only inside an RMC subscription (cborDidFromString()).
- cltool's -flashCfg= and -gpxFlashCfg= use the binary DIDs again, and its -cbor-get / -cbor-set examples use domains.
- SDK tests use domain schemas in place of the mirrors.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Five-component IMU paths exceed the shared depth limit, breaking leaf selections and truncating error paths, while diagnostic rendering mislabels nested fields by using DID-wide rather than parent-scoped names.

1 open issue
What changed in this PR

This PR expands the SDK’s CBOR registry with ten configuration and state domain DIDs, providing host-side schemas, views, defaults, and nested field names without changing existing DID structs.

Changes:

  • Add domain schemas and shared key-set types with enum-indexed instance maps.
  • Introduce parent-scoped name lookups and update YAML/diagnostic formatting, with regression tests.
  • Correct device-support documentation for RMC_STORED and RMC; these comments do not change device behavior.
File Description
tests/​test_cbor_format.cpp Tests nested names and instance-map encoding.
src/​ISCborFormat.cpp Resolves field names within their parent maps.
src/​cbor/​dids/​cbor_did_state.h Declares state keys, views, and defaults.
src/​cbor/​dids/​cbor_did_state.c Defines state schemas, defaults, and names.
src/​cbor/​dids/​cbor_did_route_filter.h Declares field-parent metadata.
src/​cbor/​dids/​cbor_did_route_filter.c Defines field-parent metadata.
src/​cbor/​dids/​cbor_did_rmc.h Corrects support documentation and declares parent metadata.
src/​cbor/​dids/​cbor_did_rmc.c Defines field-parent metadata.
src/​cbor/​dids/​cbor_did_rmc_stored.h Corrects support documentation and declares parent metadata.
src/​cbor/​dids/​cbor_did_rmc_stored.c Defines field-parent metadata.
src/​cbor/​dids/​cbor_did_mag_cal_map.h Declares field-parent metadata.
src/​cbor/​dids/​cbor_did_mag_cal_map.c Defines field-parent metadata.
src/​cbor/​dids/​cbor_did_gpx_flash_cfg.h Declares field-parent metadata.
src/​cbor/​dids/​cbor_did_gpx_flash_cfg.c Defines field-parent metadata.
src/​cbor/​dids/​cbor_did_flash_cfg.h Declares field-parent metadata.
src/​cbor/​dids/​cbor_did_flash_cfg.c Defines field-parent metadata.
src/​cbor/​dids/​cbor_did_config_system.h Declares system configuration keys and views.
src/​cbor/​dids/​cbor_did_config_system.c Defines system schemas, defaults, and names.
src/​cbor/​dids/​cbor_did_config_sensors.h Declares sensor configuration and instance views.
src/​cbor/​dids/​cbor_did_config_sensors.c Defines sensor schemas, defaults, and names.
src/​cbor/​dids/​cbor_did_config_ports.h Declares common and per-port views.
src/​cbor/​dids/​cbor_did_config_ports.c Defines port schemas, defaults, and names.
src/​cbor/​dids/​cbor_did_config_mag.h Declares magnetometer configuration views.
src/​cbor/​dids/​cbor_did_config_mag.c Defines magnetometer schemas, defaults, and names.
src/​cbor/​dids/​cbor_did_config_io.h Declares I/O configuration and pin views.
src/​cbor/​dids/​cbor_did_config_io.c Defines I/O schemas and zero-initialized defaults.
src/​cbor/​dids/​cbor_did_config_ins.h Declares navigation configuration views.
src/​cbor/​dids/​cbor_did_config_ins.c Defines navigation schemas, defaults, and names.
src/​cbor/​dids/​cbor_did_config_ground_vehicle.h Declares vehicle transform and encoder views.
src/​cbor/​dids/​cbor_did_config_ground_vehicle.c Defines vehicle schemas, defaults, and names.
src/​cbor/​dids/​cbor_did_config_gnss.h Declares receiver, antenna, and RTK views.
src/​cbor/​dids/​cbor_did_config_gnss.c Defines GNSS schemas, defaults, and names.
src/​cbor/​dids/​cbor_did_config_can.h Declares CAN configuration and message views.
src/​cbor/​dids/​cbor_did_config_can.c Defines CAN schemas, defaults, and names.
src/​cbor/​dids/​cbor_did_can_config.h Declares legacy CAN field-parent metadata.
src/​cbor/​dids/​cbor_did_can_config.c Defines legacy CAN field-parent metadata.
src/​cbor/​cbor_registry.h Adds domain IDs, enums, shared types, and scoped lookup APIs.
src/​cbor/​cbor_registry.c Checks the satellite-system count against the registry.
src/​cbor/​cbor_registry_names.c Registers domain schemas and implements scoped name lookups.

Review effort: Balanced

Comment thread src/cbor/cbor_registry_names.c Outdated
{ CBOR_DID_FLASH_CFG, &g_cborSchema_FLASH_CFG },
{ CBOR_DID_CAN_CONFIG, &g_cborSchema_CAN_CONFIG },
{ CBOR_DID_GPX_FLASH_CFG, &g_cborSchema_GPX_FLASH_CFG },
{ CBOR_DID_CONFIG_SYSTEM, &g_cborSchema_CONFIG_SYSTEM },

@Hephaestus-Maximus Hephaestus-Maximus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hephaestus review: APPROVE. I built and tested this PR together with its companion imx#1843 (whose registry these sources are generated from). The generated sources are exactly what the registry produces, and everything this PR itself changes builds and passes. I have findings on the imx side that I will put on imx#1843, listed below so they are not lost.

Group checked out

Repo SHA
inertial-sense-sdk#1398 (this PR) d3736699890bca62218218723a67a979a2ddf70d
imx#1843 7aac80f60105169569d0c8e530b4ee55a7f83836, git submodule update --init --recursive; its SDK pin is exactly this PR's head. Its docs pin is 6ef25a64c4f57636e5ea9a512496920db012adb6 (docs.inertialsense.com#156 as of its 03:59 UTC commit).

Results

  1. The generated sources match the registry. scripts/cbor_registry.py generate --check (run from the imx checkout against this SDK pin) exits 0, so every file this PR adds or changes under src/cbor/ is what the generator writes from docs_internal/cbor/registry/, including the new domain/*, the did/* -> dids/* rename and the served_by change for RMC_STORED / RMC. Its only output is the existing RMC_STORED reply-size warning ("worst case 99189 B exceeds one reply; hosts must request it in parts"), which is not new.
  2. SDK unit tests (cmake -S SDK/tests, Release, at this head): the whole binary 1090 run, 1076 passed, 0 failed, 14 skipped (fixture-gated). The CBOR tests (*cbor*, *Cbor*): 56 passed.
  3. cltool (cmake -S SDK/cltool, Release): builds clean, 0 warnings. cltool -h documents the domain form of -cbor-get / -cbor-set, e.g. -cbor-get "{CONFIG_INS: {dynamicModel, rotation}}" and -cbor-get CONFIG_SYSTEM, matching the new cltool_cbor.cpp.
  4. Registry checker (imx#1843's scripts/cbor_registry.py check): 0 errors, 0 review flags, 6 warnings, all of them the documented "pending" items (mag bias_cal / Wcal waiting on CALIBRATION, user-page g0, calibration and GPX RMCFlash stores); nothing unexpected.
  5. IMX-5 firmware with this SDK (scripts/build_firmware_imx5.sh): builds, 0 warnings, once ruyaml is available to the new converter-generation step (see below).

Findings for imx#1843 (not part of this PR; I will report them on that PR)

  • scripts/test_cbor_registry.py fails at the pinned docs commit: 58 tests, 1 failure, test_published_page_is_current, and scripts/cbor_registry.py docs --check reports cbor-parameters.md is out of date. With the docs submodule moved to docs#156's current head (00d69ab, pushed after imx#1843's last commit), docs --check passes and all 58 tests pass. So imx#1843's docs pin is stale and needs re-pointing.
  • A stock container build of the IMX-5 firmware fails in the new cbor_bind step (ModuleNotFoundError: ruyaml / yaml), because build_firmware_imx5.sh makes an SDK Python venv that does not include ruyaml; it builds after ruyaml is installed (as SDK/scripts/install_python_dependencies.sh does). Worth adding to the venv bootstrap.

Not verified

  • On-device behaviour of the domain DIDs (the description lists the hardware validation as still to come) and the IMX-6 build (is-imx#84).
  • The IMX unit tests and the Windows build-script changes in imx#1843; they belong to that PR's review.

A root key is a domain, so its macro is CBOR_DOMAIN_<NAME>. CBOR_DID_<NAME> is left to the NMEA pseudo-DIDs, which are keys inside an RMC subscription, and to the DID mapping files' include guards. The generated registry sources are regenerated; ISCborFormat, ISDevice.h and the tests use the new names.
… its own

MAG_CAL_MAP (0x0101) is removed from the generated sources: the coverage map is served and stored as STATE Mag.MAG1.coverage. STATE's coverage counts are now a 64-byte string (two 4-bit cells per byte) rather than an array of 64 integers. Regenerated from the registry.

This branch has not been deployed

No deployments
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.

5 participants