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 don't have to use fromelf etc. utility to see the source code corresponding to the assembly code.
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.
It seems imagination is no longer a prerequisite of becoming a developer <facepalm>. Well, that's an awfully rude thing to say given how well you know me. My mistake was thinking that the disassembly output from fromelf was going to be the same as that of the disassembler in the IDE (not having any function labels), which it is not. Using fromelf --text -c, I do see assembly labels that contain the function names so I can see the code broken into functions.
I thank you for your original - albeit terse - suggestion to "use [fromelf] to view the code produced by the compiler", as that was indeed the right direction to go. I do not thank you for your snide crack about my lack of imagination since we all have occasionally missed something that is obvious to others. Perhaps if you had mentioned "--text", "disassemble code", or "object file" in the context of fromelf, I would have been more well-informed as a first-day user of Keil tools.
Sankalp, 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.
I tried to explain in my original post that exactly what you've suggested is not working for me, and I cannot identify why. I have the disassembly window in "mixed mode" but do not see any source code as seen in examples in Keil documentation. Clicking in either the disassembly window or a source code window does not cause any view change in either, contrary to what my coworker looking over my should said should be happening as you describe.
Well, that's an awfully rude thing to say given how well you know me.
Given your apparent dismissive response to my suggestion, I don't think it's particularly unfair.
Look at it from my side. I'm not here as a replacement manual. Be grateful that I didn't just simply reply Please read the manual (and include one of those really derogatory links to 'smart questions').
Anyway, I'm glad you've now found the information you were originally after and hope you can progress positively.
In that case, contact keil support at support.intl@keil.com along with a test project