feat(util): opt-in MMWHAL_CRITICAL_SECTION_NOOP for critical-section IRQ masking #124
Labels
No labels
Category
App
Category
Documentation
Category
Firmware
Category
Hardware
Category
Qms
PR_Size
L
PR_Size
M
PR_Size
S
PR_Size
XL
PR_Size
XS
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Priority
Very Low Priority
Size
Epic
Size
Feature
Size
Task
Status
Blocked
Status
Draft
Status
Needs-review
Team
Board
Team
Dev
Team
Management
Type
Bug
Type
Capa
Type
Improvement
Type
New-feature
Type
Regulatory
Type
Usability
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
opendutchsolutions.public/hal_awr6843#124
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found while bringing up a downstream consumer project (
awr6843_mss_barebones_example) on real AWR6843AOP hardware.mmwhal_enter_critical()/mmwhal_exit_critical()(hal/util/mmwhal_types.h) unconditionally re-enable IRQ (cpsie i) once the critical-section nesting count unwinds to zero -- regardless of whether IRQ was already unmasked, or deliberately left masked, by whatever called into the critical section in the first place.hal_gpio_pin_init()takes one such section.For a project that never enables an interrupt source and never installs any real interrupt handling (a valid, common bare-metal design -- confirmed on real hardware in this case), the moment
hal_gpio_pin_init()unmasks IRQ, the CPU can silently trap forever the instant anything triggers one (a stray/pending peripheral flag is enough), in that project's own unhandled-IRQ vector -- before the program ever reaches application code past the critical section. This is not a hang the caller can detect or recover from.This is not proposing a change to the library's default behavior -- the real save/restore-previous-CPSR fix this design actually needs (so masking behaves correctly for downstream consumers who genuinely use interrupts) is a bigger, separate redesign, not something to rush in on the back of one project's bring-up.
Instead: add an opt-in
MMWHAL_CRITICAL_SECTION_NOOPdefine (same customization path asENABLE_<X>_MODULE, via a project's ownhal_config_mss.hcopied fromtemplate/hal_config_mss_template.h) that turns bothMMWHAL_DISABLE_IRQ()/MMWHAL_ENABLE_IRQ()into no-ops -- for projects that can state up front they never enable an interrupt source anywhere. Default (unset) behavior is completely unchanged for every existing consumer.