Skip to content
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

Question: How is NUM_IRQS determined for example for STM32F401xC #33658

Closed
gudnimg opened this issue Mar 24, 2021 · 6 comments
Closed

Question: How is NUM_IRQS determined for example for STM32F401xC #33658

gudnimg opened this issue Mar 24, 2021 · 6 comments
Assignees
Labels
platform: STM32 ST Micro STM32

Comments

@gudnimg
Copy link
Contributor

gudnimg commented Mar 24, 2021

Example:

I'm confused how NUM_IRQS = 85 is determined?

Looking at the datasheet for STM32F401RC: stm32f401rc.pdf
image

Wouldn't this mean that the number of interrupts available are NUM_IRQS = 62 + 16 = 78? What am I missing? 🤔

@gudnimg gudnimg added the RFC Request For Comments: want input from the community label Mar 24, 2021
@galak galak added the question label Mar 24, 2021
@galak galak added platform: STM32 ST Micro STM32 and removed RFC Request For Comments: want input from the community labels Mar 24, 2021
@erwango
Copy link
Member

erwango commented Mar 24, 2021

@GunZi200 NUM_IRQS = 85 is indeed not accurate, but we applied a simple rule of thumb which is to set NUM_IRQ to highest IRQ number (84 for stm32f401xc) +1. This was defined long time ago and the rule is questionnable.

Though, I think the real solution would be to get this info from dts extracted information, to set the numbed dynamically depending on the number of IRQ actually enabled in the binary so we can have a irq vector table tuned to the current binary configuration and save some bytes.
With existing dts parsing tools, I don't think there is anything that prevents us to enable this, aside from missing spare time.

@gudnimg
Copy link
Contributor Author

gudnimg commented Mar 24, 2021

@erwango I see that all stm32f401xc have 78 interrupts. How do you get 84?

It is my understanding that we count the 62 maskable interrupt channels + the 16 lines of the Cortex M4 with FPU

@erwango
Copy link
Member

erwango commented Mar 24, 2021

@GunZi200, as I mentioned, highest IRQ number + 1:
For f401xc:
SPI4_IRQn = 84 /*!< SPI4 global Interrupt */

And as I said, I know the rule is questionable.

@gudnimg
Copy link
Contributor Author

gudnimg commented Mar 24, 2021

Ok, where is this defined? I cannot find it anywhere. Is this part of some autogenerated code? I'm wondering about this because I need to determine this number for STM32L412RB but I'm not sure where to look for it to be sure I have the correct number.

@erwango
Copy link
Member

erwango commented Mar 24, 2021

@gudnimg
Copy link
Contributor Author

gudnimg commented Mar 24, 2021

Thank you for the patience @erwango closing the issue...

@gudnimg gudnimg closed this as completed Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: STM32 ST Micro STM32
Projects
None yet
Development

No branches or pull requests

3 participants