Hello, I'm trying to decide between implementations of a given function, based on the number of clock cycles each is supposed to take. I'm using the Lite version of µVision 5, with the debugger set to simulate. I can go into debug mode and open the disassembly view, but none of the source code is listed in the Hybrid display mode, it's all just assembly code. Further, I have no idea how to go to a section of assembly that represents either of my functions.
There isn't any context menu option in the source code window that would seem to take me to its section of assembly code, and I can't place a breakpoint in my source code window so that at least I could run to that and see where the program counter stops in the disassembly window. My coworker is under the impression that I should be able to click in my source code and have the disassembly view jump to the relevant section.
Bottom line, how do I find the assembly code of two functions so that I can compare their implementations? At this point it seems like my only choice is to toggle a bit in the functions and measure timing with an oscilloscope. :(
Ryan R.
You can use the keil utility fromelf [in the \Keil\ARM\ARMCC\bin\ directory) to view the code produced by the compiler.
I'm sure you are aware that whatever you do here, whatever you view and whatever you determine may change if you make a minor change to the code or change a project setting.
The only sure fire way of having fixed code is to resort to assembler. Even then the execution time is dependent on a large number of factors.
I don't just want to see all the assembly code at once, I already have that in the disassembly window. What I really need is to be able to jump to the compiled code for a particular function.
So open the fromelf disassembly in a text editor and use the basic search functions?
For extra points you could push the listing through a post-processing step and annotate with cycle counts.
At the very least you should be able the right-click "Show Disassembly at address" in the disassembler pane and type in the name of the function rather than an address.
It seems imagination is no longer a prerequisite of becoming a developer <facepalm>.
You don't have to use fromelf etc. utility to see the source code corresponding to the assembly code.
Download the latest version of MDKv5.18 (in case you are working with Cortex-M) -> compile code -> in "Options for target" -> "Debug" -> select "Use Simulator" and "Load Application at startup"
Open the debug session and click on any line of assembly code in disassembly window you should see the corresponding source code in source code window and vice versa.
True. But having a file which you can view or edit makes it a whole lot easier to annotate the code.
Having a file also makes it easier to try to use diff or similar to compare. But this works best when having the pre-linked data without absolute addresses.
View all questions in Keil forum