Hi, I am using uvision 5 in windows 7 64 bit os. My device is FRDM KL46Z. In my device, i can debug any code. However, in simulation i can not debug. There is not any errors but in assembly line when i proceed with F11, i am trapping to some loop even when i did not reach the main yet. Is there someone who can use debugger with simulation?
A Hard Fault, Exception, or unhandled Interrupt?
Or perhaps it's waiting for some external input/event?
You have the code in front of you - nobody else can see it nor knows anything about it or you or your project.
"Is there someone who can use debugger with simulation?"
Yes - that is what it's there for!
A number of devices that aren't fully simulated will hang when the programs are simulated, but everything will work well on the real hardware - the simulator will run through CPU instructions that waits for the virtual hardware to toggle some bit - but the faked processor doesn't have any logic to toggle that bit.
If you get a lockup while waiting for an oscillator/PLL to synchronize, you can comment away that piece of code to make the simulator able to reach main() - but you may still get stuck with other issues if the simulation can't produce UART, SPI, ... events for your main loop or ISR to process.
It is trapped before my code starts. In include part when i follow assembly line. However, debugging works just fine when the device is connected. I have a problem debugging in simulation. Breakpoints do not work in simulation(works just fine when device is connected)
As i said i can debug the same code while the device is connected but i can not in simulation.
I think this is the just the case. The same code can be debugged while device is connected but in simulation breakpoints does not work. From assembly line, i trapped in include part(whereas works just fine with the device) Thanks for the answer.
Breakpoints works in simulation too even if the processor isn't supported.
But you need to set the breakpoint early enough before the simulation reaches code that can't be correctly processed. So "run to main" will not work if the startup code contains references to unsupported hardware functionality.
Have you tried to place breakpoints early in the startup code?
In assembly line, i am trapping to a loop at the end of "System Init". I could not exit System Init.
As I said - some lines of code in the original startup code may not work. So you need to deactivate these lines by conditional compilation or by commenting them away. The virtual processor doesn't have any physical PLL or clock oscillator or whatever it is the code waits for so you don't need the code lines while running in the simulator - only when running on live hardware.