Skip to content

Commit

Permalink
Update to add bootloader and otadata flashing support
Browse files Browse the repository at this point in the history
  • Loading branch information
thorrak committed Feb 17, 2020
1 parent bac35fe commit f40697f
Show file tree
Hide file tree
Showing 6 changed files with 444 additions and 159 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,15 @@ ENV/
# MacOS Specific
.DS_Store

# Windows specific
Thumbs.db

# Ignore any downloaded firmware
partitions.bin
spiffs.bin
firmware.bin
bootloader.bin
otadata.bin

# Other stuff
package-lock.json
Expand Down
19 changes: 18 additions & 1 deletion Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,20 @@ def run(self):
self._config.firmware_obj.checksum_partitions) > 0:
command_extension.append("0x8000")
command_extension.append(self._config.firmware_obj.full_filepath("partitions"))

# For now, I'm assuming bootloader flashing is ESP32 only
if len(self._config.firmware_obj.download_url_bootloader) > 0 and \
len(self._config.firmware_obj.checksum_bootloader) > 0:
# We need to flash the bootloader. The location is dependent on the device, so we need to use the address
command_extension.append("0x1000")
command_extension.append(self._config.firmware_obj.full_filepath("bootloader"))

else:
command_extension = ["--chip", "esp8266",
"write_flash",
"--flash_mode", self._config.mode, "0x00000",
self._config.firmware_obj.full_filepath("firmware")]


# For both ESP32 and ESP8266 we can directly flash an image to SPIFFS.
if len(self._config.firmware_obj.download_url_spiffs) > 0 and \
len(self._config.firmware_obj.checksum_spiffs) > 0 and \
Expand All @@ -127,6 +134,16 @@ def run(self):
command_extension.append(self._config.firmware_obj.spiffs_address)
command_extension.append(self._config.firmware_obj.full_filepath("spiffs"))


# For both ESP32 and ESP8266 we can directly flash an image to the otadata section (I think?).
if len(self._config.firmware_obj.download_url_otadata) > 0 and \
len(self._config.firmware_obj.checksum_otadata) > 0 and \
len(self._config.firmware_obj.otadata_address) > 2:
# We need to flash the otadata section. The location is dependent on the partition scheme, so we need to use the address
command_extension.append(self._config.firmware_obj.otadata_address)
command_extension.append(self._config.firmware_obj.full_filepath("otadata"))


if not self._config.port.startswith(__auto_select__):
command.append("--port")
command.append(self._config.port)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ downloading brewing-related firmware to flash. The firmware selection is taken f

## License
This package was based on the NodeMCU PyFlasher project which is licensed under [MIT](http://opensource.org/licenses/MIT) license, the code for which is © Marcel Stör

All subsequent additions are additionally licensed under the [MIT](http://opensource.org/licenses/MIT) license and are © John Beeler

As noted in the license, BrewFlasher is provided without warranty of any kind. As when flashing any microcontroller,
Expand Down
2 changes: 1 addition & 1 deletion build-on-mac.spec
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ app = BUNDLE(exe,
'NSAppleScriptEnabled': False,
'LSRequiresIPhoneOS': False,
'LSApplicationCategoryType': 'public.app-category.utilities',
'CFBundleVersion': '1.0.0',
'CFBundleVersion': '1.0.1',
'CFBundleShortVersionString': '1.0',
'CFBundleSignature': 'BFLS',
'LSMinimumSystemVersion': '10.0.0'
Expand Down
Loading

0 comments on commit f40697f

Please sign in to comment.