diff options
author | iabdalkader <i.abdalkader@gmail.com> | 2019-05-13 19:44:14 +0200 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-05-15 16:04:01 +1000 |
commit | 1646eff8647d6665cb05cf56384299b49fbeb126 (patch) | |
tree | 1c8c5d7778deae27daad40186561d0650338c4c5 | |
parent | 07af74daef4398540fa623244b4802c22cee3a12 (diff) |
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.
-rw-r--r-- | ports/stm32/irq.c | 2 | ||||
-rw-r--r-- | ports/stm32/irq.h | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/ports/stm32/irq.c b/ports/stm32/irq.c index 7298a4b50..010089973 100644 --- a/ports/stm32/irq.c +++ b/ports/stm32/irq.c @@ -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() diff --git a/ports/stm32/irq.h b/ports/stm32/irq.h index bfed17ecf..075791357 100644 --- a/ports/stm32/irq.h +++ b/ports/stm32/irq.h @@ -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 |