Skip to content

Commit 87d32cd

Browse files
committed
isr_tables: Support hardware interrupt vector table-only configuration.
The existing isr_tables implementation does not allow enabling only hardware interrupt vector table without software isr table. This commit ensures that CONFIG_GEN_IRQ_VECTOR_TABLE can be used without setting CONFIG_GEN_SW_ISR_TABLE. Signed-off-by: Stephanos Ioannidis <[email protected]>
1 parent 34d5e2b commit 87d32cd

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

arch/common/isr_tables.c

+17-6
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,31 @@ Z_GENERIC_SECTION(.irq_info) struct int_list_header _iheader = {
2929
/* These are placeholder tables. They will be replaced by the real tables
3030
* generated by gen_isr_tables.py.
3131
*
32-
* z_irq_spurious and _isr_wrapper are used as placeholder values to
33-
* ensure that they are not optimized out in the first link. The first
34-
* link must contain the same symbols as the second one for the code
35-
* generation to work.
32+
* z_irq_spurious is used as a placeholder value to ensure that it is not
33+
* optimized out in the first linker pass. The first linker pass must contain
34+
* the same symbols as the second linker pass for the code generation to work.
3635
*/
3736

3837
/* Some arches don't use a vector table, they have a common exception entry
3938
* point for all interrupts. Don't generate a table in this case.
4039
*/
4140
#ifdef CONFIG_GEN_IRQ_VECTOR_TABLE
41+
/* When both the IRQ vector table and the software ISR table are used, populate
42+
* the IRQ vector table with the common software ISR by default, such that all
43+
* indirect interrupt vectors are handled using the software ISR table;
44+
* otherwise, populate the IRQ vector table with z_irq_spurious so that all
45+
* un-connected IRQ vectors end up in the spurious IRQ handler.
46+
*/
47+
#ifdef CONFIG_GEN_SW_ISR_TABLE
48+
#define IRQ_VECTOR_TABLE_DEFAULT_ISR _isr_wrapper
49+
#else
50+
#define IRQ_VECTOR_TABLE_DEFAULT_ISR z_irq_spurious
51+
#endif /* CONFIG_GEN_SW_ISR_TABLE */
52+
4253
u32_t __irq_vector_table _irq_vector_table[IRQ_TABLE_SIZE] = {
43-
[0 ...(IRQ_TABLE_SIZE - 1)] = (u32_t)&_isr_wrapper,
54+
[0 ...(IRQ_TABLE_SIZE - 1)] = (u32_t)&IRQ_VECTOR_TABLE_DEFAULT_ISR,
4455
};
45-
#endif
56+
#endif /* CONFIG_GEN_IRQ_VECTOR_TABLE */
4657

4758
/* If there are no interrupts at all, or all interrupts are of the 'direct'
4859
* type and bypass the _sw_isr_table, then do not generate one.

include/linker/common-ram.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
DEVICE_INIT_SECTIONS()
66
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
77

8-
#if defined(CONFIG_GEN_ISR_TABLES) && defined(CONFIG_DYNAMIC_INTERRUPTS)
8+
#if defined(CONFIG_GEN_SW_ISR_TABLE) && defined(CONFIG_DYNAMIC_INTERRUPTS)
99
SECTION_DATA_PROLOGUE(sw_isr_table,,)
1010
{
1111
/*

include/linker/common-rom.ld

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* SPDX-License-Identifier: Apache-2.0 */
22

3-
#if defined(CONFIG_GEN_ISR_TABLES) && !defined(CONFIG_DYNAMIC_INTERRUPTS)
3+
#if defined(CONFIG_GEN_SW_ISR_TABLE) && !defined(CONFIG_DYNAMIC_INTERRUPTS)
44
SECTION_PROLOGUE(sw_isr_table,,)
55
{
66
/*

0 commit comments

Comments
 (0)