增加esptools读取内部存储数据
This commit is contained in:
parent
e99d3cdff8
commit
d2130bb02e
@ -71,6 +71,26 @@ def flash_file(chip, port, baud, address, file_path):
|
||||
print("正在烧录,命令:", flash_cmd)
|
||||
esptool.main(flash_cmd)
|
||||
|
||||
def read_flash(chip, port, baud, address, size, output_file):
|
||||
cmd = [
|
||||
"esptool.py",
|
||||
"--chip", chip,
|
||||
"--port", port,
|
||||
"--baud", str(baud),
|
||||
"read_flash",
|
||||
hex(address),
|
||||
hex(size),
|
||||
output_file
|
||||
]
|
||||
|
||||
print("Running command:", " ".join(cmd))
|
||||
try:
|
||||
subprocess.run(cmd, check=True)
|
||||
print(f"✅ Flash 读取成功,保存为:{output_file}")
|
||||
except subprocess.CalledProcessError as e:
|
||||
print("❌ 读取失败:", e)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# directory = r"D:\\esp\\WorkSpace\\esp32c3-usb_serial\\main\\wifi\\www"
|
||||
# write_flash(directory)
|
||||
@ -78,7 +98,13 @@ if __name__ == "__main__":
|
||||
chip = "esp32c3"
|
||||
port = "COM11"
|
||||
baud = 460800
|
||||
address = 0x2e1000 # 修改为你的烧录地址
|
||||
file_path = r"D:\esp\WorkSpace\esp32c3-usb_serial\tools\target_esp32s3.bin" # 修改为你的文件路径
|
||||
# address = 0x2e1000 # 修改为你的烧录地址
|
||||
# file_path = r"D:\esp\WorkSpace\esp32c3-usb_serial\tools\target_esp32s3.bin" # 修改为你的文件路径
|
||||
|
||||
flash_file(chip, port, baud, address, file_path)
|
||||
# flash_file(chip, port, baud, address, file_path)
|
||||
|
||||
address = 0x2e1000 # 起始地址
|
||||
size = 0x10000 # 读取大小,可以修改
|
||||
output_file = r"D:\esp\backup_read_flash.bin"
|
||||
|
||||
read_flash(chip, port, baud, address, size, output_file)
|
||||
Loading…
Reference in New Issue
Block a user