Stuck on beginning the install

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
supersjimmie
Posts: 6
Joined: Fri Apr 05, 2019 2:20 pm

Stuck on beginning the install

Post by supersjimmie » Fri Apr 05, 2019 2:30 pm

I have an esp32 with 4MB spiram, SD-Card etcetera.
Since the LoBo seems to have too many issues because it's not maintained for a long time, I would like to switch to this micropython.

But somehow I totally don't understand the first part for installation:

The ESP-IDF changes quickly and MicroPython only supports a certain version. The git hash of this version can be found by running make without a configured ESPIDF. Then you can fetch only the given esp-idf using the following command:
$ git clone https://github.com/espressif/esp-idf.git
$ git checkout <Current supported ESP-IDF commit hash>
$ git submodule update --init --recursive

So I run the git clone and then I need to "run make without a configured ESPIDF". That should then give me a hint about the hash that is needed for the git checkout.
But there do I have to go to run the "make"? Because inside the newly created esp-idf the "make" makes no sense.
I feel silly but I think I miss something? :?

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Stuck on beginning the install

Post by Roberthh » Fri Apr 05, 2019 3:05 pm

You have to run make in the micropython/ports/esp32 directory. The proper hash value for the esp-idf is inside Makefile. Yo you can as well open Makefile with an editor or the less command and take it from there.

supersjimmie
Posts: 6
Joined: Fri Apr 05, 2019 2:20 pm

Re: Stuck on beginning the install

Post by supersjimmie » Sat Apr 06, 2019 9:35 am

Thanks, after some "fiddling around" I got to that point.
It now starts compiling but fails at

GEN build/esp32.common.ld
Traceback (most recent call last):
File "/home/me/esp-idf/tools/ldgen/ldgen.py", line 22, in <module>
from fragments import FragmentFileModel
File "/home/me/esp-idf/tools/ldgen/fragments.py", line 20, in <module>
from sdkconfig import SDKConfig
File "/home/me/esp-idf/tools/ldgen/sdkconfig.py", line 18, in <module>
from pyparsing import Word, printables, Combine, Literal, hexnums, quotedString, Optional, nums, removeQuotes, oneOf, Group, infixNotation, opAssoc
ImportError: No module named 'pyparsing'
Makefile:788: recipe for target 'build/esp32.common.ld' failed
make: *** [build/esp32.common.ld] Error 1


Which leads me to an open issue:
https://github.com/micropython/micropython/issues/4655

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: Stuck on beginning the install

Post by devnull » Sat Apr 06, 2019 12:21 pm

I also had this problem last week, caused I think because I have python 3 and python 2 installed nand default was python3

I edited the makefile and changed $(Q)$(PYTHON) to $(Q)$(PYTHON2)

This is probably not the best solution, but it was a quick fix for me.

supersjimmie
Posts: 6
Joined: Fri Apr 05, 2019 2:20 pm

Re: Stuck on beginning the install

Post by supersjimmie » Sat Apr 06, 2019 1:01 pm

devnull wrote:
Sat Apr 06, 2019 12:21 pm
I also had this problem last week, caused I think because I have python 3 and python 2 installed nand default was python3

I edited the makefile and changed $(Q)$(PYTHON) to $(Q)$(PYTHON2)

This is probably not the best solution, but it was a quick fix for me.
By following the suggestions in the issue I got around that.

Now I run into the next issue, something with the frozen part:

Code: Select all

# cat makefile
ESPIDF = $(HOME)/esp-idf
PORT = /dev/ttyS14
FLASH_MODE = qio
FLASH_SIZE = 4MB
CROSS_COMPILE = xtensa-esp32-elf-
SDKCONFIG = boards/sdkconfig.spiram
include Makefile


