Skip to content

Commit

Permalink
fixup! tests/periph_flashpage: add test for AUX page
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Aug 28, 2020
1 parent a6ae528 commit 4eea598
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/periph_flashpage/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,11 @@ static int cmd_dump_config(int argc, char **argv)
(void) argc;
(void) argv;

#ifdef FLASH_USER_PAGE_SIZE
od_hex_dump((void*)NVMCTRL_USER, FLASH_USER_PAGE_SIZE, 0);
#else
od_hex_dump((void*)NVMCTRL_USER, AUX_PAGE_SIZE * AUX_NB_OF_PAGES, 0);
#endif

return 0;
}
Expand All @@ -568,7 +572,7 @@ static int cmd_test_config(int argc, char **argv)
/* check if the AUX page has been cleared */
for (uint32_t i = 0; i < FLASH_USER_PAGE_AUX_SIZE; ++i) {
if (*(uint8_t*)sam0_flashpage_aux_get(i) != 0xFF) {
printf("user page not cleared at offset 0x%lx\n", i);
printf("user page not cleared at offset 0x%"PRIx32"\n", i);
return -1;
}
}
Expand All @@ -582,13 +586,13 @@ static int cmd_test_config(int argc, char **argv)
/* check if half-word was written correctly */
uint16_t data_in = *(uint16_t*)sam0_flashpage_aux_get(dst + sizeof(test_data));
if (data_in != single_data) {
printf("%x != %x, offset = 0x%lx\n", single_data, data_in, dst + sizeof(test_data));
printf("%x != %x, offset = 0x%"PRIx32"\n", single_data, data_in, dst + sizeof(test_data));
return -1;
}

/* check if test data was written correctly */
if (memcmp(sam0_flashpage_aux_get(dst), test_data, sizeof(test_data))) {
printf("write test_data failed, offset = 0x%lx\n", dst);
printf("write test_data failed, offset = 0x%"PRIx32"\n", dst);
return -1;
}

Expand Down

0 comments on commit 4eea598

Please sign in to comment.