Open kf106 opened 1 year ago
Didn't you get an error like this?
*** Support for FROZEN_MPY_DIR was removed. Please use manifest.py instead, see https://docs.micropython.org/en/latest/reference/manifest.html. Stop.
That is another new change in the build system.
@kf106
I have successfully compiled with the latest IDF (checkout 5.0.4) and MicroPython (master
branch).
I also configured default I2C(0) pins in mpconfigboard.cmake
Here are the steps I followed, forgive the lengthy description, it's from my Obsidian notes
copy ports/esp32/boards/ESP32_GENERIC_S3
to `ports/esp32/boards/LILYGO_T-Display_S3
add modules
to get them frozen in the build (optional)
add manifest.py
to instruct using a boards manifest and integrate other directives (optional)
edit the following files to add information on the board
sys
to provide implementation details)include("$(PORT_DIR)/boards/manifest.py")
freeze("modules")
cmake
directives )
set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py)
#ifndef MICROPY_HW_BOARD_NAME
// Can be set by mpconfigboard.cmake.
#define MICROPY_HW_BOARD_NAME "LilyGo T-Display S3"
#endif
#define MICROPY_HW_MCU_NAME "ESP32S3"
// Enable UART REPL for modules that have an external USB-UART and don't use native USB.
#define MICROPY_HW_ENABLE_UART_REPL (1)
#define MICROPY_HW_I2C0_SCL (44)
#define MICROPY_HW_I2C0_SDA (43)
sdkconfig.board contains configuration for flash, speed, partitions etc
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
CONFIG_ESPTOOLPY_AFTER_NORESET=y
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-16MiB.csv"
git clone git@github.com:russhughes/st7789s3_mpy.git
somewhere (make sure it's patched for MP 1.22+ and IDF 5.x)
my patched version is here https://github.com/ubidefeo/st7789s3_mpy/tree/main
cd
into the ports/esp32
and run
make BOARD=LILYGO_T-Display_S3 USER_C_MODULES={PATH_TO_ST7789s3_mpy_CLONED_REPO}/st7789s3_mpy/st7789/micropython.cmake
flash the obtained build-LILYGO_T-Display_S3/firmware.bin
to the board
esptool.py --chip=auto -p {SERIAL_PORT} erase_flash
esptool.py --chip=auto -p {SERIAL_PORT} write_flash -z 0 build-LILYGO_T-Display_S3/firmware.bin
if you're interested, here's the module I modified and froze
tdisplay.py
""" LilyGo T-DISPLAY-S3 170x320 ST7789 display """
from machine import Pin, SPI, freq
import st7789
freq(240000000) # 240mhz clock
TFA = 0
BFA = 0
def Display(rotation=0, buffer_size=0, options=0):
LCD_POWER = Pin(15, Pin.OUT)
LCD_POWER.value(1)
return st7789.ST7789(
Pin(48, Pin.OUT),
Pin(47, Pin.OUT),
Pin(46, Pin.OUT),
Pin(45, Pin.OUT),
Pin(42, Pin.OUT),
Pin(41, Pin.OUT),
Pin(40, Pin.OUT),
Pin(39, Pin.OUT),
Pin(8, Pin.OUT),
Pin(9, Pin.OUT),
170,
320,
reset=Pin(5, Pin.OUT),
cs=Pin(6, Pin.OUT),
dc=Pin(7, Pin.OUT),
backlight=Pin(38, Pin.OUT),
rotation=rotation,
options=options,
buffer_size= buffer_size)
class Buttons():
def __init__(self):
self.name = "t-display-s3"
self.left = Pin(0, Pin.IN)
self.right = Pin(14, Pin.IN)
Thank you so much @ubidefeo
@whatdtech , did you manage? :)
Yes
I couldn't get it to work with esp-idf v4.4, I needed to use esp-idf v4.4.4. I combined the esp-idf clone instructions as follows:
the micropython repo that is current didn't work. I had to use v1.20.0 as follows:
The relative path for the make command didn't work for the USER_C_MODULES; I had to use an absolute
~/<path to st7789_mpy>
argumentI needed to supply a board argument: BOARD=GENERIC_S3_SPIRAM_OCT
the
sdkconfig.board
file in micropython/ports/esp32/boards/GENERIC_S3_SPIRAM_OCT/ needed editing to select 16MB:CONFIG_SPIRAM_MEMTEST=
CONFIG_ESPTOOLPY_FLASHSIZE_4MB= CONFIG_ESPTOOLPY_FLASHSIZE_8MB= CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y CONFIG_PARTITION_TABLE_CUSTOM=y CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-8MiB.csv"