@@ -301,20 +301,55 @@ def convert(parent, efuse):
301
301
"keypurpose" : EfuseKeyPurposeField ,
302
302
"t_sensor" : EfuseTempSensor ,
303
303
"adc_tp" : EfuseAdcPointCalibration ,
304
- "wafer" : EfuseWafer ,
304
+ "recovery_bootloader" : EfuseBtldrRecoveryField ,
305
+ "bootloader_anti_rollback" : EfuseBtldrAntiRollbackField ,
305
306
}.get (efuse .class_type , EfuseField )(parent , efuse )
306
307
307
308
308
- class EfuseWafer (EfuseField ):
309
+ class EfuseBtldrRecoveryField (EfuseField ):
309
310
def get (self , from_read = True ):
310
- hi_bits = self .parent ["WAFER_VERSION_MINOR_HI" ].get (from_read )
311
- assert self .parent ["WAFER_VERSION_MINOR_HI" ].bit_len == 1
312
- lo_bits = self .parent ["WAFER_VERSION_MINOR_LO" ].get (from_read )
313
- assert self .parent ["WAFER_VERSION_MINOR_LO" ].bit_len == 3
311
+ hi_bits = self .parent ["RECOVERY_BOOTLOADER_FLASH_SECTOR_HI" ].get (from_read )
312
+ assert self .parent ["RECOVERY_BOOTLOADER_FLASH_SECTOR_HI" ].bit_len == 3
313
+ lo_bits = self .parent ["RECOVERY_BOOTLOADER_FLASH_SECTOR_LO" ].get (from_read )
314
+ assert self .parent ["RECOVERY_BOOTLOADER_FLASH_SECTOR_LO" ].bit_len == 9
315
+ return (hi_bits << 9 ) + lo_bits
316
+
317
+ def save (self , new_value ):
318
+ efuse = self .parent ["RECOVERY_BOOTLOADER_FLASH_SECTOR_HI" ]
319
+ efuse .save ((new_value >> 9 ) & 3 )
320
+ print (
321
+ f"\t - '{ efuse .name } ' { efuse .get_bitstring ()} -> { efuse .get_bitstring (from_read = False )} "
322
+ )
323
+ efuse = self .parent ["RECOVERY_BOOTLOADER_FLASH_SECTOR_LO" ]
324
+ efuse .save (new_value & 0x1FF )
325
+ print (
326
+ f"\t - '{ efuse .name } ' { efuse .get_bitstring ()} -> { efuse .get_bitstring (from_read = False )} "
327
+ )
328
+
329
+
330
+ class EfuseBtldrAntiRollbackField (EfuseField ):
331
+ def get (self , from_read = True ):
332
+ hi_bits = self .parent ["BOOTLOADER_ANTI_ROLLBACK_SECURE_VERSION_HI" ].get (
333
+ from_read
334
+ )
335
+ assert self .parent ["BOOTLOADER_ANTI_ROLLBACK_SECURE_VERSION_HI" ].bit_len == 1
336
+ lo_bits = self .parent ["BOOTLOADER_ANTI_ROLLBACK_SECURE_VERSION_LO" ].get (
337
+ from_read
338
+ )
339
+ assert self .parent ["BOOTLOADER_ANTI_ROLLBACK_SECURE_VERSION_LO" ].bit_len == 3
314
340
return (hi_bits << 3 ) + lo_bits
315
341
316
342
def save (self , new_value ):
317
- raise esptool .FatalError ("Burning %s is not supported" % self .name )
343
+ efuse = self .parent ["BOOTLOADER_ANTI_ROLLBACK_SECURE_VERSION_HI" ]
344
+ efuse .save ((new_value >> 3 ) & 1 )
345
+ print (
346
+ f"\t - '{ efuse .name } ' { efuse .get_bitstring ()} -> { efuse .get_bitstring (from_read = False )} "
347
+ )
348
+ efuse = self .parent ["BOOTLOADER_ANTI_ROLLBACK_SECURE_VERSION_LO" ]
349
+ efuse .save (new_value & 0x7 )
350
+ print (
351
+ f"\t - '{ efuse .name } ' { efuse .get_bitstring ()} -> { efuse .get_bitstring (from_read = False )} "
352
+ )
318
353
319
354
320
355
class EfuseTempSensor (EfuseField ):
0 commit comments