From d0ccac8033cac1df8acd2ff4d2f3075db1f910a6 Mon Sep 17 00:00:00 2001 From: Thomas Farstrike Date: Thu, 9 Oct 2025 19:49:53 +0200 Subject: [PATCH] Get rid of absolute paths This closes, or should close #2 --- manifest.py | 2 +- manifest_fri3d-2024.py | 2 +- manifest_unix.py | 2 +- scripts/build_lvgl_micropython.sh | 19 ++++++++++++++----- scripts/bundleapps.sh | 2 +- scripts/flash_over_usb.sh | 3 ++- 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/manifest.py b/manifest.py index 5e20ce6e..3c548e4b 100644 --- a/manifest.py +++ b/manifest.py @@ -1,4 +1,4 @@ freeze('internal_filesystem/', 'boot.py') # Hardware initialization freeze('internal_filesystem/', 'main.py') # User Interface initialization freeze('internal_filesystem/lib', '') # Additional libraries -freeze('/home/user/projects/MicroPythonOS/freezeFS/', 'freezefs_mount_builtin.py') # Built-in apps +freeze('../freezeFS/', 'freezefs_mount_builtin.py') # Built-in apps diff --git a/manifest_fri3d-2024.py b/manifest_fri3d-2024.py index 0245a672..b8c72e45 100644 --- a/manifest_fri3d-2024.py +++ b/manifest_fri3d-2024.py @@ -1,4 +1,4 @@ freeze('/tmp/', 'boot.py') # Hardware initialization - this file is copied from boot_fri3d-2024.py to /tmp by the build script to have it named boot.py freeze('internal_filesystem/', 'main.py') # User Interface initialization freeze('internal_filesystem/lib', '') # Additional libraries -freeze('/home/user/projects/MicroPythonOS/freezeFS/', 'freezefs_mount_builtin.py') # Built-in apps +freeze('../freezeFS/', 'freezefs_mount_builtin.py') # Built-in apps diff --git a/manifest_unix.py b/manifest_unix.py index 74bf1a08..c2a9945e 100644 --- a/manifest_unix.py +++ b/manifest_unix.py @@ -1,4 +1,4 @@ freeze('internal_filesystem/', 'boot_unix.py') # Hardware initialization freeze('internal_filesystem/', 'main.py') # User Interface initialization freeze('internal_filesystem/lib', '') # Additional libraries -freeze('/home/user/projects/MicroPythonOS/freezeFS/', 'freezefs_mount_builtin.py') # Built-in apps +freeze('../freezeFS/', 'freezefs_mount_builtin.py') # Built-in apps diff --git a/scripts/build_lvgl_micropython.sh b/scripts/build_lvgl_micropython.sh index 69b16190..0d8aed19 100755 --- a/scripts/build_lvgl_micropython.sh +++ b/scripts/build_lvgl_micropython.sh @@ -1,3 +1,7 @@ +#!/bin/bash + +mydir=$(readlink -f "$0") +mydir=$(dirname "$mydir") target="$1" buildtype="$2" @@ -20,15 +24,16 @@ if [ "$buildtype" == "prod" ]; then ./scripts/freezefs_mount_builtin.sh fi -manifest="" + +manifest="" if [ "$target" == "esp32" ]; then if [ "$buildtype" == "prod" ]; then if [ "$subtarget" == "fri3d-2024" ]; then cp internal_filesystem/boot_fri3d-2024.py /tmp/boot.py # dirty hack to have it included as boot.py by the manifest - manifest="FROZEN_MANIFEST=/home/user/projects/MicroPythonOS/MicroPythonOS/manifest_fri3d-2024.py" + manifest="manifest_fri3d-2024.py" else - manifest="FROZEN_MANIFEST=/home/user/projects/MicroPythonOS/MicroPythonOS/manifest.py" + manifest="manifest.py" fi else echo "Note that you can also prevent the builtin filesystem from being mounted by umounting it and creating a builtin/ folder." @@ -46,17 +51,21 @@ if [ "$target" == "esp32" ]; then # CONFIG_FREERTOS_USE_TRACE_FACILITY=y # CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y # CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y + [ ! -z "$manifest" ] && frozenmanifest="FROZEN_MANIFEST="$(readlink -f "$manifest") + twoup=$(readlink -f "$mydir"/../..) # build process needs absolute paths + oneup=$(readlink -f "$mydir"/..) # build process needs absolute paths pushd ~/projects/MicroPythonOS/lvgl_micropython - 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/projects/MicroPythonOS/micropython-camera-API/src/micropython.cmake USER_C_MODULE=/home/user/projects/MicroPythonOS/secp256k1-embedded-ecdh/micropython.cmake USER_C_MODULE=/home/user/projects/MicroPythonOS/MicroPythonOS/c_mpos/micropython.cmake CONFIG_FREERTOS_USE_TRACE_FACILITY=y CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y "$manifest" + 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="$twoup"/micropython-camera-API/src/micropython.cmake USER_C_MODULE="$twoup"/secp256k1-embedded-ecdh/micropython.cmake USER_C_MODULE="$oneup"/c_mpos/micropython.cmake CONFIG_FREERTOS_USE_TRACE_FACILITY=y CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y "$frozenmanifest" popd elif [ "$target" == "unix" -o "$target" == "macos" ]; then if [ "$buildtype" == "prod" ]; then - manifest="FROZEN_MANIFEST=/home/user/projects/MicroPythonOS/MicroPythonOS/manifest_unix.py" + manifest="manifest_unix.py" fi # build for desktop #python3 make.py "$target" DISPLAY=sdl_display INDEV=sdl_pointer INDEV=sdl_keyboard "$manifest" # LV_CFLAGS are passed to USER_C_MODULES # STRIP= makes it so that debug symbols are kept + [ ! -z "$manifest" ] && frozenmanifest="FROZEN_MANIFEST="$(readlink -f "$manifest") pushd ~/projects/MicroPythonOS/lvgl_micropython python3 make.py "$target" LV_CFLAGS="-g -O0 -ggdb -ljpeg" STRIP= DISPLAY=sdl_display INDEV=sdl_pointer INDEV=sdl_keyboard "$manifest" popd diff --git a/scripts/bundleapps.sh b/scripts/bundleapps.sh index 527da9d3..96607945 100755 --- a/scripts/bundleapps.sh +++ b/scripts/bundleapps.sh @@ -1,4 +1,4 @@ -output=/home/user/projects/MicroPythonOS/apps/ +output=../apps/ outputjson="$output"/app_index.json output=$(readlink -f "$output") outputjson=$(readlink -f "$outputjson") diff --git a/scripts/flash_over_usb.sh b/scripts/flash_over_usb.sh index 557fe18c..526b0090 100755 --- a/scripts/flash_over_usb.sh +++ b/scripts/flash_over_usb.sh @@ -1,6 +1,7 @@ -fwfile="/home/user/projects/MicroPythonOS/lvgl_micropython/build/lvgl_micropy_ESP32_GENERIC_S3-SPIRAM_OCT-16.bin" +fwfile="../lvgl_micropython/build/lvgl_micropy_ESP32_GENERIC_S3-SPIRAM_OCT-16.bin" ls -al $fwfile echo "Add --erase-all if needed" sleep 5 +# This needs python and the esptool ~/.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 $1 0x0 $fwfile