stm32/irq: Fix IRQ_ENABLE_STATS stats config to work on all MCUs.

Only the M4 and M7 MCUs have an FPU and FPU_IRQn, and FPU_IRQn is not
always the last entry/IRQ number.
This commit is contained in:
iabdalkader 2019-05-13 19:44:14 +02:00 committed by Damien George
parent 07af74daef
commit 1646eff864
2 changed files with 7 additions and 2 deletions

View File

@ -31,7 +31,7 @@
/// \moduleref pyb
#if IRQ_ENABLE_STATS
uint32_t irq_stats[FPU_IRQn + 1] = {0};
uint32_t irq_stats[IRQ_STATS_MAX] = {0};
#endif
/// \function wfi()

View File

@ -39,7 +39,12 @@
#define IRQ_ENABLE_STATS (0)
#if IRQ_ENABLE_STATS
extern uint32_t irq_stats[FPU_IRQn + 1];
#if defined(STM32H7)
#define IRQ_STATS_MAX (256)
#else
#define IRQ_STATS_MAX (128)
#endif
extern uint32_t irq_stats[IRQ_STATS_MAX];
#define IRQ_ENTER(irq) ++irq_stats[irq]
#define IRQ_EXIT(irq)
#else