Shop OBEX P1 Docs P2 Docs Learn Events
DEBUG — Parallax Forums

DEBUG

Still trying to figure out how to launch the PASM debugger. In the Parallax Propeller 2
Spin2 Language Documentation, example code is given that is supposed to launch two debuggers. This is the code:

CON _clkfreq = 200_000_000
debug_main 'run debugger(s) for all main code
PUB go() | i
coginit(newcog, @pasm, 0) 'start another cog with a pasm program
repeat 'increment i
i++
DAT org
pasm add $100,#1 'increment some registers
add $101,#1
add $102,#1
add $103,#1
jmp #pasm 'loop
long 0[11] 'clear space after code for clarity

When I paste this code into a new P2 template and run it, only one debugging window appears after I press "Enter". The debugging window is "dead" in that nothing works. Incidentally, I do have "Enable Debug" checked. So....how do I launch the debugger? I can't even get it to run on example code.

Comments

  • RaymanRayman Posts: 14,632

    You need a debug statement int the code to invoke the debugger...

  • cgraceycgracey Posts: 14,151

    I just ran it using Ctrl-F10 to run with DEBUG and the first window came up. I hit ENTER and it animated and eventually the second window came, up, which starts to animate after you hit ENTER for it. I am running Windows 8.1.

  • RaymanRayman Posts: 14,632

    Ctrl-F10? Is that in PNut? In Prop Tool, says no P1 found, which is strange...

  • cgraceycgracey Posts: 14,151

    @Rayman said:
    Ctrl-F10? Is that in PNut? In Prop Tool, says no P1 found, which is strange...

    Sorry, yes. I always use PNut because it has the current compiler in it.

  • @Rayman said:
    You need a debug statement int the code to invoke the debugger...

    There is one in the code. It is "debug_main 'run debugger(s) for all main code" immediately under the clock frequency statement.

  • 3dogpottery3dogpottery Posts: 78
    edited 2024-01-23 12:14

    @cgracey said:

    @Rayman said:
    Ctrl-F10? Is that in PNut? In Prop Tool, says no P1 found, which is strange...

    Sorry, yes. I always use PNut because it has the current compiler in it.

    Is this another program that can be run to single step through assembly code? I was under the impression that single stepping could be launched from the Propeller Tool for the P2. I have to confess that I am a P2 noob. I am pretty familiar with the Propeller 1 however, and used PASD to single step through my assembly code. I was hoping that Parallax somehow incorporated this ability into the new P2. I don't know if it's just me getting older and stupider, or that it is actually that arcane.
    Anyway, in above code that I pasted; it is from the Spin2 language documentation, and it supposed to demonstrate single stepping assembly code. It doesn’t work for me.

  • JonnyMacJonnyMac Posts: 9,102
    edited 2024-01-20 21:21

    I was under the impression that single stepping could be launched from the Propeller Tool for the P2.

    Sadly, Propeller Tool is not in step with PNut. Nor does Parallax write any libraries -- which is why there are many of us "3rd party" developers.

    If you have Propeller Tool installed and want to try PNut, download it and move a copy of the PNut executable to the Propeller Tool library folder -- run it from there. Why? PNut can open a file from anywhere, but it can only use libraries from the path where it's located.

    I wanted to try single-stepping, too. Here's a cleaned-up version of that demo:

    con _clkfreq = 200_000_000
    
      debug_main                                                    ' run debugger(s) for all main code
    
    
    pub go() | i
    
      coginit(newcog, @pasm, 0)                                     ' start pasm cog
    
      repeat
        i++
    
    
    dat 
                            org
    
    pasm                    add     $100, #1                        ' increment some registers
                            add     $101, #1
                            add     $102, #1
                            add     $103, #1
                            jmp     #pasm 
    
    
                            long    0[11]                           ' clear space after code for clarity
    

    Run it from PNut (latest is v43) using Ctrl+F10 and it will bring up a DEBUG text window, and a graphical DEBUG window for COG 0. In the graphical window click on the DEBUG button (that is right above GO), and then click GO. A second graphical window, this one for COG 1 (the PASM code), will open. Move into that window and click GO to single-step the program

    1920 x 1040 - 202K
  • JonnyMacJonnyMac Posts: 9,102

    As a follow-up I tried to do this in the latest version of Propeller Tool (2.9.3) -- the DEBUG screens froze. That saddens me because I really dislike PNut, and I can't do graphic debugging in Spin Tools.

  • 3dogpottery3dogpottery Posts: 78
    edited 2024-01-20 20:11

    @JonnyMac said:
    As a follow-up I tried to do this in the latest version of Propeller Tool (2.9.3) -- the DEBUG screens froze. That saddens me because I really dislike PNut, and I can't do graphic debugging in Spin Tools.

    OK Jon! I did what you said and actually got the code to single step! You are the only one who actually understood what I was talking about. And yes, when launched from the Propeller Tool, the screen that appears is frozen. What the P2 documentation states is that:

    "There is also a single-stepping PASM debugger which can be invoked via plain DEBUG statements which do not contain any parameters within parentheses. Debugging is initiated in PNut by adding the Ctrl key to the usual F10 to 'run' or F11 to 'program', or in PropellerTool by enabling Debug Mode with Ctrl+D then using F10 or F11 as is normal."

    The P2 documentation should be amended to reflect the inoperability of this function. I've been pulling my hair out for days, and I'm already bald!

    Edit: The other thing I forgot to mention is that this "Debug" screen is tiny, and there is no way to zoom in. The P2 documentation states that the use of the Debugger is "intuitive". I guess I don't have much intuition. All that being said, I do like the P2 and it will give me plenty to do for quite awhile. ...and, I enjoy your presentations.

  • JonnyMacJonnyMac Posts: 9,102

    The P2 documentation should be amended to reflect the inoperability of this function.

    The online documentation can be edited by the community. Give it a go. At least add a note.

  • You can use VSC as IDE and launch PNut from it as compiler an debugger.
    Look here

  • cgraceycgracey Posts: 14,151

    The debugger window will be proportional to your font size in PNut.exe. Bigger font = bigger debugger.

  • JonnyMacJonnyMac Posts: 9,102
    edited 2024-01-21 18:13

    Confirmed. Use [Ctrl]+[Up Arrow] to increase PNut editor text size. This is good to know.

    1920 x 1040 - 195K
  • @cgracey said:
    The debugger window will be proportional to your font size in PNut.exe. Bigger font = bigger debugger.

    Thanks! It works.

  • @ManAtWork said:
    You can use VSC as IDE and launch PNut from it as compiler an debugger.
    Look here

    Thank you for the suggestion, but currently, it’s a bit above my pay grade. I would have to have a “How to launch PNut from VSC for Dummies” book.

Sign In or Register to comment.