Search found 67 matches

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

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

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

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

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

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

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

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_...
by cduran
Mon May 15, 2017 2:58 pm
Forum: Development of MicroPython
Topic: Need help, mp_lexer_new_from_str_len returning null
Replies: 10
Views: 2992

Re: Need help, mp_lexer_new_from_str_len returning null

- No error codes per se, just returns NULL.
- My heap is currently set at 16kb:
static char heap[16384]

I can't imagine that with a heap that large and a script that small that I would be running out of memory.
dhylands wrote:What error?
Did you setup your heap?
Are you running out of memory?
by cduran
Thu May 11, 2017 12:33 pm
Forum: Development of MicroPython
Topic: Need help, mp_lexer_new_from_str_len returning null
Replies: 10
Views: 2992

Re: Need help, mp_lexer_new_from_str_len returning null

Is src a null-terminated string? strlen requires it. Yes, for testing I'm passing it a constant string like this: "def test():\n t=call(0x23,0x04,0x16,0x00,0x00)\n if len(t) < 1\n return\n t[10]=0x06\n t[14]=0x63\n call(0x20,t,0,0,0)\n return\ntest()" The call() function never gives an error, that ...
by cduran
Wed May 10, 2017 11:04 pm
Forum: Development of MicroPython
Topic: Need help, mp_lexer_new_from_str_len returning null
Replies: 10
Views: 2992

Re: Need help, mp_lexer_new_from_str_len returning null

I'm still having problems with this. I'm using the following code, which is used in the Minimal build as well as other builds. mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, src, strlen(src), 0); Seems to be almost at random. The syntax of the script is correct and there is no wa...