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 <jianxiong.gu@outlook.com>
This commit is contained in:
Jianxiong Gu 2024-12-12 07:19:23 +08:00 committed by Benjamin Cabé
commit 74b502e914
3 changed files with 16 additions and 1 deletions

View file

@ -1,4 +1,5 @@
# Copyright (c) 2024 Michael Hope
# Copyright (c) 2024 Jianxiong Gu
# SPDX-License-Identifier: Apache-2.0
config SOC_FAMILY_CH32V
@ -10,6 +11,13 @@ config SOC_FAMILY_CH32V
if SOC_FAMILY_CH32V
config VECTOR_TABLE_SIZE
int "Number of Interrupt and Exception Vectors"
range 20 256
help
This option defines the total number of interrupt and exception
vectors in the vector table.
rsource "*/Kconfig"
endif # SOC_FAMILY_CH32V

View file

@ -3,6 +3,9 @@
if SOC_CH32V003
config VECTOR_TABLE_SIZE
default 38
config NUM_IRQS
default 48

View file

@ -6,6 +6,10 @@
#include <zephyr/toolchain.h>
#ifndef CONFIG_VECTOR_TABLE_SIZE
#error "VECTOR_TABLE_SIZE must be defined"
#endif
/* Exports */
GTEXT(__start)
@ -15,7 +19,7 @@ GTEXT(__initialize)
SECTION_FUNC(vectors, ivt)
.option norvc
j __start
.rept 38
.rept CONFIG_VECTOR_TABLE_SIZE
.word _isr_wrapper
.endr