Add wait halt mode for real intermittent-power evaluation - #58
Merged
Conversation
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.
Summary
Adds a fourth halt mode,
wait, for evaluating milp/rockclimb/schematic under real capacitor power (Otii + R + diode + capacitor). Instead of halting at region boundaries, the board blocks until the supply is recharged to 3.3 V, matching the algorithms' assumption that every region starts with a full capacitor.passes/runtime/vcc_wait.c—wait_until_vcc_full(): measures VCC via the ADC12_B battery monitor (AVCC/2 on channel 31) against the internal 2.0 V reference; sleeps in LPM3 between samples, woken every ~10 ms by Timer_A0 on VLO. The reference and ADC are powered down around each sample, so waiting draws only LPM3-level current (~160 nA measured) and does not fight the capacitor's charging current.boot_common.inc—HALT_WAITbranch insave_pc_sp_and_halt: checkpoint PC/SP, wait for a full capacitor, then continue into the next region without rebooting (caller-saved registers/SR preserved for RockClimb's post-regalloc call sites). Removes the unusedlpm4mode.__nvm_pcand waits for a full capacitor before resuming, so a power failure during the wait re-enters recovery instead of being misread as a fresh boot; fresh boot waits before any persistent write.park_if_done— debug builds park in LPM4 at boot once__nvm_doneis set, freezing NVM results/counters so mspdebug readback (which resets the board onto FET power) can no longer re-execute the program and contaminate them.--halt-mode waitplumbed through compile/bench/verify;vcc_wait.ccompiled and linked automatically;HALT_MODESmoved tocompile/common.pyas the single source of truth.Validation (MSP430FR5994 LaunchPad + Otii)
__nvm_result0xcc9e,cnt_boundary37,407).Test plan
uv run --extra test pytest tests/ -m unit)