russhughes / s3lcd

ESP_LCD based MicroPython driver for ESP32-S3 Devices with ST7789 or compatible displays.
Other
74 stars 11 forks source link

Build From Source Fails Due to Mismatch of Micropython Version Relative to ESP-IDF Version #20

Closed genereese closed 1 year ago

genereese commented 1 year ago

Hello. Thanks for your work on this driver and firmware version.

I'm attempting to include some additional support in the firmware image (like ESP NOW functionality) and I'm attempting to build via your source instructions.

However, it appears they may be outdated. Using the version of ESP-IDF specified in the instruction (v4.4.4), the latest version of micropython fails building - complaining that it requires version 5+ of ESP-IDF to build.

Updating ESP-IDF to version 5+ and attempting the build fails with the following error:

Including User C Module(s) from ../../../s3lcd/src/micropython.cmake
CMake Error at ~/esp/micropython/py/usermod.cmake:42 (include):
  include could not find requested file:

    ../../../s3lcd/src/micropython.cmake
Call Stack (most recent call first):
  esp32_common.cmake:22 (include)
  main_esp32/CMakeLists.txt:11 (include)

Did you have a specific version of micropython that we could checkout for this build process instead of checking out the latest version?

Alternatively, would you be able to update the instructions to work with the latest ESP-IDF version?

Either way, I appreciate your help.

genereese commented 1 year ago

As an update, I ran:

make USER_C_MODULES=../../../s3lcd/src/micropython.cmake

-with an absolute path, instead:

make USER_C_MODULES=/home/greese/esp32/s3lcd/src/micropython.cmake

-and I made further progress in the build but it still failed citing:

FAILED: .bin_timestamp /home/greese/esp/micropython/ports/esp32/build-GENERIC/bootloader/.bin_timestamp cd /home/greese/esp/micropython/ports/esp32/build-GENERIC/bootloader && /home/greese/.espressif/python_env/idf4.4_py3.11_env/bin/python /home/greese/esp/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 elf2image --flash_mode dio --flash_freq 40m --flash_size 4MB -o /home/greese/esp/micropython/ports/esp32/build-GENERIC/bootloader/bootloader.bin /home/greese/esp/micropython/ports/esp32/build-GENERIC/bootloader/bootloader.elf && /usr/bin/cmake -E echo "Generated /home/greese/esp/micropython/ports/esp32/build-GENERIC/bootloader/bootloader.bin" && /usr/bin/cmake -E md5sum /home/greese/esp/micropython/ports/esp32/build-GENERIC/bootloader/bootloader.bin > /home/greese/esp/micropython/ports/esp32/build-GENERIC/bootloader/.bin_timestamp /home/greese/.espressif/python_env/idf4.4_py3.11_env/bin/python: can't open file '/home/greese/esp/esp-idf/components/esptool_py/esptool/esptool.py': [Errno 2] No such file or directory ninja: build stopped: subcommand failed. [360/1414] Building C object esp-idf/wpa_supplicant/CMakeFiles/__idf_wpa_supplicant.dir/esp_supplicant/src/esp_wps.c.obj ninja: build stopped: subcommand failed. ninja failed with exit code 1

esptool.py definitely does not exist that that location with the v4.4.4 checkout of ESP-IDF - but it does exist there in the latest master checkout of ESP-IDF.

genereese commented 1 year ago

Ok, I had to do quite a bit to get this to work, but I was finally able to.

If you clone version v5.1.1 of ESP-IDF and use v1.21.0 of micropython, then modify uart.c under micropython/ports/esp32 to include:

#include "soc/uart_periph.h"

-THEN build using your instructions, everything seems to build OK.

Much appreciated.

russhughes commented 1 year ago

MicroPython is using esp-idf 5.0.2. The BOARD names have changed, and there is a new BOARD_VARIANT as well. For the S3, if your BOARD has Octal PSRAM, add BOARD_VARIANT=SPIRAM_OCT.

cd micropython/ports/esp32
make submodules
make BOARD=ESP32_GENERIC_S3 USER_C_MODULES=/Volumes/MicroPython/s3lcd/src/micropython.cmake

Builds clean for me without modifications.

genereese commented 1 year ago

Yes, I wanted to try to get a build working with at least ESP-IDF v5.1.

Again, thanks for your work and I appreciate your reply, regardless.