Skip to content

Commit

Permalink
Merge branch 'main_work' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason2866 authored Nov 5, 2024
2 parents bd8d43a + ab2e0bf commit 88dc7be
Show file tree
Hide file tree
Showing 49 changed files with 322 additions and 170 deletions.
1 change: 1 addition & 0 deletions docs/en/esptool/advanced-options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,6 @@ at least one FilterValue for each specified FilterType to be considered. Example
* ``--port-filter vid=0x303A --port-filter pid=0x0002`` matches Espressif ESP32-S2 in USB-OTG mode by VID and PID.
* ``--port-filter vid=0x303A --port-filter pid=0x1001`` matches Espressif USB-Serial/JTAG unit used by multiple chips by VID and PID.
* ``--port-filter name=ttyUSB`` matches ports where the port name contains the specified text.
* ``--port-filter serial=7c98d1065267ee11bcc4c8ab93cd958c`` matches ports where the serial number contains the specified text.

See also the `Espressif USB customer-allocated PID repository <https://github.com/espressif/usb-pids>`_
36 changes: 36 additions & 0 deletions espefuse/efuse/base_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,42 @@ def is_efuses_incompatible_for_burn(self):
# Overwrite this function for a specific target if you want to check if a certain eFuse(s) can be burned.
return False

def get_major_chip_version(self):
try:
return self["WAFER_VERSION_MAJOR"].get()
except KeyError:
return 0

def get_minor_chip_version(self):
try:
return self["WAFER_VERSION_MINOR"].get()
except KeyError:
return 0

def get_chip_version(self):
return self.get_major_chip_version() * 100 + self.get_minor_chip_version()

def get_major_block_version(self):
try:
return self["BLK_VERSION_MAJOR"].get()
except KeyError:
return 0

def get_minor_block_version(self):
try:
return self["BLK_VERSION_MINOR"].get()
except KeyError:
return 0

def get_block_version(self):
return self.get_major_block_version() * 100 + self.get_minor_block_version()

def get_pkg_version(self):
try:
return self["PKG_VERSION"].get()
except KeyError:
return 0


class EfuseFieldBase(EfuseProtectBase):
def __init__(self, parent, param):
Expand Down
2 changes: 1 addition & 1 deletion espefuse/efuse/esp32c2/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(
for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
]
else:
if self["BLK_VERSION_MINOR"].get() == 1:
if self.get_block_version() >= 1:
self.efuses += [
EfuseField.convert(self, efuse)
for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
Expand Down
3 changes: 0 additions & 3 deletions espefuse/efuse/esp32c2/mem_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,7 @@ class EfuseDefineFields(EfuseFieldsBase):
def __init__(self, extend_efuse_table) -> None:
# List of efuse fields from TRM the chapter eFuse Controller.
self.EFUSES = []

self.KEYBLOCKS = []

# if BLK_VERSION_MINOR is 1, these efuse fields are in BLOCK2
self.BLOCK2_CALIBRATION_EFUSES = []

dir_name = os.path.dirname(os.path.abspath(__file__))
Expand Down
6 changes: 2 additions & 4 deletions espefuse/efuse/esp32c2/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,16 @@ def set_flash_voltage(esp, efuses, args):


def adc_info(esp, efuses, args):
print("")
# fmt: off
if efuses["BLK_VERSION_MINOR"].get() == 1:
print("Block version:", efuses.get_block_version())
if efuses.get_block_version() >= 1:
print("Temperature Sensor Calibration = {}C".format(efuses["TEMP_CALIB"].get()))
print("ADC OCode = ", efuses["OCODE"].get())
print("ADC1:")
print("INIT_CODE_ATTEN0 = ", efuses["ADC1_INIT_CODE_ATTEN0"].get())
print("INIT_CODE_ATTEN3 = ", efuses["ADC1_INIT_CODE_ATTEN3"].get())
print("CAL_VOL_ATTEN0 = ", efuses["ADC1_CAL_VOL_ATTEN0"].get())
print("CAL_VOL_ATTEN3 = ", efuses["ADC1_CAL_VOL_ATTEN3"].get())
else:
print("BLK_VERSION_MINOR = {}".format(efuses["BLK_VERSION_MINOR"].get_meaning()))
# fmt: on


Expand Down
2 changes: 1 addition & 1 deletion espefuse/efuse/esp32c3/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(
for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
]
else:
if self["BLK_VERSION_MAJOR"].get() == 1:
if self.get_block_version() >= 100:
self.efuses += [
EfuseField.convert(self, efuse)
for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
Expand Down
4 changes: 0 additions & 4 deletions espefuse/efuse/esp32c3/mem_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,8 @@ class EfuseDefineFields(EfuseFieldsBase):
def __init__(self, extend_efuse_table) -> None:
# List of efuse fields from TRM the chapter eFuse Controller.
self.EFUSES = []

self.KEYBLOCKS = []

# if BLK_VERSION_MAJOR is 1, these efuse fields are in BLOCK2
self.BLOCK2_CALIBRATION_EFUSES = []

self.CALC = []

dir_name = os.path.dirname(os.path.abspath(__file__))
Expand Down
6 changes: 2 additions & 4 deletions espefuse/efuse/esp32c3/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ def set_flash_voltage(esp, efuses, args):


def adc_info(esp, efuses, args):
print("")
# fmt: off
if efuses["BLK_VERSION_MAJOR"].get() == 1:
print("Block version:", efuses.get_block_version())
if efuses.get_block_version() >= 100:
print("Temperature Sensor Calibration = {}C".format(efuses["TEMP_CALIB"].get()))
print("ADC OCode = ", efuses["OCODE"].get())
print("ADC1:")
Expand All @@ -206,8 +206,6 @@ def adc_info(esp, efuses, args):
print("CAL_VOL_ATTEN1 = ", efuses["ADC1_CAL_VOL_ATTEN1"].get())
print("CAL_VOL_ATTEN2 = ", efuses["ADC1_CAL_VOL_ATTEN2"].get())
print("CAL_VOL_ATTEN3 = ", efuses["ADC1_CAL_VOL_ATTEN3"].get())
else:
print("BLK_VERSION_MAJOR = {}".format(efuses["BLK_VERSION_MAJOR"].get_meaning()))
# fmt: on


Expand Down
10 changes: 5 additions & 5 deletions espefuse/efuse/esp32c5/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ def __init__(
for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
]
else:
# if self["BLK_VERSION_MINOR"].get() == 1:
# self.efuses += [
# EfuseField.convert(self, efuse)
# for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
# ]
if self.get_block_version() >= 1:
self.efuses += [
EfuseField.convert(self, efuse)
for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
]
self.efuses += [
EfuseField.convert(self, efuse) for efuse in self.Fields.CALC
]
Expand Down
4 changes: 0 additions & 4 deletions espefuse/efuse/esp32c5/mem_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,8 @@ class EfuseDefineFields(EfuseFieldsBase):
def __init__(self, extend_efuse_table) -> None:
# List of efuse fields from TRM the chapter eFuse Controller.
self.EFUSES = []

self.KEYBLOCKS = []

# if BLK_VERSION_MINOR is 1, these efuse fields are in BLOCK2
self.BLOCK2_CALIBRATION_EFUSES = []

self.CALC = []

dir_name = os.path.dirname(os.path.abspath(__file__))
Expand Down
6 changes: 5 additions & 1 deletion espefuse/efuse/esp32c5/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,11 @@ def set_flash_voltage(esp, efuses, args):


def adc_info(esp, efuses, args):
print("not supported yet")
print("Block version:", efuses.get_block_version())
if efuses.get_block_version() >= 1:
for efuse in efuses:
if efuse.category == "calibration":
print(f"{efuse.name:<30} = ", efuses[efuse.name].get())


def burn_key(esp, efuses, args, digest=None):
Expand Down
10 changes: 5 additions & 5 deletions espefuse/efuse/esp32c5beta3/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ def __init__(
for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
]
else:
# if self["BLK_VERSION_MINOR"].get() == 1:
# self.efuses += [
# EfuseField.convert(self, efuse)
# for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
# ]
if self.get_block_version() >= 1:
self.efuses += [
EfuseField.convert(self, efuse)
for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
]
self.efuses += [
EfuseField.convert(self, efuse) for efuse in self.Fields.CALC
]
Expand Down
4 changes: 0 additions & 4 deletions espefuse/efuse/esp32c5beta3/mem_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,8 @@ class EfuseDefineFields(EfuseFieldsBase):
def __init__(self, extend_efuse_table) -> None:
# List of efuse fields from TRM the chapter eFuse Controller.
self.EFUSES = []

self.KEYBLOCKS = []

# if BLK_VERSION_MINOR is 1, these efuse fields are in BLOCK2
self.BLOCK2_CALIBRATION_EFUSES = []

self.CALC = []

dir_name = os.path.dirname(os.path.abspath(__file__))
Expand Down
2 changes: 1 addition & 1 deletion espefuse/efuse/esp32c6/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(
for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
]
else:
if self["BLK_VERSION_MINOR"].get() == 1:
if self.get_block_version() >= 1:
self.efuses += [
EfuseField.convert(self, efuse)
for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
Expand Down
4 changes: 0 additions & 4 deletions espefuse/efuse/esp32c6/mem_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,8 @@ class EfuseDefineFields(EfuseFieldsBase):
def __init__(self, extend_efuse_table) -> None:
# List of efuse fields from TRM the chapter eFuse Controller.
self.EFUSES = []

self.KEYBLOCKS = []

# if BLK_VERSION_MINOR is 1, these efuse fields are in BLOCK2
self.BLOCK2_CALIBRATION_EFUSES = []

self.CALC = []

dir_name = os.path.dirname(os.path.abspath(__file__))
Expand Down
6 changes: 2 additions & 4 deletions espefuse/efuse/esp32c6/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ def set_flash_voltage(esp, efuses, args):


def adc_info(esp, efuses, args):
print("")
# fmt: off
if efuses["BLK_VERSION_MINOR"].get() == 1:
print("Block version:", efuses.get_block_version())
if efuses.get_block_version() >= 1:
print("Temperature Sensor Calibration = {}C".format(efuses["TEMP_CALIB"].get()))
print("ADC OCode = ", efuses["OCODE"].get())
print("ADC1:")
Expand All @@ -213,8 +213,6 @@ def adc_info(esp, efuses, args):
print("INIT_CODE_ATTEN0_CH4 = ", efuses['ADC1_INIT_CODE_ATTEN0_CH4'].get())
print("INIT_CODE_ATTEN0_CH5 = ", efuses['ADC1_INIT_CODE_ATTEN0_CH5'].get())
print("INIT_CODE_ATTEN0_CH6 = ", efuses['ADC1_INIT_CODE_ATTEN0_CH6'].get())
else:
print("BLK_VERSION_MINOR = {}".format(efuses["BLK_VERSION_MINOR"].get_meaning()))
# fmt: on


Expand Down
10 changes: 5 additions & 5 deletions espefuse/efuse/esp32c61/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ def __init__(
for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
]
else:
# if self["BLK_VERSION_MINOR"].get() == 1:
# self.efuses += [
# EfuseField.convert(self, efuse)
# for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
# ]
if self.get_block_version() >= 1:
self.efuses += [
EfuseField.convert(self, efuse)
for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
]
self.efuses += [
EfuseField.convert(self, efuse) for efuse in self.Fields.CALC
]
Expand Down
4 changes: 0 additions & 4 deletions espefuse/efuse/esp32c61/mem_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,8 @@ class EfuseDefineFields(EfuseFieldsBase):
def __init__(self, extend_efuse_table) -> None:
# List of efuse fields from TRM the chapter eFuse Controller.
self.EFUSES = []

self.KEYBLOCKS = []

# if BLK_VERSION_MINOR is 1, these efuse fields are in BLOCK2
self.BLOCK2_CALIBRATION_EFUSES = []

self.CALC: List = []

dir_name = os.path.dirname(os.path.abspath(__file__))
Expand Down
6 changes: 5 additions & 1 deletion espefuse/efuse/esp32c61/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,11 @@ def set_flash_voltage(esp, efuses, args):


def adc_info(esp, efuses, args):
print("not supported yet")
print("Block version:", efuses.get_block_version())
if efuses.get_block_version() >= 1:
for efuse in efuses:
if efuse.category == "calibration":
print(f"{efuse.name:<30} = ", efuses[efuse.name].get())


def key_block_is_unused(block, key_purpose_block):
Expand Down
2 changes: 1 addition & 1 deletion espefuse/efuse/esp32h2/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(
for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
]
else:
if self["BLK_VERSION_MINOR"].get() == 2:
if self.get_block_version() >= 2:
self.efuses += [
EfuseField.convert(self, efuse)
for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
Expand Down
4 changes: 0 additions & 4 deletions espefuse/efuse/esp32h2/mem_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,8 @@ class EfuseDefineFields(EfuseFieldsBase):
def __init__(self, extend_efuse_table) -> None:
# List of efuse fields from TRM the chapter eFuse Controller.
self.EFUSES = []

self.KEYBLOCKS = []

# if BLK_VERSION_MINOR is 2, these efuse fields are in BLOCK2
self.BLOCK2_CALIBRATION_EFUSES = []

self.CALC = []

dir_name = os.path.dirname(os.path.abspath(__file__))
Expand Down
6 changes: 2 additions & 4 deletions espefuse/efuse/esp32h2/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ def set_flash_voltage(esp, efuses, args):


def adc_info(esp, efuses, args):
print("")
# fmt: off
if efuses["BLK_VERSION_MINOR"].get() == 2:
print("Block version:", efuses.get_block_version())
if efuses.get_block_version() >= 2:
print("Temperature Sensor Calibration = {}C".format(efuses["TEMP_CALIB"].get()))
print("")
print("ADC1:")
Expand All @@ -210,8 +210,6 @@ def adc_info(esp, efuses, args):
print("CH2_ATTEN0_INITCODE_DIFF = ", efuses["ADC1_CH2_ATTEN0_INITCODE_DIFF"].get())
print("CH3_ATTEN0_INITCODE_DIFF = ", efuses["ADC1_CH3_ATTEN0_INITCODE_DIFF"].get())
print("CH4_ATTEN0_INITCODE_DIFF = ", efuses["ADC1_CH4_ATTEN0_INITCODE_DIFF"].get())
else:
print("BLK_VERSION_MINOR = {}".format(efuses["BLK_VERSION_MINOR"].get()))
# fmt: on


Expand Down
2 changes: 1 addition & 1 deletion espefuse/efuse/esp32h2beta1/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(
for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
]
else:
if self["BLK_VERSION_MINOR"].get() == 2:
if self.get_block_version() >= 2:
self.efuses += [
EfuseField.convert(self, efuse)
for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
Expand Down
4 changes: 0 additions & 4 deletions espefuse/efuse/esp32h2beta1/mem_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,8 @@ class EfuseDefineFields(EfuseFieldsBase):
def __init__(self, extend_efuse_table) -> None:
# List of efuse fields from TRM the chapter eFuse Controller.
self.EFUSES = []

self.KEYBLOCKS = []

# if BLK_VERSION_MAJOR is 1, these efuse fields are in BLOCK2
self.BLOCK2_CALIBRATION_EFUSES = []

self.CALC: List = []

dir_name = os.path.dirname(os.path.abspath(__file__))
Expand Down
6 changes: 2 additions & 4 deletions espefuse/efuse/esp32h2beta1/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ def set_flash_voltage(esp, efuses, args):


def adc_info(esp, efuses, args):
print("")
# fmt: off
if efuses["BLK_VERSION_MINOR"].get() == 2:
print("Block version:", efuses.get_block_version())
if efuses.get_block_version() >= 2:
print("Temperature Sensor Calibration = {}C".format(efuses["TEMP_CALIB"].get()))
print("")
print("ADC1:")
Expand All @@ -210,8 +210,6 @@ def adc_info(esp, efuses, args):
print("CH2_ATTEN0_INITCODE_DIFF = ", efuses["ADC1_CH2_ATTEN0_INITCODE_DIFF"].get())
print("CH3_ATTEN0_INITCODE_DIFF = ", efuses["ADC1_CH3_ATTEN0_INITCODE_DIFF"].get())
print("CH4_ATTEN0_INITCODE_DIFF = ", efuses["ADC1_CH4_ATTEN0_INITCODE_DIFF"].get())
else:
print("BLK_VERSION_MINOR = {}".format(efuses["BLK_VERSION_MINOR"].get()))
# fmt: on


Expand Down
11 changes: 5 additions & 6 deletions espefuse/efuse/esp32p4/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,11 @@ def __init__(
for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
]
else:
# TODO add processing of self.Fields.BLOCK2_CALIBRATION_EFUSES
# if self["BLK_VERSION_MINOR"].get() == 1:
# self.efuses += [
# EfuseField.convert(self, efuse)
# for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
# ]
if self.get_block_version() >= 1:
self.efuses += [
EfuseField.convert(self, efuse)
for efuse in self.Fields.BLOCK2_CALIBRATION_EFUSES
]
self.efuses += [
EfuseField.convert(self, efuse) for efuse in self.Fields.CALC
]
Expand Down
Loading

0 comments on commit 88dc7be

Please sign in to comment.