ARM Technical Support Knowledge Articles

DETERMINING THE LOCATION OF ASSEMBLER INSTRUCTIONS

Applies to: C51 C Compiler

Answer


Information in this article applies to:


QUESTION

I have written a project in C and I notice that the listing file shows the C code converted to assembler. How do I find out the location of the instructions shown in memory? The addresses in the listing file seem to repeat.

ANSWER

The listing file is generated by the compiler and the assembler generated is relocatable. The linker decides where in memory the instructions will be placed, so you need to cross reference the listing file with the linker generated map (.m51) file.

Here is an example.

In HELLO.LST I have:

                                           ; SOURCE LINE # 58
0006 438920        ORL     TMOD,#020H

If I look in the file HELLO.M51 at the Symbol Table of Module, I see:

  VALUE           TYPE          NAME
  ----------------------------------
...
  C:0710H         LINE#         58
...

So the instruction ORL TMOD, #020H is located at 0710H in Code memory (the C prefix to the address indicates Code memory).

If you have mutiple source files, then the symbol table is grouped into Modules, one module per source file. For C files, the module is named after the source file. So you need to locate the section that relates to your source file before looking for the line number.

  VALUE           TYPE          NAME
  ----------------------------------

  -------         MODULE        HELLO
...
  -------         ENDMOD        HELLO

If the assembly code is missing from your listing file, then you need to turn on the option to include it. In uVision:

Article last edited on: 2004-06-16 15:26:29

Rate this article

[Bad]
|
|
[Good]
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