Debug program writen in the CodeVision

Discussion on both general simulation and Proteus VSM microcontroller simulation.
Locked
dibor
Professional User
Posts: 138
Joined: Sat 2013-11-09 13:32

Debug program writen in the CodeVision

Post by dibor »

Hello.
For simulation used cof file.
While debug program written in the CodevisionAvr - source code is not visible when I pause simulation.
Got message - "No source line at PC address ......"
Every time I mast to choose source file from the list.
CodevisionAVR is listed as supported compiler.

Where the problem?
I do something wrong?

Thank you.
Ettore
Labcenter Staff
Posts: 2932
Joined: Fri 2006-03-03 11:56
Location: Milan
Contact:

Re: Debug program writen in the CodeVision

Post by Ettore »

First thing first you should start a debug session by selecting "Start VSM Debugging" or hit on CTRL+F12.
Also, is a good practice to end your program with a "forever loop" as the last line of void main(void) function like this :

Code: Select all

  while(1) ;
otherwise the Proteus debugger might lost address when simulation is paused.

I have been testing a simple circuit with latest CodeVision evaluation version 3.42 and didn't get any issue.
Attachments
screen shot 2020-08-26 105317.jpg
screen shot 2020-08-26 105317.jpg (384.29 KiB) Viewed 1095 times
Kind regards,
Ettore Arena - Labcenter Electronics.
uriotech
Professional User
Posts: 164
Joined: Sun 2010-05-30 22:13

Re: Debug program writen in the CodeVision

Post by uriotech »

Hello,

I tried several working simulations and now can't debug code anymore. The same error "No source line at PC address..."

Ricardo Urio
Proteus Release 8.10 SP3 (Build 29560)
PS : COF generated by Proton
uriotech
Professional User
Posts: 164
Joined: Sun 2010-05-30 22:13

Re: Debug program writen in the CodeVision

Post by uriotech »

*SOLVED*

I solved the issue compiling COF again and saving the Proteus project with last version. Is imperative to do both.

Regards

Ricardo Urio
dibor
Professional User
Posts: 138
Joined: Sat 2013-11-09 13:32

Re: Debug program writen in the CodeVision

Post by dibor »

Hello.
Me doesn't helps anything.
I am trying with latest Proteus beta and latest CodevisionAVR on Windows 7 x64 machine.
What I get you can see in the small video from there : https://1drv.ms/v/s!Auurs2F0cQKFgbQIUpPcP3W4xcfGpQ
May be I do something wrong but I do not know what.

This is happens not only with my project, but also with examples from CV examples folder.

Thank you.
Last edited by dibor on Thu 2020-08-27 8:25, edited 1 time in total.
dibor
Professional User
Posts: 138
Joined: Sat 2013-11-09 13:32

Re: Debug program writen in the CodeVision

Post by dibor »

uriotech wrote:Hello,
Proteus Release 8.10 SP3 (Build 29560)
PS : COF generated by Proton
Hi.
Do you mean cof file generated by Proton basic compiler for PICs?
If so this is absolutely different thing, topic about AVR and CodevisionAVR compiler.

Best Wishes.
Ettore
Labcenter Staff
Posts: 2932
Joined: Fri 2006-03-03 11:56
Location: Milan
Contact:

Re: Debug program writen in the CodeVision

Post by Ettore »

The message "No source line at PC address" may occur at the timestep zero when you start the simulation with Pause button on the animation control.
In fact, from the video I can see you are using the animation control to run and pause the simulation, but that's not the correct way to go through the debug window.
You have to use the combination CTRL+F12 to enter in debug mode AND use the debugging controls in the debug window to procede step-by-step through the code.
The debugging control are depicted in the screen shot attached.

Also, read the Simulation Help at WORKING WITH MICROPROCESSORS->Direct Simulation for further details and how to use single stepping and using breakpoints.
Attachments
debug window 2020-08-27 114336.jpg
debug window 2020-08-27 114336.jpg (190.63 KiB) Viewed 1062 times
Kind regards,
Ettore Arena - Labcenter Electronics.
dibor
Professional User
Posts: 138
Joined: Sat 2013-11-09 13:32

Re: Debug program writen in the CodeVision

Post by dibor »

Ettore wrote: In fact, from the video I can see you are using the animation control to run and pause the simulation, but that's not the correct way to go through the debug window.
Hello Ettore.
Clicking on animation key or click on Debug -> Start VSM Debugging or use Ctrl+F12 key combinations - DO SAME
I do not do any pause, when I start VSM debugging simulation is paused itself.
"No source line at PC address" occurs every time and doesnt matter when I pause it from start or after 10 mins after running.
Same proteus project but with Bascom obj file works as should.
I can not understand where a problem.
Ettore
Labcenter Staff
Posts: 2932
Joined: Fri 2006-03-03 11:56
Location: Milan
Contact:

Re: Debug program writen in the CodeVision

Post by Ettore »

I cannot reproduce the issue and you seem not willing to supply your real project to get a close look at, so this discussion makes no sense.
So, I attach an example I simply taken from CV example directory. This is the LED example.
The Proteus file is created with latest Proteus beta but, as you have claimed, you are using the latest beta so you should be able to open and run it.
Q1: are you able to start debug session by hitting over the CTRL+F12 ? (yes or not)
Q2: are you able to see code without choosing it in the source code list after you hit on CTRL+F12? (yes or not)
Q3: if you are able to see the code at the start of debugging, are you able to step through the code by using single step button (no pause) in in debug window? (yes or not)

In either cases I suggest to fully zip your project and send it to support@labcenter.com so that AVR's developer can have a closer look at.
Attachments
LED.zip
(35.06 KiB) Downloaded 94 times
Kind regards,
Ettore Arena - Labcenter Electronics.
dibor
Professional User
Posts: 138
Joined: Sat 2013-11-09 13:32

Re: Debug program writen in the CodeVision

Post by dibor »

Hello Ettore.
Attached project or compiled by me same project from CV example folder works same.
1: I able to start debug session by hitting over the CTRL+F12
2: I able to see code without choosing it in the source code list after you hit on CTRL+F12?
3: Yes I can.

This small poject I can to run simulation and pause it after few seconds or start VSM Debugger and every time I will see code without choosing it in the source code list.
But if example is more solid like ILI9225 Arduino SPI, I can see code without choosing it in the source code list if I hit on CTRL+F12 but do not see it if I pause simulation.

Best Wishes.
Ettore
Labcenter Staff
Posts: 2932
Joined: Fri 2006-03-03 11:56
Location: Milan
Contact:

Re: Debug program writen in the CodeVision

Post by Ettore »

dibor wrote:... I can see code without choosing it in the source code list if I hit on CTRL+F12 but do not see it if I pause simulation.
This was expected as the Pause button is simply not useful in a debug session.
The correct commands to use are those buttons in debug window as depicted above and as I said several time now.

A more technical reason why the Pause button - the one in the animation control - won't work is because of pause step time of 50m by default.
This means that Pause button stops the program counter after 50m, although with microprocessors running at 16MHz several thousand instructions are executed and the program counter may reach the end of program or just seat everywhere the debugger cannot show any source code.

Although I cannot understand why you do insist on using the Pause button - despite you have debugging commands specialized for the purpose - I suggest to select "Animation Options" in the System menu. In the Animation Circuit Configuration dialog you can set the parameter "Single Step Time" to, say 1u, or 0.05u.
This will narrow the Pause action time.
Kind regards,
Ettore Arena - Labcenter Electronics.
Locked