Search found 49 matches

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

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

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...
by cduran
Tue May 09, 2017 3:47 pm
Forum: Development of MicroPython
Topic: Getting a lexer error when modifying an array/list
Replies: 0
Views: 602

Getting a lexer error when modifying an array/list

I am testing a simple script: def test9(): test=call(0x23,0x04,0x16,0x00,0x00) test[10]=0x06 test[14]=0x63 call(0x20,test,0,0,0) return test9() the call(0x23,0x04,0x16,0x00,0x00) function returns a byte array created in my firmware using mp_obj_new_bytearray. I am getting a lexer memory error when I...
by cduran
Thu May 04, 2017 12:02 am
Forum: Development of MicroPython
Topic: Passing variables between C and Python
Replies: 12
Views: 8146

Re: Passing variables between C and Python

I want to pass a python list to my c callback: static mp_obj_t c_sample_call_callback(mp_obj_t mpOpcode, mp_obj_t mp_arg1, mp_obj_t mp_arg2) I've been using mp_obj_new_bytearray() to go from a c array to a python list, but I would like to know what the function is to go from a python list to a c arr...
by cduran
Wed May 03, 2017 2:38 pm
Forum: General Discussion and Questions
Topic: Reseting Micropython
Replies: 3
Views: 1186

Re: Reseting Micropython

machine.reset() - see http://docs.micropython.org/en/latest/esp8266/library/machine.html#reset-related-functions . Also on the Pyboard pyb.hard_reset() http://docs.micropython.org/en/latest/pyboard/library/pyb.html#reset-related-functions Thank you, but I forgot to mention that I want my firmware t...
by cduran
Tue May 02, 2017 4:48 pm
Forum: General Discussion and Questions
Topic: Reseting Micropython
Replies: 3
Views: 1186

Reseting Micropython

Is there a function for reseting mp? Or is this just done by calling deinit and init back to back?
by cduran
Fri Apr 28, 2017 11:03 pm
Forum: Development of MicroPython
Topic: Need help, mp_lexer_new_from_str_len returning null
Replies: 10
Views: 2676

Need help, mp_lexer_new_from_str_len returning null

I'm trying to compile and run a script stored in flash. I'm not using a file system, the script is just stored as raw ascii. The problem I'm having is that mp_lexer_new_from_str_len() is returning NULL. Seems to be having trouble allocating memory for something. There are many other things going on ...
by cduran
Tue Apr 18, 2017 5:12 pm
Forum: Development of MicroPython
Topic: How to clear all scripts in mp
Replies: 1
Views: 949

How to clear all scripts in mp

I'm currently using micropython to execute scripts that are sent over the air to my device. The scripts are kept in FLASH until its time for their execution by mp. What I would like to do is after a script executes, remove it from RAM. Is there a function for removing mp scripts from the heap?
by cduran
Mon Mar 06, 2017 2:07 pm
Forum: Development of MicroPython
Topic: Embedding with frozen code
Replies: 7
Views: 2995

Re: Embedding with frozen code

Do you mean the code I posted? (Which is the cross compilers code) or the micopython build?
by cduran
Fri Mar 03, 2017 9:01 pm
Forum: Development of MicroPython
Topic: Embedding with frozen code
Replies: 7
Views: 2995

Re: Embedding with frozen code

In your main.c file you can call pyexec_frozen_module("main.py"); replacing main.py with the name of your frozen module. This is what I do on the teensy. I haven't tried with frozen bytecode, just frozen python code. Thanks that worked well for source code, however it didn't work with byte code (mp...