Blacklist STC8G series
stcgal may brick these untested MCUs. Fixes #63.
This commit is contained in:
parent
15e04c1626
commit
9900e3088d
@ -1143,10 +1143,18 @@ class MCUModelDatabase:
|
|||||||
MCUModel(name='IAP15L14AD', magic=0xd4de, total=14336, code=14336, eeprom=0),
|
MCUModel(name='IAP15L14AD', magic=0xd4de, total=14336, code=14336, eeprom=0),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def check_model(self, model):
|
||||||
|
# User reported bricked MCUs, GH #63
|
||||||
|
if model.name.startswith("STC8G"):
|
||||||
|
raise ValueError("MCU model {} is blacklisted".format(model.name))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def find_model(self, magic):
|
def find_model(self, magic):
|
||||||
for model in self.models:
|
for model in self.models:
|
||||||
if model.magic == magic: return model
|
if model.magic == magic:
|
||||||
|
self.check_model(model)
|
||||||
|
return model
|
||||||
raise NameError
|
raise NameError
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -214,6 +214,8 @@ class StcBaseProtocol(ABC):
|
|||||||
print(msg, file=sys.stderr)
|
print(msg, file=sys.stderr)
|
||||||
self.model = MCUModelDatabase.MCUModel(name="UNKNOWN",
|
self.model = MCUModelDatabase.MCUModel(name="UNKNOWN",
|
||||||
magic=self.mcu_magic, total=63488, code=63488, eeprom=0)
|
magic=self.mcu_magic, total=63488, code=63488, eeprom=0)
|
||||||
|
except ValueError as ex:
|
||||||
|
raise StcProtocolException(ex)
|
||||||
|
|
||||||
# special case for duplicated mcu magic,
|
# special case for duplicated mcu magic,
|
||||||
# 0xf294 (STC15F104W, STC15F104E)
|
# 0xf294 (STC15F104W, STC15F104E)
|
||||||
|
Loading…
Reference in New Issue
Block a user