Skip to content

Commit 2fe1e0a

Browse files
committed
Move into platform.h, and prevent use of irqs without entries
1 parent de16925 commit 2fe1e0a

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

src/rp2040/pico_platform/include/pico/platform.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,13 @@
6666
#define PICO_RP2040_B2_SUPPORTED 1
6767
#endif
6868

69+
// PICO_CONFIG: PICO_VECTOR_TABLE_NUM_IRQS, Number of IRQ vectors to include in the vector table, type=int, default=NUM_IRQS, advanced=true, group=pico_platform
70+
#ifndef PICO_VECTOR_TABLE_NUM_IRQS
71+
#define PICO_VECTOR_TABLE_NUM_IRQS NUM_IRQS
72+
#endif
73+
6974
#ifndef PICO_RAM_VECTOR_TABLE_SIZE
70-
#define PICO_RAM_VECTOR_TABLE_SIZE (VTABLE_FIRST_IRQ + NUM_IRQS)
75+
#define PICO_RAM_VECTOR_TABLE_SIZE (VTABLE_FIRST_IRQ + PICO_VECTOR_TABLE_NUM_IRQS)
7176
#endif
7277

7378
// 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

src/rp2350/pico_platform/include/pico/platform.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,13 @@
5454
#define PICO_NO_RAM_VECTOR_TABLE 0
5555
#endif
5656

57+
// PICO_CONFIG: PICO_VECTOR_TABLE_NUM_IRQS, Number of IRQ vectors to include in the vector table, type=int, default=NUM_IRQS, advanced=true, group=pico_platform
58+
#ifndef PICO_VECTOR_TABLE_NUM_IRQS
59+
#define PICO_VECTOR_TABLE_NUM_IRQS NUM_IRQS
60+
#endif
61+
5762
#ifndef PICO_RAM_VECTOR_TABLE_SIZE
58-
#define PICO_RAM_VECTOR_TABLE_SIZE (VTABLE_FIRST_IRQ + NUM_IRQS)
63+
#define PICO_RAM_VECTOR_TABLE_SIZE (VTABLE_FIRST_IRQ + PICO_VECTOR_TABLE_NUM_IRQS)
5964
#endif
6065

6166
// PICO_CONFIG: PICO_USE_STACK_GUARDS, Enable/disable stack guards, type=bool, default=0, advanced=true, group=pico_platform
@@ -284,4 +289,3 @@ __force_inline static int32_t __mul_instruction(int32_t a, int32_t b) {
284289
#endif // __ASSEMBLER__
285290

286291
#endif
287-

src/rp2_common/hardware_irq/include/hardware/irq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ extern "C" {
195195
typedef void (*irq_handler_t)(void);
196196

197197
static inline void check_irq_param(__unused uint num) {
198-
invalid_params_if(HARDWARE_IRQ, num >= NUM_IRQS);
198+
invalid_params_if(HARDWARE_IRQ, num >= PICO_VECTOR_TABLE_NUM_IRQS);
199199
}
200200

201201
/*! \brief Set specified interrupt's priority

src/rp2_common/pico_crt0/crt0.S

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ __vectors:
5252
// we don't include any IRQ vectors; we will initialize them during runtime_init in the RAM vector table
5353
#else
5454

55-
// PICO_CONFIG: PICO_VECTOR_TABLE_NUM_IRQS, Number of IRQ vectors to include in the vector table, type=int, default=NUM_IRQS, group=pico_crt0
56-
#ifndef PICO_VECTOR_TABLE_NUM_IRQS
57-
#define PICO_VECTOR_TABLE_NUM_IRQS NUM_IRQS
58-
#endif
59-
6055
.macro if_irq_word num func
6156
.if \num < PICO_VECTOR_TABLE_NUM_IRQS
6257
.word \func

0 commit comments

Comments
 (0)