Repository navigation
Conversation
_split_commands() already splits a command line into words and removes quotes and escapes, but parse_command() split the resulting words again. Quoted arguments that contain operator characters were therefore broken up, e.g. the path of Nordic's DECT NR+ modem firmware package, "mfw-nr+_nrf91x1_1.0.1.zip", reached the command as three words, and neither quoting nor escaping the '+' helped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`nrf91-update-modem-fw` reported "wait for events timed out" in cases where the modem was working fine: - A second modem DFU while debug power had stayed requested since an earlier one got no answer from the modem. This broke the verify-then-program path of the command (firmware differs -> program in the same session) and every `pyocd cmd` run following another one, as the commander keeps the debug port powered on exit. The debug domain is now power-cycled at the start of the DFU setup. - Any exception raised while verifying was swallowed and turned into a programming attempt, so e.g. a wrong file path showed up as a modem timeout. Only a firmware mismatch now leads to programming; other errors are reported as they are, and a missing file is reported by parse(). - The modem stayed in its DFU bootloader after verify/program, including after errors. The device is now reset when the procedure ends. Tested on an nRF9151 (DAPLink) with mfw-nr+_nrf91x1_1.0.1.zip, each in a separate `pyocd cmd` run: verify x4; a package with an altered digest (verify mismatch -> program in the same session -> "checksum mismatch" reported, no timeout); -f program + verify (17 s); verify. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title: nrf91: fix "wait for events timed out" in modem firmware update; split commander lines once
Problem
On an nRF9151 with a CMSIS-DAP probe (DAPLink),
nrf91-update-modem-fwfailed with
wait for events timed outalthough the modem DFU itself works(
ModemUpdater.verify()from the Python API passes every time from a cleanstate). Three independent causes all ended in the same misleading message:
_split_commands()splitsinto words (removing quotes/escapes), then
parse_command()split the wordsagain. Nordic's DECT NR+ package is named
mfw-nr+_nrf91x1_1.0.1.zip; thepath reached the command as three words, and neither quoting nor
\+helped.except:turned any verify error (here:FileNotFoundError) into a programming attempt. The verify had already leftthe modem in its DFU bootloader, so the second attempt timed out.
the command's own verify-then-program path (same session) and any
pyocd cmdrun after another one, because the commander keeps the debug port powered on
exit (
resume_on_disconnect=False).Changes
commands: split command lines into words only once+ unit test(
test/unit/test_execution_context.py; fails on the old code for the quotedand escaped cases).
nrf91: fix modem firmware update failures:_setup_device();checksum mismatch/Error while verifyinglead to programming,other errors propagate;
parse()reports a missing file (hinting at quoting);leaves its DFU bootloader.
Testing (nRF9151 LACA A1A, ARM DAPLink on NUCLEO-F103RB, mfw-nr+_nrf91x1_1.0.1.zip)
Each line is a separate
pyocd cmd -t nrf91 -c "nrf91-update-modem-fw ..."run:+modem firmware file not found: _nrf91x1_1.0.1.zip (quote paths ...)checksum mismatch-fprogram + verifyMeasured but not changed: the IPC receive masks. Another tool uses
0xFFFFfor nRF9151; with the existing nRF9160 values (
0x4/0x10) all cases abovepass, the modem signalled on channels 2 and 4.
Developed with assistance from Claude (Anthropic); I reviewed the changes and ran all tests on specific hardware.