Assertion 'mp_obj_is_exception_instance(self_in)

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
jevers76
Posts: 5
Joined: Thu Jan 02, 2014 9:10 pm

Assertion 'mp_obj_is_exception_instance(self_in)

Post by jevers76 » Fri Aug 01, 2014 3:04 am

I am running MP for the first time on a STM32F4discovery board built from the source code downloaded from the Github on July 17. I built within Cygwin and use eMblocks to load and debug. I have modified the main.py to print 'hello world' When I type a ctl-D to do a soft reset I get the exception shown below and it crashes. I am new to Python and this project so any guidance would be helpful. I can set breakpoints and step, but I don't know what to look for.
>>>
>>> pyb.info()
ID=29001e00:05473133:31333037
S=168000000
H=168000000
P1=42000000
P2=84000000
_etext=808089c
_sidata=808089c
_sdata=20000000
_edata=20000bd8
_sbss=20000bd8
_ebss=20002e84
_estack=2001ffff
_ram_start=20000000
_heap_start=20002e84
_heap_end=2001c000
_ram_end=20020000
qstr:
n_pool=1
n_qstr=5
n_str_data_bytes=66
n_total_bytes=162
GC:
100416 total
1056 : 99360
1=27 2=10 m=6
LFS free: 91648 bytes
>>>
>>>
PYB: sync filesystems
PYB: soft reboot
Assertion 'mp_obj_is_exception_instance(self_in)' failed, at file ..\..\py\objexcept.c:332

FATAL ERROR:

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Assertion 'mp_obj_is_exception_instance(self_in)

Post by dhylands » Fri Aug 01, 2014 3:22 pm

So I tried using the very latest build (for the discovery board) using linux to build and I'm not seeing the problem:

Code: Select all

PYB: sync filesystems
PYB: soft reboot
Micro Python v1.2-51-gf8f963a on 2014-08-01; F4DISC with STM32F407
Type "help()" for more information.
>>> 
I had to make a small fix get the very latest to build with the discovery. Can you tell me which git hash you're using?

i.e. what is the output of:

Code: Select all

git rev-parse HEAD
I just got my VirtualBox running XP (and cygwin) able to build the windows version of micropython, so I'll see if building there makes any difference.

jevers76
Posts: 5
Joined: Thu Jan 02, 2014 9:10 pm

Re: Assertion 'mp_obj_is_exception_instance(self_in)

Post by jevers76 » Fri Aug 01, 2014 4:52 pm

I used the zip download. Can I still use the git command to find out which version? Is the version embedded somewhere in the source files? I download the code on July 16 or 17th. The current code does not build for me right now or I would update.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Assertion 'mp_obj_is_exception_instance(self_in)

Post by dhylands » Fri Aug 01, 2014 5:16 pm

The very latest one should work (there was a fix committed this morning).

I just built it using cygwin and flashed. Something significant I noticed is this output from your pyb.info():

Mine shows:

Code: Select all

_etext=805ce8c
and yours shows:

Code: Select all

_etext=808089c
which means that your code size is about 140K bigger. This seems extremely odd to me. Did you modify any other build flags?

Which toolchain are you using?

I used the win32 one from here: https://launchpad.net/gcc-arm-embedded

I noticed that it totally messes up the dependency files (generating DOS style pathnames), which means I have to do a clean build.

jevers76
Posts: 5
Joined: Thu Jan 02, 2014 9:10 pm

Re: Assertion 'mp_obj_is_exception_instance(self_in)

Post by jevers76 » Sat Aug 02, 2014 3:44 am

I used DEBUG=1, and i also looked and saw I also added -ggdb to the compile options. The compiler shows gcc version 4.7.3 20130312 (release) [ARM/embedded-4_7-branch revision 196615] ( GNU Tools for ARM Embedded Processors). Tomorrow I will try without the debug.

jevers76
Posts: 5
Joined: Thu Jan 02, 2014 9:10 pm

Re: Assertion 'mp_obj_is_exception_instance(self_in)

Post by jevers76 » Mon Aug 04, 2014 1:17 am

I have rebuilt and loaded August 3 zip file from the git repository. I built using Ubuntu 12.04 running in Vmware player. When I load as a hex file with st-link everything runs fine. When I use emblocks and load the .elf file I get the same crash as described in my earlier posts. I will try to find out why running with debugging in emblocks breaks it. What tool are you using for debugging? How do I determine and specify the software version number, especially when downloading as a zip?

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Assertion 'mp_obj_is_exception_instance(self_in)

Post by dhylands » Mon Aug 04, 2014 7:39 am

I'm able to reproduce the problem using a DEBUG=1 build.

The size of the executable is considerably larger, and if I boot up and just press Control-D then I get:

Code: Select all

PYB: sync filesystems
PYB: soft reboot
Assertion 'mp_obj_is_exception_instance(self_in)' failed, at file ../py/objexcept.c:426

FATAL ERROR:


I raised https://github.com/micropython/micropython/issues/788 and I understand why this is happening (after doing a bit of investigation).

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Assertion 'mp_obj_is_exception_instance(self_in)

Post by dhylands » Mon Aug 04, 2014 8:40 am

jevers76 wrote:How do I determine and specify the software version number, especially when downloading as a zip?
To download a zip for the latest source code use: https://github.com/micropython/micropyt ... master.zip

To download a zip for the source code as of a particular commit use: https://github.com/micropython/micropyt ... /{sha}.zip

where {sha} is the full sha for the commit.

To see the sha for a particular "release" look at: https://github.com/micropython/micropython/releases
You'll see the short sha below the relase number. You can click on it to get the full sha.

I don't know that there is a way to figure out the version given a zip file (because the version is determined by querying git).

You could just install the cygwin git and use that to fetch your code.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Assertion 'mp_obj_is_exception_instance(self_in)

Post by dhylands » Mon Aug 04, 2014 6:42 pm

Damien fixed the underlying issue, and I confirmed that the assert is no longer hit with my DEBUG=1 build.

Post Reply