Add new board setting "download speed" to esp32x boards json (#20291)

* add download_speed setting

* add "download speed"

* add / change up- download speed
This commit is contained in:
Jason2866 2023-12-22 19:40:47 +01:00 committed by GitHub
parent fbc827d11d
commit 18e5f53e97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 64 additions and 10 deletions

View File

@ -41,6 +41,9 @@
"require_upload_port": true, "require_upload_port": true,
"speed": 460800 "speed": 460800
}, },
"download": {
"speed": 230400
},
"url": "https://en.wikipedia.org/wiki/ESP32", "url": "https://en.wikipedia.org/wiki/ESP32",
"vendor": "Espressif" "vendor": "Espressif"
} }

View File

@ -41,6 +41,9 @@
"require_upload_port": true, "require_upload_port": true,
"speed": 460800 "speed": 460800
}, },
"download": {
"speed": 230400
},
"url": "https://en.wikipedia.org/wiki/ESP32", "url": "https://en.wikipedia.org/wiki/ESP32",
"vendor": "Espressif" "vendor": "Espressif"
} }

View File

@ -41,6 +41,9 @@
"require_upload_port": true, "require_upload_port": true,
"speed": 460800 "speed": 460800
}, },
"download": {
"speed": 230400
},
"url": "https://en.wikipedia.org/wiki/ESP32", "url": "https://en.wikipedia.org/wiki/ESP32",
"vendor": "Espressif" "vendor": "Espressif"
} }

View File

@ -39,6 +39,9 @@
"require_upload_port": true, "require_upload_port": true,
"speed": 460800 "speed": 460800
}, },
"download": {
"speed": 230400
},
"url": "https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/index.html", "url": "https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/index.html",
"vendor": "Espressif" "vendor": "Espressif"
} }

View File

@ -39,6 +39,9 @@
"require_upload_port": true, "require_upload_port": true,
"speed": 460800 "speed": 460800
}, },
"download": {
"speed": 230400
},
"url": "https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/index.html", "url": "https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/index.html",
"vendor": "Espressif" "vendor": "Espressif"
} }

View File

@ -39,6 +39,9 @@
"require_upload_port": true, "require_upload_port": true,
"speed": 460800 "speed": 460800
}, },
"download": {
"speed": 230400
},
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html", "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html",
"vendor": "Espressif" "vendor": "Espressif"
} }

View File

@ -41,7 +41,10 @@
"maximum_ram_size": 327680, "maximum_ram_size": 327680,
"maximum_size": 4194304, "maximum_size": 4194304,
"require_upload_port": true, "require_upload_port": true,
"speed": 460800 "speed": 2000000
},
"download": {
"speed": 2000000
}, },
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html", "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html",
"vendor": "Espressif" "vendor": "Espressif"

View File

@ -39,6 +39,9 @@
"require_upload_port": true, "require_upload_port": true,
"speed": 460800 "speed": 460800
}, },
"download": {
"speed": 230400
},
"url": "https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/index.html", "url": "https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/index.html",
"vendor": "Espressif" "vendor": "Espressif"
} }

View File

@ -41,7 +41,10 @@
"maximum_ram_size": 327680, "maximum_ram_size": 327680,
"maximum_size": 4194304, "maximum_size": 4194304,
"require_upload_port": true, "require_upload_port": true,
"speed": 460800 "speed": 2000000
},
"download": {
"speed": 2000000
}, },
"url": "https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/index.html", "url": "https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/index.html",
"vendor": "Espressif" "vendor": "Espressif"

View File

@ -38,6 +38,9 @@
"require_upload_port": true, "require_upload_port": true,
"speed": 460800 "speed": 460800
}, },
"download": {
"speed": 230400
},
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/hw-reference/esp32s2/user-guide-saola-1-v1.2.html", "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/hw-reference/esp32s2/user-guide-saola-1-v1.2.html",
"vendor": "Espressif" "vendor": "Espressif"
} }

View File

@ -37,7 +37,10 @@
"maximum_size": 4194304, "maximum_size": 4194304,
"require_upload_port": true, "require_upload_port": true,
"before_reset": "usb_reset", "before_reset": "usb_reset",
"speed": 460800 "speed": 2000000
},
"download": {
"speed": 2000000
}, },
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/hw-reference/esp32s2/user-guide-saola-1-v1.2.html", "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/hw-reference/esp32s2/user-guide-saola-1-v1.2.html",
"vendor": "Espressif" "vendor": "Espressif"

View File

@ -41,6 +41,9 @@
"require_upload_port": true, "require_upload_port": true,
"speed": 460800 "speed": 460800
}, },
"download": {
"speed": 230400
},
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/", "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/",
"vendor": "Espressif" "vendor": "Espressif"
} }

View File

@ -41,6 +41,9 @@
"require_upload_port": true, "require_upload_port": true,
"speed": 460800 "speed": 460800
}, },
"download": {
"speed": 230400
},
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/", "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/",
"vendor": "Espressif" "vendor": "Espressif"
} }

View File

@ -41,6 +41,9 @@
"require_upload_port": true, "require_upload_port": true,
"speed": 460800 "speed": 460800
}, },
"download": {
"speed": 230400
},
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/", "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/",
"vendor": "Espressif" "vendor": "Espressif"
} }

