Commit d0213ee9 authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by Cesanta Bot

ESP32: Add support for the 3/4 key encoding scheme

 * Add calculated redundancy values when writing eFuse blocks 1-3
 * Perform 192 -> 256 bit key extension when encrypting images for flashing

Fixes https://github.com/cesanta/mos-tool/issues/37

CL: mos: ESP32: Add support for the 3/4 key encoding scheme

PUBLISHED_FROM=16639fb25d5200550ad2097929239d896e188b5b
parent 1e9fabe1
...@@ -470,6 +470,27 @@ uint8_t cmd_loop(void) { ...@@ -470,6 +470,27 @@ uint8_t cmd_loop(void) {
resp = 0; resp = 0;
break; break;
} }
case CMD_READ_REG: {
len = SLIP_recv(args, sizeof(args));
if (len == 4) {
uint32_t value = READ_PERI_REG((uint32_t *) args[0]);
SLIP_send(&value, sizeof(value));
resp = 0;
} else {
resp = 0x91;
}
break;
}
case CMD_WRITE_REG: {
len = SLIP_recv(args, sizeof(args));
if (len == 8) {
WRITE_PERI_REG((uint32_t *) args[0], args[1]);
resp = 0;
} else {
resp = 0xa1;
}
break;
}
} }
SLIP_send(&resp, 1); SLIP_send(&resp, 1);
} while (cmd != CMD_BOOT_FW && cmd != CMD_REBOOT); } while (cmd != CMD_BOOT_FW && cmd != CMD_REBOOT);
......
...@@ -91,6 +91,24 @@ enum stub_cmd { ...@@ -91,6 +91,24 @@ enum stub_cmd {
* Output: arguments. * Output: arguments.
*/ */
CMD_ECHO = 8, CMD_ECHO = 8,
/*
* Read register value.
*
* Args: register address.
* Input: None.
* Output: register value.
*/
CMD_READ_REG = 9,
/*
* Write register value.
*
* Args: register address, value.
* Input: None.
* Output: None.
*/
CMD_WRITE_REG = 10,
}; };
#endif /* CS_COMMON_PLATFORMS_ESP8266_STUBS_STUB_FLASHER_H_ */ #endif /* CS_COMMON_PLATFORMS_ESP8266_STUBS_STUB_FLASHER_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment