[#941] NVIC: Correct ICSR RETTOBASE behavior - #217
Open
PhysicistJohn wants to merge 1 commit into
Open
Conversation
PhysicistJohn
force-pushed
the
941-nvic_rettobase
branch
from
August 8, 2026 04:43
297ee9f to
7f7d577
Compare
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.
Related issue
Fixes renode/renode#941
Description
Corrects the read-only
ICSR.RETTOBASEbit for Armv7-M and Armv8-M Mainline cores.After this PR was opened, master independently implemented RETTOBASE in bd7f752f. That implementation counts only active
SystemExceptionvalues, so it ignores active external interrupts (exception numbers 16 and above). This version counts the complete active exception stack: the bit is set for zero or one active exception and clear for nested active exceptions.Cortex-M0, Cortex-M0+, Cortex-M1, and Cortex-M23 keep bit 11 at zero. Armv6-M reserves the field, and Armv8-M Baseline does not implement it without the Main Extension.
The explicit model check is needed because Renode currently exposes Armv7 compatibility features for the Cortex-M0 family.
Regression tests cover zero, one, and two active external interrupts.
Usage example
The reproduction from renode/renode#941 reports bit 11 set for an idle Cortex-M4 NVIC. A native matrix also verifies every currently supported Cortex-M model.
Additional information
Validated on macOS Arm64 with .NET 8:
NVICTests: 3 passed, 0 faileddotnet format --verify-no-changeson both changed files: passed