From c53434539b258e69ae265b2958c2de8179e1271d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 27 Sep 2022 00:16:12 +0200 Subject: [PATCH 1/2] use the native littlefs builder of newer framework --- arch/esp32/esp32.ini | 2 +- arch/esp32/esp32s3.ini | 3 ++- bin/device-install.bat | 1 + bin/device-install.sh | 1 + bin/mklittlefs.py | 51 ---------------------------------------- bin/platformio-custom.py | 7 ------ 6 files changed, 5 insertions(+), 60 deletions(-) delete mode 100755 bin/mklittlefs.py diff --git a/arch/esp32/esp32.ini b/arch/esp32/esp32.ini index 3c5c5335c..101752e8b 100644 --- a/arch/esp32/esp32.ini +++ b/arch/esp32/esp32.ini @@ -7,7 +7,7 @@ build_src_filter = upload_speed = 921600 debug_init_break = tbreak setup monitor_filters = esp32_exception_decoder -platform_packages = platformio/tool-esptoolpy@^1.40201.0 +board_build.filesystem = littlefs # Remove -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL for low level BLE logging. # See library directory for BLE logging possible values: .pio/libdeps/tbeam/NimBLE-Arduino/src/log_common/log_common.h diff --git a/arch/esp32/esp32s3.ini b/arch/esp32/esp32s3.ini index 11051f0fc..dbf1a5df6 100644 --- a/arch/esp32/esp32s3.ini +++ b/arch/esp32/esp32s3.ini @@ -1,12 +1,13 @@ [esp32s3_base] extends = arduino_base -platform = espressif32 +platform = espressif32@5.1.1 build_src_filter = ${arduino_base.build_src_filter} - - - upload_speed = 961200 monitor_speed = 115200 debug_init_break = tbreak setup monitor_filters = esp32_exception_decoder +board_build.filesystem = littlefs # Remove -DMYNEWT_VAL_BLE_HS_LOG_LVL=LOG_LEVEL_CRITICAL for low level BLE logging. # See library directory for BLE logging possible values: .pio/libdeps/tbeam/NimBLE-Arduino/src/log_common/log_common.h diff --git a/bin/device-install.bat b/bin/device-install.bat index a7a6743e1..763cdac85 100755 --- a/bin/device-install.bat +++ b/bin/device-install.bat @@ -35,6 +35,7 @@ IF EXIST %FILENAME% ( %PYTHON% -m esptool --baud 115200 write_flash 0x300000 %%f ) %PYTHON% -m esptool --baud 115200 write_flash 0x10000 %FILENAME% + %PYTHON% -m esptool --baud 115200 write_flash 0x260000 bleota.bin ) else ( echo "Invalid file: %FILENAME%" goto HELP diff --git a/bin/device-install.sh b/bin/device-install.sh index d1f4ba158..163499d7b 100755 --- a/bin/device-install.sh +++ b/bin/device-install.sh @@ -50,6 +50,7 @@ if [ -f "${FILENAME}" ]; then "$PYTHON" -m esptool write_flash 0x1000 system-info.bin "$PYTHON" -m esptool write_flash 0x8000 partitions.bin "$PYTHON" -m esptool write_flash 0x300000 littlefs-*.bin + "$PYTHON" -m esptool write_flash 0x260000 bleota.bin "$PYTHON" -m esptool write_flash 0x10000 ${FILENAME} else echo "Invalid file: ${FILENAME}" diff --git a/bin/mklittlefs.py b/bin/mklittlefs.py deleted file mode 100755 index d79d5c783..000000000 --- a/bin/mklittlefs.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python3 -import getopt -import sys -import os -from littlefs import LittleFS -from pathlib import Path - -print( "Building LittleFS image..." ) - -argList = sys.argv[1:] -arxx = { argList[i]: argList[i+1] for i in range(0, len(argList)-1, 2) } - -dataPath = arxx["-c"] -blockSize = int(arxx["-b"]) -blockCount = int(arxx["-s"]) / blockSize - -cwd = os.getcwd() - -os.chdir(dataPath) - -fileList = [] -dirList = [] - -for (dirpath, dirnames, filenames) in os.walk('.'): - for f in filenames: - if (f[:1] != '.'): - fileList.append( os.path.join(dirpath, f) ) - for d in dirnames: - if (d[:1] != '.'): - dirList.append( os.path.join(dirpath, d) ) - -fs = LittleFS(block_size=blockSize, block_count=blockCount) # create a 448kB partition - -for curDir in dirList: - print( "Creating dir " + curDir ) - fs.mkdir( curDir ) - -for curFile in fileList: - print( "Adding file " + curFile ) - with open( curFile, 'rb' ) as f: - data = f.read() - - with fs.open( curFile, 'wb') as fh: - fh.write( data ) - -outName = argList[-1] - -os.chdir(cwd) - -with open(outName, 'wb') as fh: - fh.write(fs.context.buffer) diff --git a/bin/platformio-custom.py b/bin/platformio-custom.py index 3cf45d287..951d89b0a 100644 --- a/bin/platformio-custom.py +++ b/bin/platformio-custom.py @@ -6,13 +6,6 @@ import traceback import sys from readprops import readProps -Import("env") -env.Replace( MKSPIFFSTOOL=env.get("PROJECT_DIR") + '/bin/mklittlefs.py' ) -try: - import littlefs -except ImportError: - env.Execute("$PYTHONEXE -m pip install littlefs-python") - Import("projenv") prefsLoc = projenv["PROJECT_DIR"] + "/version.properties" From b8eb751316c9a3bbe0f12fd8c2e2eaa6b7205c71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Tue, 27 Sep 2022 00:23:50 +0200 Subject: [PATCH 2/2] Update build-esp32.sh --- bin/build-esp32.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/build-esp32.sh b/bin/build-esp32.sh index 1f6a7aed3..153638425 100755 --- a/bin/build-esp32.sh +++ b/bin/build-esp32.sh @@ -34,7 +34,7 @@ cp $SRCBIN $OUTDIR/$basename.bin echo "Building Filesystem for ESP32 targets" pio run --environment tbeam -t buildfs -cp .pio/build/tbeam/spiffs.bin $OUTDIR/littlefs-$VERSION.bin +cp .pio/build/tbeam/littlefs.bin $OUTDIR/littlefs-$VERSION.bin cp images/system-info.bin $OUTDIR/system-info.bin cp .pio/build/$1/partitions.bin $OUTDIR/partitions.bin