ARM Technical Support Knowledge Articles


Applies to: C51 C Compiler


Information in this article applies to:


I've written a very simple program with a dummy ISR as follows:

void ISR (void) interrupt 0

void main (void)
while (1)

When I look at the map file, it appears that my ISR is located at the wrong address.

            * * * * * * *   C O D E   M E M O R Y   * * * * * * *
            CODE    0000H     0003H     ABSOLUTE
            CODE    0003H     0003H     ABSOLUTE
            CODE    0006H     000CH     UNIT         ?C_C51STARTUP
            CODE    0012H     0002H     UNIT         ?PR?MAIN?MAIN
            CODE    0014H     0001H     UNIT         ?PR?ISR?MAIN

What's going on? Shouldn't the ISR (?PR?ISR?MAIN) be located at 0003h instead of 0006h?


The code generated by the compiler is correct. When you create an interrupt service routine (in C), the compiler generates 2 code objects.

The first object is the interrupt service routine. This routine is terminated with an IRET instruction. The interrupt service routine is relocatable and may be located anywhere in CODE memory. This is ?PR?ISR?MAIN in your example.

The second object is the interrupt vector to LJMP to the interrupt routine. If you take a look at the code map (from the linker map file) you will notice that at address 0003h, there are 3 bytes that are marked as ABSOLUTE. This is the LJMP instruction that jumps to ?PR?ISR?MAIN in your example.

Article last edited on: 2001-05-29 00:00:00

Rate this article

Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential