Skip to content

isr_tables: Support hardware interrupt vector table-only configuration. #22742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions arch/common/isr_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add a comment here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about an inline comment here at the #else? This seems to be the differentiation brought in this patch

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if I understand what you mean by "inline comment" here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I'd like a comment as the one in lines 41-44, for the #else case, i.e. when only the vector tables are used.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was quite self-explanatory -- that unconnected IRQs should have z_irq_spurious, as you would in _sw_isr_table.

I will add a comment explaining this anyway, since this might not be as obvious to the person reading this for the first time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, please

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/* 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.
 */

#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.
Expand Down
2 changes: 1 addition & 1 deletion include/linker/common-ram.ld
Original file line number Diff line number Diff line change
Expand Up @@ -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,,)
{
/*
Expand Down
2 changes: 1 addition & 1 deletion include/linker/common-rom.ld
Original file line number Diff line number Diff line change
@@ -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,,)
{
/*
Expand Down