You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* There was a pre-existing (undocumented) variable PICO_NO_STORED_VECTOR_TABLE that did something similar (have replaced that with the new var)
* Renamed PICO_MINIMAL_VECTOR_TABLE to PICO_MINIMAL_STORED_VECTOR_TABLE to contrast PICO_NO_RAM_VECTOR_TABLE
* Explicitly mentioned that PICO_MINIMAL_STORED_VECTOR_TABLE has no effect on RISC-V atm
* Added a new documented variable PICO_NUM_VTABLE_IRQs to indicate how many IRQs the user would like to store in the vtable (either stored or RAM) - this is the limit of what any IRQ api can touch, or indeed what isr_irqN you can override. This is a better alternative to changing PICO_RAM_VECTOR_TABLE_SIZE (which wasn't documented), but did allow you (unsafely) to limit the RAM vector table size (but not the stored size)
TLDR:
1. if you set PICO_MINIMAL_STORED_VECTOR_TABLE=1, you get a 4 word VTABLE on Arm.. you still get a RAM vector table with up to PICO_NUM_VTABLE_IRQs (defaults to NUM_IRQs) but everything - including things like `isr_pendsv` point to `__unhandled_user_irq`.
2. PICO_NUM_VTABLE_IRQs (default NUM_IRQS) sets the number of IRQs that have handlers in the VTABLE (this affects the space reserved, and what the irq APIs let you touch - at least as far as invalid_params_if!)
3. If you set PICO_MINIMAL_STORED_VECTOR_TABLE=1 for a no flash binary, then PICO_NUM_VTABLE_IRQs is forced to 0 as there is no reserved space for the handlers.
// PICO_CONFIG: PICO_CLKDIV_ROUND_NEAREST, True if floating point clock divisors should be rounded to the nearest possible clock divisor by default rather than rounding down, type=bool, default=1, group=pico_platform
Copy file name to clipboardExpand all lines: src/rp2_common/hardware_irq/include/hardware/irq.h
+20-1Lines changed: 20 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,25 @@
23
23
#definePICO_VTABLE_PER_CORE 0
24
24
#endif
25
25
26
+
// note this is defined here as it simplifies dependencies
27
+
// PICO_CONFIG: PICO_MINIMAL_STORED_VECTOR_TABLE, Only store a very minimal vector table in the binary on Arm, type=bool, default=0, advanced=true, group=pico_crt0
#warning PICO_NUM_VTABLE_IRQS is specied with PICO_MINIMAL_STORED_VECTOR_TABLE for NO_FLASH Arm binary; ignored
35
+
#undef PICO_NUM_VTABLE_IRQS
36
+
#endif
37
+
#definePICO_NUM_VTABLE_IRQS 0
38
+
#else
39
+
// PICO_CONFIG: PICO_NUM_VTABLE_IRQS, Number of IRQ handlers in the vector table - can be lowered to save space if you aren't using some higher IRQs, type=int, default=NUM_IRQS, group=hardware_irq
Copy file name to clipboardExpand all lines: src/rp2_common/pico_crt0/crt0.S
+21-25Lines changed: 21 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@
11
11
12
12
#include "hardware/regs/addressmap.h"
13
13
#include "hardware/regs/sio.h"
14
+
#include "hardware/irq.h"
14
15
#include "pico/binary_info/defs.h"
15
16
#include "boot/picobin.h"
16
17
#include "pico/bootrom.h"
@@ -23,26 +24,22 @@
23
24
24
25
pico_default_asm_setup
25
26
27
+
#ifdef PICO_NO_STORED_VECTOR_TABLE
28
+
#warning PICO_NO_STORED_VECTOR_TABLE is no longer used. PICO_MINIMAL_STORED_VECTOR_TABLE is not identical but usually serves the same purpose
29
+
#endif
30
+
26
31
.section .vectors,"ax"
27
32
.align2
28
33
29
-
// 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
30
-
#ifndef PICO_MINIMAL_VECTOR_TABLE
31
-
#define PICO_MINIMAL_VECTOR_TABLE 0
32
-
#endif
33
-
34
-
.global__vectors, __VECTOR_TABLE
34
+
.global__vectors, __VECTOR_TABLE, __vectors_end
35
35
__VECTOR_TABLE:
36
36
__vectors:
37
37
.word __StackTop
38
38
.word _reset_handler
39
39
40
-
#if PICO_MINIMAL_VECTOR_TABLE
41
40
.word isr_invalid // NMI
42
41
.word isr_invalid // HardFault
43
-
#else
44
-
.word isr_nmi
45
-
.word isr_hardfault
42
+
#if !PICO_MINIMAL_STORED_VECTOR_TABLE
46
43
.word isr_invalid // Reserved, should never fire
47
44
.word isr_invalid // Reserved, should never fire
48
45
.word isr_invalid // Reserved, should never fire
@@ -55,15 +52,9 @@ __vectors:
55
52
.word isr_invalid // Reserved, should never fire
56
53
.word isr_pendsv
57
54
.word isr_systick
58
-
#if PICO_NO_STORED_VECTOR_TABLE && !PICO_NO_FLASH // note in no flash binary, we only have the single RAM vector table anyway
59
-
#if PICO_NO_RAM_VECTOR_TABLE
60
-
#error Can't specify PICO_NO_STORED_VECTOR_TABLE and PICO_NO_RAM_VECTOR_TABLE
61
-
#endif
62
-
// we don't include any IRQ vectors; we will initialize them during runtime_init in the RAM vector table
63
-
#else
64
55
65
56
.macro if_irq_word num func
66
-
.if \num < NUM_IRQS
57
+
.if \num < PICO_NUM_VTABLE_IRQS
67
58
.word \func
68
59
.endif
69
60
.endm
@@ -152,11 +143,11 @@ if_irq_word 76 isr_irq76
152
143
if_irq_word 77 isr_irq77
153
144
if_irq_word 78 isr_irq78
154
145
if_irq_word 79 isr_irq79
155
-
#if NUM_IRQS > 80
146
+
#if PICO_NUM_VTABLE_IRQS > 80
156
147
#error more IRQ entries required
157
148
#endif
158
-
#endif
159
-
#endif // #if !PICO_MINIMAL_VECTOR_TABLE
149
+
#endif // #if !PICO_MINIMAL_STORED_VECTOR_TABLE
150
+
__vectors_end:
160
151
161
152
// all default exception handlers do nothing,and we can check for them being set to our
162
153
// default values by seeing if they point to somewhere between __defaults_isrs_start and __default_isrs_end
0 commit comments