Skip to content

Commit c32258d

Browse files
committed
Added Interrupt vector relocation test automation.
1 parent 8c234ad commit c32258d

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

libraries/tests/mbed/vtor_reloc/main.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ static uint32_t int_table[NUM_VECTORS];
1818

1919
void flipper() {
2020
for (int i = 0; i < 5; i++) {
21-
out = 1; wait(0.2);
22-
out = 0; wait(0.2);
21+
out = 1;
22+
wait(0.2);
23+
out = 0;
24+
wait(0.2);
2325
}
2426
}
2527

@@ -30,31 +32,30 @@ void in_handler() {
3032

3133
static bool test_once() {
3234
InterruptIn in(PIN_IN);
33-
3435
checks = 0;
35-
printf(" Interrupt table location: 0x%08X\r\n", SCB->VTOR);
36+
printf("Interrupt table location: 0x%08X\r\n", SCB->VTOR);
3637
in.rise(NULL);
3738
in.fall(in_handler);
3839
flipper();
3940
in.fall(NULL);
40-
if (checks != 5) {
41-
printf(" Test failed.\r\n");
42-
return false;
43-
}
44-
printf(" Test passed.\r\n");
45-
return true;
41+
bool result = (checks == 5);
42+
printf(result ? "Test passed.\r\n" : "Test failed.\r\n");
43+
return result;
4644
}
4745

4846
int main() {
4947
printf("Starting first test (interrupts not relocated).\r\n");
50-
if (!test_once())
48+
if (!test_once()) {
5149
notify_completion(false);
50+
return 1;
51+
}
5252

5353
// Relocate interrupt table and test again
5454
memcpy(int_table, (void*)SCB->VTOR, sizeof(int_table));
5555
SCB->VTOR = (uint32_t)int_table;
5656
printf("Starting second test (interrupts relocated).\r\n");
5757

58-
notify_completion(test_once());
58+
notify_completion(test_once());
59+
return 0;
5960
}
6061

workspace_tools/tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@
183183
"id": "MBED_A18", "description": "Interrupt vector relocation",
184184
"source_dir": join(TEST_DIR, "mbed", "vtor_reloc"),
185185
"dependencies": [MBED_LIBRARIES, TEST_MBED_LIB,],
186-
"mcu": ["LPC1768"]
186+
"mcu": ["LPC1768"],
187+
"automated": True,
187188
},
188189
{
189190
"id": "MBED_A19", "description": "I2C EEPROM read/write test",

0 commit comments

Comments
 (0)