Build firmware v1.14 with IDF 4.2 problems
Posted: Sat Mar 20, 2021 11:16 am
This is my first time to compile ESP32 port with IDF4, I want to write down a Shell script used for one key deploy MicroPython development environment.
Here is the key segments of my script
When this script running into 'compile firmware' part, it's thrown a CMake Error
In the file '/micropython/py/mkrules.cmake:32'
Here is the first problem, I can solved this problem by replacing 'Python3' to 'PythonInterp', but I don't know that's why?
After fixed first problem, here is my second problem
Is '/micropython/py/makeversionhdr.py' missing '#!/usr/bin/env python' at first line?
So....I append the 'missing line' for every .py file in '/micropython/py/', and here is my last problem, without solution....
Is there any way to solve all my problems? And the important thing is, do not manually modify file contents is the best way....
Here is the key segments of my script
Code: Select all
#!/bin/bash
tmp_root_dir=$PWD
# update and install git
sudo apt-get update
sudo apt-get install -y git
# clone IDF and submodules, checkout branch to v4.2
git clone -b v4.2 --recursive https://github.com/espressif/esp-idf.git
# export IDF path
echo "export IDF_PATH=$tmp_root_dir/esp-idf" >> ~/.profile
source ~/.profile
# install development software
sudo apt-get install -y wget flex bison gperf gcc tar make cmake ninja-build ccache
sudo apt-get install -y libffi-dev libssl-dev dfu-util libusb-1.0-0 python-pyparsing python-pyelftools
sudo apt-get install -y python3 python3-pip python3-setuptools libpython3-dev libpython-dev libncurses-dev
sudo apt-get install -y python python-pip python-setuptools python-serial python-cryptography python-future
# switch Python 3.6 to default
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2
# Install toolchains by using IDF install tools
$IDF_PATH/install.sh
# clone MicroPython and submodules
cd $tmp_root_dir
git clone --recursive https://github.com/micropython/micropython.git
# compile firmware
echo "export Python3_DIR=~/.espressif/python_env/idf4.2_py3.6_env" >> ~/.profile
source ~/.profile
source $IDF_PATH/export.sh
cd $tmp_root_dir/micropython
make -C mpy-cross
cd ports/esp32 && make submodules && make
Code: Select all
CMake Error at /home/walkline/esp32_idf4/micropython/py/mkrules.cmake:32 (find_package):
By not providing "FindPython3.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Python3", but
CMake did not find one.
Could not find a package configuration file provided by "Python3" with any
of the following names:
Python3Config.cmake
python3-config.cmake
Add the installation prefix of "Python3" to CMAKE_PREFIX_PATH or set
"Python3_DIR" to a directory containing one of the above files. If
"Python3" provides a separate development package or SDK, be sure it has
been installed.
Code: Select all
find_package(Python3 REQUIRED COMPONENTS Interpreter)
After fixed first problem, here is my second problem
Code: Select all
esptool.py v3.0
Generated /home/walkline/esp32_idf4/micropython/ports/esp32/build-GENERIC/bootloader/bootloader.bin
[1021/1241] Generating ../../genhdr/mpversion.h
FAILED: genhdr/mpversion.h
cd /home/walkline/esp32_idf4/micropython/ports/esp32/build-GENERIC/esp-idf/main && /usr/bin/cmake -E make_directory /home/walkline/esp32_idf4/micropython/ports/esp32/build-GENERIC/genhdr && /home/walkline/esp32_idf4/micropython/py/makeversionhdr.py /home/walkline/esp32_idf4/micropython/ports/esp32/build-GENERIC/genhdr/mpversion.h
/bin/sh: 1: /home/walkline/esp32_idf4/micropython/py/makeversionhdr.py: Permission denied
[1022/1241] Building C object esp-idf/wifi_provisioning/CMakeFiles/__idf_wifi_provisioning.dir/src/scheme_ble.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
Makefile:24: recipe for target 'all' failed
make: *** [all] Error 2
Code: Select all
/bin/sh: 1: /home/walkline/esp32_idf4/micropython/py/makeversionhdr.py: Permission denied
So....I append the 'missing line' for every .py file in '/micropython/py/', and here is my last problem, without solution....
Code: Select all
[2/224] Generating ../../genhdr/mpversion.h
FAILED: genhdr/mpversion.h
cd /home/walkline/esp32_idf4/micropython/ports/esp32/build-GENERIC/esp-idf/main && /usr/bin/cmake -E make_directory /home/walkline/esp32_idf4/micropython/ports/esp32/build-GENERIC/genhdr && /home/walkline/esp32_idf4/micropython/py/makeversionhdr.py /home/walkline/esp32_idf4/micropython/ports/esp32/build-GENERIC/genhdr/mpversion.h
/bin/sh: 1: /home/walkline/esp32_idf4/micropython/py/makeversionhdr.py: Permission denied
[3/224] Performing build step for 'bootloader'
ninja: no work to do.
[4/222] Linking CXX static library esp-idf/wifi_provisioning/libwifi_provisioning.a
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
Makefile:24: recipe for target 'all' failed
make: *** [all] Error 2
Code: Select all
/bin/sh: 1: /home/walkline/esp32_idf4/micropython/py/makeversionhdr.py: Permission denied