View File

@ -49,7 +49,10 @@
"maximum_ram_size": 327680, "maximum_ram_size": 327680,
"maximum_size": 4194304, "maximum_size": 4194304,
"require_upload_port": true, "require_upload_port": true,
"speed": 460800 "speed": 2000000
},
"download": {
"speed": 2000000
}, },
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/", "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/",
"vendor": "Espressif" "vendor": "Espressif"

View File

@ -49,7 +49,10 @@
"maximum_ram_size": 327680, "maximum_ram_size": 327680,
"maximum_size": 4194304, "maximum_size": 4194304,
"require_upload_port": true, "require_upload_port": true,
"speed": 460800 "speed": 2000000
},
"download": {
"speed": 2000000
}, },
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/", "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/",
"vendor": "Espressif" "vendor": "Espressif"

View File

@ -49,7 +49,10 @@
"maximum_ram_size": 327680, "maximum_ram_size": 327680,
"maximum_size": 4194304, "maximum_size": 4194304,
"require_upload_port": true, "require_upload_port": true,
"speed": 460800 "speed": 2000000
},
"download": {
"speed": 2000000
}, },
"url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/", "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/",
"vendor": "Espressif" "vendor": "Espressif"

View File

@ -186,6 +186,7 @@ def parse_partition_table(content):
def get_partition_table(): def get_partition_table():
esptoolpy = join(platform.get_package_dir("tool-esptoolpy") or "", "esptool.py") esptoolpy = join(platform.get_package_dir("tool-esptoolpy") or "", "esptool.py")
upload_port = join(env.get("UPLOAD_PORT", "none")) upload_port = join(env.get("UPLOAD_PORT", "none"))
download_speed = join(str(board.get("download.speed", "115200")))
if "none" in upload_port: if "none" in upload_port:
env.AutodetectUploadPort() env.AutodetectUploadPort()
upload_port = join(env.get("UPLOAD_PORT", "none")) upload_port = join(env.get("UPLOAD_PORT", "none"))
@ -193,7 +194,7 @@ def get_partition_table():
esptoolpy_flags = [ esptoolpy_flags = [
"--chip", mcu, "--chip", mcu,
"--port", upload_port, "--port", upload_port,
"--baud", env.subst("$UPLOAD_SPEED"), "--baud", download_speed,
"--before", "default_reset", "--before", "default_reset",
"--after", "hard_reset", "--after", "hard_reset",
"read_flash", "read_flash",
@ -246,6 +247,7 @@ def download_fs(fs_info: FSInfo):
print(fs_info) print(fs_info)
esptoolpy = join(platform.get_package_dir("tool-esptoolpy") or "", "esptool.py") esptoolpy = join(platform.get_package_dir("tool-esptoolpy") or "", "esptool.py")
upload_port = join(env.get("UPLOAD_PORT", "none")) upload_port = join(env.get("UPLOAD_PORT", "none"))
download_speed = join(str(board.get("download.speed", "115200")))
if "none" in upload_port: if "none" in upload_port:
env.AutodetectUploadPort() env.AutodetectUploadPort()
upload_port = join(env.get("UPLOAD_PORT", "none")) upload_port = join(env.get("UPLOAD_PORT", "none"))
@ -253,7 +255,7 @@ def download_fs(fs_info: FSInfo):
esptoolpy_flags = [ esptoolpy_flags = [
"--chip", mcu, "--chip", mcu,
"--port", upload_port, "--port", upload_port,
"--baud", env.subst("$UPLOAD_SPEED"), "--baud", download_speed,
"--before", "default_reset", "--before", "default_reset",
"--after", "hard_reset", "--after", "hard_reset",
"read_flash", "read_flash",
@ -278,7 +280,7 @@ def unpack_fs(fs_info: FSInfo, downloaded_file: str):
unpack_dir = env.GetProjectOption("custom_unpack_dir", "unpacked_fs") unpack_dir = env.GetProjectOption("custom_unpack_dir", "unpacked_fs")
#unpack_dir = "unpacked_fs" #unpack_dir = "unpacked_fs"
if not os.path.exists(downloaded_file): if not os.path.exists(downloaded_file):
print(f"ERROR: {downloaded_file} with filesystem not found, maybe download failed due to upload_speed setting being too high.") print(f"ERROR: {downloaded_file} with filesystem not found, maybe download failed due to download_speed setting being too high.")
assert(0) assert(0)
try: try:
if os.path.exists(unpack_dir): if os.path.exists(unpack_dir):
@ -305,7 +307,7 @@ def display_fs(extracted_dir):
print("Extracted " + str(file_count) + " file(s) from filesystem.") print("Extracted " + str(file_count) + " file(s) from filesystem.")
def command_download_fs(*args, **kwargs): def command_download_fs(*args, **kwargs):
print("Entrypoint") #print("Entrypoint")
#print(env.Dump()) #print(env.Dump())
get_partition_table() get_partition_table()
info = get_fs_type_start_and_length() info = get_fs_type_start_and_length()
@ -356,3 +358,4 @@ env.AddCustomTarget(
title="Flash factory", title="Flash factory",
description="Flash factory firmware" description="Flash factory firmware"
) )