[TM4C123] Assertion failed

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
ExXec
Posts: 83
Joined: Sat Oct 20, 2018 4:02 pm

[TM4C123] Assertion failed

Post by ExXec » Sat Dec 15, 2018 8:31 pm

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

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: [TM4C123] Assertion failed

Post by jickster » Sat Dec 15, 2018 8:46 pm

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

ExXec
Posts: 83
Joined: Sat Oct 20, 2018 4:02 pm

Re: [TM4C123] Assertion failed

Post by ExXec » Sat Dec 15, 2018 9:11 pm

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

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: [TM4C123] Assertion failed

Post by jickster » Sat Dec 15, 2018 9:26 pm

Did you actually create a heap for uPy and pass its pointer to mp_init ?


Sent from my iPhone using Tapatalk Pro

ExXec
Posts: 83
Joined: Sat Oct 20, 2018 4:02 pm

Re: [TM4C123] Assertion failed

Post by ExXec » Sat Dec 15, 2018 9:48 pm

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;
}

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: [TM4C123] Assertion failed

Post by jickster » Sat Dec 15, 2018 10:17 pm

What exact release of uPy are you using?

1.9.3?
1.9.4?


Sent from my iPhone using Tapatalk Pro

ExXec
Posts: 83
Joined: Sat Oct 20, 2018 4:02 pm

Re: [TM4C123] Assertion failed

Post by ExXec » Sat Dec 15, 2018 11:11 pm

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?

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: [TM4C123] Assertion failed

Post by jickster » Sat Dec 15, 2018 11:19 pm

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

ExXec
Posts: 83
Joined: Sat Oct 20, 2018 4:02 pm

Re: [TM4C123] Assertion failed

Post by ExXec » Sat Dec 15, 2018 11:24 pm

Ok thank you so far!

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: [TM4C123] Assertion failed

Post by jickster » Sat Dec 15, 2018 11:25 pm

ExXec wrote:Ok thank you so far!
Ok. What release version are you using?


Sent from my iPhone using Tapatalk Pro

Post Reply