Skip to content

cortex m0+: Fix bug doing read modify write on set only registers - #1006

Merged
mattnite merged 1 commit into
ZigEmbeddedGroup:mainfrom
Kytezign:patch-8
Aug 9, 2026
Merged

cortex m0+: Fix bug doing read modify write on set only registers#1006
mattnite merged 1 commit into
ZigEmbeddedGroup:mainfrom
Kytezign:patch-8

Conversation

@Kytezign

@Kytezign Kytezign commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

This bug can be especially bad on the NVIC_ICER where a read, modify, write can actually disable all previously enabled interrupts (rather than just the intended interrupt)

I'm not that familiar with the code base but I suspect this is an issue in other places. I might try to look closer later but I just wanted to get this out there as at least a partial fix for an issue I ran into earlier this year (and worked around at the time).

#955

Update to do write only rather than read, modify, write since 0 is meaningless and the read-back 1 may not have the desired effect.

@Grazfather Grazfather changed the title Fix bug doing read modify write on set only registers cortex m0+: Fix bug doing read modify write on set only registers Aug 6, 2026
This bug can be especially bad on the NVIC_ICER where a read, modify, write can actually disable all previously enabled interrupts (rather than just the intended interrupt)

@mattnite mattnite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, this is definitely an area where we could add some safety abstractions to/like Mmio

@mattnite
mattnite merged commit a1b54bb into ZigEmbeddedGroup:main Aug 9, 2026
33 checks passed
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.

2 participants