Shop OBEX P1 Docs P2 Docs Learn Events
P2 Debugging Questions. — Parallax Forums

P2 Debugging Questions.

  • Can you single-step the P2? (as in flip the clock bit). (although I assume that if you do then stuff like the serial smart-pins aren't going to work anymore at the proper speed).
  • Failing that, would it be possible to 'single-step' instructions by forcing a debugging interrupt to fire after every instruction, copy cog state (ie, PC, content of current PC register, C & Z flags) to an area of memory (HUB probably) for spooling out to instrumentation by another cog?
  • Is there a better way of achieving this kind of functionality?
I'm working on the hardware interface for my minicomputer idea and my current console currently intends to display:
  • C & Z flags
  • Contents of PC
  • Contents of PTRA & B
  • State of DIRA&B / INA&B

... as well as provide an interface to allow random peeking / poking at HUB & cog memory.

Feeling viewport'esque (for those that remember that).

Currently kicking this design around... (apologies for the serious overexposure).
(Can you tell I visited a vintage electronics component supplier last week) ;-)

n7fhdW3.jpg

Comments

  • jmgjmg Posts: 15,173
    __red__ wrote: »
    * Can you single-step the P2? (as in flip the clock bit). (although I assume that if you do then stuff like the serial smart-pins aren't going to work anymore at the proper speed).
    Yes, P2 is Static CMOS, so you could clock at 1Hz, or below.

    .. but you are correct that in practical terms, a single clock edge does not show you much...
    __red__ wrote: »
    * Failing that, would it be possible to 'single-step' instructions by forcing a debugging interrupt to fire after every instruction, copy cog state (ie, PC, content of current PC register, C & Z flags) to an area of memory (HUB probably) for spooling out to instrumentation by another cog?

    That is more how Debug is intended to work in P2.
    There are already Alpha/Beta debuggers around for P2, and IIRC the ROM also has some monitor support.

  • I've nearly finished my new P2 debugger.
    It has full disassembler,single step, breakpoints and watch functions,etc..
    I'm a bit tied up with real P2 silicon testing at the moment.
    Hope to have something to post soon.
  • __red____red__ Posts: 470
    edited 2018-10-21 23:08
    ozpropdev wrote: »
    I've nearly finished my new P2 debugger.
    It has full disassembler,single step, breakpoints and watch functions,etc..
    I'm a bit tied up with real P2 silicon testing at the moment.
    Hope to have something to post soon.

    That's great to hear, and seeing what you've got going on you're clearly busy :smile:

    Related, I've mostly finished my disassembler and now have implemented two opcodes in my simulator - NOP and JMP.

    I can now compile from PASM2 to eeprom, load into my simulator, cogstart it and run my amazing "Hello World" application that looks like this:
    DAT
    
    org 0
    label  nop
           nop
           nop
           nop
           jmp label
    

    It's very exciting ;-)
  • ozpropdev wrote: »
    I've nearly finished my new P2 debugger.
    It has full disassembler,single step, breakpoints and watch functions,etc..
    I'm a bit tied up with real P2 silicon testing at the moment.
    Hope to have something to post soon.

    I went looking for an updated version and the latest I was able to find was v16a_1_8 (March 2017).

    Did you post anything later that I may have missed?

    Thanks,



    Red

  • That sounds right, didn't seem to be much interest back then.
    Anyhow the new debugger is completely different and has moved all the heavy lifting to the PC end so only a small code snippet is attached to the test code.
    I've just got to finish some more P2 silicon tests and I can get pack to the debugger.
    It would be nice to have it ready for the eval boards. :)
  • Any opportunity you get to post it in any state would be appreciated.

    I've been trying to prioritize which opcodes to implement in my emulator - attacking those which you use in your debug shim first makes a whole lot of sense.

    Then in theory, try and replicate the functionality of your PC-side in the UI portion of the emulator so that the debugging process will be identical in my emulator vs real silicon (at least that's the hope).
  • (and enough of a subset to drive my mini-computer console implemented on the P1)
  • If you put your debugger in Git and host it somewhere people can get it, it will be easy for people to get unfinished versions now and yet not have to worry about whether they have an old version later as you work on it more, since Git makes it easy to update to the latest version.
Sign In or Register to comment.