cancel
Showing results for 
Search instead for 
Did you mean: 

Eclipse Disassemby format

Posted on March 16, 2009 at 09:39

Eclipse Disassemby format

2 REPLIES 2
Posted on May 17, 2011 at 13:06

Anglia Electronics kindly sent me an Eclipse version of the STM32demo project. It includes a custom makefile, so it doesn't use any outside resource such as Solaris to create the makefile.

I am trying to create my own project to emulate this with good success so far. In my project I am using Solaris to create the makefile for me, so I can add or delete modules at will without having to modify the makefile each time.

However, when I compile the Anglia version of the project the Eclipse disassembly window shows each line of source code, followed by the assembler code generated. When I step through the code the source window and the disassembly window track logically.

My project does not include the relevant source code line in the disassembly. Furthermore, if I step through the code the 'cursor' in the source code window follows approximately where it should be, but may jump backwards or forward several lines each time I step.

Examining my disassemby explains the jumping, since the code is not totally logical. For example, if I have a sequence of lines setting variables to specific values the code is likely to load each value in turn to different r registers, then write each r register in turn to the relevant memory address. The same code in the Anglia version would load the first value into an r register, then copy it to the relevant memory address, then proceed to the next variable.

Can anyone help in identifying how to configure the compiler to create logical code, and embed source code into the disassembly listing? I suspect the difference must be within the makefile, since this invokes gcc, but all my switches are the same as those in the original. From searching the web I suspect I need to invoke objdump somewhere.

Regards

domen2
Associate III
Posted on May 17, 2011 at 13:06

I think optimizations are responsible for weird instruction ordering. Try -O0 ?

-S option for objdump will produce C source mixed with disassembly. Not sure if this helps.

These settings are probably hidden somewhere in Eclipse/project options?