Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,21 @@ anything you can download you can also program directly. A collection that
lives in another repository has to be cloned next to this one; the error says
which `git clone` to run.

A radio running [RadioFoundry](https://radiofoundry.org/) firmware can have
the firmware pinned too. `firmware build` compiles it from one commit of a
RadioFoundry checkout in the toolchain container that commit pins and checks
the image against a recorded hash; `firmware install` flashes it; and
`program` then refuses a radio that reports any other firmware:

```bash
uv run codeplugger firmware build --radio baofeng_dm32_radiofoundry
uv run codeplugger firmware install --radio baofeng_dm32_radiofoundry \
--port /dev/cu.usbserial-2120 --confirm
```

The build needs Docker; the details and what has been verified are in
[docs/backends.md](docs/backends.md#radiofoundry-firmware-firmware-build-and-firmware-install).

`--profile` also takes a git URL or a local directory, so a group does not have
to be in the registry to be usable:

Expand Down Expand Up @@ -130,6 +145,9 @@ flowchart LR
exporter["Exporter<br/>CHIRP CSV / qdmr YAML / P4 TOML / benlink plan"]
cps["CPS tool<br/>CHIRP / vendor CPS"]
artifacts["Artifacts<br/>HTML reference + operation log"]
rfoundry["RadioFoundry checkout<br/>one verified commit"]
fwbuild["firmware build<br/>pinned toolchain container, image checked against firmware.lock.json"]
fwinstall["firmware install<br/>gated flash through rfoundry"]
radio["Radio"]

public --> resolve
Expand All @@ -140,8 +158,14 @@ flowchart LR
resolved --> backend --> radio
resolved --> exporter --> cps --> radio
resolved --> artifacts
rfoundry --> fwbuild --> fwinstall --> radio
radio -. "reports its firmware commit" .-> backend
```

The firmware path applies to RadioFoundry radios only: their firmware is
built from one commit and flashed before the codeplug is written, and the
write is refused when the radio reports any other firmware.

The diagram source is also available in [docs/workflow.mmd](docs/workflow.mmd).

## Documentation
Expand All @@ -154,7 +178,8 @@ The diagram source is also available in [docs/workflow.mmd](docs/workflow.mmd).
- [docs/backends.md](docs/backends.md): each exporter and programming
backend, with the write gates it enforces: CHIRP CSV and `chirp-writer`,
qdmr YAML and `dmrconf`, qdmr YAML and `radiofoundry-cps` for RadioFoundry
firmware, P4 TOML and `p64tool`, benlink.
firmware, P4 TOML and `p64tool`, benlink. Also building and installing
RadioFoundry firmware at a pinned commit with `codeplugger firmware`.
- [docs/operations.md](docs/operations.md): HTML reference artifacts,
operation logs, and the registry-driven fleet dry run.
- [docs/architecture.md](docs/architecture.md): which repository owns which
Expand All @@ -171,7 +196,11 @@ four exporters, the five gated write backends, and HTML/operation-log
artifacts are working today. Which radios have had a codeplugger-generated
codeplug written to them and read back is recorded per radio on the
[project site](https://codeplugger.chicagooffline.com/); the benlink path has
not yet been accepted against a physical radio. Prebuilt community codeplugs
not yet been accepted against a physical radio. RadioFoundry firmware builds
reproducibly from a pinned commit with `codeplugger firmware build`, and
`codeplugger firmware install` has flashed one RT3S; the DM-32UV and DM-1701
have not been flashed that way yet. Prebuilt
community codeplugs
are published at
[codeplugger.chicagooffline.com/codeplugs/](https://codeplugger.chicagooffline.com/codeplugs/)
so members can download a file without installing anything. What comes next,
Expand Down
272 changes: 255 additions & 17 deletions docs/backends.md

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion docs/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ This creates `.artifacts/<radio>/<radio-instance>/reference.html` and
`operations.jsonl`. The latter records successful profile generation and can
also be passed to a backend as an `ArtifactStore` to audit device reads and
writes; `codeplugger program --artifact-root` does this, and the backups and
read-back images it takes land in the same directory. Generated artifacts are
read-back images it takes land in the same directory. `codeplugger firmware`
keeps a log of its own at `.artifacts/<radio>/firmware/operations.jsonl`,
beside the images it builds, recording each build with its SHA-256 and
compiler, each comparison with the firmware lock, and each install step.
Generated artifacts are
evidence of an operation, not an authoritative profile or RF data source.

The reference begins with the radio model, instance identity, UTC generation
Expand Down
81 changes: 71 additions & 10 deletions docs/plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,29 +191,71 @@ Working today:
radio against an image, where dmrconf can only archive a read-back.
dmrconf keeps the one job only it can do, encoding the YAML, through
RadioFoundry's `codeplug_port.py`, which is imported from the checkout
rather than copied and which restores the TX contacts qdmr's encoder
drops. The gates are the house pattern (confirm, identity, mandatory
rather than copied and which puts back the TX contacts qdmr's encoder
drops and clears the TS1 override it gives every contact. The gates are
the house pattern (confirm, identity, mandatory
backup, write, read-back, verify) with two bench lessons built in. A
byte compare is the wrong judge of a write: a DM-1701 whose decoded
read-back matched the YAML sent line for line still differed in 8,634
read-back matched the image's YAML line for line still differed in 8,634
bytes, all of them VFO A scratch the radio rewrites or padding that is
never sent, so a failed byte compare falls back to decoding the read-back
and comparing that. And radio type 6 is not an identity: it is the
firmware's fallback for a board that declares none, the DM-32UV is such
a board, and reading it as "MD-UV380" refused every correct DM-32 write.
**Hardware-verified 2026-12-01** on the DM-32UV (`eam_dm32_02`, 279
channels / 30 zones / 23 contacts / 5 group lists, decoded read-back
identical to the codeplug sent) and on the DM-1701 (the same counts,
decoded read-back identical). The DM-1701 had been verified the day
before over the `dmrconf` path, which both STM32 entries still carry a
block for (**2026-11-30**, `eam_dm1701_01`, 278 channels / 30 zones,
identical to the encoded image) and on the DM-1701 (the same counts,
decoded read-back identical). **Neither write was what it claimed**: a
third lesson came
on 2026-12-02, when an RT3S written the same way read back clean while
holding 9 of its profile's 38 TX contacts and a TS1 override on all 23
contacts. Upstream finds channels and contacts by qdmr's indentation and
took codeplugger's export, whose list items start in column zero, for
empty lists, so neither fix-up ran, and both verify steps compare the
radio with the encoded image rather than with the export. The backend now
hands upstream a re-indented copy and refuses an image that differs from
the export in a channel's TX contact or a contact's timeslot override.
**Hardware-verified with that fix 2026-12-02** on the RT3S (`eam_rt3s_01`)
and on a DM-32UV (`eam_dm32_03`), both carrying the same codeplug (232
channels / 8 zones / 23 contacts / 5 group lists): 29 contacts put back,
23 overrides cleared, and for each the decoded read-back compared with the
export shows no differences. That DM-32UV had been carrying the
279-channel bench codeplug from the old path, and read back with no TX
contact on any of its 31 DMR channels that have a group list, which
confirms the loss on a second model. The DM-1701 had first been written
over the
`dmrconf` path, which both STM32 entries still
carry a block for (**2026-11-30**, `eam_dm1701_01`, 278 channels / 30 zones,
read-back decoded equal to the intended image); that run added `--port`
-> `--device` plumbing to the dmrconf backend (macOS lists `cu.*` and
`tty.*` as two devices and qdmr refuses to choose), a CLI
`--init-codeplug` flag, and a read-back retry because the radio reboots
off USB on dmrconf's closing command. The RT3S entry remains unbadged:
`eam_rt3s_01` runs OpenGD77, and nothing has been written to an RT3S on
this firmware.
off USB on dmrconf's closing command.
- RadioFoundry firmware is pinned as well as written to (2026-12-02), so a
RadioFoundry radio is one firmware commit plus one codeplug. Three pieces,
all keyed on `VERIFIED_REVISIONS`, the list that pins the checkout.
`program` reads the commit the radio reports in `cps_client info`, logs it,
and refuses a write to firmware that is not a verified revision
(`--allow-unverified-firmware` opts in). `codeplugger firmware build`
(`backends/radiofoundry_firmware.py`) compiles a radio's image from a
scratch clone of the checkout at one commit, in the toolchain container
that commit pins, packages it with upstream's `release.py`, and compares
its SHA-256 with `radios/<id>/firmware.lock.json`; the board comes from a
new `radiofoundry_firmware` capabilities block. `codeplugger firmware
install` flashes a locked image through upstream's `rfoundry`, showing its
plan first and afterwards requiring the radio to report the commit that
was sent. **Builds reproduced 2026-12-02** at `62db1bae` for all three
radios (`dm32` 777,592 bytes, `dm1701` 704,852, `mduv380` 706,132; hashes
in the lock files), each byte-identical across repeated builds from fresh
clones on an Apple silicon Mac under amd64 emulation. Upstream has no
published release to compare with, so that is repeatability, not equality
with an upstream artifact. **Install hardware-verified 2026-12-02 on the
RT3S**, once: a radio running `acd7cd69` was refused by the firmware
check, `firmware install` flashed the locked `62db1bae` image through
rfoundry (codec kept, sectors 3 to 9 rewritten), and the radio came back
reporting `62db1bae` with the commit's own build stamp and passed the
check. The DM-32UV's serial route and the DM-1701 have not been flashed
this way.
- Analog radios (UV-5R Mini, Ailunce HA2, Retevis C64, Baofeng BF-888S, Baofeng
W31E, Yaesu FT-270R / FT-277R / FT-2800M): CHIRP CSV export (FM, with NFM
as its narrow bandwidth, and receive-only AM), either imported in the CHIRP
Expand Down Expand Up @@ -702,6 +744,25 @@ Known gaps not tracked by an item above:
behaviour at that revision: the group-list cleanup is switched off because
it drops every list from qdmr 0.15.1's export, and serial faults are
retried around a write loop that does not catch them itself.
- `codeplugger firmware install` has flashed one radio, an RT3S (the
first attempt stopped before flashing because the radio was not ready).
The DM-32UV and DM-1701 have not been flashed through it. The firmware
gate in `program` has run on that one radio: it refused `acd7cd69` on an
identity read and passed `62db1bae` through a full `program --confirm`.
- The DM-1701 written on 2026-12-01 needs re-programming through the fixed
`radiofoundry-cps` path: it very likely holds a codeplug with most DMR
channels' TX contacts missing and a TS1 override on every contact, as the
RT3S and a DM-32UV written the same way both did, and it has not been
read back. Its `hw` flag on the site was earned by a write that matched
the encoded image, not the export. The DM-32UV row's flag is now backed by
a write that matches its export, and the RT3S RadioFoundry row, which has
one too, carries no flag yet. Two
limits on what the lock pins: the C-SKY toolchain image is pinned upstream
by tag, not digest, so a re-pushed tag surfaces as a lock mismatch rather
than being prevented, and the AMBE codec is outside the build entirely.
Arm boards are built inside the C-SKY image with the Arm toolchain mounted
in, because upstream publishes no runnable image of its pinned Arm
compiler; an upstream change to either image's layout breaks that.

## Later

Expand Down
7 changes: 6 additions & 1 deletion docs/workflow.mmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ flowchart LR
exporter["Exporter<br/>CHIRP CSV / qdmr YAML / P4 TOML / benlink plan"]
cps["CPS tool<br/>CHIRP / vendor CPS"]
artifacts["Artifacts<br/>HTML reference + operation log"]
rfoundry["RadioFoundry checkout<br/>one verified commit"]
fwbuild["firmware build<br/>pinned toolchain container, image checked against firmware.lock.json"]
fwinstall["firmware install<br/>gated flash through rfoundry"]
radio["Radio"]

public --> resolve
Expand All @@ -18,4 +21,6 @@ flowchart LR
resolve --> resolved
resolved --> backend --> radio
resolved --> exporter --> cps --> radio
resolved --> artifacts
resolved --> artifacts
rfoundry --> fwbuild --> fwinstall --> radio
radio -. "reports its firmware commit" .-> backend
3 changes: 3 additions & 0 deletions radios/baofeng_dm1701_radiofoundry/capabilities.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,8 @@
"regions": "codeplug",
"model": "DM-1701"
},
"radiofoundry_firmware": {
"board": "dm1701"
},
"notes": "Baofeng DM-1701 (also sold as the Retevis RT84) after installing RadioFoundry, the MIT-licensed multi-mode firmware (radiofoundry.org). To the toolchain it is a third radio beside baofeng_dm1701 (OEM) and baofeng_dm1701_opengd77: RadioFoundry stores the codeplug in the open-firmware layout and speaks qdmr's open-firmware CPS protocol through a compatibility shim (RadioFoundry docs/spec/open-firmware-cps.md and cps-protocol.md), so dmrconf can program it under radio key openuv380 exactly like the OpenGD77 entries, and the dmrconf block above is kept for that. codeplugger program no longer goes that way: the radiofoundry_cps block takes precedence, so dmrconf only encodes the image and RadioFoundry's own tools/cps_client.py moves it, which avoids dmrconf's cold-read failures against this firmware and adds a verify step. Its model assertion, 'DM-1701', is a string read off this radio. The USB details that follow describe the dmrconf path. On this STM32 radio the host port is USB CDC-ACM at VID 0x1FC9 PID 0x0094, which is the only identity qdmr auto-detects; the radio reports open-firmware radio type 8 (10 on the other panel variant), which qdmr's driver maps to its OpenUV380 model, so detect prints 'Open MD-UV380' and the backend's RADIO_NAMES gate holds unchanged. The radio must be in USB serial mode, not RadioFoundry's USB network mode (PID 0x0095/0x0096), which qdmr cannot see. Limits are qdmr v0.15.1 OpenGD77Limits, the same singleton the opengd77 entries cite, and they match what RadioFoundry itself reads from the image (RadioFoundry docs/user/04-programming.md): 1024 channels, 68 zones of 80 channels (RadioFoundry always writes the 80-channel zone layout), 1024 contacts, 76 RX group lists of 32, 16-character names. max_scan_lists is 0 on purpose: RadioFoundry's qdmr import drops scanLists (docs/spec/qdmr-yaml.md section 2) and qdmr marks them ignored on this key, so a profile carrying scan lists is refused loudly rather than silently trimmed. The UHF ceiling is 470 MHz because qdmr's OpenGD77Limits rejects anything above it on this key, although the hardware and RadioFoundry both cover 400-480. Modes are FM and DMR only: RadioFoundry's P25, NXDN and Tier III channels live in a radioFoundry block of the YAML that qdmr ignores and this exporter never writes, and the OpenGD77 limits define no AM channel class. The dmrconf verify stand-in (openuv380 -> opengd77) and the never-pass---radio-on-write rule in the backend apply as for OpenGD77. Flashing RadioFoundry over an OEM codeplug is a capacity downgrade (1024 channels and contacts against 3000 and 10000), so a profile built for baofeng_dm1701 has to be rebuilt against this entry, not reused. BENCH-VERIFIED 2026-11-30 on eam_dm1701_01 (MuehlMini, dmrconf 0.15.1): detect 'Open MD-UV380', pre-write backup, a 278-channel / 30-zone write, read-back decoded to the same channels, zones and TG lists as an offline encode of the sent YAML; the only decoded difference was contact timeSlotOverride reading None where qdmr had encoded TS1, which RadioFoundry's qdmr-yaml spec documents as the firmware's reading of a contact without an openGD77 block. Two operational facts from that run: on macOS the port must be passed (--port /dev/cu.usbmodem21101) because qdmr lists the cu.* and tty.* nodes as two devices and refuses to auto-detect; and the radio reboots on dmrconf's closing C 6 0 and drops off USB for a few seconds, so the backend retries the read-back. BENCH-VERIFIED 2026-12-01 over the radiofoundry_cps path (RadioFoundry git 62db1bae): 279 channels, 30 zones, 23 contacts and 5 group lists written, and the read-back decoded to YAML identical to what was sent. The byte compare still reported 8,634 differing bytes, 26 in the VFO_A scratch area the radio rewrites and 8,608 of padding that is never sent, which is why that backend verifies semantically. Sources: RadioFoundry docs at commit 62db1bae (2026-11-30)."
}
11 changes: 11 additions & 0 deletions radios/baofeng_dm1701_radiofoundry/firmware.lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"board": "dm1701",
"format": "codeplugger-firmware-lock/1",
"images": {
"62db1bae38969bf5ac72764376b31416ba55a71e": {
"sha256": "37e475ebe70bdfaced85039b00a01ae2ecf6be0a39e8326e76aec32083414658",
"size": 704852,
"toolchain": "arm-none-eabi-gcc (Arm GNU Toolchain 13.3.Rel1 (Build arm-13.24)) 13.3.1 20240614"
}
}
}
Loading
Loading