Debugging on the LoPy

  • I have an issue here with some code and would like to debug it.
    Is there a way to debug on the LoPy?

    OSError('Network card not available',)
    Guru Meditation Error of type LoadProhibited occurred on core   0. Exception was unhandled.
    Register dump:
    PC      :  400d79cb  PS      :  00060330  A0      :  800ea3f8  A1      :  3ffdd380
    A2      :  3ffb6370  A3      :  00000000  A4      :  00000001  A5      :  00000001
    A6      :  00000000  A7      :  3ffd8828  A8      :  00000000  A9      :  00000000
    A10     :  3ffb6370  A11     :  00060f23  A12     :  00060f20  A13     :  b33f0000
    A14     :  0000000a  A15     :  3ffec1a0  SAR     :  00000006  EXCCAUSE:  0000001c
    EXCVADDR:  00000044  LBEG    :  4000c46c  LEND    :  4000c477  LCOUNT  :  00000000
    CPU halted.

  • Python has a debugger , which is available as a module called pdb . It supports setting conditional breakpoints , stepping through the source code one line at a time, stack inspection, and more.

    import pdb
    msg = "this is a test"

    Insert pdb.set_trace() anywhere and it will function as a breakpoint . When you execute the script by python, you will in the debug mode.

  • @daniel Here you go, courtesy of print-based debugging and tenacity:

    While I have your attention, please reopen...

  • Feature Request: Good debugging story!

    This is already on our wish list, to add a MicroPython debugger to Pymakr :-)

    But anyway, for the kind of crash that you are experiencing, the only way to find the root cause is to debug it at C level.

  • @daniel Looks like I have got a steep learning curve ahead of me. :-( Can a JTAG debugger then be queried by the Python debugger, or are we strictly in C mode?

    Feature Request: Good debugging story!

    I will try. Have to use logging then to track it down. Might take a few days. I will file my results on GH and cross-link forum and issue for your reference.

  • @betabrain there's a way to connect a JTAG debugger and launch GDB, but it's not for the faint of heart ;-)

    Can you share the steps to reproduce it? Thanks.

Log in to reply

Pycom on Twitter