Support Cortex-M33 architectural stepping. - #80
Merged
Merged
Conversation
M33 halt/resume and register access were available, but stepping still rejected the architecture. Extend the existing step lifecycle with M33 permission, snap-stall, and restart checks while preserving competing stop evidence and caller deadlines. A step itself sets restart status. Accept it while execution is pending, but prevent automatic cleanup if restart status appears again after observing completion. Recheck the halt before clearing stepping so cleanup cannot claim a later independent stop. Never replay an uncertain launch. Two fresh RP2350 core-0 sessions verified PC, R0, and RAM across thirteen steps each, then restored inherited debug state through resume/release.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Owner
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Allow
Target.Stepon an acquired Cortex-M33 from a halt owned by that target. It returns halted with stepping disabled and retains ownership for register access, another step, or resume. The caller controls cancellation and deadlines. Permission, snap-stall, and restart checks preserve the M33 cleanup rules.Previously this call rejected M33, even after acquiring its debug state and requesting a halt:
The same call now performs an architectural step. Through a borrowed core-0 MEM-AP selected with
dap.APAt(0x2000), the complete sequence is:The caller supplies
ctxand a livecleanupCtx, including after operation cancellation. An inherited halt grants no permission to step or resume. A step can enter an exception handler instead of retiring an instruction; it preserves DFSR flags and rejects competing debug events. Instruction effects are not rolled back.Why
M33 halt/resume and register access were available, but stepping still required M0. The existing step lifecycle supports M33 with additional state checks. The step's own restart is expected while execution is pending; a further restart after observing the completed halt prevents automatic cleanup, even if the processor has already halted again. Before clearing C_STEP, the target rereads DHCSR to confirm the halt and check permission, snap-stall, and restart status. An uncertain launch is never replayed.
Hardware evidence
On Nostalgia, two fresh sessions used J-Link EDU Mini V2
000802011345, 1 MHz SWD, and RP2350 core 0 at AP0x2000, CPUID0x411fd210. The already-running RAM counter was exercised with:Both sessions checked 13 steps each, with PC/R0/RAM matching the increment, store, and branch effects. The counter stayed unchanged while halted and advanced after resume and release from another stepped halt. DSCSR remained
0x00030000across the first twelve steps. Initially disabled debug and running state were restored before Arm owner close; both owners closed successfully.The counter runs in Secure state with configurable interrupts disabled. Exception entry, competing events, permission loss, snap-stall, restart after completion, and failure cleanup have behavioral coverage. Sleeping instructions, Non-secure execution, core-1 control, and cross-core coordination were not exercised. State after Arm owner close was not measured. Flash was untouched; the existing RAM program remains running.
Documentation
Update the stepping API, Cortex-M guide, architecture and composition guides, capability table, and README for M33 stepping. The Cortex-M guide includes the gated hardware procedure, instruction observations, and cleanup limits.