diff --git a/arch/common/gen_isr_tables.py b/arch/common/gen_isr_tables.py index 754d78432de..95c9afb3a45 100755 --- a/arch/common/gen_isr_tables.py +++ b/arch/common/gen_isr_tables.py @@ -58,7 +58,7 @@ def read_intlist(intlist_path): prefix = endian_prefix() - intlist_header_fmt = prefix + "IIII" + intlist_header_fmt = prefix + "IIIII" intlist_entry_fmt = prefix + "iiII" with open(intlist_path, "rb") as fp: @@ -72,8 +72,9 @@ def read_intlist(intlist_path): intlist["spurious_handler"] = header[0] intlist["sw_irq_handler"] = header[1] - intlist["num_isrs"] = header[2] - intlist["num_vectors"] = header[3] + intlist["num_vectors"] = header[2] + intlist["offset"] = header[3] + intlist["num_isrs"] = header[4] debug("spurious handler: %s" % hex(header[0])) @@ -148,6 +149,7 @@ def main(): intlist = read_intlist(args.intlist) nvec = intlist["num_vectors"] + offset = intlist["offset"] prefix = endian_prefix() # Set default entries in both tables @@ -173,14 +175,14 @@ def main(): if (param != 0): error("Direct irq %d declared, but has non-NULL parameter" % irq) - vt[irq] = func + vt[irq - offset] = func else: # Regular interrupt if not swt: error("Regular Interrupt %d declared with parameter 0x%x " "but no SW ISR_TABLE in use" % (irq, param)) - swt[irq] = (param, func) + swt[irq - offset] = (param, func) with open(args.output_source, "w") as fp: write_source_file(fp, vt, swt, intlist) diff --git a/arch/common/isr_tables.c b/arch/common/isr_tables.c index db306f7f03b..36c973862ce 100644 --- a/arch/common/isr_tables.c +++ b/arch/common/isr_tables.c @@ -15,13 +15,26 @@ #define ISR_WRAPPER NULL #endif +/* There is an additional member at the end populated by the linker script + * which indicates the number of interrupts specified + */ +struct int_list_header { + void *spurious_ptr; + void *handler_ptr; + uint32_t table_size; + uint32_t offset; +}; + /* These values are not included in the resulting binary, but instead form the * header of the initList section, which is used by gen_isr_tables.py to create * the vector and sw isr tables, */ -_GENERIC_SECTION(.irq.spurious) void *_irq_spurious_ptr = &_irq_spurious; -_GENERIC_SECTION(.irq.handler) void *_irq_handler_ptr = ISR_WRAPPER; -_GENERIC_SECTION(.irq.tablesize) uint32_t _irq_table_size = IRQ_TABLE_SIZE; +_GENERIC_SECTION(.irq_info) struct int_list_header _iheader = { + .spurious_ptr = &_irq_spurious, + .handler_ptr = ISR_WRAPPER, + .table_size = IRQ_TABLE_SIZE, + .offset = CONFIG_GEN_IRQ_START_VECTOR, +}; /* These are placeholder tables. They will be replaced by the real tables * generated by gen_isr_tables.py. diff --git a/include/linker/intlist.ld b/include/linker/intlist.ld index 5d9756d25b1..6299113c887 100644 --- a/include/linker/intlist.ld +++ b/include/linker/intlist.ld @@ -42,10 +42,8 @@ SECTION_PROLOGUE(.intList,,) { - KEEP(*(.irq.spurious)) - KEEP(*(.irq.handler)) + KEEP(*(.irq_info)) LONG((__INT_LIST_END__ - __INT_LIST_START__) / __ISR_LIST_SIZEOF) - KEEP(*(.irq.tablesize)) __INT_LIST_START__ = .; KEEP(*(.intList)) __INT_LIST_END__ = .;