mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-02 04:42:33 +00:00
bootloader: add fake processing of FirmwareUpload messages
This commit is contained in:
parent
b91d8da421
commit
8a9e31382e
@ -171,6 +171,7 @@ void mainloop(void)
|
|||||||
uint16_t msg_id = (buf[3] << 8) + buf[4];
|
uint16_t msg_id = (buf[3] << 8) + buf[4];
|
||||||
uint32_t msg_size = (buf[5] << 24) + (buf[6] << 16) + (buf[7] << 8) + buf[8];
|
uint32_t msg_size = (buf[5] << 24) + (buf[6] << 16) + (buf[7] << 8) + buf[8];
|
||||||
(void)msg_size;
|
(void)msg_size;
|
||||||
|
static uint32_t chunk = 0;
|
||||||
switch (msg_id) {
|
switch (msg_id) {
|
||||||
case 0: // Initialize
|
case 0: // Initialize
|
||||||
DPRINTLN("received Initialize");
|
DPRINTLN("received Initialize");
|
||||||
@ -182,14 +183,21 @@ void mainloop(void)
|
|||||||
break;
|
break;
|
||||||
case 6: // FirmwareErase
|
case 6: // FirmwareErase
|
||||||
DPRINTLN("received FirmwareErase");
|
DPRINTLN("received FirmwareErase");
|
||||||
send_msg_Failure(iface);
|
send_msg_FirmwareRequest(iface, 0, 128 * 1024);
|
||||||
|
chunk = 0;
|
||||||
break;
|
break;
|
||||||
case 7: // FirmwareUpload
|
case 7: // FirmwareUpload
|
||||||
DPRINTLN("received FirmwareUpload");
|
DPRINTLN("received FirmwareUpload");
|
||||||
send_msg_Failure(iface);
|
// TODO: process chunk
|
||||||
|
chunk++;
|
||||||
|
if (chunk <= 3) {
|
||||||
|
send_msg_FirmwareRequest(iface, chunk * 128 * 1024, 128 * 1024);
|
||||||
|
} else {
|
||||||
|
send_msg_Success(iface);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DPRINTLN("received garbage");
|
DPRINTLN("received unknown message");
|
||||||
send_msg_Failure(iface);
|
send_msg_Failure(iface);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user