# make V=1 PYTHON=python2
......
......
GEN build/frozen_mpy.c
python2 ../../tools/mpy-tool.py -f -q build/genhdr/qstrdefs.preprocessed.h build/frozen_mpy/_boot.mpy build/frozen_mpy/apa106.mpy build/frozen_mpy/dht.mpy build/frozen_mpy/ds18x20.mpy build/frozen_mpy/flashbdev.mpy build/frozen_mpy/inisetup.mpy build/frozen_mpy/neopixel.mpy build/frozen_mpy/ntptime.mpy build/frozen_mpy/onewire.mpy build/frozen_mpy/upip.mpy build/frozen_mpy/upip_utarfile.mpy build/frozen_mpy/webrepl.mpy build/frozen_mpy/webrepl_setup.mpy build/frozen_mpy/websocket_helper.mpy > build/frozen_mpy.c
Traceback (most recent call last):
  File "../../tools/mpy-tool.py", line 865, in <module>
    main()
  File "../../tools/mpy-tool.py", line 853, in main
    raw_codes = [read_mpy(file) for file in args.files]
  File "../../tools/mpy-tool.py", line 721, in read_mpy
    return read_raw_code(f, qstr_win)
  File "../../tools/mpy-tool.py", line 703, in read_raw_code
    return RawCodeBytecode(fun_data.buf, qstrs, objs, raw_codes)
  File "../../tools/mpy-tool.py", line 426, in __init__
    super().__init__(MP_CODE_BYTECODE, bytecode, 0, qstrs, objs, raw_codes)
TypeError: super() takes at least 1 argument (0 given)
../../py/mkrules.mk:122: recipe for target 'build/frozen_mpy.c' failed
make: *** [build/frozen_mpy.c] Error 1
make: *** Deleting file 'build/frozen_mpy.c'
Opening a new issue:
https://github.com/micropython/micropython/issues/4674

User avatar
devnull
Posts: 473
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: Stuck on beginning the install

Post by devnull » Sat Apr 06, 2019 1:21 pm

I don't think this is is a bug/issue, sounds like configuration / setup issue to me.

supersjimmie
Posts: 6
Joined: Fri Apr 05, 2019 2:20 pm

Re: Stuck on beginning the install

Post by supersjimmie » Sat Apr 06, 2019 1:59 pm

