Merge pull request #360 from Erethon/set-baud-rate-when-flashing

rnodeconf: Add option to set baud when flashing
This commit is contained in:
markqvist 2023-08-14 16:42:26 +02:00 committed by GitHub
commit b0c6c53430
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 25 deletions

View File

@ -1131,7 +1131,8 @@ def main():
parser.add_argument("-e", "--extract", action="store_true", help="Extract firmware from connected RNode for later use")
parser.add_argument("-E", "--use-extracted", action="store_true", help="Use the extracted firmware for autoinstallation or update")
parser.add_argument("-C", "--clear-cache", action="store_true", help="Clear locally cached firmware files")
parser.add_argument("--baud-flash", action="store", metavar="baud_flash", type=str, default="921600", help="Set specific baud rate when flashing device. Default is 921600")
parser.add_argument("-N", "--normal", action="store_true", help="Switch device to normal mode")
parser.add_argument("-T", "--tnc", action="store_true", help="Switch device to TNC mode")
@ -1348,11 +1349,11 @@ def main():
hash_f.close()
extraction_parts = [
("bootloader", "python \""+CNF_DIR+"/recovery_esptool.py\" --chip esp32 --port "+port_path+" --baud 921600 --before default_reset --after hard_reset read_flash 0x1000 0x4650 \""+EXT_DIR+"/extracted_rnode_firmware.bootloader\""),
("partition table", "python \""+CNF_DIR+"/recovery_esptool.py\" --chip esp32 --port "+port_path+" --baud 921600 --before default_reset --after hard_reset read_flash 0x8000 0xC00 \""+EXT_DIR+"/extracted_rnode_firmware.partitions\""),
("app boot", "python \""+CNF_DIR+"/recovery_esptool.py\" --chip esp32 --port "+port_path+" --baud 921600 --before default_reset --after hard_reset read_flash 0xe000 0x2000 \""+EXT_DIR+"/extracted_rnode_firmware.boot_app0\""),
("application image", "python \""+CNF_DIR+"/recovery_esptool.py\" --chip esp32 --port "+port_path+" --baud 921600 --before default_reset --after hard_reset read_flash 0x10000 0x200000 \""+EXT_DIR+"/extracted_rnode_firmware.bin\""),
("console image", "python \""+CNF_DIR+"/recovery_esptool.py\" --chip esp32 --port "+port_path+" --baud 921600 --before default_reset --after hard_reset read_flash 0x210000 0x1F0000 \""+EXT_DIR+"/extracted_console_image.bin\""),
("bootloader", "python \""+CNF_DIR+"/recovery_esptool.py\" --chip esp32 --port "+port_path+" --baud "+args.baud_flash+" --before default_reset --after hard_reset read_flash 0x1000 0x4650 \""+EXT_DIR+"/extracted_rnode_firmware.bootloader\""),
("partition table", "python \""+CNF_DIR+"/recovery_esptool.py\" --chip esp32 --port "+port_path+" --baud "+args.baud_flash+" --before default_reset --after hard_reset read_flash 0x8000 0xC00 \""+EXT_DIR+"/extracted_rnode_firmware.partitions\""),
("app boot", "python \""+CNF_DIR+"/recovery_esptool.py\" --chip esp32 --port "+port_path+" --baud "+args.baud_flash+" --before default_reset --after hard_reset read_flash 0xe000 0x2000 \""+EXT_DIR+"/extracted_rnode_firmware.boot_app0\""),
("application image", "python \""+CNF_DIR+"/recovery_esptool.py\" --chip esp32 --port "+port_path+" --baud "+args.baud_flash+" --before default_reset --after hard_reset read_flash 0x10000 0x200000 \""+EXT_DIR+"/extracted_rnode_firmware.bin\""),
("console image", "python \""+CNF_DIR+"/recovery_esptool.py\" --chip esp32 --port "+port_path+" --baud "+args.baud_flash+" --before default_reset --after hard_reset read_flash 0x210000 0x1F0000 \""+EXT_DIR+"/extracted_console_image.bin\""),
]
import subprocess, shlex
for part, command in extraction_parts:
@ -2055,7 +2056,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",
@ -2073,7 +2074,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",
@ -2091,7 +2092,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",
@ -2109,7 +2110,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",
@ -2127,7 +2128,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",
@ -2145,7 +2146,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",
@ -2163,7 +2164,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",
@ -2181,7 +2182,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",
@ -2199,7 +2200,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",
@ -2217,7 +2218,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",
@ -2235,7 +2236,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",
@ -2253,7 +2254,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",
@ -2271,7 +2272,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",
@ -2289,7 +2290,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",
@ -2307,7 +2308,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",
@ -2325,7 +2326,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",
@ -2343,7 +2344,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",
@ -2361,7 +2362,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",
@ -2378,7 +2379,7 @@ def main():
sys.executable, flasher,
"--chip", "esp32",
"--port", args.port,
"--baud", "921600",
"--baud", args.baud_flash,
"--before", "default_reset",
"--after", "hard_reset",
"write_flash", "-z",