Skip to content

kernel/os/arch: Fix Cortex-M irq priority setting #3423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2025

Conversation

kasjer
Copy link
Contributor

@kasjer kasjer commented May 19, 2025

os_arch_os_init() initialized interrupt priority level for all interrupts using incorrect array limit taken from sizeof instead of ARRAY_SIZE.
For Cortex-M0 field IP is array of uint32_t unlike all other version where this array consist of uint8_t.

Now array is iterated using ARRAY_SIZE(NVIC->IP) to limit instead of sizeof(NVIC->IP) and for Cortex-M33
ARRAY_SIZE(NVIC->IPR).

For all non Cortex-M0 IP or IPR is uint8_t but this changes it to use ARRAY_SIZE() anyway to make it consistent.

Copy link
Contributor

@sjanc sjanc left a comment

Choose a reason for hiding this comment

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

commit message mentions M0 only

For Cortex-M0:
os_arch_os_init() initialized interrupt priority level
for all interrupts using incorrect array limit taken
from sizeof instead of ARRAY_SIZE.
For Cortex-M0 field IP is array of uint32_t unlike all
other version where this array consist of uint8_t.

Now array is iterated using ARRAY_SIZE(NVIC->IP) to limit
instead of sizeof(NVIC->IP) and for Cortex-M33
ARRAY_SIZE(NVIC->IPR).

Signed-off-by: Jerzy Kasenberg <[email protected]>
@kasjer kasjer force-pushed the kasjer/nvic-default-irq-prio branch from b7a9b05 to 90d4ae7 Compare May 19, 2025 13:44
@kasjer kasjer changed the title kernel/os/arch: Fix Cortex-M0 irq priority setting kernel/os/arch: Fix Cortex-M irq priority setting May 19, 2025
@kasjer kasjer merged commit 2b49188 into apache:master May 23, 2025
20 checks passed
@kasjer kasjer deleted the kasjer/nvic-default-irq-prio branch May 23, 2025 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants