Skip to content

Commit

Permalink
Merge branch 'espressif:master' into release/v4
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason2866 authored Dec 13, 2023
2 parents f0c6492 + c0ea74a commit d8ae101
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions esptool/targets/esp32c2.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ def get_major_chip_version(self):
num_word = 1
return (self.read_reg(self.EFUSE_BLOCK2_ADDR + (4 * num_word)) >> 20) & 0x3

def get_flash_cap(self):
# ESP32-C2 doesn't have eFuse field FLASH_CAP.
# Can't get info about the flash chip.
return 0

def get_flash_vendor(self):
# ESP32-C2 doesn't have eFuse field FLASH_VENDOR.
# Can't get info about the flash chip.
return ""

def get_crystal_freq(self):
# The crystal detection algorithm of ESP32/ESP8266 works for ESP32-C2 as well.
return ESPLoader.get_crystal_freq(self)
Expand Down
16 changes: 16 additions & 0 deletions test/test_esptool.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,22 @@ def test_flash_id_trace(self):
assert "Manufacturer:" in res
assert "Device:" in res

@pytest.mark.quick_test
@pytest.mark.skipif(
arg_chip not in ["esp32c2"],
reason="This test make sense only for EPS32-C2",
)
def test_flash_size(self):
"""Test ESP32-C2 efuse block for flash size feature"""
# ESP32-C2 class inherits methods from ESP32-C3 class
# but it does not have the same amount of efuse blocks
# the methods are overwritten
# in case anything changes this test will fail to remind us
res = self.run_esptool("flash_id")
lines = res.splitlines()
for line in lines:
assert "embedded flash" not in line.lower()


@pytest.mark.skipif(
os.getenv("ESPTOOL_TEST_SPI_CONN") is None, reason="Needs external flash"
Expand Down

0 comments on commit d8ae101

Please sign in to comment.