Breakpoints for the PChip
APStech-Attila
Posts: 38
Hi Everyone!
·· I have developed a module to enable breakpoints and trace points for the Propeller! All you need is a terminal program to do breakpoint stepping.
In your code you will add breakpoints and tracepoints like this:
Line#20·|·BPT.BPT(1,20)····· 'Breakpoint(FileID, Line#)
Line#21·| outa[noparse][[/noparse]8]~~
Line#22·|· repeat
Line#23·|·· ·BPT.TRC(1,23)··· 'Tracepoint(FileID, Line#)
Line#24·|··· !outa[noparse][[/noparse]8]
··
In the hyperterminal you will see·cnt·time your code has reached a trace or breakpoint, you will see the cogid, fileID (or other·8bit information - it supports constants and variables too!) and finally the line number (HEX)
B03303B1 TRC 00010026
B041CCE1 TRC 00010017
B05071F1 TRC 0001001A
B05G2G21 BPT 00010023
The code runs normally, until it·run into·a trace or breakpoint.
If your code is executing a tracepoint, a trace infromation is sent to the terminal via RS232, so you can see "File 1, line 23 was executed by COG $00,·at cnt time $B041CCE1" . This way it easy to see if a condition was true, see how your case statements work,·calculate cycle time, etc.
A breakpoint is very similar to a tracepoint, but·a breakpoint·halts the·execution until user interaction. It will show the same infromation, just it will wait for a keypress on hyper terminal, to continue execution. Combined with the "monitor.spin" you can see all variables, modify them if you want before continuing execution.
I have started working on a PC software, that will display the actual BPT and TRC in realtime, in the SPIN sourcecode!
Comments, ideas and help are wellcome!
Attila
·· I have developed a module to enable breakpoints and trace points for the Propeller! All you need is a terminal program to do breakpoint stepping.
In your code you will add breakpoints and tracepoints like this:
Line#20·|·BPT.BPT(1,20)····· 'Breakpoint(FileID, Line#)
Line#21·| outa[noparse][[/noparse]8]~~
Line#22·|· repeat
Line#23·|·· ·BPT.TRC(1,23)··· 'Tracepoint(FileID, Line#)
Line#24·|··· !outa[noparse][[/noparse]8]
··
In the hyperterminal you will see·cnt·time your code has reached a trace or breakpoint, you will see the cogid, fileID (or other·8bit information - it supports constants and variables too!) and finally the line number (HEX)
B03303B1 TRC 00010026
B041CCE1 TRC 00010017
B05071F1 TRC 0001001A
B05G2G21 BPT 00010023
The code runs normally, until it·run into·a trace or breakpoint.
If your code is executing a tracepoint, a trace infromation is sent to the terminal via RS232, so you can see "File 1, line 23 was executed by COG $00,·at cnt time $B041CCE1" . This way it easy to see if a condition was true, see how your case statements work,·calculate cycle time, etc.
A breakpoint is very similar to a tracepoint, but·a breakpoint·halts the·execution until user interaction. It will show the same infromation, just it will wait for a keypress on hyper terminal, to continue execution. Combined with the "monitor.spin" you can see all variables, modify them if you want before continuing execution.
I have started working on a PC software, that will display the actual BPT and TRC in realtime, in the SPIN sourcecode!
Comments, ideas and help are wellcome!
Attila
Comments
This looks really neat!
I think that by making an object to do this, you're taking the best approach. People have been asking about (integrated) debuggers and I've been loathe to pick a single approach and then complicate the tool system with it. An object is a neutral approach which doesn't undermine anything. Plus, debug objects could take many forms and be very flexible. I like this much better than an integrated one-size-fits-all approach which would load things with caveats.·I know that a map file would greatly extend your capabilities, though. It's going to take some work on this end...
Keep up the good work!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
·· Attached please find a low-end preprocessor to help line numbering for breakpoints and tracepoints.
·· It is called SPINup
·· Soon it will have the usual #Include<file> option - of course Propeller style
Here is another attempt·at·propeller debugging tools, roughly in line with Atilla's approach. Only,·I·use·a prop with VGA and keyboard to control 2 propsticks over a 2 wire connection. Sacrificing·one·Cog in the target system·allows for a variety of·control and monitoring functions. See the attached document.
I have two comments after this exercise:
- for Parallax: working with 2 props and·one PC means I have to·switch·programming cables all the time,·the IDE does not allow me to choose a specific interface (USB for the demoboard, USB·to serial for the propsticks). Any chance·this will change?
- for Mike Green: thanks for using your OS, works fine for·creating custom keyboard commands. Only, I have to cut and paste my parts·in your·source directly. Is there a more intelligent way to do this?
Regards
Nico Hattink
Please inform me of comments, bugs etc
Nico Hattink
In the most recent upload, the initialization code has been moved to a separate object so there are only a few lines required in your main program to essentially make your main program the command interpreter. That doesn't take care of the command scanning routines which you still have to incorporate into your program. Now that the SPIN compiler is more flexible with the number of objects allowed in your program, I could move most of the scanning routines to a separate object which would make their use easier. Send me a PM about what would be helpful for you.
Mike