Sat, 15 Jan 2022 18:42:21 +0100
MicroPython
- added support for ESP32-C3, ESP32-S2 and ESP32-S3 chips
--- a/docs/changelog Sat Jan 15 18:40:57 2022 +0100 +++ b/docs/changelog Sat Jan 15 18:42:21 2022 +0100 @@ -11,6 +11,7 @@ - MicroPython -- updated the list of known CircuitPython boards -- updated the list of known UF2 capable boards + -- added support for ESP32-C3, ESP32-S2 and ESP32-S3 chips - Project Browser -- added capability to open SVG files in the text editor to the Project Others Browser
--- a/eric7/MicroPython/EspBackupRestoreFirmwareDialog.py Sat Jan 15 18:40:57 2022 +0100 +++ b/eric7/MicroPython/EspBackupRestoreFirmwareDialog.py Sat Jan 15 18:42:21 2022 +0100 @@ -26,21 +26,52 @@ Class implementing a dialog to select the ESP chip type and the backup and restore parameters. """ + Chips = ( + ("", ""), + ("ESP32", "esp32"), + ("ESP32-C3", "esp32c3"), + ("ESP32-S2", "esp32s2"), + ("ESP32-S3", "esp32s3"), + ("ESP8266", "esp8266"), + ) + FlashModes = [ ("Quad I/O", "qio"), ("Quad Output", "qout"), ("Dual I/O", "dio"), ("Dual Output", "dout"), ] + FlashSizes = { - "ESP32": [ + "esp32": [ + (" 1 MB", "0x100000"), + (" 2 MB", "0x200000"), + (" 4 MB", "0x400000"), + (" 8 MB", "0x800000"), + ("16 MB", "0x1000000"), + ], + "esp32c3": [ (" 1 MB", "0x100000"), (" 2 MB", "0x200000"), (" 4 MB", "0x400000"), (" 8 MB", "0x800000"), ("16 MB", "0x1000000"), ], - "ESP8266": [ + "esp32s2": [ + (" 1 MB", "0x100000"), + (" 2 MB", "0x200000"), + (" 4 MB", "0x400000"), + (" 8 MB", "0x800000"), + ("16 MB", "0x1000000"), + ], + "esp32s3": [ + (" 1 MB", "0x100000"), + (" 2 MB", "0x200000"), + (" 4 MB", "0x400000"), + (" 8 MB", "0x800000"), + ("16 MB", "0x1000000"), + ], + "esp8266": [ ("256 KB", "0x40000"), ("512 KB", "0x80000"), (" 1 MB", "0x100000"), @@ -66,7 +97,8 @@ self.__isBackupMode = backupMode - self.espComboBox.addItems(["", "ESP32", "ESP8266"]) + for text, chip in self.Chips: + self.espComboBox.addItem(text, chip) self.firmwarePicker.setFilters( self.tr("Firmware Files (*.img);;All Files (*)")) @@ -108,9 +140,10 @@ """ selectedSize = self.sizeComboBox.currentText() self.sizeComboBox.clear() - if chip and chip in self.FlashSizes: + chipType = self.espComboBox.currentData() + if chipType and chipType in self.FlashSizes: self.sizeComboBox.addItem("") - for text, data in self.FlashSizes[chip]: + for text, data in self.FlashSizes[chipType]: self.sizeComboBox.addItem(text, data) self.sizeComboBox.setCurrentText(selectedSize) @@ -136,7 +169,7 @@ @rtype tuple of (str, str, str, str) """ return ( - self.espComboBox.currentText().lower(), + self.espComboBox.currentData(), self.sizeComboBox.currentData(), self.modeComboBox.currentData(), self.firmwarePicker.text(),
--- a/eric7/MicroPython/EspDevices.py Sat Jan 15 18:40:57 2022 +0100 +++ b/eric7/MicroPython/EspDevices.py Sat Jan 15 18:42:21 2022 +0100 @@ -195,22 +195,11 @@ def __flashMicroPython(self): """ Private slot to flash a MicroPython firmware to the device. - - @exception ValueError raised to indicate an unsupported chip type """ from .EspFirmwareSelectionDialog import EspFirmwareSelectionDialog dlg = EspFirmwareSelectionDialog() if dlg.exec() == QDialog.DialogCode.Accepted: - chip, firmware, baudRate, flashMode, _ = dlg.getData() - if chip not in ("esp8266", "esp32"): - raise ValueError(self.tr("Unsupported chip type '{0}'.") - .format(chip)) - - if chip == "esp8266": - flashAddress = "0x0000" - elif chip == "esp32": - flashAddress = "0x1000" - + chip, firmware, baudRate, flashMode, flashAddress = dlg.getData() flashArgs = [ "-u", "-m", "esptool",
--- a/eric7/MicroPython/EspFirmwareSelectionDialog.py Sat Jan 15 18:40:57 2022 +0100 +++ b/eric7/MicroPython/EspFirmwareSelectionDialog.py Sat Jan 15 18:42:21 2022 +0100 @@ -24,6 +24,15 @@ Class implementing a dialog to select the ESP chip type and the firmware to be flashed. """ + Chips = ( + ("", ""), + ("ESP32", "esp32"), + ("ESP32-C3", "esp32c3"), + ("ESP32-S2", "esp32s2"), + ("ESP32-S3", "esp32s3"), + ("ESP8266", "esp8266"), + ) + FlashModes = ( ("", ""), ("Quad I/O", "qio"), @@ -32,6 +41,14 @@ ("Dual Output", "dout"), ) + FlashAddresses = { + "esp8266": "0x0000", + "esp32": "0x1000", + "esp32c3": "0x0000", + "esp32s2": "0x1000", + "esp32s3": "0x1000", + } + def __init__(self, addon=False, parent=None): """ Constructor @@ -50,7 +67,8 @@ self.firmwarePicker.setFilters( self.tr("Firmware Files (*.bin);;All Files (*)")) - self.espComboBox.addItems(["", "ESP32", "ESP8266"]) + for text, chip in self.Chips: + self.espComboBox.addItem(text, chip) self.baudRateComboBox.addItems([ "74.880", "115.200", "230.400", "460.800", "921.600", "1.500.000"]) @@ -112,10 +130,14 @@ address @rtype tuple of (str, str, str, str, str) """ - address = self.addressEdit.text() if self.__addon else "" + chip = self.espComboBox.currentData() + address = ( + self.addressEdit.text() + if self.__addon else + self.FlashAddresses[chip]) return ( - self.espComboBox.currentText().lower(), + chip, self.firmwarePicker.text(), self.baudRateComboBox.currentText().replace(".", ""), self.modeComboBox.currentData(),