PC-based QT emulator debugger?

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

PC-based QT emulator debugger?

Post by jickster » Thu Oct 05, 2017 3:44 pm

As discussed here, viewtopic.php?f=3&t=1210#p22174 micropython is a ways off from having full debugger functionality.

However, an alternative to having the debugger run on-target is to build micropython for Windows and somehow run a Python debugger on Windows?

Sure you could run the Python script using Pycharm but there'd be inconsistencies between MicroPython and CPython implementation.

In this post viewtopic.php?f=3&t=3840#p22056 user cduran states
Using QT I developed a sort of debugger for python code running on my firmware. For this I used the same build of micropython just so that I have a dublicate of mp that will behave just like the one on my firmware.
I'd LOVE to know how you did it.

Simsys
Posts: 3
Joined: Fri Jun 10, 2016 1:58 pm

Re: PC-based QT emulator debugger?

Post by Simsys » Wed Oct 18, 2017 3:37 pm

As I see it, there is no concept for debugging uPy scripts today: neither under Windows/Linux nor on an embedded system. I think that's a pity. Micropython claims to be simple, easy to learn. What else does it make sense to offer Micropython for a platform like The Micro Bit?

A good debugger is especially important for beginners. How does my program work? What's happening right now? Where's what going wrong? If you want to use Micropython on an embedded system you have to know how such a system works and on the other hand you have to be able to program (Python).

Of course, this is a difficult task to realize this function. However, the subject does not seem to be of any real interest either. I can imagine that the circle of users would expand enormously with a good debugging solution.

pfalcon
Posts: 1155
Joined: Fri Feb 28, 2014 2:05 pm

Re: PC-based QT emulator debugger?

Post by pfalcon » Sat Oct 28, 2017 6:24 pm

There's, and always has been a concept for debugging in MicroPython, it's very simple and obvious one - you debug in any other implementation of Python (CPython or whatever), and then run in MicroPython. As an intermediate step between CPython and baremetal MicroPython you case use Unix MicroPython.

If that doesn't work for you, you're welcome to implement and contribute a native MicroPython debugger. A lot of users will indeed rejoice at your doing that.
Awesome MicroPython list
Pycopy - A better MicroPython https://github.com/pfalcon/micropython
MicroPython standard library for all ports and forks - https://github.com/pfalcon/micropython-lib
More up to date docs - http://pycopy.readthedocs.io/

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: PC-based QT emulator debugger?

Post by jickster » Sun Nov 05, 2017 11:23 pm

pfalcon wrote:
Sat Oct 28, 2017 6:24 pm
As an intermediate step between CPython and baremetal MicroPython you case use Unix MicroPython.
Can you explain why the Unix port is an "intermediate" step and how it helps with debugging?

Thanks

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: PC-based QT emulator debugger?

Post by pythoncoder » Mon Nov 06, 2017 12:10 pm

I think he's suggesting you debug the code under CPython. When it's working you run in under Unix MicroPython to ensure that there are no issues resulting from implementation differences between CPython and MicroPython. If it passes this test then you can be confident it will run on baremetal. Barring (possibly) timing issues...
Peter Hinch
Index to my micropython libraries.

stijn
Posts: 735
Joined: Thu Apr 24, 2014 9:13 am

Re: PC-based QT emulator debugger?

Post by stijn » Mon Nov 06, 2017 12:58 pm

Plus you can debug the Unix port's C code using gdb if needed

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: PC-based QT emulator debugger?

Post by jickster » Mon Nov 06, 2017 3:43 pm

pythoncoder wrote:
Mon Nov 06, 2017 12:10 pm
I think he's suggesting you debug the code under CPython. When it's working you run in under Unix MicroPython to ensure that there are no issues resulting from implementation differences between CPython and MicroPython. If it passes this test then you can be confident it will run on baremetal. Barring (possibly) timing issues...
stijn wrote:
Mon Nov 06, 2017 12:58 pm
Plus you can debug the Unix port's C code using gdb if needed
Got it; thanks!

Post Reply