I'm new to MicroPython and I have successfully ported MicroPython as a standalone binary image to a new embedded SoC platform (x86-based arch 32bit). It runs like a charm and I do not have any issues. Then I tried to combine MicroPython with U-Boot, where U-Boot code by default are all compiled with -mregparm=3, meaning at-most 3 parameters can be passed by CPU registers. This looks like causing issues where MicroPython always facing initialization problems. I also tried to add the "-mregparm=3" to the unix port and forcing 32 bit in mpconfigport.mk, the compilation is fine but the compiled image fails to start.
However the problem seems not exactly the same.
When compiling the unix port with -mregparm=3 it seems clear that it is due to the mismatch of ABI between libc and micropython:
Code: Select all
(gdb) run
Starting program: /home/hua/mp/micropython/unix/micropython
Program received signal SIGSEGV, Segmentation fault.
0xf7e106f1 in ?? () from /lib/i386-linux-gnu/libc.so.6
(gdb) bt
#0 0xf7e106f1 in ?? () from /lib/i386-linux-gnu/libc.so.6
#1 0xf7dc740c in getenv () from /lib/i386-linux-gnu/libc.so.6
#2 0x08049f43 in ?? ()
#3 0xf7db172e in __libc_start_main () from /lib/i386-linux-gnu/libc.so.6
#4 0x0804a5ab in ?? ()
(gdb)
Anyone having any in-depth knowledge of the MicroPython implementation and how could -mregparm=3 having the impact at run-time? I see the exception handling in MicroPython using something like none-local-return and could this having the assumption that all parameters are passing on stack?
Thanks in advance.
Hua