Open
Description
Hi! The issue linked in the README blocking use on RP2040 looks to be resolved as a few weeks ago, but the deployment artifact is from last summer. I'm super interested on trying this project out on an RP2040, so I tried building it myself but ran into problems:
(.venv) devon@ESO-3-DEV-VM:~/Documents/bray_airways/noreaster/lib_source/emlearn-micropython$ make dist ARCH=armv6m MPY_DIR=/home/devon/Documents/bray_airways/noreaster/micropython_firmware/micropython
make -C src/emlearn_trees/ ARCH=armv6m MPY_DIR=/home/devon/Documents/bray_airways/noreaster/micropython_firmware/micropython V=1 clean dist
make[1]: Entering directory '/home/devon/Documents/bray_airways/noreaster/lib_source/emlearn-micropython/src/emlearn_trees'
/usr/lib/gcc/arm-none-eabi/6.3.1/thumb/v6-m/libgcc.a
/bin/rm -rf build _arm_cmpsf2.o lesf2.o _arm_fixsfsi.o fixsfsi.o eqsf2.o gesf2.o _arm_addsubsf3.o _arm_muldivsf3.o addsf3.o _clzsi2.o _udivsi3.o floatsisf.o divsf3.o _thumb1_case_uqi.o
/bin/mkdir -p build/
arm-none-eabi-ar -x /usr/lib/gcc/arm-none-eabi/6.3.1/thumb/v6-m/libgcc.a _arm_cmpsf2.o lesf2.o _arm_fixsfsi.o fixsfsi.o eqsf2.o gesf2.o _arm_addsubsf3.o _arm_muldivsf3.o addsf3.o _clzsi2.o _udivsi3.o floatsisf.o divsf3.o _thumb1_case_uqi.o
GEN build/emlearn_trees.config.h
python3 /home/devon/Documents/bray_airways/noreaster/micropython_firmware/micropython/tools/mpy_ld.py '-vvv' --arch armv6m --preprocess -o build/emlearn_trees.config.h trees.c trees.py
CC trees.c
arm-none-eabi-gcc -I. -I/home/devon/Documents/bray_airways/noreaster/micropython_firmware/micropython -std=c99 -Os -Wall -Werror -DNDEBUG -DNO_QSTR -DMICROPY_ENABLE_DYNRUNTIME -DMP_CONFIGFILE='<build/emlearn_trees.config.h>' -fpic -fno-common -U _FORTIFY_SOURCE -mthumb -mcpu=cortex-m0 -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_NONE -I/home/devon/Documents/bray_airways/noreaster/.venv/lib/python3.10/site-packages/emlearn -o build/trees.o -c trees.c
LINK _arm_cmpsf2.o
python3 /home/devon/Documents/bray_airways/noreaster/micropython_firmware/micropython/tools/mpy_ld.py '-vvv' --arch armv6m --qstrs build/emlearn_trees.config.h -o build/emlearn_trees.native.mpy _arm_cmpsf2.o lesf2.o _arm_fixsfsi.o fixsfsi.o eqsf2.o gesf2.o _arm_addsubsf3.o _arm_muldivsf3.o addsf3.o _clzsi2.o _udivsi3.o floatsisf.o divsf3.o _thumb1_case_uqi.o build/trees.o
qstr vals: __del__, addleaf, addnode, addroot, emltrees, new, predict, setdata
sections:
00000008 .text size=116
0000007c .text size=132
00000100 .text size=64
00000140 .text size=76
0000018c .text size=128
0000020c .text size=16
0000021c .text size=804
00000540 .text size=60
0000057c .text size=276
00000690 .text size=160
00000730 .text size=656
000009c0 .rodata size=128
00000a40 .text size=20
00000a54 .text size=1488
00000000 .bss size=112
00001024 .data.rel.ro size=80
00001074 .data.rel.ro.local size=40
0000109c .rodata.str1.1 size=236
00001188 GOT size=20
GOT: 00001188
00000000 mp_fun_table -> .external+00000000
00000004 mp_native_qstr_table -> .external.qstr_table+00000000
00000008 eml_error_strs -> .data.rel.ro.local+00001084
0000000c trees_builder_type -> .bss+00000030
00000010 trees_locals_dict_table -> .bss+00000000
_arm_cmpsf2.o: .text relocations via .rel.text:
00000012 __lesf2 -> 0000007d
00000022 __eqsf2 -> 00000141
0000002e __lesf2 -> 0000007d
00000042 __lesf2 -> 0000007d
00000056 __gesf2 -> 0000018d
0000006a __gesf2 -> 0000018d
_arm_addsubsf3.o: .text relocations via .rel.text:
00000214 __aeabi_fadd -> 0000021d
addsf3.o: .text relocations via .rel.text:
0000026c __clzsi2 -> 00000541
_udivsi3.o: .text relocations via .rel.text:
00000680 __aeabi_idiv0 -> 00000f45
floatsisf.o: .text relocations via .rel.text:
000006a0 __clzsi2 -> 00000541
divsf3.o: .text relocations via .rel.text:
00000814 __clzsi2 -> 00000541
0000082c __clzsi2 -> 00000541
Traceback (most recent call last):
File "/home/devon/Documents/bray_airways/noreaster/micropython_firmware/micropython/tools/mpy_ld.py", line 1093, in <module>
main()
File "/home/devon/Documents/bray_airways/noreaster/micropython_firmware/micropython/tools/mpy_ld.py", line 1089, in main
do_link(args)
File "/home/devon/Documents/bray_airways/noreaster/micropython_firmware/micropython/tools/mpy_ld.py", line 1060, in do_link
link_objects(env, len(native_qstr_vals))
File "/home/devon/Documents/bray_airways/noreaster/micropython_firmware/micropython/tools/mpy_ld.py", line 850, in link_objects
do_relocation_text(env, sec.addr, r)
File "/home/devon/Documents/bray_airways/noreaster/micropython_firmware/micropython/tools/mpy_ld.py", line 595, in do_relocation_text
assert 0, r_info_type
AssertionError: 2
/home/devon/Documents/bray_airways/noreaster/micropython_firmware/micropython/py/dynruntime.mk:149: recipe for target 'build/emlearn_trees.native.mpy' failed
make[1]: *** [build/emlearn_trees.native.mpy] Error 1
make[1]: Leaving directory '/home/devon/Documents/bray_airways/noreaster/lib_source/emlearn-micropython/src/emlearn_trees'
Makefile:14: recipe for target 'dist/armv6m_6.3/emlearn_trees.mpy' failed
make: *** [dist/armv6m_6.3/emlearn_trees.mpy] Error 2
The micropython version is the lastest, so that being out of date isn't the problem (I don't think)...
I modified mpy_ld.py
to log some more info. In that function do_relocation_text
:
env.arch.name = EM_ARM
r_info_type = 2
The ELF constant for 2 is R_386_PC32
. Is the issue that I'm trying to build the armv6m
version on an x86 box?
Best,
Devon