Skip to content

Commit

Permalink
esptool: Add new "Features" line to esptool summary output
Browse files Browse the repository at this point in the history
Designed to sync roughly with info returned by get_chip_info_esp32() function.
  • Loading branch information
projectgus committed Feb 27, 2018
1 parent f565a9e commit b4d0182
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions esptool.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,12 @@ def get_chip_description(self):
is_8285 = (efuses & ((1 << 4) | 1 << 80)) != 0 # One or the other efuse bit is set for ESP8285
return "ESP8285" if is_8285 else "ESP8266EX"

def get_chip_features(self):
features = "WiFi"
if self.get_chip_description() == "ESP8285":
features += ["Embedded Flash"]
return features

def flash_spi_attach(self, hspi_arg):
if self.IS_STUB:
super(ESP8266ROM, self).flash_spi_attach(hspi_arg)
Expand Down Expand Up @@ -1016,6 +1022,29 @@ def get_chip_description(self):

return "%s (revision %s)" % (chip_name, silicon_rev)

def get_chip_features(self):
features = ["WiFi"]
word3 = self.read_efuse(3)

if word3 & (1 << 1) == 0: # RD_CHIP_VER_DIS_BT
features += ["BT"]

if word3 & (1 << 0): # RD_CHIP_VER_DIS_APP_CPU
features += ["Single Core"]
else:
features += ["Dual Core"]

pkg_version = (word3 >> 9) & 0x07
if pkg_version != 0:
features += ["Embedded Flash"]

word4 = self.read_efuse(4)
vref = (word4 >> 8) & 0x1F
if vref != 0:
features += ["VRef calibration in efuse"]

return features

def read_efuse(self, n):
""" Read the nth word of the ESP3x EFUSE region. """
return self.read_reg(self.EFUSE_REG_BASE + (4 * n))
Expand Down Expand Up @@ -2328,6 +2357,8 @@ def add_spi_flash_subparsers(parent, is_elf2image):

print("Chip is %s" % (esp.get_chip_description()))

print("Features: %s" % ", ".join(esp.get_chip_features()))

if not args.no_stub:
esp = esp.run_stub()

Expand Down

0 comments on commit b4d0182

Please sign in to comment.