From e816ac7124025a2aafa3a4f78bbc921f942f9c3c Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Mon, 14 Oct 2019 13:47:17 +0900 Subject: [PATCH] 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 --- arch/common/isr_tables.c | 23 +++++++++++++++++------ include/linker/common-ram.ld | 2 +- include/linker/common-rom.ld | 2 +- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/arch/common/isr_tables.c b/arch/common/isr_tables.c index 43b4dc88e0e..f7d11ce04b6 100644 --- a/arch/common/isr_tables.c +++ b/arch/common/isr_tables.c @@ -29,20 +29,31 @@ Z_GENERIC_SECTION(.irq_info) struct int_list_header _iheader = { /* These are placeholder tables. They will be replaced by the real tables * generated by gen_isr_tables.py. * - * z_irq_spurious and _isr_wrapper are used as placeholder values to - * ensure that they are not optimized out in the first link. The first - * link must contain the same symbols as the second one for the code - * generation to work. + * z_irq_spurious is used as a placeholder value to ensure that it is not + * optimized out in the first linker pass. The first linker pass must contain + * the same symbols as the second linker pass for the code generation to work. */ /* Some arches don't use a vector table, they have a common exception entry * point for all interrupts. Don't generate a table in this case. */ #ifdef CONFIG_GEN_IRQ_VECTOR_TABLE +/* When both the IRQ vector table and the software ISR table are used, populate + * the IRQ vector table with the common software ISR by default, such that all + * indirect interrupt vectors are handled using the software ISR table; + * otherwise, populate the IRQ vector table with z_irq_spurious so that all + * un-connected IRQ vectors end up in the spurious IRQ handler. + */ +#ifdef CONFIG_GEN_SW_ISR_TABLE +#define IRQ_VECTOR_TABLE_DEFAULT_ISR _isr_wrapper +#else +#define IRQ_VECTOR_TABLE_DEFAULT_ISR z_irq_spurious +#endif /* CONFIG_GEN_SW_ISR_TABLE */ + u32_t __irq_vector_table _irq_vector_table[IRQ_TABLE_SIZE] = { - [0 ...(IRQ_TABLE_SIZE - 1)] = (u32_t)&_isr_wrapper, + [0 ...(IRQ_TABLE_SIZE - 1)] = (u32_t)&IRQ_VECTOR_TABLE_DEFAULT_ISR, }; -#endif +#endif /* CONFIG_GEN_IRQ_VECTOR_TABLE */ /* If there are no interrupts at all, or all interrupts are of the 'direct' * type and bypass the _sw_isr_table, then do not generate one. diff --git a/include/linker/common-ram.ld b/include/linker/common-ram.ld index 41525be9d65..d95a2b697c1 100644 --- a/include/linker/common-ram.ld +++ b/include/linker/common-ram.ld @@ -5,7 +5,7 @@ DEVICE_INIT_SECTIONS() } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) -#if defined(CONFIG_GEN_ISR_TABLES) && defined(CONFIG_DYNAMIC_INTERRUPTS) +#if defined(CONFIG_GEN_SW_ISR_TABLE) && defined(CONFIG_DYNAMIC_INTERRUPTS) SECTION_DATA_PROLOGUE(sw_isr_table,,) { /* diff --git a/include/linker/common-rom.ld b/include/linker/common-rom.ld index 35f184cffd0..3ed9e6d476c 100644 --- a/include/linker/common-rom.ld +++ b/include/linker/common-rom.ld @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: Apache-2.0 */ -#if defined(CONFIG_GEN_ISR_TABLES) && !defined(CONFIG_DYNAMIC_INTERRUPTS) +#if defined(CONFIG_GEN_SW_ISR_TABLE) && !defined(CONFIG_DYNAMIC_INTERRUPTS) SECTION_PROLOGUE(sw_isr_table,,) { /*