Propeller 2 Debug system
ozpropdev
Posts: 2,792
in Propeller 2
Hi All
Here's my Propeller 2 Debugger.
It's Python based and makes use of P2's debug interrupt mechanism.
It currently only supports debugging one cog a a time.
The cog ubnder test can be single stepped and monitored with a variety of commands
such as disassembly,wathlist,flag modification,stack manipulation and memory related
functions.
The code requires Python 3 and pyserial (see pyserial site).
The debuggers command line options can be found by
To load the sample denug code.
The debugger will search for a P2 on all available com ports.
If a P2 is detected the object file will be loaded into the P2.
If available a .lst file is scanned for symbol information.
The debugger recognizes pnut , fastspin and p2asm format list files.
When you are presented with the debug prompt ">" type "help" or "help1" for a list
of commands and examples.
For an interactive demo type "intro". A log of the 'intro' session can be found in the 'oz.txt' file.
For pnut users make sure you use "Ctrl-M" "Ctrl-S" to generate a .lst file.
For p2asm users use the -o option to generate a .bin object file.
See the sample1.spin2 source file to see how the debugger attaches to your code.
This is still a work in progress, code needs tidying up. I need to expand on the documentation and build
some more interactive demos first!
Here's my Propeller 2 Debugger.
It's Python based and makes use of P2's debug interrupt mechanism.
It currently only supports debugging one cog a a time.
The cog ubnder test can be single stepped and monitored with a variety of commands
such as disassembly,wathlist,flag modification,stack manipulation and memory related
functions.
The code requires Python 3 and pyserial (see pyserial site).
The debuggers command line options can be found by
python p2debug7_5.py -?
To load the sample denug code.
python p2debug7_5.py sample1
The debugger will search for a P2 on all available com ports.
If a P2 is detected the object file will be loaded into the P2.
If available a .lst file is scanned for symbol information.
The debugger recognizes pnut , fastspin and p2asm format list files.
When you are presented with the debug prompt ">" type "help" or "help1" for a list
of commands and examples.
For an interactive demo type "intro". A log of the 'intro' session can be found in the 'oz.txt' file.
For pnut users make sure you use "Ctrl-M" "Ctrl-S" to generate a .lst file.
For p2asm users use the -o option to generate a .bin object file.
See the sample1.spin2 source file to see how the debugger attaches to your code.
This is still a work in progress, code needs tidying up. I need to expand on the documentation and build
some more interactive demos first!
Comments
(1) If your machine has both python2 and python3 installed, make sure to use python3 to run P2Debug7_5.py.
(2) I had to increase the timeouts in find_p2() from "sleep(0.01)" to "sleep(0.1)" (with 0.01 the P2 wasn't being detected).
(3) Running the sample1 program worked fine, but when I tried to load my own program (compiled with fastspin) I got a "Loading failed!,no response from P2" message. My program is a bit larger than sample1.obj (6528 bytes), I'm not sure if that's the problem or not.
Never mind, I see the problem now, I don't have the debug code linked in to my program.
I think I have to wait for the new version.
It's the same for me.
Lol, I've just discovered this doesn't always load a program in stopped debug state. My first attempt to use p2debug7_5.py has resulted in the target program always taking over and running as normal. Said program is Chip's interrupt driven NTSC_256_x_192_interrupt.spin2. What I'm wanting is the disassembled machine code. In fact, only the first three (six including AUGDs) instructions:
PS: I know they'll be HUBSET, WAITX, HUBSET, in that order.