From 2e01df8250b7591e3dbd8bbf707741b869593f61 Mon Sep 17 00:00:00 2001 From: Thomas Farstrike Date: Wed, 30 Apr 2025 13:50:04 +0200 Subject: [PATCH] Add patches and update build instructions --- README.md | 23 +++++++++++++++++++ patches/freezeFS_fix_glob_python_3.9.patch | 16 +++++++++++++ ...cropython_add_cnadler86_esp32-camera.patch | 10 ++++++++ ...opython_lib_micropython_fix_mpremote.patch | 14 +++++++++++ ...on_lib_micropython_temperature_float.patch | 14 +++++++++++ scripts/build_lvgl_micropython.sh | 6 +++++ scripts/flash_over_usb.sh | 4 ++++ pngtobin.sh => scripts/pngtobin.sh | 0 8 files changed, 87 insertions(+) create mode 100644 patches/freezeFS_fix_glob_python_3.9.patch create mode 100644 patches/lvgl_micropython_lib_micropython_add_cnadler86_esp32-camera.patch create mode 100644 patches/lvgl_micropython_lib_micropython_fix_mpremote.patch create mode 100644 patches/lvgl_micropython_lib_micropython_temperature_float.patch create mode 100644 scripts/build_lvgl_micropython.sh create mode 100644 scripts/flash_over_usb.sh rename pngtobin.sh => scripts/pngtobin.sh (100%) diff --git a/README.md b/README.md index c0ecc504..672bab7c 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,26 @@ Furthermore, these apps are also built-in for convenience: - /builtin/apps: apps that are builtin and necessary for minimal facilities (launcher, wificonf, appstore etc) - /builtin/res/mipmap-mdpi/default_icon_64x64.bin: default icon for apps that don't have one +# Building + +mkdir ~/sources/ +cd ~/sources/ + +git clone https://github.com/LightningPiggy/PiggyOS.git + +git clone https://github.com/bixb922/freezeFS +~/sources/PiggyOS/scripts/build_freezefs_mount_builtin.sh + +git clone https://github.com/cnadler86/micropython-camera-API +echo 'include("~/sources/lvgl_micropython/build/manifest.py")' >> micropython-camera-API/src/manifest.py + +git clone https://github.com/lvgl-micropython/lvgl_micropython +# TODO: apply patches from ~/sources/PiggyOS/patches/ + +cp ~/sources/PiggyOS/patches/lv_conf.h lvgl_micropython/lib/ + +cd lvgl_micropython/ +~/sources/PiggyOS/scripts/build_lvgl_micropython.sh + +# Now install it with: +~/sources/PiggyOS/scripts/flash_over_usb.sh diff --git a/patches/freezeFS_fix_glob_python_3.9.patch b/patches/freezeFS_fix_glob_python_3.9.patch new file mode 100644 index 00000000..81488ca8 --- /dev/null +++ b/patches/freezeFS_fix_glob_python_3.9.patch @@ -0,0 +1,16 @@ +diff --git a/freezefs/archive.py b/freezefs/archive.py +index 843090d..26e2029 100644 +--- a/freezefs/archive.py ++++ b/freezefs/archive.py +@@ -87,8 +87,9 @@ def to_python( pc_infolder, pc_outfile, + + # Get files + files = [] +- for path in glob( "**", root_dir=pc_infolder, recursive=True ): +- fo = FileObject( pc_infolder, Path( path ), request_compression, level, wbits ) ++ for path in glob(os.path.join(pc_infolder, "**"), recursive=True): ++ rel_path = os.path.relpath(path, pc_infolder) ++ fo = FileObject(pc_infolder, Path(rel_path), request_compression, level, wbits) + files.append( fo ) + + # Generate output diff --git a/patches/lvgl_micropython_lib_micropython_add_cnadler86_esp32-camera.patch b/patches/lvgl_micropython_lib_micropython_add_cnadler86_esp32-camera.patch new file mode 100644 index 00000000..9d31fcd9 --- /dev/null +++ b/patches/lvgl_micropython_lib_micropython_add_cnadler86_esp32-camera.patch @@ -0,0 +1,10 @@ +diff --git a/ports/esp32/main_esp32s3/idf_component.yml b/ports/esp32/main_esp32s3/idf_component.yml +index 05ab2f2..0ce3878 100644 +--- a/ports/esp32/main_esp32s3/idf_component.yml ++++ b/ports/esp32/main_esp32s3/idf_component.yml +@@ -4,3 +4,5 @@ dependencies: + espressif/esp_tinyusb: "~1.0.0" + idf: + version: ">=5.0.4" ++ espressif/esp32-camera: ++ git: https://github.com/cnadler86/esp32-camera.git diff --git a/patches/lvgl_micropython_lib_micropython_fix_mpremote.patch b/patches/lvgl_micropython_lib_micropython_fix_mpremote.patch new file mode 100644 index 00000000..6c04b215 --- /dev/null +++ b/patches/lvgl_micropython_lib_micropython_fix_mpremote.patch @@ -0,0 +1,14 @@ +diff --git a/tools/mpremote/mpremote/main.py b/tools/mpremote/mpremote/main.py +index e6e3970..5501fa4 100644 +--- a/tools/mpremote/mpremote/main.py ++++ b/tools/mpremote/mpremote/main.py +@@ -477,7 +477,8 @@ class State: + self.ensure_connected() + soft_reset = self._auto_soft_reset if soft_reset is None else soft_reset + if soft_reset or not self.transport.in_raw_repl: +- self.transport.enter_raw_repl(soft_reset=soft_reset) ++ #self.transport.enter_raw_repl(soft_reset=soft_reset) ++ self.transport.enter_raw_repl(soft_reset=False) + self._auto_soft_reset = False + + def ensure_friendly_repl(self): diff --git a/patches/lvgl_micropython_lib_micropython_temperature_float.patch b/patches/lvgl_micropython_lib_micropython_temperature_float.patch new file mode 100644 index 00000000..6c04b215 --- /dev/null +++ b/patches/lvgl_micropython_lib_micropython_temperature_float.patch @@ -0,0 +1,14 @@ +diff --git a/tools/mpremote/mpremote/main.py b/tools/mpremote/mpremote/main.py +index e6e3970..5501fa4 100644 +--- a/tools/mpremote/mpremote/main.py ++++ b/tools/mpremote/mpremote/main.py +@@ -477,7 +477,8 @@ class State: + self.ensure_connected() + soft_reset = self._auto_soft_reset if soft_reset is None else soft_reset + if soft_reset or not self.transport.in_raw_repl: +- self.transport.enter_raw_repl(soft_reset=soft_reset) ++ #self.transport.enter_raw_repl(soft_reset=soft_reset) ++ self.transport.enter_raw_repl(soft_reset=False) + self._auto_soft_reset = False + + def ensure_friendly_repl(self): diff --git a/scripts/build_lvgl_micropython.sh b/scripts/build_lvgl_micropython.sh new file mode 100644 index 00000000..c8b50f5d --- /dev/null +++ b/scripts/build_lvgl_micropython.sh @@ -0,0 +1,6 @@ +# Build for https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-2: +# --ota: support Over-The-Air updates +# --partition size: both OTA partitions are 4MB +# --flash-size: total flash size is 16MB +# +python3 make.py --ota --partition-size=4194304 --flash-size=16 esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT DISPLAY=st7789 INDEV=cst816s USER_C_MODULE="/home/user/sources/micropython-camera-API/src/micropython.cmake" FROZEN_MANIFEST=manifest.py diff --git a/scripts/flash_over_usb.sh b/scripts/flash_over_usb.sh new file mode 100644 index 00000000..1cd75513 --- /dev/null +++ b/scripts/flash_over_usb.sh @@ -0,0 +1,4 @@ +fwfile="build/lvgl_micropy_ESP32_GENERIC_S3-SPIRAM_OCT-16.bin" +ls -al "$fwfile" +~/.espressif/python_env/idf5.2_py3.9_env/bin/python -m esptool --chip esp32s3 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_size 16MB --flash_freq 80m --erase-all 0x0 "$fwfile" + diff --git a/pngtobin.sh b/scripts/pngtobin.sh similarity index 100% rename from pngtobin.sh rename to scripts/pngtobin.sh