mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
tests/periph_flashpage: use before last page for msp430
- msp430 holds the isr vector on the last page so avoid erasing that page when testing.
This commit is contained in:
parent
f0bbcef987
commit
0a68323570
@ -64,8 +64,8 @@ void flashpage_write_raw(void *target_addr, const void *data, size_t len)
|
|||||||
((unsigned)data % FLASHPAGE_RAW_ALIGNMENT)));
|
((unsigned)data % FLASHPAGE_RAW_ALIGNMENT)));
|
||||||
|
|
||||||
/* ensure the length doesn't exceed the actual flash size */
|
/* ensure the length doesn't exceed the actual flash size */
|
||||||
assert(((unsigned)target_addr + len) <=
|
assert(((unsigned)target_addr + len) <
|
||||||
(CPU_FLASH_BASE + (FLASHPAGE_SIZE * FLASHPAGE_NUMOF)));
|
(CPU_FLASH_BASE + (FLASHPAGE_SIZE * FLASHPAGE_NUMOF) - 1));
|
||||||
|
|
||||||
uint8_t *page_addr = target_addr;
|
uint8_t *page_addr = target_addr;
|
||||||
const uint8_t *data_addr = data;
|
const uint8_t *data_addr = data;
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
#define LINE_LEN (16)
|
#define LINE_LEN (16)
|
||||||
|
|
||||||
/* For MSP430 cpu's the last page holds the interrupt vector, allthough the api
|
/* For MSP430 cpu's the last page holds the interrupt vector, although the api
|
||||||
should not limit erasing that page, we don't want to brake when testing */
|
should not limit erasing that page, we don't want to break when testing */
|
||||||
#if defined(CPU_CC430) || defined(CPU_MSP430FXYZ)
|
#if defined(CPU_CC430) || defined(CPU_MSP430FXYZ)
|
||||||
#define TEST_LAST_AVAILABLE_PAGE (FLASHPAGE_NUMOF - 2)
|
#define TEST_LAST_AVAILABLE_PAGE (FLASHPAGE_NUMOF - 2)
|
||||||
#else
|
#else
|
||||||
@ -333,7 +333,7 @@ static int cmd_test_last(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined(CPU_CC430) || defined(CPU_MSP430FXYZ)
|
#if defined(CPU_CC430) || defined(CPU_MSP430FXYZ)
|
||||||
printf("The last page holds the ISR vector, so test pag %d\n", TEST_LAST_AVAILABLE_PAGE);
|
printf("The last page holds the ISR vector, so test page %d\n", TEST_LAST_AVAILABLE_PAGE);
|
||||||
#endif
|
#endif
|
||||||
if (flashpage_write_and_verify(TEST_LAST_AVAILABLE_PAGE, page_mem) != FLASHPAGE_OK) {
|
if (flashpage_write_and_verify(TEST_LAST_AVAILABLE_PAGE, page_mem) != FLASHPAGE_OK) {
|
||||||
puts("error verifying the content of last page");
|
puts("error verifying the content of last page");
|
||||||
@ -359,17 +359,17 @@ static int cmd_test_last_raw(int argc, char **argv)
|
|||||||
|
|
||||||
/* try to align */
|
/* try to align */
|
||||||
memcpy(raw_buf, "test12344321tset", 16);
|
memcpy(raw_buf, "test12344321tset", 16);
|
||||||
|
#if defined(CPU_CC430) || defined(CPU_MSP430FXYZ)
|
||||||
|
printf("The last page holds the ISR vector, so test page %d\n", TEST_LAST_AVAILABLE_PAGE);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* erase the page first */
|
/* erase the page first */
|
||||||
flashpage_write(((int)FLASHPAGE_NUMOF - 1), NULL);
|
flashpage_write(TEST_LAST_AVAILABLE_PAGE, NULL);
|
||||||
|
|
||||||
flashpage_write_raw(flashpage_addr((int)FLASHPAGE_NUMOF - 1), raw_buf, strlen(raw_buf));
|
flashpage_write_raw(flashpage_addr(TEST_LAST_AVAILABLE_PAGE), raw_buf, strlen(raw_buf));
|
||||||
|
|
||||||
#if defined(CPU_CC430) || defined(CPU_MSP430FXYZ)
|
|
||||||
printf("The last page holds the ISR vector, so test pag %d\n", TEST_LAST_AVAILABLE_PAGE);
|
|
||||||
#endif
|
|
||||||
/* verify that previous write_raw effectively wrote the desired data */
|
/* verify that previous write_raw effectively wrote the desired data */
|
||||||
if (memcmp(flashpage_addr((int)FLASHPAGE_NUMOF - 1), raw_buf, strlen(raw_buf)) != 0) {
|
if (memcmp(flashpage_addr(TEST_LAST_AVAILABLE_PAGE), raw_buf, strlen(raw_buf)) != 0) {
|
||||||
puts("error verifying the content of last page");
|
puts("error verifying the content of last page");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -492,7 +492,7 @@ static int cmd_test_last_rwwee(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flashpage_rwwee_write_and_verify(TEST_LAST_AVAILABLE_PAGE, page_mem) != FLASHPAGE_OK) {
|
if (flashpage_rwwee_write_and_verify((int)FLASHPAGE_RWWEE_NUMOF - 1, page_mem) != FLASHPAGE_OK) {
|
||||||
puts("error verifying the content of last RWWEE page");
|
puts("error verifying the content of last RWWEE page");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user