Setup for Compiling MicroPython firmware - stuck

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
rx8pilot
Posts: 12
Joined: Fri Mar 26, 2021 3:39 am

Setup for Compiling MicroPython firmware - stuck

Post by rx8pilot » Fri Feb 11, 2022 5:02 am

I have spent a few days trying to setup to compile micropython for a custom board that I made.

Running a dedicated Ubuntu VM, I installed ESP-IDF and cloned micropython. As best I know how, I followed the smattering of README's, instructions, and forum posts trying to get anything to compile. It seems to be pretty close - but when I attempt to run make, I just get

Code: Select all

ModuleNotFoundError: No module named 'Click'
I have run from system Python3 and a venv with all the dependencies in the requirements.txt file. A PIP list shows click as installed. In this particular case, I am testing with an ESP32-S2 if that is relevant. Not sure if this is a simple thing or perhaps I have done everything wrong. I have no clue where to turn next.

Question: Is there a definitive resource for getting configured to compile MicroPython - in particular, ESP32 for now? This is far more challenging than I anticipated.

Code: Select all

(build-venv) carlos@ubuntu:~/micropython/ports/esp32$ make                                                                                                                     
idf.py -D MICROPY_BOARD=GENERIC_S2 -B build-GENERIC_S2  build                                                                                                                  
Traceback (most recent call last):                                                                                                                                             
  File "/home/carlos/esp/esp-idf/tools/idf.py", line 805, in <module>                                                                                                          
    main()                                                                                                                                                                     
  File "/home/carlos/esp/esp-idf/tools/idf.py", line 737, in main
    cli = init_cli(verbose_output=checks_output)
  File "/home/carlos/esp/esp-idf/tools/idf.py", line 151, in init_cli
    import Click
ModuleNotFoundError: No module named 'Click'
make: *** [Makefile:34: all] Error 1

fivdi
Posts: 16
Joined: Thu Feb 03, 2022 10:28 pm
Contact:

Re: Setup for Compiling MicroPython firmware - stuck

Post by fivdi » Fri Feb 11, 2022 1:21 pm

It looks like the environment isn't set up correctly for ESP-IDF development. In other words, I think esp-idf hasn't been installed correctly yet.

For example, on my system, the command "idf.py --version" shows me that I have ESP-IDF v4.4 installed.

Code: Select all

$ idf.py --version
ESP-IDF v4.4
Then, by running the following commands in my directory of choice, the MicroPython binaries for BOARD GENERIC_S2 can be built successfully:

Code: Select all

git clone https://github.com/micropython/micropython.git
cd micropython/mpy-cross/
make
cd ../ports/esp32
make submodules
export BOARD=GENERIC_S2
make
Have you performed all the steps mentioned in the ESP-IDF Get Started Guide for the ESP32-S2, including getting the hello_world project up and running on your board?

rx8pilot
Posts: 12
Joined: Fri Mar 26, 2021 3:39 am

Re: Setup for Compiling MicroPython firmware - stuck

Post by rx8pilot » Fri Feb 11, 2022 7:32 pm

Thank you so much for the notes. I believe I went through those steps - but it is entirely possible I messed something up along the way.

I am going to make a clean start and see if I can stop and take notes of anything that seems to be an indication of a problem. At this point, I have been trying to 'fix' things and perhaps just making it worse.

Time to start fresh and take a more methodical approach.

rx8pilot
Posts: 12
Joined: Fri Mar 26, 2021 3:39 am

Re: Setup for Compiling MicroPython firmware - stuck

Post by rx8pilot » Sat Feb 12, 2022 2:30 am

Success!

I am not sure where the previous effort went wrong, but starting from scratch (all new VM) everything seems to work just fine.

https://docs.espressif.com/projects/esp ... et-esp-idf
These instructions work just fine. If you have trouble - apparently just try again.

Thanks.....

Post Reply