Skip to content

Conversation

@mkeeter
Copy link
Contributor

@mkeeter mkeeter commented Oct 29, 2025

ProbeCore::halted is currently an integer value. Each time halt() is called, we increment the counter, only actually halting when it's initially zero. Similarly, run() decrements the counter, only actually starting the core when the counter reaches 0 again. This logic resembles that of a reentrant mutex, a famously hard-to-misuse primitive.

This is causing problems in reset_and_halt, in combination with #577:

  • The call to reset_and_halt after programming starts from an already-halted system, so run() decrements the counter back to 0 and resumes the processor.
  • After programming auxflash, we call reset_and_halt again. In this case, the chip is running, so run() decrements the counter from 0, which causes a panic.

I don't think the counter behavior is necessary. We switched halted from bool to u32 in 6877a7a along with an unhalted_reads: bool flag; however, we have since torn out that flag (1b2e361) without switching halted back to a bool.

@mkeeter mkeeter merged commit 73ccbf2 into master Oct 29, 2025
11 checks passed
@mkeeter mkeeter deleted the mkeeter/halted-bool branch October 29, 2025 20:35
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.

3 participants