This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to obtain an overview of the total generated assembly code?

Hello,

When compiling a program, the generated .lst file creates 'blocks' of assembly code. Every block starts with the name of the function and between brackets the word 'BEGIN'. For instance:

; FUNCTION _i2c (BEGIN)
0000 8F00 R MOV Address,R7
0002 8D00 R MOV NrSend,R5

At the end of the function, you'll see something like this:

00A7 ?C0002:
00A7 22 RET
; FUNCTION _i2c (END)

This is repeated for every function in a source file.
However, as you can see from the example, the 'real' location of the code is not filled in. That i2c function does not start from address 0000 onwards. Also the correct jump addresses are not in. Example:

009D 120000 R LCALL I2cGenerateStopCondition

As you can see, the real location of the subroutine 'I2cGenerateStopCondition' is not filled in (yet?).

I'm using a simulator that really needs that correctly filled in information.

Questions:
==========
1. Is there a way to obtain a .lst file (or another file) with all the addresses correctly filled in as they would be located in the final eprom (or something similar) and not filled with 'temporary' values of '0'?

2. Can this also be done for sources that use other object files? For instance, I wrote an I2C routine and I'm using the generated object file of that I2C routine in a project that has I2C communication.

Any help would be appreciated.

Thanks in advance,

Geert Vancompernolle

Parents Reply Children
  • The Linker also performs the locating, so the listing you need is the one from the Linker!

    FWIW, there are other toolchains that go back and adjust the assembly listings with the actual post-link addresses. HI-TECH's PIC C compiler is one that I use that does this. Nice!

  • You can see the located assembler in Keil's Disassembly View in the debugger.
    Unfortunately, you can't print it :-(

    I have no idea why Keil have omitted this fairly obvious facility!
    (or, in fact, the facility to print from any of the debug windows!)

  • I'm using a simulator that really needs that correctly filled in information.

    Can't your simulator work that out for itself? - it's all in the debug info!

    The Keil simulator does it - why not use that, as you abviously have the Keil tools?!

  • Can't your simulator work that out for itself? - it's all in the debug info!

    The Keil simulator does it - why not use that, as you abviously have the Keil tools?!


    The problem is, I do have the IDE environment and the compiler (V5.50), but I only have the demo version of the debugger and that's limited to only 2kB...

  • The Linker also performs the locating, so the listing you need is the one from the Linker!

    The listing that is generated by the linker contains, among other things, the line numbers of the different sections and the start addresses of the different sections, but it does not contain the assembly code. Or do I miss something?

  • You're right: the Linker listing gives you addresses (both Code & Data) - 'cos that's what the Linker knows about!
    Armed with this information, you can go back to the Compiler's assembler listings and fill-in the required addresses (the addresses shown in the listing are all offsets relative to the start of each function).

    It's not too hard to get something like Excel to do the sums for you; or maybe this'll just provide the justification to fork-out for the upgrade to include Keil's simulator.

    can I have my commission now, please? ;-)

  • can I have my commission now, please? ;-)

    Yes, sure! Let's have a drink together... :-)

    Thanks anyway for this useful input, Andrew! The Excel tip is a nice one...