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

Add PICO_MINIMAL_VECTOR_TABLE compile option #2233

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/rp2_common/pico_crt0/crt0.S
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,21 @@ pico_default_asm_setup
.section .vectors, "ax"
.align 2

// PICO_CONFIG: PICO_MINIMAL_VECTOR_TABLE, Use Minimal Vector Table - this prevents use of all interrupts, type=bool, default=0, advanced=true, group=pico_crt0
#ifndef PICO_MINIMAL_VECTOR_TABLE
#define PICO_MINIMAL_VECTOR_TABLE 0
#endif

.global __vectors, __VECTOR_TABLE
__VECTOR_TABLE:
__vectors:
.word __StackTop
.word _reset_handler

#if PICO_MINIMAL_VECTOR_TABLE
.word isr_invalid // NMI
.word isr_invalid // HardFault
#else
.word isr_nmi
.word isr_hardfault
.word isr_invalid // Reserved, should never fire
Expand Down Expand Up @@ -146,6 +156,7 @@ if_irq_word 79 isr_irq79
#error more IRQ entries required
#endif
#endif
#endif // #if !PICO_MINIMAL_VECTOR_TABLE

// all default exception handlers do nothing, and we can check for them being set to our
// default values by seeing if they point to somewhere between __defaults_isrs_start and __default_isrs_end
Expand All @@ -166,6 +177,7 @@ __default_isrs_start:

// these are separated out for clarity
decl_isr_bkpt isr_invalid
#if !PICO_MINIMAL_VECTOR_TABLE
decl_isr_bkpt isr_nmi
decl_isr_bkpt isr_hardfault
decl_isr_bkpt isr_svcall
Expand Down Expand Up @@ -287,6 +299,7 @@ __unhandled_user_irq:
.global unhandled_user_irq_num_in_r0
unhandled_user_irq_num_in_r0:
bkpt #0
#endif // #if !PICO_MINIMAL_VECTOR_TABLE

// ----------------------------------------------------------------------------

Expand Down