pfalcon / pycopy

Pycopy - a minimalist and memory-efficient Python dialect. Good for desktop, cloud, constrained systems, microcontrollers, and just everything.
http://pycopy.readthedocs.io
MIT License
805 stars 78 forks source link

ESP32 missing '/lib/mbedtls_errors/mp_mbedtls_errors.c' and others.. #57

Closed megazhuk closed 3 years ago

megazhuk commented 3 years ago

I trying to compile Pycopy for esp32 using /tools/ci.sh And cant so this because compiler tell me about missing /lib/mbedtls_errors/mp_mbedtls_errors.c. I do not found anything about this in google. You can check this process here in colab: Run CI.sh in Google Colab

When i comment line with ${MICROPY_DIR}/lib/mbedtls_errors/mp_mbedtls_errors.c in /pycopy/ports/esp32/main/CMakeLists.txt and try to run ci_esp32_build in /tools/ci.sh again, then compiller told me:

[ 93%] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/pycopy/extmod/moduhashlib.c.obj [ 93%] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/pycopy/extmod/moduheapq.c.obj /pycopy/extmod/moductypes.c: In function 'uctypes_get_buffer': /pycopy/extmod/moductypes.c:761:18: error: 'addr' may be used uninitialized in this function [-Werror=maybe-uninitialized] bufinfo->buf = addr;


cc1: some warnings being treated as errors
[ 93%] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/pycopy/extmod/modujson.c.obj
[ 93%] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/pycopy/extmod/modurandom.c.obj
esp-idf/main/CMakeFiles/__idf_main.dir/build.make:2170: recipe for target 'esp-idf/main/CMakeFiles/__idf_main.dir/pycopy/extmod/moductypes.c.obj' failed
make[3]: *** [esp-idf/main/CMakeFiles/__idf_main.dir/pycopy/extmod/moductypes.c.obj] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/pycopy/ports/esp32/build-GENERIC'
CMakeFiles/Makefile2:4776: recipe for target 'esp-idf/main/CMakeFiles/__idf_main.dir/all' failed
make[2]: *** [esp-idf/main/CMakeFiles/__idf_main.dir/all] Error 2
make[2]: Leaving directory '/pycopy/ports/esp32/build-GENERIC'
Makefile:129: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/pycopy/ports/esp32/build-GENERIC'
make failed with exit code 2
Makefile:18: recipe for target 'all' failed
make: *** [all] Error 2
make: Leaving directory '/pycopy/ports/esp32'

Next, when i fix uctypes_get_buffer in /pycopy/extmod/moductypes.c like this: -change strNo.749: addr = *(void **)self->addr; -> bufinfo->buf = *(void **)self->addr; -change strNo.758: addr = self->addr; -> bufinfo->buf = self->addr; -remove strNo.761 and strNo.740

Then compilation done by 100%, but linking fails:

[100%] Building C object CMakeFiles/micropython.elf.dir/project_elf_src.c.obj [100%] Linking CXX executable micropython.elf /root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(lexer.c.obj):(.literal.skip_whitespace+0x8): undefined reference to mp_strict_mode' /root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(objmodule.c.obj):(.literal.module_attr+0x4): undefined reference tomp_strict_runtime' /root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(objmodule.c.obj):(.literal.module_attr+0x8): undefined reference to mp_strict_mode_error' /root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(objmodule.c.obj):(.literal.module_attr+0xc): undefined reference tomp_handle_store_ns_strict' /root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(objmodule.c.obj): in function module_attr': /pycopy/py/objmodule.c:101: undefined reference tomp_strict_mode_error' /root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /pycopy/py/objmodule.c:107: undefined reference to mp_handle_store_ns_strict' /root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(objtype.c.obj): in functiontype_attr': /pycopy/py/objtype.c:1141: undefined reference to mp_strict_mode_error' /root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: /pycopy/py/objtype.c:1147: undefined reference tomp_handle_store_ns_strict' /root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(runtime.c.obj):(.literal.mp_parse_compile_execute+0x0): undefined reference to mp_strict_update_main_name' /root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(runtime.c.obj): in functionmp_store_name': /pycopy/py/runtime.c:219: undefined reference to mp_handle_store_ns_strict' /root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(runtime.c.obj): in functionmp_delete_name': /pycopy/py/runtime.c:227: undefined reference to mp_strict_mode_error' /root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(runtime.c.obj): in functionmp_store_global': /pycopy/py/runtime.c:234: undefined reference to mp_handle_store_ns_strict' /root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(runtime.c.obj): in functionmp_delete_global': /pycopy/py/runtime.c:242: undefined reference to mp_strict_mode_error' /root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(runtime.c.obj): in functionmp_parse_compile_execute': /pycopy/py/runtime.c:1562: undefined reference to mp_strict_update_main_name' /root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(builtinimport.c.obj): in functiondo_execute_raw_code': /pycopy/py/builtinimport.c:192: undefined reference to mp_strict_update_main_name' /root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(modbuiltins.c.obj):(.literal.mp_builtin_globals+0x0): undefined reference tomp_strict_runtime' /root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(modio.c.obj):(.rodata.mp_module_io_globals_table+0x24): undefined reference to mp_type_textiobase' /root/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: esp-idf/main/libmain.a(modio.c.obj):(.rodata.mp_module_io_globals_table+0x2c): undefined reference tomp_type_textiobase' collect2: error: ld returned 1 exit status CMakeFiles/micropython.elf.dir/build.make:249: recipe for target 'micropython.elf' failed make[3]: [micropython.elf] Error 1 make[3]: Leaving directory '/pycopy/ports/esp32/build-GENERIC' CMakeFiles/Makefile2:470: recipe for target 'CMakeFiles/micropython.elf.dir/all' failed make[2]: [CMakeFiles/micropython.elf.dir/all] Error 2 make[2]: Leaving directory '/pycopy/ports/esp32/build-GENERIC' Makefile:129: recipe for target 'all' failed make[1]: [all] Error 2 make[1]: Leaving directory '/pycopy/ports/esp32/build-GENERIC' make failed with exit code 2 Makefile:18: recipe for target 'all' failed make: [all] Error 2 make: Leaving directory '/pycopy/ports/esp32'

Can you tell me how to compile Pycopy for esp32 ?

May be you can make a Colab Notebook, for compiling Pycopy ? i think it will be a great, when anyone can load Notebook and customize, compile and download a firmware..

pfalcon commented 3 years ago

Thanks for interest in Pycopy. Pycopy is in development, and the main target platform is POSIX systems. Until JIT, etc. is developed for it, other platforms are on back-burner (I consider removing them).