mirror of
https://github.com/markqvist/RNode_Firmware.git
synced 2026-04-28 09:43:08 +00:00
Fix self-provisioning: write INFO_LOCK_BYTE and EEPROM checksum
Self-provisioning wrote 0x00 to ADDR_INFO_LOCK instead of INFO_LOCK_BYTE (0x73), causing eeprom_lock_set() to fail and hw_ready to stay false after flash erase. Also computes and writes the MD5 checksum over the first 11 EEPROM bytes so eeprom_checksum_valid() passes without rnodeconf.
This commit is contained in:
parent
2bf457e2ba
commit
c3ab57f484
1 changed files with 9 additions and 1 deletions
|
|
@ -137,8 +137,16 @@ void setup() {
|
|||
EEPROM.write(eeprom_addr(ADDR_MADE+1), 0x00);
|
||||
EEPROM.write(eeprom_addr(ADDR_MADE+2), 0x00);
|
||||
EEPROM.write(eeprom_addr(ADDR_MADE+3), 0x00);
|
||||
EEPROM.write(eeprom_addr(ADDR_INFO_LOCK), 0x00);
|
||||
EEPROM.write(eeprom_addr(ADDR_INFO_LOCK), INFO_LOCK_BYTE);
|
||||
EEPROM.write(eeprom_addr(ADDR_CONF_OK), CONF_OK_BYTE);
|
||||
// Compute and write EEPROM checksum (MD5 of first CHECKSUMMED_SIZE bytes)
|
||||
char chk_data[CHECKSUMMED_SIZE];
|
||||
for (uint8_t i = 0; i < CHECKSUMMED_SIZE; i++)
|
||||
chk_data[i] = EEPROM.read(eeprom_addr(i));
|
||||
unsigned char *chk_hash = MD5::make_hash(chk_data, CHECKSUMMED_SIZE);
|
||||
for (uint8_t i = 0; i < 16; i++)
|
||||
EEPROM.write(eeprom_addr(ADDR_CHKSUM + i), chk_hash[i]);
|
||||
free(chk_hash);
|
||||
EEPROM.commit();
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue