mirror of https://github.com/ARMmbed/mbed-os.git
Added Interrupt vector relocation test automation.
parent
8c234adf9a
commit
c32258de09
|
@ -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,31 +32,30 @@ 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));
|
||||||
SCB->VTOR = (uint32_t)int_table;
|
SCB->VTOR = (uint32_t)int_table;
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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",
|
||||||
|
|
Loading…
Reference in New Issue