1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-17 19:00:58 +00:00

prodtest: add wipe command to erase vendorheader

This commit is contained in:
Pavol Rusnak 2018-04-28 14:48:39 +01:00
parent 0f2ed0f07c
commit 5e90d5116c
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -267,6 +267,20 @@ power_off:
sdcard_power_off(); sdcard_power_off();
} }
static void test_wipe(void)
{
// erase start of the firmware (metadata) -> invalidate FW
ensure(flash_unlock(), NULL);
for (int i = 0; i < 1024 / sizeof(uint32_t); i++) {
ensure(flash_write_word(FLASH_SECTOR_FIRMWARE_START, i * sizeof(uint32_t), 0x00000000), NULL);
}
ensure(flash_lock(), NULL);
display_clear();
display_text_center(DISPLAY_RESX / 2, DISPLAY_RESY / 2 + 10, "WIPED", -1, FONT_BOLD, COLOR_WHITE, COLOR_BLACK);
display_refresh();
vcp_printf("OK");
}
static void test_sbu(const char *args) static void test_sbu(const char *args)
{ {
secbool sbu1 = sectrue * (args[0] == '1'); secbool sbu1 = sectrue * (args[0] == '1');
@ -366,6 +380,9 @@ int main(void)
} else if (startswith(line, "OTP WRITE ")) { } else if (startswith(line, "OTP WRITE ")) {
test_otp_write(line + 10); test_otp_write(line + 10);
} else if (startswith(line, "WIPE")) {
test_wipe();
} else { } else {
vcp_printf("UNKNOWN"); vcp_printf("UNKNOWN");
} }