How to freeze module for ESP32

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: How to freeze module for ESP32

Post by davef » Sun Apr 17, 2022 8:27 am

138 packages to install.

Have you done a:

Code: Select all

sudo apt upgrade
then

Code: Select all

sudo apt dist-upgrade
and maybe a

Code: Select all

sudo apt autoremove
Then try upgrading Python

Peugot206
Posts: 31
Joined: Sat Apr 09, 2022 5:57 pm

Re: How to freeze module for ESP32

Post by Peugot206 » Sun Apr 17, 2022 8:40 am

Thanks davef for your help so far! I figured out my Ubuntu version is too old and thus does not allow users to upgrade to Python 3.7 anymore. I'm updating the latest Ubuntu version now (even though the tutorial I watched recommended an older one). And will re-do all the steps. I'm getting more of an idea now on how to install everything, let's hope it works this time :D , will let you know

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: How to freeze module for ESP32

Post by davef » Sun Apr 17, 2022 8:45 am

Is that related to 32bit versus 64bit?

Peugot206
Posts: 31
Joined: Sat Apr 09, 2022 5:57 pm

Re: How to freeze module for ESP32

Post by Peugot206 » Sun Apr 17, 2022 9:46 am

davef wrote:
Sun Apr 17, 2022 8:45 am
Is that related to 32bit versus 64bit?
Uhm none I think, I always use the 64-bit, but the Ubuntu version was 16.04, and the latest is already 20.4 or something, so it was very outdated.

I've now installed a fresh Ubuntu version, with the version 20.04, Python 3.8.10 installed on it. Built all the ESP-IDF tools and MicroPython files. Can succesfully make for Unix port and run ./micropython in the Ubuntu terminal.

Now when I go to the ports/esp32/ and run 'make submodules' it all works fine, until I run 'make' I run into an error again..

Code: Select all

-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
CMake Error at /home/peugot206/esp/esp-idf/tools/cmake/build.cmake:197 (message):
  Failed to resolve component 'tcpip_adapter'.
Call Stack (most recent call first):
  /home/peugot206/esp/esp-idf/tools/cmake/build.cmake:225 (__build_resolve_and_add_req)
  /home/peugot206/esp/esp-idf/tools/cmake/build.cmake:512 (__build_expand_requirements)
  /home/peugot206/esp/esp-idf/tools/cmake/project.cmake:422 (idf_build_process)
  CMakeLists.txt:58 (project)


-- Configuring incomplete, errors occurred!
See also "/home/peugot206/micropython/ports/esp32/build-GENERIC/CMakeFiles/CMakeOutput.log".
cmake failed with exit code 1
make: *** [Makefile:34: all] Error 2
This is driving me crazy! What now? Any ideas? :)

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: How to freeze module for ESP32

Post by davef » Sun Apr 17, 2022 9:57 am

Ah, it was awhile ago when I tried this and since there has been a change to cmake.

There have been some threads about the differences. I would expect the readme in /ports/esp32 to reflect the new make environment.

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: How to freeze module for ESP32

Post by davef » Sun Apr 17, 2022 10:00 am


Peugot206
Posts: 31
Joined: Sat Apr 09, 2022 5:57 pm

Re: How to freeze module for ESP32

Post by Peugot206 » Sun Apr 17, 2022 10:12 am

davef wrote:
Sun Apr 17, 2022 9:57 am
Ah, it was awhile ago when I tried this and since there has been a change to cmake.

There have been some threads about the differences. I would expect the readme in /ports/esp32 to reflect the new make environment.
It works!! I switched to the version in the ESP32 readme (even though I have been following this readme all the time, I somehow managed to ignore this specific version..)

Code: Select all

git checkout v4.2
I then re-ran some install.sh files again and it gave me errors that it could not create a new environment, because there was already one active. So I simply opened a new terminal and copy-pasted the install.sh line again and it was done!

Then I went to the ports/esp32 and was able to run make!! :D

So now I can finally add the files I want to 'modules', run 'make', flash the file into my ESP32 and the modules are baked into the firmware?

Peugot206
Posts: 31
Joined: Sat Apr 09, 2022 5:57 pm

Re: How to freeze module for ESP32

Post by Peugot206 » Sun Apr 17, 2022 10:16 am

I want to bake in the IR library for a test, it consists out of 2 folders:

ir_rx
-- file 1
-- file 2

ir_tx
-- file 1
-- file 2

Can I simply put the 'ir_rx' and 'ir_tx' in the /ports/esp32/modules/ folder and then run make, and from my main.py call

Code: Select all

import ir_rx.file_1
Or will that not work?

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: How to freeze module for ESP32

Post by davef » Sun Apr 17, 2022 10:21 am

Sorry, you are further ahead than I ever manged to get.

There was a thread recently about directories, but that was do to with files in flash ... I think.

Peugot206
Posts: 31
Joined: Sat Apr 09, 2022 5:57 pm

Re: How to freeze module for ESP32

Post by Peugot206 » Sun Apr 17, 2022 10:43 am

Edit: the custom build MP firmware .bin file for the ESP32 results in a boot-loop, I created a new thread here: viewtopic.php?f=15&t=12276, since the topic is different now.

Post Reply