Merge "Fix the problem with tap_strap tests"
diff --git a/sw/device/lib/spi_flash.c b/sw/device/lib/spi_flash.c
index 8765118..0e8932e 100644
--- a/sw/device/lib/spi_flash.c
+++ b/sw/device/lib/spi_flash.c
@@ -75,11 +75,15 @@
if (!size_out || !filename) {
return 0;
}
-
+ const char kTarMagic[] = "ustar";
tar_header tar;
size_t cursor = start_cursor;
CHECK_DIF_OK(spi_flash_read_page(cursor, (uint8_t*)&tar));
while (cursor < kSpiFlashBytes) {
+ // Check the tar header magic field to validate the header info.
+ if (memcmp((const char*)&tar.magic, kTarMagic, str_size(kTarMagic)) != 0) {
+ break;
+ }
int size = parse_octal((uint8_t*)&tar.size);
cursor += 512;
const char* tar_name = (const char*)&tar.name;
diff --git a/sw/device/tests/kelvin/fpga_tests/kelvin_test_sc.c b/sw/device/tests/kelvin/fpga_tests/kelvin_test_sc.c
index b49225a..0031960 100644
--- a/sw/device/tests/kelvin/fpga_tests/kelvin_test_sc.c
+++ b/sw/device/tests/kelvin/fpga_tests/kelvin_test_sc.c
@@ -89,8 +89,13 @@
mmio_region_write32(base_addr, ML_TOP_CTRL_REG_OFFSET,
ML_TOP_CTRL_REG_RESVAL | (1 << ML_TOP_CTRL_FREEZE_BIT));
// Write 1 to clear INTR_STATE
- mmio_region_write32(base_addr, ML_TOP_INTR_STATE_REG_OFFSET, 0x1);
- memset(kelvin_bin_name, 0, sizeof(kelvin_bin_name));
+ mmio_region_write32(base_addr, ML_TOP_INTR_STATE_REG_OFFSET, intr_state);
+ intr_state = mmio_region_read32(base_addr, ML_TOP_INTR_STATE_REG_OFFSET);
+ CHECK(
+ intr_state == 0,
+ "ML_TOP_Core offset 0 INTR_STATE read again - Expected: 0 | Actual: "
+ "0x%x",
+ intr_state);
}
LOG_INFO("Total test: %d, failed test: %d", test_num, failed_test);
if (failed_test == 0) {