prodtest: add wipe command to erase vendorheader

pull/25/head
Pavol Rusnak 6 years ago
parent 0f2ed0f07c
commit 5e90d5116c
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -267,6 +267,20 @@ 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)
{
secbool sbu1 = sectrue * (args[0] == '1');
@ -366,6 +380,9 @@ int main(void)
} else if (startswith(line, "OTP WRITE ")) {
test_otp_write(line + 10);
} else if (startswith(line, "WIPE")) {
test_wipe();
} else {
vcp_printf("UNKNOWN");
}

Loading…
Cancel
Save