File tree Expand file tree Collapse file tree 4 files changed +21
-3
lines changed
soc/common/riscv-privileged Expand file tree Collapse file tree 4 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -262,6 +262,15 @@ config RISCV_GENERIC_TOOLCHAIN
262
262
Allow SOCs that have custom extended riscv ISA to still
263
263
compile with generic riscv32 toolchain.
264
264
265
+ config USE_ISR_WRAPPER
266
+ bool "Use isr_wrapper to handle interrupt and/or exception/fault"
267
+ default y if GEN_SW_ISR_TABLE
268
+ default y if MULTITHREADING
269
+ help
270
+ This is helper config to be able to use exception handling
271
+ when GEN_SW_ISR_TABLE is not used but multithreading is, which
272
+ needs exception handling and thread entry/switch functions.
273
+
265
274
config GEN_ISR_TABLES
266
275
default y
267
276
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ endif()
26
26
zephyr_library_sources_ifdef (CONFIG_FPU_SHARING fpu.c fpu.S )
27
27
zephyr_library_sources_ifdef (CONFIG_DEBUG_COREDUMP coredump.c )
28
28
zephyr_library_sources_ifdef (CONFIG_IRQ_OFFLOAD irq_offload.c )
29
- zephyr_library_sources_ifdef (CONFIG_GEN_SW_ISR_TABLE isr.S )
29
+ zephyr_library_sources_ifdef (CONFIG_USE_ISR_WRAPPER isr.S )
30
30
zephyr_library_sources_ifdef (CONFIG_RISCV_PMP pmp.c pmp.S )
31
31
zephyr_library_sources_ifdef (CONFIG_THREAD_LOCAL_STORAGE tls.c )
32
32
zephyr_library_sources_ifdef (CONFIG_USERSPACE userspace.S )
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ GTEXT(__soc_is_irq)
73
73
#endif
74
74
GTEXT(__soc_handle_irq)
75
75
GTEXT(z_riscv_fault)
76
+ GTEXT(z_irq_spurious)
76
77
#ifdef CONFIG_RISCV_SOC_CONTEXT_SAVE
77
78
GTEXT(__soc_save_context)
78
79
GTEXT(__soc_restore_context)
@@ -331,6 +332,7 @@ no_fp: /* increment _current->arch.exception_depth */
331
332
* function (that needs to be implemented by each SOC). The result is
332
333
* returned via register a0 (1: interrupt, 0 exception)
333
334
*/
335
+
334
336
#ifdef CONFIG_RISCV_SOC_EXCEPTION_FROM_IRQ
335
337
jal ra, __soc_is_irq
336
338
bnez a0, is_interrupt
@@ -646,6 +648,7 @@ on_irq_stack:
646
648
*/
647
649
jal ra, __soc_handle_irq
648
650
651
+ #if defined CONFIG_GEN_SW_ISR_TABLE
649
652
/*
650
653
* Call corresponding registered function in _sw_isr_table.
651
654
* (table is 2-word wide, we should shift index accordingly)
@@ -659,6 +662,12 @@ on_irq_stack:
659
662
660
663
/* Load ISR function address in register t1 */
661
664
lr t1, RV_REGSIZE(t0)
665
+ #else
666
+ /* Load spurious interrupt function in case _sw_isr_table does not exist */
667
+ la t1, z_irq_spurious
668
+ /* NULL as parameter */
669
+ li a0, 0
670
+ #endif
662
671
663
672
/* Call ISR function */
664
673
jalr ra, t1, 0
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ GTEXT(__start)
12
12
13
13
/* imports */
14
14
GTEXT(__initialize)
15
- #if defined(CONFIG_GEN_SW_ISR_TABLE )
15
+ #if defined(CONFIG_USE_ISR_WRAPPER )
16
16
GTEXT(_isr_wrapper)
17
17
#endif
18
18
@@ -41,7 +41,7 @@ SECTION_FUNC(vectors, __start)
41
41
* mtvec.base must be aligned to 64 bytes (this is done using
42
42
* CONFIG_RISCV_TRAP_HANDLER_ALIGNMENT)
43
43
*/
44
- #if defined(CONFIG_GEN_SW_ISR_TABLE )
44
+ #if defined(CONFIG_USE_ISR_WRAPPER )
45
45
la t0, _isr_wrapper
46
46
#else
47
47
add t0, zero, zero
You can’t perform that action at this time.
0 commit comments