nios2: use gen_isr_tables mechanism

Change-Id: If1ffcedf86a015789b42e7aec45dae3cc58f74fa
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2017-02-09 14:37:32 -08:00 committed by Anas Nashif
commit c99c686b2c
6 changed files with 30 additions and 67 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 <toolchain.h>
#include <sections.h>
#include <arch/cpu.h>
/*
* 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

View file

@ -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;

View file

@ -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 <custom-sections.ld>
#endif
#ifdef CONFIG_GEN_ISR_TABLES
#include <linker/intlist.ld>
#endif
}