mirror of
https://github.com/esphome/esphome-flasher.git
synced 2024-06-26 10:35:04 +02:00
Generate partitions path based on ESP32 model
To be able to support the ESP32-C3, a different partitioning scheme is needed. Add a helper function to generate the URL to download the binary partition table from, and use it when the user did not pass the partitions argument. Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
This commit is contained in:
parent
70c74bba2f
commit
e3b778d4da
|
@ -3,7 +3,10 @@ import struct
|
||||||
|
|
||||||
import esptool
|
import esptool
|
||||||
|
|
||||||
from esphomeflasher.const import HTTP_REGEX
|
from esphomeflasher.const import (
|
||||||
|
ESP32_DEFAULT_PARTITIONS,
|
||||||
|
HTTP_REGEX,
|
||||||
|
)
|
||||||
from esphomeflasher.helpers import prevent_print
|
from esphomeflasher.helpers import prevent_print
|
||||||
|
|
||||||
|
|
||||||
|
@ -186,6 +189,10 @@ def format_bootloader_path(path, model, flash_mode, flash_freq):
|
||||||
return path.replace("$MODEL$", model).replace("$FLASH_MODE$", flash_mode).replace("$FLASH_FREQ$", flash_freq)
|
return path.replace("$MODEL$", model).replace("$FLASH_MODE$", flash_mode).replace("$FLASH_FREQ$", flash_freq)
|
||||||
|
|
||||||
|
|
||||||
|
def format_partitions_path(path, model):
|
||||||
|
return path.replace("$MODEL$", model)
|
||||||
|
|
||||||
|
|
||||||
def configure_write_flash_args(
|
def configure_write_flash_args(
|
||||||
info, firmware_path, flash_size, bootloader_path, partitions_path, otadata_path
|
info, firmware_path, flash_size, bootloader_path, partitions_path, otadata_path
|
||||||
):
|
):
|
||||||
|
@ -206,6 +213,10 @@ def configure_write_flash_args(
|
||||||
bootloader = open_downloadable_binary(
|
bootloader = open_downloadable_binary(
|
||||||
format_bootloader_path(bootloader_path, model, flash_mode, flash_freq)
|
format_bootloader_path(bootloader_path, model, flash_mode, flash_freq)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not partitions_path:
|
||||||
|
partitions_path = format_partitions_path(ESP32_DEFAULT_PARTITIONS, model)
|
||||||
|
|
||||||
partitions = open_downloadable_binary(partitions_path)
|
partitions = open_downloadable_binary(partitions_path)
|
||||||
otadata = open_downloadable_binary(otadata_path)
|
otadata = open_downloadable_binary(otadata_path)
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ ESP32_DEFAULT_BOOTLOADER_FORMAT = (
|
||||||
"2.0.2/tools/sdk/$MODEL$/bin/bootloader_$FLASH_MODE$_$FLASH_FREQ$.bin"
|
"2.0.2/tools/sdk/$MODEL$/bin/bootloader_$FLASH_MODE$_$FLASH_FREQ$.bin"
|
||||||
)
|
)
|
||||||
ESP32_DEFAULT_PARTITIONS = (
|
ESP32_DEFAULT_PARTITIONS = (
|
||||||
"https://raw.githubusercontent.com/esphome/esphomeflasher/main/partitions.esp32.bin"
|
"https://raw.githubusercontent.com/esphome/esphomeflasher/main/partitions.$MODEL$.bin"
|
||||||
)
|
)
|
||||||
|
|
||||||
# https://stackoverflow.com/a/3809435/8924614
|
# https://stackoverflow.com/a/3809435/8924614
|
||||||
|
|
Loading…
Reference in New Issue
Block a user