Search found 44 matches

by cduran
Wed Oct 11, 2017 3:55 pm
Forum: Development of MicroPython
Topic: Looking for help using MP in Windows with QT
Replies: 20
Views: 2413

Re: Looking for help using MP in Windows with QT

What are you initializing stack_top to? It looks like you're passing in an uninitialized global which will be NULL. For a desktop port (windows, unix, etc) I would expect that you'd pass in the address of a variable located on the stack. Or use mp_stack_ctrl_init which does that (takes the address ...
by cduran
Mon Oct 09, 2017 6:13 pm
Forum: Development of MicroPython
Topic: Looking for help using MP in Windows with QT
Replies: 20
Views: 2413

Re: Looking for help using MP in Windows with QT

So this is the content of my mpconfigport.h is there something I'm missing or needs to be different? #include <stdint.h> // options to control how Micro Python is built #define MICROPY_QSTR_BYTES_IN_HASH (1) #define MICROPY_ALLOC_PATH_MAX (256) #define MICROPY_ALLOC_PARSE_CHUNK_INIT (16) #define MIC...
by cduran
Fri Oct 06, 2017 3:05 pm
Forum: Development of MicroPython
Topic: Looking for help using MP in Windows with QT
Replies: 20
Views: 2413

Re: Looking for help using MP in Windows with QT

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. Hi cduran . Please let us know how you implemented this debugger here https://forum....
by cduran
Thu Oct 05, 2017 3:45 pm
Forum: Development of MicroPython
Topic: Looking for help using MP in Windows with QT
Replies: 20
Views: 2413

Re: Looking for help using MP in Windows with QT

What are you initializing stack_top to? It looks like you're passing in an uninitialized global which will be NULL. For a desktop port (windows, unix, etc) I would expect that you'd pass in the address of a variable located on the stack. Or use mp_stack_ctrl_init which does that (takes the address ...
by cduran
Mon Oct 02, 2017 7:03 pm
Forum: Development of MicroPython
Topic: Looking for help using MP in Windows with QT
Replies: 20
Views: 2413

Re: Looking for help using MP in Windows with QT

The next thing to check is that your port does all of the appropriate micropython initializations. i.e. calls gc_init and mp_init I'm using the following to initialize: #define BYTES_IN_KB 1024 #define KB_IN_PYTHON_HEAP 32 #define PYTHON_HEAP_SIZE (KB_IN_PYTHON_HEAP * BYTES_IN_KB) ... static char *...
by cduran
Tue Sep 26, 2017 6:26 pm
Forum: Development of MicroPython
Topic: Looking for help using MP in Windows with QT
Replies: 20
Views: 2413

Re: Looking for help using MP in Windows with QT

Using extern C just satisfies the linker. You need to make sure that once you're in MicroPython land, if you call ANY C++ code that it does not throw an exception, or it will totally mess up the MicroPython exception stack. As long as MicroPython doesn't call any C++ functions which may throw an ex...
by cduran
Tue Sep 26, 2017 2:39 pm
Forum: Development of MicroPython
Topic: Looking for help using MP in Windows with QT
Replies: 20
Views: 2413

Re: Looking for help using MP in Windows with QT

stijn wrote:Can't you just run this under the debugger and see what's goiing on? In particular, inspect the values of type and call in the code shown.
The debugger isn't working inside the C code.
by cduran
Tue Sep 26, 2017 2:38 pm
Forum: Development of MicroPython
Topic: Looking for help using MP in Windows with QT
Replies: 20
Views: 2413

Re: Looking for help using MP in Windows with QT

Using extern C just satisfies the linker. You need to make sure that once you're in MicroPython land, if you call ANY C++ code that it does not throw an exception, or it will totally mess up the MicroPython exception stack. As long as MicroPython doesn't call any C++ functions which may throw an ex...
by cduran
Mon Sep 25, 2017 8:22 pm
Forum: Development of MicroPython
Topic: Looking for help using MP in Windows with QT
Replies: 20
Views: 2413

Re: Looking for help using MP in Windows with QT

By the way QT is both C++ and C, I just have to use:

Code: Select all

#ifdef __cplusplus
extern "C" {
#endif
 [...]
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
to call the C code from QT/C++ code.
by cduran
Mon Sep 25, 2017 8:18 pm
Forum: Development of MicroPython
Topic: Looking for help using MP in Windows with QT
Replies: 20
Views: 2413

Re: Looking for help using MP in Windows with QT

Well, I've been digging some more and the hang is definitely coming from here:

Code: Select all

if (type->call != NULL)
{
	return type->call(fun_in, n_args, n_kw, args);
}
Which is inside mp_obj_t mp_call_function_n_kw(mp_obj_t fun_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args)