diff --git a/platformio.ini b/platformio.ini index d43eff2e..5ad878c4 100644 --- a/platformio.ini +++ b/platformio.ini @@ -441,7 +441,9 @@ build_src_filter = ${env:esp32c6_8mb_fromitems.build_src_filter} [env:bk7231n] -extra_scripts = pre:tools/lt_fsbuildscript.py +extra_scripts = + pre:tools/lt_fsbuild.py + pre:tools/lt_fsflash.py lib_compat_mode = off lib_deps = LT_WebSockets diff --git a/tools/lt_fsbuild.py b/tools/lt_fsbuild.py new file mode 100644 index 00000000..4eb04226 --- /dev/null +++ b/tools/lt_fsbuild.py @@ -0,0 +1,38 @@ + +# c:\Users\bmw\.platformio\penv\Scripts\pio run -t buildfs +#c:\Users\bmw\.platformio\penv\.libretiny\Scripts\ltchiptool -v flash write lt_littlefs.bin --start 0x1db000 -f BK7231N + + + +Import("env") + +# Определите имя таргета +target_name = "buildfs" + +# Получите путь к директории с данными из переменной среды env +data_dir = env.subst("$PROJECT_DIR") + "/data_svelte" + +# Получите путь к выходному файлу LittleFS из переменной среды env +output_file = env.subst("$PROJECT_DIR") + "/lt_littlefs.bin" + +# Получите путь к mklittlefs.exe из переменной среды env +mklittlefs_path = env.subst("$PROJECT_DIR") + "/tools/mklittlefs.exe" + +# Определите команду, которая будет выполнена при вызове таргета +command = "{} -c {} -s 0x25000 -p 0x100 -b 0x1000 {}".format(mklittlefs_path, data_dir, output_file) + +# Добавьте кастомный таргет +env.AddCustomTarget( + name=target_name, + dependencies=None, + actions=[command], + title="Build LittleFS", + description="Build LittleFS file system" +) + + +# Определите путь к исполняемому файлу ltchiptool +ltchiptool_path = "${LTCHIPTOOL}" + + +print("Custom target '{}' added!".format(target_name)) \ No newline at end of file diff --git a/tools/lt_fsflash.py b/tools/lt_fsflash.py new file mode 100644 index 00000000..1f71fa6b --- /dev/null +++ b/tools/lt_fsflash.py @@ -0,0 +1,34 @@ + +# c:\Users\bmw\.platformio\penv\Scripts\pio run -t buildfs +#c:\Users\bmw\.platformio\penv\.libretiny\Scripts\ltchiptool -v flash write lt_littlefs.bin --start 0x1db000 -f BK7231N -c + + + +Import("env") + +# Определите имя таргета +target_name = "flashfs" + +# Получите путь к выходному файлу LittleFS из переменной среды env +output_file = env.subst("$PROJECT_DIR") + "/lt_littlefs.bin" + +# Получите путь к mklittlefs.exe из переменной среды env +ltchiptool_path = "${LTCHIPTOOL}" +# Определите команду, которая будет выполнена при вызове таргета +command = "{} flash write {} -s 0x1db000 -c -f BK7231N ".format(ltchiptool_path, output_file) + +# Добавьте кастомный таргет +env.AddCustomTarget( + name=target_name, + dependencies=None, + actions=[command], + title="Flash LittleFS", + description="Flash LittleFS file system" +) + + +# Определите путь к исполняемому файлу ltchiptool + + + +print("Custom target '{}' added!".format(target_name)) \ No newline at end of file