Nios® II Software Developer Handbook

ID 683525
Date 8/28/2023
Public
Document Table of Contents

9.3.1.7.2. Separate Hardware Interrupt Stack

The separate hardware interrupt stack is available with the EIC interface. The separate hardware interrupt stack is not applicable to the IIC. With the IIC, hardware interrupts and software exceptions use the same stack.The following BSP settings enable you to control the separate hardware interrupt stack:
  • hal.linker.enable_interrupt_stack enables a separate hardware interrupt stack.
  • hal.linker.interrupt_stack_size controls the size of the hardware interrupt stack.
  • hal.linker.interrupt_stack_memory_region_name enables you to control where the hardware interrupt stack is positioned in memory.

The HAL funnel code takes care of correctly changing the stack pointer on entry to and exit from an ISR.

Table 44.  Separate Exception Stack Usage
Interrupt Controller BSP Settings Application Stack General Exception Stack Hardware Interrupt Stack
Separate General

Exception Stack Enabled

Separate Hardware

Interrupt Stack Enabled

Internal No
  • Application
  • Software exceptions
  • Hardware interrupts
Yes Application
  • Software exceptions
  • Hardware interrupts
External No No
  • Application
  • Software exceptions
  • Hardware interrupts
Yes
  • Application
  • Software exceptions
Hardware interrupts
Yes No
  • Application
  • Hardware interrupts
Software exceptions
Yes Application Software exceptions Hardware interrupts
Note: If your ISR is located in a vector table, the HAL does not provide funnel code. In this case, your code must manage the stack pointer, as well as all other funnel code functions.

For more information about implementing a separate hardware interrupt stack, refer to AN595: Vectored Interrupt Controller Applications and Usage.