diff --git a/soc/wch/ch32v/Kconfig b/soc/wch/ch32v/Kconfig index 736c76ba659..86da17a0321 100644 --- a/soc/wch/ch32v/Kconfig +++ b/soc/wch/ch32v/Kconfig @@ -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 diff --git a/soc/wch/ch32v/qingke_v2a/Kconfig.defconfig.ch32v003 b/soc/wch/ch32v/qingke_v2a/Kconfig.defconfig.ch32v003 index d687a36a7a2..44d27fd3865 100644 --- a/soc/wch/ch32v/qingke_v2a/Kconfig.defconfig.ch32v003 +++ b/soc/wch/ch32v/qingke_v2a/Kconfig.defconfig.ch32v003 @@ -3,6 +3,9 @@ if SOC_CH32V003 +config VECTOR_TABLE_SIZE + default 38 + config NUM_IRQS default 48 diff --git a/soc/wch/ch32v/qingke_v2a/vector.S b/soc/wch/ch32v/qingke_v2a/vector.S index 7abbc167c9c..d078444d85e 100644 --- a/soc/wch/ch32v/qingke_v2a/vector.S +++ b/soc/wch/ch32v/qingke_v2a/vector.S @@ -6,6 +6,10 @@ #include +#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