Keil Logo

NOFRAME Compiler Directive






Interrupt routines are created with prolog and epilog.


This directive cannot be entered at command line level.


The NOFRAME directive suppresses the prolog and epilog for an Interrupt Service Routine (ISR). By default, the C166 Compiler adds a prolog and epilog that save and restore used register to interrupt functions.

The NOFRAME directive is useful with interrupt functions that never return as is the case with an interrupt that resets the MCU.


  • The NOFRAME directive is active for one function only. It is therefore not possible to use it at command line level.

The following example illustrates the difference between a standard interrupt frame and one created with the NOFRAME directive.

  1          int i1, i2, i3;
  3          void intr_func1 (void)  interrupt 0x21  {
  4   1        i1 = i2 * i3;
  5   1      }
  7          #pragma NOFRAME
  8          void intr_func2 (void)  interrupt 0x22  {
  9   1        i1 = i2 * i3;
 10   1      }


 ; FUNCTION intr_func1 (BEGIN  RMASK = @0x2030)
                                ; SOURCE LINE # 3
 0000 C6871000      SCXT    MDC,#010H
 0004 EC06          PUSH    MDH
 0006 EC07          PUSH    MDL
 0008 ECF4          PUSH    R4
 000A ECF5          PUSH    R5
                                ; SOURCE LINE # 4
 000C F2F50000 R    MOV     R5,i3
 0010 F2F40200 R    MOV     R4,i2
 0014 0B45          MUL     R4,R5
 0016 F2F40EFE      MOV     R4,MDL
 001A F6070400 R    MOV     i1,MDL
                                ; SOURCE LINE # 5
001E FCF5          POP     R5
0020 FCF4          POP     R4
0022 FC07          POP     MDL
0024 FC06          POP     MDH
0026 FC87          POP     MDC
0028 FB88          RETI
; FUNCTION intr_func1 (END    RMASK = @0x2030)

; FUNCTION intr_func2 (BEGIN  RMASK = @0x2030)
                                ; SOURCE LINE # 8
                                ; SOURCE LINE # 9
002A F2F50000 R    MOV     R5,i3
002E F2F40200 R    MOV     R4,i2
0032 0B45          MUL     R4,R5
0034 F2F40EFE      MOV     R4,MDL
0038 F6070400 R    MOV     i1,MDL
                                ; SOURCE LINE # 10
003C FB88          RETI
; FUNCTION intr_func2 (END    RMASK = @0x2030)
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.