devnull wrote:
Sat Apr 06, 2019 1:21 pm
I don't think this is is a bug/issue, sounds like configuration / setup issue to me.
Yes that's what I thought too.
So I removed my entire ~/micropython and started new (so having a clean and latest version again) while strictly following all steps for micropython in general and for the esp32 port.
Same result. :(

Code: Select all

git clone https://github.com/micropython/micropython.git
cd micropython
make -C mpy-cross
git submodule init lib/berkeley-db-1.xx
git submodule update
cd ports/esp32
vi makefile
-------------
ESPIDF = $(HOME)/esp-idf
PORT = /dev/ttyS14
FLASH_MODE = qio
FLASH_SIZE = 4MB
CROSS_COMPILE = xtensa-esp32-elf-
SDKCONFIG = boards/sdkconfig.spiram
include Makefile
----------
make V=1 PYTHON=python2
It runs a lot, until it comes to the MPY part:

Code: Select all

MPY modules/_boot.py
mkdir -p build/frozen_mpy/
../../mpy-cross/mpy-cross -o build/frozen_mpy/_boot.mpy -s _boot.py  modules/_boot.py
MPY modules/apa106.py
mkdir -p build/frozen_mpy/
../../mpy-cross/mpy-cross -o build/frozen_mpy/apa106.mpy -s apa106.py  modules/apa106.py
MPY modules/dht.py
mkdir -p build/frozen_mpy/
../../mpy-cross/mpy-cross -o build/frozen_mpy/dht.mpy -s dht.py  modules/dht.py
MPY modules/ds18x20.py
mkdir -p build/frozen_mpy/
../../mpy-cross/mpy-cross -o build/frozen_mpy/ds18x20.mpy -s ds18x20.py  modules/ds18x20.py
MPY modules/flashbdev.py
mkdir -p build/frozen_mpy/
../../mpy-cross/mpy-cross -o build/frozen_mpy/flashbdev.mpy -s flashbdev.py  modules/flashbdev.py
MPY modules/inisetup.py
mkdir -p build/frozen_mpy/
../../mpy-cross/mpy-cross -o build/frozen_mpy/inisetup.mpy -s inisetup.py  modules/inisetup.py
MPY modules/neopixel.py
mkdir -p build/frozen_mpy/
../../mpy-cross/mpy-cross -o build/frozen_mpy/neopixel.mpy -s neopixel.py  modules/neopixel.py
MPY modules/ntptime.py
mkdir -p build/frozen_mpy/
../../mpy-cross/mpy-cross -o build/frozen_mpy/ntptime.mpy -s ntptime.py  modules/ntptime.py
MPY modules/onewire.py
mkdir -p build/frozen_mpy/
../../mpy-cross/mpy-cross -o build/frozen_mpy/onewire.mpy -s onewire.py  modules/onewire.py
MPY modules/upip.py
mkdir -p build/frozen_mpy/
../../mpy-cross/mpy-cross -o build/frozen_mpy/upip.mpy -s upip.py  modules/upip.py
MPY modules/upip_utarfile.py
mkdir -p build/frozen_mpy/
../../mpy-cross/mpy-cross -o build/frozen_mpy/upip_utarfile.mpy -s upip_utarfile.py  modules/upip_utarfile.py
MPY modules/webrepl.py
mkdir -p build/frozen_mpy/
../../mpy-cross/mpy-cross -o build/frozen_mpy/webrepl.mpy -s webrepl.py  modules/webrepl.py
MPY modules/webrepl_setup.py
mkdir -p build/frozen_mpy/
../../mpy-cross/mpy-cross -o build/frozen_mpy/webrepl_setup.mpy -s webrepl_setup.py  modules/webrepl_setup.py
MPY modules/websocket_helper.py
mkdir -p build/frozen_mpy/
../../mpy-cross/mpy-cross -o build/frozen_mpy/websocket_helper.mpy -s websocket_helper.py  modules/websocket_helper.py
GEN build/frozen_mpy.c
python2 ../../tools/mpy-tool.py -f -q build/genhdr/qstrdefs.preprocessed.h build/frozen_mpy/_boot.mpy build/frozen_mpy/apa106.mpy build/frozen_mpy/dht.mpy build/frozen_mpy/ds18x20.mpy build/frozen_mpy/flashbdev.mpy build/frozen_mpy/inisetup.mpy build/frozen_mpy/neopixel.mpy build/frozen_mpy/ntptime.mpy build/frozen_mpy/onewire.mpy build/frozen_mpy/upip.mpy build/frozen_mpy/upip_utarfile.mpy build/frozen_mpy/webrepl.mpy build/frozen_mpy/webrepl_setup.mpy build/frozen_mpy/websocket_helper.mpy > build/frozen_mpy.c
Traceback (most recent call last):
  File "../../tools/mpy-tool.py", line 865, in <module>
    main()
  File "../../tools/mpy-tool.py", line 853, in main
    raw_codes = [read_mpy(file) for file in args.files]
  File "../../tools/mpy-tool.py", line 721, in read_mpy
    return read_raw_code(f, qstr_win)
  File "../../tools/mpy-tool.py", line 703, in read_raw_code
    return RawCodeBytecode(fun_data.buf, qstrs, objs, raw_codes)
  File "../../tools/mpy-tool.py", line 426, in __init__
    super().__init__(MP_CODE_BYTECODE, bytecode, 0, qstrs, objs, raw_codes)
TypeError: super() takes at least 1 argument (0 given)
../../py/mkrules.mk:122: recipe for target 'build/frozen_mpy.c' failed
make: *** [build/frozen_mpy.c] Error 1
make: *** Deleting file 'build/frozen_mpy.c' 
Since it's all brand new and clean, I don't think it's a user-thing anymore.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Stuck on beginning the install

Post by Roberthh » Sat Apr 06, 2019 2:38 pm

There are quite a few people like me who have not problem in building the binaries using the provided repositories. Please check if you followed the instructions in the README of esp-idf an micropython literally.
From the log of the build here I see, that mpy_tool is called with python3. I agree that there might be a mismatch between all the required python versions, but maybe you could change your system set-up to use python2 as default for python. I've read that it works different for @devnull.
Or may you changed the setting in py/mkenv.mk too, where PYTHON is set to python3 .

supersjimmie
Posts: 6
Joined: Fri Apr 05, 2019 2:20 pm

Re: Stuck on beginning the install

Post by supersjimmie » Mon Apr 08, 2019 5:13 am

Roberthh wrote:
Sat Apr 06, 2019 2:38 pm
There are quite a few people like me who have not problem in building the binaries using the provided repositories. Please check if you followed the instructions in the README of esp-idf an micropython literally.
From the log of the build here I see, that mpy_tool is called with python3. I agree that there might be a mismatch between all the required python versions, but maybe you could change your system set-up to use python2 as default for python. I've read that it works different for @devnull.
Or may you changed the setting in py/mkenv.mk too, where PYTHON is set to python3 .
Sorry but in my logs I see:

Code: Select all

python2 ../../tools/mpy-tool.py 
Which I think is not python3 but python2.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Stuck on beginning the install

Post by Roberthh » Mon Apr 08, 2019 5:31 am

Yes, but the python version to be used is set by your make call option, it is not hard coded in the script. Anyhow, meanwhile, Damien pushed a change to mpytools.py to work with python2. So the issue should be settled.

Post Reply