Page 1 of 2
[TM4C123] Assertion failed
Posted: Sat Dec 15, 2018 8:31 pm
by ExXec
Hey everybody,
I'm in the process of porting uPy to the Tiva Launchpad.
I recently finished some of the pin control and while testing on the REPL I noticed this assertion error:
Code: Select all
from umachine import Pin
p = Pin.board.PF2
p.init(Pin.OUT)
p.on()
p.off()
p.on()
p.off()
Assertion 'MP_PARSE_NODE_STRUCT_KIND(pns) <= PN_const_object' failed, at file ../../py/compile.c:2746
What is causing this?
I suspect a GC issue, because the board only has 32kB SRAM? But I have no idea really
Thanks
-ExXec
Re: [TM4C123] Assertion failed
Posted: Sat Dec 15, 2018 8:46 pm
by jickster
Let’s eliminate those function calls and see if it still happens.
Try it with simper code like
a = 55
a = a * 55
b = a + 87
etc
Keep typing simple lines and let us know if you see the same issue.
Sent from my iPhone using Tapatalk Pro
Re: [TM4C123] Assertion failed
Posted: Sat Dec 15, 2018 9:11 pm
by ExXec
So I did this and I got a different error this time
Code: Select all
MicroPython v1.9.4-799-g89944c591-dirty on 2018-12-15; Tiva Launch Pad with TM4C123G6HPM
>>> a = 9
>>> b = 8
>>> c = 7
>>> d = 6
>>> c = 5
>>> b = 4
>>> a = 3
>>> b = 2
>>> c = 1
Assertion 'l < emit->max_num_labels' failed, at file ../../py/emitbc.c:496
Re: [TM4C123] Assertion failed
Posted: Sat Dec 15, 2018 9:26 pm
by jickster
Did you actually create a heap for uPy and pass its pointer to mp_init ?
Sent from my iPhone using Tapatalk Pro
Re: [TM4C123] Assertion failed
Posted: Sat Dec 15, 2018 9:48 pm
by ExXec
This is from my main.c:
This is just from the minimal port with slight alterations
The flag MICROPY_ENABLE_GC is set to 1
Code: Select all
#if MICROPY_ENABLE_GC
static char heap[2048];
#endif
int main(int argc, char **argv) {
int stack_dummy;
stack_top = (char*)&stack_dummy;
#if MICROPY_ENABLE_GC
gc_init(heap, heap + sizeof(heap));
#endif
mp_init();
#if MICROPY_ENABLE_COMPILER
#if MICROPY_REPL_EVENT_DRIVEN
pyexec_event_repl_init();
for (;;) {
int c = mp_hal_stdin_rx_chr();
if (pyexec_event_repl_process_char(c)) {
break;
}
}
#else
pyexec_friendly_repl();
#endif
//do_str("print('hello world!', list(x+1 for x in range(10)), end='eol\\n')", MP_PARSE_SINGLE_INPUT);
//do_str("for i in range(10):\r\n print(i)", MP_PARSE_FILE_INPUT);
#else
pyexec_frozen_module("frozentest.py");
#endif
mp_deinit();
return 0;
}
Re: [TM4C123] Assertion failed
Posted: Sat Dec 15, 2018 10:17 pm
by jickster
What exact release of uPy are you using?
1.9.3?
1.9.4?
Sent from my iPhone using Tapatalk Pro
Re: [TM4C123] Assertion failed
Posted: Sat Dec 15, 2018 11:11 pm
by ExXec
Oh, I didn't use a specific version, I forked it at somepoint and then worked from there.
Latest commit is from 10.Dec this year.
So 1.9.4 I guess?
Re: [TM4C123] Assertion failed
Posted: Sat Dec 15, 2018 11:19 pm
by jickster
ExXec wrote:Oh, I didn't use a specific version, I forked it at somepoint and then worked from there.
Latest commit is from 10.Dec this year.
So 1.9.4 I guess?
To eliminate that variable, please use a specific version.
Monday I’ll run your exact code and see what happens.
Sent from my iPhone using Tapatalk Pro
Re: [TM4C123] Assertion failed
Posted: Sat Dec 15, 2018 11:24 pm
by ExXec
Ok thank you so far!
Re: [TM4C123] Assertion failed
Posted: Sat Dec 15, 2018 11:25 pm
by jickster
ExXec wrote:Ok thank you so far!
Ok. What release version are you using?
Sent from my iPhone using Tapatalk Pro