diff --git a/arch/common/Makefile.gen_isr_tables b/arch/common/Makefile.gen_isr_tables index 0f51fa6c609..54923f90f04 100644 --- a/arch/common/Makefile.gen_isr_tables +++ b/arch/common/Makefile.gen_isr_tables @@ -5,6 +5,9 @@ OUTPUT_OBJ := isr_tables.o ifeq ($(ARCH),arm) OUTPUT_FORMAT := elf32-littlearm OUTPUT_ARCH := arm +else ifeq ($(ARCH),nios2) +OUTPUT_FORMAT := elf32-littlenios2 +OUTPUT_ARCH := nios2 else $(error Output formats not defined for this architecture) endif diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig index 44cb7a86953..ebb37dc6e70 100644 --- a/arch/nios2/Kconfig +++ b/arch/nios2/Kconfig @@ -37,6 +37,16 @@ config XIP bool default y +config GEN_ISR_TABLES + default y + +config GEN_IRQ_VECTOR_TABLE + default n + +config NUM_IRQS + int + default 32 + config IRQ_OFFLOAD bool "Enable IRQ offload" default n diff --git a/arch/nios2/core/Makefile b/arch/nios2/core/Makefile index 6ef0ce02384..af03974db13 100644 --- a/arch/nios2/core/Makefile +++ b/arch/nios2/core/Makefile @@ -3,6 +3,6 @@ ccflags-y += -I$(srctree)/arch/$(ARCH)/include obj-y += reset.o irq_manage.o fatal.o swap.o thread.o \ cpu_idle.o irq_offload.o prep_c.o crt0.o \ - exception.o sw_isr_table.o cache.o + exception.o cache.o obj-$(CONFIG_IRQ_OFFLOAD) += irq_offload.o diff --git a/arch/nios2/core/sw_isr_table.S b/arch/nios2/core/sw_isr_table.S deleted file mode 100644 index 47488c641d6..00000000000 --- a/arch/nios2/core/sw_isr_table.S +++ /dev/null @@ -1,49 +0,0 @@ -/* sw_isr_table.S - ISR table for static ISR declarations for ARC */ - -/* - * Copyright (c) 2015 Intel Corporation - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -/* - * enable preprocessor features, such - * as %expr - evaluate the expression and use it as a string - */ -.altmacro - -/* - * Define an ISR table entry - * Define symbol as weak and give the section .gnu.linkonce - * prefix. This allows linker overload the symbol and the - * whole section by the one defined by a device driver - */ -.macro _isr_table_entry_declare index - WDATA(_isr_irq\index) - .section .gnu.linkonce.isr_irq\index - _isr_irq\index: .word 0xABAD1DEA, _irq_spurious -.endm - -/* - * Declare the ISR table - */ -.macro _isr_table_declare from, to - counter = \from - .rept (\to - \from) - _isr_table_entry_declare %counter - counter = counter + 1 - .endr -.endm - -GTEXT(_irq_spurious) -GDATA(_sw_isr_table) - -.section .isr_irq0 -.align -_sw_isr_table: - -_isr_table_declare 0 NIOS2_NIRQ diff --git a/include/arch/nios2/arch.h b/include/arch/nios2/arch.h index 352b209e54c..dbc912bf802 100644 --- a/include/arch/nios2/arch.h +++ b/include/arch/nios2/arch.h @@ -74,14 +74,12 @@ typedef unsigned int vaddr_t; */ #define _ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p) \ ({ \ - enum { IRQ = irq_p }; \ - static struct _isr_table_entry _CONCAT(_isr_irq, irq_p) \ - __attribute__ ((used)) \ - __attribute__ ((section(STRINGIFY(_CONCAT(.gnu.linkonce.isr_irq, irq_p))))) = \ - {isr_param_p, isr_p}; \ + _ISR_DECLARE(irq_p, 0, isr_p, isr_param_p); \ irq_p; \ }) +extern void _irq_spurious(void *unused); + static ALWAYS_INLINE unsigned int _arch_irq_lock(void) { unsigned int key, tmp; diff --git a/include/arch/nios2/linker.ld b/include/arch/nios2/linker.ld index 316f73b1c3c..4f75c2fc3e5 100644 --- a/include/arch/nios2/linker.ld +++ b/include/arch/nios2/linker.ld @@ -61,6 +61,9 @@ MEMORY RESET (rx) : ORIGIN = _RESET_VECTOR, LENGTH = 0x20 FLASH (rx) : ORIGIN = _RESET_VECTOR + 0x20 , LENGTH = (_ROM_SIZE - 0x20) SRAM (wx) : ORIGIN = _EXC_VECTOR, LENGTH = _RAM_SIZE - (_EXC_VECTOR - _RAM_ADDR) + /* Used by and documented in include/linker/intlist.ld */ + IDT_LIST (wx) : ORIGIN = 0xFFFFF7FF, LENGTH = 2K + } #else @@ -69,6 +72,9 @@ MEMORY { RESET (wx) : ORIGIN = _RESET_VECTOR, LENGTH = 0x20 SRAM (wx) : ORIGIN = _EXC_VECTOR, LENGTH = _RAM_SIZE - (_EXC_VECTOR - _RAM_ADDR) + + /* Used by and documented in include/linker/intlist.ld */ + IDT_LIST (wx) : ORIGIN = 0xFFFFF7FF, LENGTH = 2K } #endif @@ -158,18 +164,9 @@ SECTIONS SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,) { - - KEEP(*(.isr_irq*)) - - /* sections for IRQ0-9 */ - KEEP(*(SORT(.gnu.linkonce.isr_irq[0-9]))) - - /* sections for IRQ10-99 */ - KEEP(*(SORT(.gnu.linkonce.isr_irq[0-9][0-9]))) - - /* sections for IRQ100-999 */ - KEEP(*(SORT(.gnu.linkonce.isr_irq[0-9][0-9][0-9]))) - +#ifdef CONFIG_GEN_SW_ISR_TABLE + KEEP(*(SW_ISR_TABLE)) +#endif *(.data) *(".data.*") @@ -241,6 +238,10 @@ SECTIONS #ifdef CONFIG_CUSTOM_SECTIONS_LD /* Located in project source directory */ #include +#endif + +#ifdef CONFIG_GEN_ISR_TABLES +#include #endif }