Skip to main content

IAR Embedded Workbench for Arm 9.70.x

Processor modes and stacks

In this section:

The various processor modes need separate stacks. Knowing the names of the linker blocks for these can be necessary in some cases, for example when making settings on the Stack page of the IDE Options dialog box.

The Arm 7/9/11, Cortex-A, and Cortex-R devices support five exception modes which are entered when different exceptions occur. Each exception mode has its own stack to avoid corrupting the System/User mode stack.

Note

64-bit Arm cores and Cortex-M do not have individual exception stacks. By default, all exception stacks are placed in the CSTACK section.

The table shows default stack block names for the various stacks, but you can define your own names. Be aware, however, that the stack checking features that you can set on the Stack page of the IDE Options dialog box only work if the stack blocks are using these default names.

Processor mode

Default stack block name

Description

Supervisor

SVC_STACK

Operation system stack for Arm 7/9/11, Cortex-A, and Cortex-R.

IRQ

IRQ_STACK

Stack for general-purpose (IRQ) interrupt handlers for Arm 7/9/11, Cortex-A, and Cortex-R.

FIQ

FIQ_STACK

Stack for high-speed (FIQ) interrupt handlers for Arm 7/9/11, Cortex-A, and Cortex-R.

Undefined

UND_STACK

Stack for undefined instruction interrupts for Arm 7/9/11, Cortex-A, and Cortex-R. Supports software emulation of hardware coprocessors and instruction set extensions.

Abort

ABT_STACK

Stack for instruction fetch and data access memory abort interrupt handlers for Arm 7/9/11, Cortex-A, and Cortex-R.

User

CSTACK or USR_STACK

Stack for User mode.

Monitor

MON_STACK

Stack for context switching between Secure and Non-Secure states.

Hypervisor

HYP_STACK

Stack for access to facilities for virtualization.

Table 89. Stacks for Arm processor modes


For each processor mode where a stack is needed, a separate stack pointer must be initialized in your startup code, and section placement should be done in the linker configuration file. The IRQ and FIQ stacks are the only exception stacks which are preconfigured in the supplied cstartup.s and lnkarm.icf files, but other exception stacks can easily be added.

Caution

To view any of these stacks in the Stack window available in the IDE, the default block names must be used instead of user-defined block names.