Search found 80 matches

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: 13807

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: 13807

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: 13807

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: 13807

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: 13807

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: 13807

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)
by cduran
Mon Sep 25, 2017 6:43 pm
Forum: Development of MicroPython
Topic: Looking for help using MP in Windows with QT
Replies: 20
Views: 13807

Re: Looking for help using MP in Windows with QT

Just an idea, but whenever nlr_push is used in the uPy code it's result is never assigned to a variable and instead it's put directly in the if condition. Not sure if this matters, but if your nlr_push implementation is the one using setjmp and setjmp fiddles with the stack etc, it just might. So t...
by cduran
Mon Sep 25, 2017 2:40 pm
Forum: Development of MicroPython
Topic: Looking for help using MP in Windows with QT
Replies: 20
Views: 13807

Looking for help using MP in Windows with QT

First I think I should give some background. I started by using the minimal build to run on Atmel SAM MCU. I started with minimal because I was embedding micropython into my existing firmware. I should also add that I am not using the current builds of MP, my project started somewhere around April 2...
by cduran
Wed May 17, 2017 5:16 pm
Forum: Development of MicroPython
Topic: Need help, mp_lexer_new_from_str_len returning null
Replies: 10
Views: 7285

Re: Need help, mp_lexer_new_from_str_len returning null

Problem solved. My firmware is heavily optimized and that was wrecking havoc with mp. I de-optimized mp's files and it seems to be working fine now.
by cduran
Tue May 16, 2017 3:38 pm
Forum: Development of MicroPython
Topic: Need help, mp_lexer_new_from_str_len returning null
Replies: 10
Views: 7285

Re: Need help, mp_lexer_new_from_str_len returning null

Actually, I forgot to mention that the heap is NOT declared in main(). Neither is the stack. My init function, heap, stack and gc callbacks are all in a separate file. Would this cause any issues? static volatile char *stack_top; static char heap[16384] = {0xff}; void mp_initialize(void) { mp_stack_...