Building MP firmware results in boot-loop 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.
Peugot206
Posts: 31
Joined: Sat Apr 09, 2022 5:57 pm

Re: Building MP firmware results in boot-loop ESP32

Post by Peugot206 » Sun Apr 24, 2022 10:38 am

So after I gave up after a few days I stumbled upon this library (https://github.com/russhughes/st7789_mp ... untu-20042), the library has given MicroPython build tutorials for the ESP32. So here I went again with good hopes! Started on a fresh installed Ubuntu 20.04 desktop version.

After following all the steps it still didn't work.. and then I figured out why.. I was uploading the micropython.bin file all these times, while it should have been the firmware.bin file... I have no words lol...

Anyways, maybe these previous 'makes' would have failed too, even with the correct .bin file, we will never know I guess. For now, here are the steps that seems to be working for me (running Ubuntu 20.04, fresh install) using ESP-IDF v4.2 and MicroPython v1.18. Step 1 is to install the ESP-IDF tools:

Code: Select all

o	sudo apt-get -y update
o	sudo apt-get -y upgrade
o	sudo apt-get -y install build-essential libffi-dev git pkg-config cmake virtualenv python3-pip python3-virtualenv~
o	cd ~
o	git clone -b v4.2 --recursive https://github.com/espressif/esp-idf.git
		 (if you already have a copy of the ESP-IDF you can update its version by using):
		cd esp-idf
		git checkout v4.2
		git submodule update --init --recursive
o	cd esp-idf/
o	git pull (this one doesn't seem to work, skipped)
o	./install.sh (note: this time without the specific 'esp32')
o	source export.sh (NOTE: do not use ./export.sh)
o	cd ..
Step 2 is to install MicroPython:

Code: Select all

o	git clone https://github.com/micropython/micropython.git
o	cd micropython/
o	git submodule update --init
o	cd mpy-cross/
o	make
o	cd ..
o	cd ports/esp32
o	make (with this you start building your custom firmware right away)
Step 3 is to upload the firmware.bin found in `/ports/esp32/build-GENERIC/`, I upload the .bin file using Thonny. So far it seems to work, whenever I run into trouble when I start freezing modules etc. I will make a new thread. I hope this information could help anyone out.

Let me know if this works for you @davef!

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

Re: Building MP firmware results in boot-loop ESP32

Post by davef » Sun Apr 24, 2022 7:49 pm

Glad you sorted it. When I was going through this exercise the instructions I was following must have said to use firmware.bin. I wondered what micropython.bin was for but never tried to find out.

I will keep your script if I should ever need to freeze anything in the future.

The problem I am having is with the official v1.18 Generic image. But I think that my boot-loop issue is now sorted:
viewtopic.php?f=18&t=12294

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

Re: Building MP firmware results in boot-loop ESP32

Post by Peugot206 » Mon Apr 25, 2022 7:08 am

Interesting.. the problem you state I also have since I've built my custom firmware, but I didn't really see this as an issue. I simply keep pressing CTRL + D until it works again.. however I did not know that this is only in the 'custom' built firmwares. I will give your try-except solution definitely a go!

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

Re: Building MP firmware results in boot-loop ESP32

Post by davef » Mon Apr 25, 2022 7:22 am

I spoke too soon. I reduced things to the bare-minimum and it works OK on another ESP32 board. The original board would work as long as rshell was running. When I disconnected the USB cable and pressed EN button is would go into a 1-2 second boot-loop.

Tomorrow I will run the test code on the original board to verify.

Post Reply