Skip to content

Commit 74b502e

Browse files
recalcikartben
authored andcommitted
soc: wch: add generic vector table support
Add `VECTOR_TABLE_SIZE` Kconfig option to define the number of interrupt and exception vectors based on the actual hardware specification. Signed-off-by: Jianxiong Gu <[email protected]>
1 parent 957ec63 commit 74b502e

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

soc/wch/ch32v/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Copyright (c) 2024 Michael Hope
2+
# Copyright (c) 2024 Jianxiong Gu
23
# SPDX-License-Identifier: Apache-2.0
34

45
config SOC_FAMILY_CH32V
@@ -10,6 +11,13 @@ config SOC_FAMILY_CH32V
1011

1112
if SOC_FAMILY_CH32V
1213

14+
config VECTOR_TABLE_SIZE
15+
int "Number of Interrupt and Exception Vectors"
16+
range 20 256
17+
help
18+
This option defines the total number of interrupt and exception
19+
vectors in the vector table.
20+
1321
rsource "*/Kconfig"
1422

1523
endif # SOC_FAMILY_CH32V

soc/wch/ch32v/qingke_v2a/Kconfig.defconfig.ch32v003

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
if SOC_CH32V003
55

6+
config VECTOR_TABLE_SIZE
7+
default 38
8+
69
config NUM_IRQS
710
default 48
811

soc/wch/ch32v/qingke_v2a/vector.S

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
#include <zephyr/toolchain.h>
88

9+
#ifndef CONFIG_VECTOR_TABLE_SIZE
10+
#error "VECTOR_TABLE_SIZE must be defined"
11+
#endif
12+
913
/* Exports */
1014
GTEXT(__start)
1115

@@ -15,7 +19,7 @@ GTEXT(__initialize)
1519
SECTION_FUNC(vectors, ivt)
1620
.option norvc
1721
j __start
18-
.rept 38
22+
.rept CONFIG_VECTOR_TABLE_SIZE
1923
.word _isr_wrapper
2024
.endr
2125

0 commit comments

Comments
 (0)