Skip to content

Commit 291a735

Browse files
committed
add new M33 processor exception handlers
1 parent c9c3825 commit 291a735

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

src/rp2_common/cmsis/include/cmsis/rename_exceptions.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@
5252
#if PICO_RP2350
5353
#define isr_nmi NMI_Handler
5454
#define isr_hardfault HardFault_Handler
55+
#define isr_memmanage MemManage_Handler
56+
#define isr_busfault BusFault_Handler
57+
#define isr_usagefault UsageFault_Handler
58+
#define isr_securefault SecureFault_Handler
5559
#define isr_svcall SVC_Handler
60+
#define isr_debugmonitor DebugMon_Handler
5661
#define isr_pendsv PendSV_Handler
5762
#define isr_systick SysTick_Handler
5863
#define isr_irq0 TIMER0_IRQ_0_Handler

src/rp2_common/pico_crt0/crt0.S

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,26 @@ __vectors:
5252
#else
5353
.word isr_nmi
5454
.word isr_hardfault
55+
#if PICO_RP2040
5556
.word isr_invalid // Reserved, should never fire
5657
.word isr_invalid // Reserved, should never fire
5758
.word isr_invalid // Reserved, should never fire
5859
.word isr_invalid // Reserved, should never fire
60+
#else
61+
.word isr_memmanage
62+
.word isr_busfault
63+
.word isr_usagefault
64+
.word isr_securefault
65+
#endif
5966
.word isr_invalid // Reserved, should never fire
6067
.word isr_invalid // Reserved, should never fire
6168
.word isr_invalid // Reserved, should never fire
6269
.word isr_svcall
70+
#if PICO_RP2040
6371
.word isr_invalid // Reserved, should never fire
72+
#else
73+
.word isr_debugmonitor
74+
#endif
6475
.word isr_invalid // Reserved, should never fire
6576
.word isr_pendsv
6677
.word isr_systick
@@ -287,8 +298,20 @@ if_irq_decl 79 isr_irq79
287298
#if PICO_NUM_VTABLE_IRQS > 80
288299
#error more IRQ entries required
289300
#endif
301+
#if !PICO_RP2040
302+
// since these are disabled by default, map them all to __unhandled_user_irq (will have
303+
// a negative number
304+
decl_isr isr_memmanage
305+
decl_isr isr_busfault
306+
decl_isr isr_usagefault
307+
decl_isr isr_securefault
308+
decl_isr isr_debugmonitor
309+
#endif
290310

291-
// All unhandled USER IRQs fall through to here
311+
// All unhandled USER IRQs fall through to here.
312+
// Additionally, if the Armv9-M MemManage/BusFault/UsageFault/SescureFault/DebugMonitor exceptions
313+
// are enabled, but the handlers are not defined, then unhandled_user_irq_num_in_r0 will
314+
// also be reached, but with a negative exception number (e.g. MemManage == -12)
292315
.global __unhandled_user_irq
293316
.thumb_func
294317
__unhandled_user_irq:
@@ -305,7 +328,7 @@ unhandled_user_irq_num_in_r0:
305328

306329
decl_isr_bkpt isr_invalid
307330
#if !PICO_MINIMAL_STORED_VECTOR_TABLE
308-
// these are separated out for clarity
331+
// these are separated out into individual BKPT instructions with label for clarity
309332
decl_isr_bkpt isr_nmi
310333
decl_isr_bkpt isr_hardfault
311334
decl_isr_bkpt isr_svcall

0 commit comments

Comments
 (0)