Skip to content

Machine: Digitone II RAM boot over the development link (piece 5, stage one) - #1821

Open
prodbysmolec wants to merge 78 commits into
repeat98:base/digitone-ii-nextfrom
prodbysmolec:machine/digitone-ii-ramboot
Open

prodbysmolec wants to merge 78 commits into
repeat98:base/digitone-ii-nextfrom
prodbysmolec:machine/digitone-ii-ramboot

Conversation

@prodbysmolec

@prodbysmolec prodbysmolec commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator
  • What was wrong or hard: Piece 5 of the Digitone II goal starts with a trial in RAM: every test so far wrote the flash. The Rytm link boots an image from RAM; the Digitone II had none of the addresses, and one thing differs. Builds on Machine: Digitone II diagnostics log, the Octatrack's layout, over the development link #1820 (this branch holds its commits, Machine: Digitone II development link, stage two (panel keys and encoders over USB MIDI) #1817's and Machine: Digitone II development link, stage one (read-only diagnostics over USB MIDI) #1763's): please review it after them.
  • What this changes: Development bases only. The Rytm link's RAM boot at OS 1.12's addresses (link.s, link.c): ramboot (armed) presses YES at UPGRADE OS NOW?; a site at the upgrade job's call of the erase-and-write routine (0x4010921c -> 0x40139104) resets instead when asked, after stock's wait and drain, with the data cache written out and off; a gate at 0x4000053e (the same 8 bytes as the Rytm's 0x400008c6, before stock fills SRAM and clears its RAM) checks the mailbox, unpacks with the Rytm link's depacker and enters the image. The difference: the Digitone II's bootstrap reads the flashed MAIN OS to 0x40400000, inside the staged upload (0x4038bec0), so the container is copied to 0x47000000 before the reset; the CRCs guard it. The same reset (0x80 to 0xec090000 after 27 nops) and cache settings (0xa50ce100) as the Rytm's 1.74. There is no remote YES for a flash: only a person's YES writes the flash. Host ramboot and bootdiag, LINK.md's RAM boot section, a test that the host's limits are the gate's, a changelog entry.
  • How I checked it: npm run pr:ready; the gate's CRC, container parse and depacker, compiled for a computer from link.c, unpacked the development image's container to the linker's main OS byte for byte (202fa0da…), and its four numbers match the host's.
  • Tested on a unit: development base 6f72efd1 (this code before the addresses moved into the recipe, the same sections), my Digitone II: flashed with the marker (.syx 70634720); ramboot of the image without it (.syx 59800fb7) booted from RAM, ident boot 1 with the image's own CRC, the marker gone; a power cycle brought the flashed image back; then stock 1.12 flashed normally from this base (record). Seen: RSR reads 0x20 after a power cycle too, so the mailbox, not RSR, is what keeps a power cycle from booting from RAM. Not tested: cancelling by a press or disarm, a failed check, repeated RAM boots.
    Edge cases
Case Why this change makes it a risk How run Result
A RAM boot of an image without the marker it must boot from RAM, not flash ramboot, no hand on the unit pass: boot 1, CRC its own
A power cycle after the flashed OS must come back the developer power-cycled pass: boot 0, marker back
A normal flash from this base the new site in the upgrade path must pass it through stock 1.12 over USB, YES pass: it installed
A cancelled request, a failing check the gate must boot the flashed OS not run not run: not tried yet
Repeated RAM boots the gate and the copy each time many RAM boots during #1842's tests pass: every one booted from RAM
  • What the guides lacked or got wrong, and where I fixed it: LINK.md's RAM boot section says what differs from the Rytm's and why.

🤖 Generated with Claude Code

prodbysmolec and others added 26 commits November 19, 2026 03:03
…SB MIDI SysEx

Development bases (base.json's dev) observe stock's SysEx router at 0x4012197a (core-dn2 0.3's ev_sysex site) and
answer the Analog Rytm MKII link's ident and mem requests from ev_tick through stock's sysex_send on USB. A host
(tools/dn2_link.py) with a test of its frames, LINK.md, the goal row and a changelog entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The status byte of stock's USB MIDI receive parser, 0x445090ac on OS 1.12, reads 0xF0 while a SysEx message arrives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, not yet on a unit)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…host on a unit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and the encoder pushes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ot yet on a unit)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…red rate

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ot on a unit)

DIAG, MARK and DIAG_STAGE are defined after their first use in link.c: move that block up before building.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The upload is copied to 0x47000000 before the reset, because the bootstrap reads the flashed MAIN OS into the staged
upload. Host ramboot and bootdiag; LINK.md; a test that the host's limits are the gate's. Not yet on a unit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gitguardian

gitguardian Bot commented Nov 20, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard.
Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
40376663 Triggered Generic High Entropy Secret 19be13a src/community/agent-sessions.test.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

prodbysmolec and others added 2 commits November 20, 2026 01:40
… the same

Every Digitone II address link.c held (keys, the upload buffer, the RAM boot's copy and diagnostics, stock's boot
argument, wait and drain) is a cflag in base.json, as the owner asked for one link with each machine's addresses in
its recipe. The built package's sections, symbols and relocations are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@prodbysmolec

Copy link
Copy Markdown
Collaborator Author

Fixed in 9b34288 (then merged main and base/digitone-ii-next). What changed: the base now presses YES only for the staged container the host describes, checking both its length and its CRC32. Another image of the same size gets status 7, and the panel is left alone. Not run on a unit yet (the unit wasn't on USB today).

  • CMD_RAMBOOT checks, before posting YES:

    • stock's upload buffer is complete;
    • its struct's length is CLEN;
    • CLEN <= CONTAINER_MAX;
    • the CRC32 of the staged container (STAGED + 2, CLEN bytes) is the CCRC the host sent.

    It is the same zlib CRC the gate checks later on the copy, so the two can't disagree. It runs in the UI task with a 16-word nibble table (a quarter of the bitwise steps the gate uses, which matters for up to 3 MB). I'll measure on the unit how long it stands still for a 2.4 MB image.

  • Host fixture (dn2_link_host.c): a real 256-byte container behind the struct, with crc32_nibble checked against the gate's crc32 and zlib's check value (123456789 → cbf43926). Cases:

    • no prompt;
    • another length;
    • the same length with one bit flipped: status 7, mw_link_ramboot_due unset, nothing posted;
    • a length past CONTAINER_MAX: never read;
    • then the matching container: YES once, due set.

    With the CRC comparison removed from staged_is(), the flipped-bit case fails.

  • diag.h copied again from main's Octatrack one (the layout test asks for it); the dev base builds (18 sites). Lint, typecheck, Vitest (83) and sdk:check pass. The board step reports main's mackity claim only because base/digitone-ii-next is behind main.

Guides: LINK.md step 1 and status 7 now name the CRC.

prodbysmolec and others added 11 commits November 25, 2026 12:05
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… key link

link.c keeps the keys and turns and takes repeat98#1763's screen in place of mem; one host fixture covers both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…omes in parts the unit reads itself (log OFF)

mem is gone, so link.c answers log OFF (0x24) with up to 128 bytes of diag.c's log and its seq; dn2_link.py diag --save
and the site's readLog read part 0, the rest, then part 0 again, and keep only a log that stood still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t: bootdiag gets its own request

With mem gone, bootdiag (0x25) sends the gate's 15 words and the two marks the base itself writes; the host reads them
with one request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n names

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n names

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n names

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
prodbysmolec added a commit to prodbysmolec/modwerk that referenced this pull request Nov 25, 2026
…nto the loader: ident sends the modules' test value itself

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@prodbysmolec

Copy link
Copy Markdown
Collaborator Author

#1763, #1817 and #1820 are now merged in (e257145). bootdiag used to read the gate's words through mem at the address ident reported. It now has its own request, bootdiag (0x25): the unit sends exactly the gate's 15 words and the two marks of the way to the reset (the base's own RAMBOOT_DIAG area), and the host makes one request. The host fixture checks all 17 words and that bootdiag is no unknown command. sdk:check passes. Not run on a unit yet.

@repeat98

Copy link
Copy Markdown
Owner

Thanks. Binding YES to the staged container's length and CRC32 is what I asked for, and the flipped-bit case in dn2_link_host.c covers it.

Two things before this can go into base/digitone-ii-next (after #1763, #1817 and #1820, which it carries):

  1. A unit run on this head. The record is from 20 November, before ramboot needed the requested image CRC, before status 7 and the CRC check in staged_is(), and before bootdiag got its own request. Please run this head's dev package on the unit and put its SHA-256 in the record, with:
    • one ramboot that boots from RAM (ident boot 1 with the image's CRC) and a bootdiag read through 0x25;
    • one ramboot whose CRC doesn't match the staged upload: status 7, and UPGRADE OS NOW? still waits for a person;
    • how long the unit stands still while crc32_nibble() runs over a full-size image, and whether the sound goes on meanwhile.
  2. Repeated RAM boots. The edge-case table says they passed during Digitone II: the runtime loader in the development base, over the link #1842's tests, but the description's "Not tested" line and the record both say they weren't tried. Please make the three agree: add those runs to the record, or mark the row as still open.

prodbysmolec and others added 13 commits November 26, 2026 10:30
…chine/digitone-ii-link

# Conflicts:
#	src/engine/elektron/dn2-link.ts
…nto machine/digitone-ii-diagnostics

# Conflicts:
#	src/engine/elektron/dn2-link.ts
The unit refuses 0x21 since the link became bounded, so mem, MEM_MAX,
read() and the readLog that read through them are gone, with their
tests. repeat98#1820 brings the log back through log OFF (0x24). The fake unit
now refuses every command link.c does not serve.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-diagnostics

# Conflicts:
#	src/engine/elektron/dn2-link.test.ts
#	src/engine/elektron/dn2-link.ts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a unit, the link held YES while an OS upload completed, then
'release' posted YES's key-up, and stock started the flash: it answers
the prompt on the release as on the press. At the prompt mw_link_key now
takes every key event the link posted, releases included, and counts it
as refused; a person's YES and NO still reach stock. The host test
asserted the old behaviour and now checks the release is taken (it fails
against the old dispatch).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ii-ramboot

# Conflicts:
#	sdk/machines/digitone-ii/LINK.md
With the link's releases held back at UPGRADE OS NOW? (repeat98#1817), ramboot's
YES would be held back too: until now its press was taken at dispatch
and only its release reached stock, which answered the prompt with it.
The two events ramboot posts for the upload it checked (length and
CRC32) are now marked in the pending queue and pass; any other key event
the link posted is still taken. The host test checks both reach stock,
and fails when the release is posted unmarked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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.

2 participants