Added Interrupt vector relocation test automation.

pull/222/head
Przemek Wirkus 2014-03-20 11:06:14 +00:00
parent 8c234adf9a
commit c32258de09
2 changed files with 15 additions and 13 deletions

View File

@ -18,8 +18,10 @@ static uint32_t int_table[NUM_VECTORS];
void flipper() {
for (int i = 0; i < 5; i++) {
out = 1; wait(0.2);
out = 0; wait(0.2);
out = 1;
wait(0.2);
out = 0;
wait(0.2);
}
}
@ -30,31 +32,30 @@ void in_handler() {
static bool test_once() {
InterruptIn in(PIN_IN);
checks = 0;
printf(" Interrupt table location: 0x%08X\r\n", SCB->VTOR);
printf("Interrupt table location: 0x%08X\r\n", SCB->VTOR);
in.rise(NULL);
in.fall(in_handler);
flipper();
in.fall(NULL);
if (checks != 5) {
printf(" Test failed.\r\n");
return false;
}
printf(" Test passed.\r\n");
return true;
bool result = (checks == 5);
printf(result ? "Test passed.\r\n" : "Test failed.\r\n");
return result;
}
int main() {
printf("Starting first test (interrupts not relocated).\r\n");
if (!test_once())
if (!test_once()) {
notify_completion(false);
return 1;
}
// Relocate interrupt table and test again
memcpy(int_table, (void*)SCB->VTOR, sizeof(int_table));
SCB->VTOR = (uint32_t)int_table;
printf("Starting second test (interrupts relocated).\r\n");
notify_completion(test_once());
notify_completion(test_once());
return 0;
}

View File

@ -183,7 +183,8 @@ TESTS = [
"id": "MBED_A18", "description": "Interrupt vector relocation",
"source_dir": join(TEST_DIR, "mbed", "vtor_reloc"),
"dependencies": [MBED_LIBRARIES, TEST_MBED_LIB,],
"mcu": ["LPC1768"]
"mcu": ["LPC1768"],
"automated": True,
},
{
"id": "MBED_A19", "description": "I2C EEPROM read/write test",