mirror of https://github.com/arendst/Tasmota.git
Merge pull request #10574 from Jason2866/patch-2
add ESP32 filesystem download with PIO
This commit is contained in:
commit
f928a1c75a
|
@ -9,6 +9,8 @@
|
||||||
.clang_complete
|
.clang_complete
|
||||||
.gcc-flags.json
|
.gcc-flags.json
|
||||||
.cache
|
.cache
|
||||||
|
data
|
||||||
|
unpacked_fs
|
||||||
tasmota/user_config_override.h
|
tasmota/user_config_override.h
|
||||||
build
|
build
|
||||||
build_output
|
build_output
|
||||||
|
|
|
@ -23,6 +23,11 @@ Import("env")
|
||||||
platform = env.PioPlatform()
|
platform = env.PioPlatform()
|
||||||
board = env.BoardConfig()
|
board = env.BoardConfig()
|
||||||
mcu = board.get("build.mcu", "esp32")
|
mcu = board.get("build.mcu", "esp32")
|
||||||
|
# Hack for using mklittlefs instead of mkspiffs -> needed since littlefs is not supported with this for ESP32
|
||||||
|
if env["PIOPLATFORM"] == "espressif32":
|
||||||
|
#print("Replace MKSPIFFSTOOL with mklittlefs")
|
||||||
|
env.Replace( MKSPIFFSTOOL=platform.get_package_dir("tool-mklittlefs") + '/mklittlefs' )
|
||||||
|
|
||||||
# needed for later
|
# needed for later
|
||||||
AutodetectUploadPort(env)
|
AutodetectUploadPort(env)
|
||||||
|
|
||||||
|
@ -41,7 +46,7 @@ class FSInfo:
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"FS type {self.fs_type} Start {hex(self.start)} Len {self.length} Page size {self.page_size} Block size {self.block_size}"
|
return f"FS type {self.fs_type} Start {hex(self.start)} Len {self.length} Page size {self.page_size} Block size {self.block_size}"
|
||||||
# extract command supposed to be implemented by subclasses
|
# extract command supposed to be implemented by subclasses
|
||||||
def get_extract_cmd(self):
|
def get_extract_cmd(self, input_file, output_dir):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
class LittleFSInfo(FSInfo):
|
class LittleFSInfo(FSInfo):
|
||||||
|
@ -56,7 +61,7 @@ class LittleFSInfo(FSInfo):
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"FS type {self.fs_type} Start {hex(self.start)} Len {self.length} Page size {self.page_size} Block size {self.block_size} Tool: {self.tool}"
|
return f"FS type {self.fs_type} Start {hex(self.start)} Len {self.length} Page size {self.page_size} Block size {self.block_size} Tool: {self.tool}"
|
||||||
def get_extract_cmd(self, input_file, output_dir):
|
def get_extract_cmd(self, input_file, output_dir):
|
||||||
return f'"{self.tool}" -b {self.block_size} -p {self.page_size} --unpack "{output_dir}" "{input_file}"'
|
return [self.tool, "-b", str(self.block_size), "-p", str(self.page_size), "--unpack", output_dir, input_file]
|
||||||
|
|
||||||
|
|
||||||
class SPIFFSInfo(FSInfo):
|
class SPIFFSInfo(FSInfo):
|
||||||
|
@ -258,16 +263,16 @@ def download_fs(fs_info: FSInfo):
|
||||||
fs_file = join(env["PROJECT_DIR"], f"downloaded_fs_{hex(fs_info.start)}_{hex(fs_info.length)}.bin")
|
fs_file = join(env["PROJECT_DIR"], f"downloaded_fs_{hex(fs_info.start)}_{hex(fs_info.length)}.bin")
|
||||||
esptoolpy_flags = [
|
esptoolpy_flags = [
|
||||||
"--chip", mcu,
|
"--chip", mcu,
|
||||||
"--port", '"' + env.subst("$UPLOAD_PORT") + '"',
|
"--port", env.subst("$UPLOAD_PORT"),
|
||||||
"--baud", env.subst("$UPLOAD_SPEED"),
|
"--baud", env.subst("$UPLOAD_SPEED"),
|
||||||
"--before", "default_reset",
|
"--before", "default_reset",
|
||||||
"--after", "hard_reset",
|
"--after", "hard_reset",
|
||||||
"read_flash",
|
"read_flash",
|
||||||
hex(fs_info.start),
|
hex(fs_info.start),
|
||||||
hex(fs_info.length),
|
hex(fs_info.length),
|
||||||
'"' + fs_file + '"'
|
fs_file
|
||||||
]
|
]
|
||||||
esptoolpy_cmd = '"' + env["PYTHONEXE"]+ '"' + ' "' + esptoolpy + '" ' + " ".join(esptoolpy_flags)
|
esptoolpy_cmd = [env["PYTHONEXE"], esptoolpy] + esptoolpy_flags
|
||||||
print("Executing flash download command.")
|
print("Executing flash download command.")
|
||||||
print(esptoolpy_cmd)
|
print(esptoolpy_cmd)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -67,7 +67,7 @@ default_envs = ${build_envs.default_envs}
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board = esp01_1m
|
board = esp01_1m
|
||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
custom_unpack_dir = unpacked_esp8266_littlefs
|
custom_unpack_dir = unpacked_littlefs
|
||||||
board_build.flash_mode = dout
|
board_build.flash_mode = dout
|
||||||
board_build.ldscript = eagle.flash.1m.ld
|
board_build.ldscript = eagle.flash.1m.ld
|
||||||
|
|
||||||
|
|
|
@ -116,33 +116,21 @@ build_flags = ${esp82xx_defaults.build_flags}
|
||||||
-DWAVEFORM_LOCKED_PWM
|
-DWAVEFORM_LOCKED_PWM
|
||||||
-Wno-switch-unreachable
|
-Wno-switch-unreachable
|
||||||
|
|
||||||
|
|
||||||
[common32]
|
[common32]
|
||||||
platform = ${core32.platform}
|
|
||||||
platform_packages = ${core32.platform_packages}
|
platform_packages = ${core32.platform_packages}
|
||||||
build_unflags = ${core32.build_unflags}
|
build_unflags = ${core32.build_unflags}
|
||||||
build_flags = ${core32.build_flags}
|
build_flags = ${core32.build_flags}
|
||||||
board = esp32dev
|
upload_port = COM4
|
||||||
board_build.ldscript = esp32_out.ld
|
|
||||||
board_build.partitions = esp32_partition_app1984k_spiffs64k.csv
|
|
||||||
board_build.flash_mode = ${common.board_build.flash_mode}
|
|
||||||
board_build.f_flash = ${common.board_build.f_flash}
|
|
||||||
board_build.f_cpu = ${common.board_build.f_cpu}
|
|
||||||
monitor_speed = ${common.monitor_speed}
|
|
||||||
upload_port = ${common.upload_port}
|
|
||||||
upload_resetmethod = ${common.upload_resetmethod}
|
|
||||||
upload_speed = 921600
|
|
||||||
extra_scripts = ${common.extra_scripts}
|
|
||||||
lib_extra_dirs = ${library.lib_extra_dirs}
|
lib_extra_dirs = ${library.lib_extra_dirs}
|
||||||
; *** ESP32 lib. ALWAYS needed for ESP32 !!!
|
; *** ESP32 lib. ALWAYS needed for ESP32 !!!
|
||||||
lib/libesp32
|
lib/libesp32
|
||||||
|
|
||||||
[core32]
|
[core32]
|
||||||
; Activate Stage Core32 by removing ";" in next 3 lines, if you want to override the standard core32
|
; Activate Stage Core32 by removing ";" in next 3 lines, if you want to override the standard core32
|
||||||
;platform_packages = ${core32_stage.platform_packages}
|
;platform_packages = ${core32_stage.platform_packages}
|
||||||
;build_unflags = ${core32_stage.build_unflags}
|
;build_unflags = ${core32_stage.build_unflags}
|
||||||
;build_flags = ${core32_stage.build_flags}
|
;build_flags = ${core32_stage.build_flags}
|
||||||
|
|
||||||
|
|
||||||
[core32_stage]
|
[core32_stage]
|
||||||
platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/arduino-esp32/releases/download/1.0.5-rc6/esp32-1.0.5-rc6.zip
|
platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/arduino-esp32/releases/download/1.0.5-rc6/esp32-1.0.5-rc6.zip
|
||||||
platformio/tool-mklittlefs @ ~1.203.200522
|
platformio/tool-mklittlefs @ ~1.203.200522
|
||||||
|
|
|
@ -48,6 +48,7 @@ build_unflags = ${core32.build_unflags}
|
||||||
build_flags = ${core32.build_flags}
|
build_flags = ${core32.build_flags}
|
||||||
board = esp32dev
|
board = esp32dev
|
||||||
board_build.filesystem = ${common.board_build.filesystem}
|
board_build.filesystem = ${common.board_build.filesystem}
|
||||||
|
custom_unpack_dir = ${common.custom_unpack_dir}
|
||||||
board_build.ldscript = esp32_out.ld
|
board_build.ldscript = esp32_out.ld
|
||||||
board_build.partitions = esp32_partition_app1984k_spiffs64k.csv
|
board_build.partitions = esp32_partition_app1984k_spiffs64k.csv
|
||||||
board_build.flash_mode = ${common.board_build.flash_mode}
|
board_build.flash_mode = ${common.board_build.flash_mode}
|
||||||
|
|
Loading…
Reference in New Issue