2025-10-09 19:49:53 +02:00
#!/bin/bash
mydir = $( readlink -f " $0 " )
mydir = $( dirname " $mydir " )
2025-10-13 19:14:37 +02:00
twoup = $( readlink -f " $mydir " /../..) # build process needs absolute paths
oneup = $( readlink -f " $mydir " /..) # build process needs absolute paths
2025-05-07 10:24:33 +02:00
2025-05-17 19:14:07 +02:00
target = " $1 "
buildtype = " $2 "
2025-10-08 16:19:26 +02:00
subtarget = " $3 "
2025-05-17 19:14:07 +02:00
if [ -z " $target " -o -z " $buildtype " ] ; then
2025-10-08 16:19:26 +02:00
echo " Usage: $0 target buildtype [optional subtarget] "
2025-10-20 22:44:57 +02:00
echo " Usage: $0 <esp32 or unix or macOS> <dev or prod> [<waveshare-esp32-s3-touch-lcd-2 or fri3d-2024>] "
2025-06-05 01:53:09 +02:00
echo " Example: $0 unix dev "
2025-10-09 19:51:23 +02:00
echo " Example: $0 esp32 dev fri3d-2024 "
2025-10-08 16:19:26 +02:00
echo " Example: $0 esp32 prod fri3d-2024 "
2025-10-09 19:51:23 +02:00
echo " Example: $0 esp32 dev waveshare-esp32-s3-touch-lcd-2 "
echo " Example: $0 esp32 prod waveshare-esp32-s3-touch-lcd-2 "
2025-05-17 19:14:07 +02:00
echo
2025-05-17 19:16:20 +02:00
echo "A 'dev' build is without any preinstalled files or builtin/ filsystem, so it will just start with a black screen and you'll have to do: ./scripts/install.sh to install the User Interface."
2025-06-05 01:53:09 +02:00
echo "A 'prod' build has the files from manifest*.py frozen in. Don't forget to run: ./scripts/freezefs_mount_builtin.sh !"
2025-05-17 19:14:07 +02:00
exit 1
fi
2025-05-07 10:24:33 +02:00
2025-06-13 14:50:09 +02:00
if [ " $buildtype " = = "prod" ] ; then
./scripts/freezefs_mount_builtin.sh
fi
2025-05-02 00:17:05 +02:00
2025-10-09 19:49:53 +02:00
manifest = ""
2025-05-17 19:14:07 +02:00
if [ " $target " = = "esp32" ] ; then
if [ " $buildtype " = = "prod" ] ; then
2025-10-08 16:19:26 +02:00
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
2025-10-09 19:49:53 +02:00
manifest = "manifest_fri3d-2024.py"
2025-10-08 16:19:26 +02:00
else
2025-10-09 19:49:53 +02:00
manifest = "manifest.py"
2025-10-08 16:19:26 +02:00
fi
2025-06-17 18:00:18 +02:00
else
echo "Note that you can also prevent the builtin filesystem from being mounted by umounting it and creating a builtin/ folder."
2025-05-17 19:14:07 +02:00
fi
# Build for https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-2.
# See https://github.com/lvgl-micropython/lvgl_micropython
# --ota: support Over-The-Air updates
# --partition size: both OTA partitions are 4MB
# --flash-size: total flash size is 16MB
# --debug: enable debugging from ESP-IDF but makes copying files to it very slow
# --dual-core-threads: disabled GIL, run code on both CPUs
# --task-stack-size={stack size in bytes}
# CONFIG_* sets ESP-IDF options
2025-05-20 08:08:37 +02:00
# listing processes on the esp32 still doesn't work because no esp32.vtask_list_threads() or something
2025-05-17 19:14:07 +02:00
# CONFIG_FREERTOS_USE_TRACE_FACILITY=y
# CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y
# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y
2025-10-09 19:49:53 +02:00
[ ! -z " $manifest " ] && frozenmanifest = "FROZEN_MANIFEST=" $( readlink -f " $manifest " )
2025-10-24 17:02:20 +02:00
pushd 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 = " $mydir " /micropython-camera-API/src/micropython.cmake USER_C_MODULE = " $mydir " /secp256k1-embedded-ecdh/micropython.cmake USER_C_MODULE = " $mydir " /c_mpos/micropython.cmake CONFIG_FREERTOS_USE_TRACE_FACILITY = y CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID = y CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS = y " $frozenmanifest "
2025-10-08 16:19:26 +02:00
popd
2025-10-20 22:44:57 +02:00
elif [ " $target " = = "unix" -o " $target " = = "macOS" ] ; then
2025-05-17 19:14:07 +02:00
if [ " $buildtype " = = "prod" ] ; then
2025-10-09 19:49:53 +02:00
manifest = "manifest_unix.py"
2025-05-17 19:14:07 +02:00
fi
2025-05-10 17:44:31 +02:00
# build for desktop
2025-06-05 12:34:56 +02:00
#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
2025-10-09 19:49:53 +02:00
[ ! -z " $manifest " ] && frozenmanifest = "FROZEN_MANIFEST=" $( readlink -f " $manifest " )
2025-10-24 17:02:20 +02:00
pushd lvgl_micropython/
2025-10-16 17:36:32 +02:00
# USER_C_MODULE doesn't seem to work properly so there are symlinks in lvgl_micropython/extmod/
2025-06-10 00:00:04 +02:00
python3 make.py " $target " LV_CFLAGS = "-g -O0 -ggdb -ljpeg" STRIP = DISPLAY = sdl_display INDEV = sdl_pointer INDEV = sdl_keyboard " $manifest "
2025-10-08 16:19:26 +02:00
popd
2025-05-20 08:08:37 +02:00
else
echo " invalid target $target "
2025-05-10 17:44:31 +02:00
fi
2025-05-09 17:49:16 +02:00