Skip to content

Commit 8a02301

Browse files
Deomid Ryabkovcesantabot
authored andcommitted
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 cesanta/mos-tool#37 CL: mos: ESP32: Add support for the 3/4 key encoding scheme PUBLISHED_FROM=16639fb25d5200550ad2097929239d896e188b5b
1 parent 81c647a commit 8a02301

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

common/platforms/esp/stub_flasher.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,27 @@ uint8_t cmd_loop(void) {
470470
resp = 0;
471471
break;
472472
}
473+
case CMD_READ_REG: {
474+
len = SLIP_recv(args, sizeof(args));
475+
if (len == 4) {
476+
uint32_t value = READ_PERI_REG((uint32_t *) args[0]);
477+
SLIP_send(&value, sizeof(value));
478+
resp = 0;
479+
} else {
480+
resp = 0x91;
481+
}
482+
break;
483+
}
484+
case CMD_WRITE_REG: {
485+
len = SLIP_recv(args, sizeof(args));
486+
if (len == 8) {
487+
WRITE_PERI_REG((uint32_t *) args[0], args[1]);
488+
resp = 0;
489+
} else {
490+
resp = 0xa1;
491+
}
492+
break;
493+
}
473494
}
474495
SLIP_send(&resp, 1);
475496
} while (cmd != CMD_BOOT_FW && cmd != CMD_REBOOT);

common/platforms/esp/stub_flasher.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,24 @@ enum stub_cmd {
9191
* Output: arguments.
9292
*/
9393
CMD_ECHO = 8,
94+
95+
/*
96+
* Read register value.
97+
*
98+
* Args: register address.
99+
* Input: None.
100+
* Output: register value.
101+
*/
102+
CMD_READ_REG = 9,
103+
104+
/*
105+
* Write register value.
106+
*
107+
* Args: register address, value.
108+
* Input: None.
109+
* Output: None.
110+
*/
111+
CMD_WRITE_REG = 10,
94112
};
95113

96114
#endif /* CS_COMMON_PLATFORMS_ESP8266_STUBS_STUB_FLASHER_H_ */

0 commit comments

Comments
 (0)