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() { void flipper() {
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
out = 1; wait(0.2); out = 1;
out = 0; wait(0.2); wait(0.2);
out = 0;
wait(0.2);
} }
} }
@ -30,25 +32,23 @@ void in_handler() {
static bool test_once() { static bool test_once() {
InterruptIn in(PIN_IN); InterruptIn in(PIN_IN);
checks = 0; 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.rise(NULL);
in.fall(in_handler); in.fall(in_handler);
flipper(); flipper();
in.fall(NULL); in.fall(NULL);
if (checks != 5) { bool result = (checks == 5);
printf(" Test failed.\r\n"); printf(result ? "Test passed.\r\n" : "Test failed.\r\n");
return false; return result;
}
printf(" Test passed.\r\n");
return true;
} }
int main() { int main() {
printf("Starting first test (interrupts not relocated).\r\n"); printf("Starting first test (interrupts not relocated).\r\n");
if (!test_once()) if (!test_once()) {
notify_completion(false); notify_completion(false);
return 1;
}
// Relocate interrupt table and test again // Relocate interrupt table and test again
memcpy(int_table, (void*)SCB->VTOR, sizeof(int_table)); memcpy(int_table, (void*)SCB->VTOR, sizeof(int_table));
@ -56,5 +56,6 @@ int main() {
printf("Starting second test (interrupts relocated).\r\n"); 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", "id": "MBED_A18", "description": "Interrupt vector relocation",
"source_dir": join(TEST_DIR, "mbed", "vtor_reloc"), "source_dir": join(TEST_DIR, "mbed", "vtor_reloc"),
"dependencies": [MBED_LIBRARIES, TEST_MBED_LIB,], "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB,],
"mcu": ["LPC1768"] "mcu": ["LPC1768"],
"automated": True,
}, },
{ {
"id": "MBED_A19", "description": "I2C EEPROM read/write test", "id": "MBED_A19", "description": "I2C EEPROM read/write test",