DeaD_EyE icon

compose esp32 binary to flash it

DeaD_EyE | PRO | 03/28/22 09:53:58 AM UTC | 0 ⭐ | 1364 👁️ | Never ⏰ | []
Python |

680 B

|

None

|

0 👍

/

0 👎

from pathlib import Path
 
 
BASE = Path("/home/andre/ESP32_Build/home/build/micropython/ports/esp32/build-GENERIC/")
START = 0x1000
FILES = (
    (BASE / "bootloader/bootloader.bin", 0),
    (BASE / "partition_table/partition-table.bin", 0x8000 - START),
    (BASE / "micropython.bin", 0x10000 - START)
)
TARGET = Path.home().joinpath("micropython_esp32.bin")
 
 
with TARGET.open("w+b") as fd_out:
    for file, offset in FILES:
        print(f"Writing {file.name} as offset {offset:x}")
        fd_out.seek(offset)
        with file.open("rb") as fd_in:
            while chunk := fd_in.read(65 * 1024 ** 1):
                fd_out.write(chunk)
 
 
# start flashing at 0x1000

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