diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-02-09 17:20:51 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-02-09 17:20:51 +0000 |
commit | 36f2bd63d4ae9757e6ece2e1c3a25aa844926539 (patch) | |
tree | 178f80ff17adc0253aabd3b604c2d2831516ccd4 | |
parent | 1f50c3f3294c6b67cf69cd71d919e58ed886ac41 (diff) |
test3: Update to use tapit output format and add to runtests
Update the test3 code to use tapit output format so we can add it
to the tests run by the runtests script.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | README | 2 | ||||
-rwxr-xr-x | runtests.sh | 1 | ||||
-rw-r--r-- | test3.c | 89 |
4 files changed, 54 insertions, 40 deletions
@@ -28,7 +28,7 @@ all: test12-kern.bin all: test13-kern.bin test1-kern.elf: cortexm.ld common.ld setup.o armv7m.o init-m.o testme.o test1.o -test3-kern.elf: cortexm.ld common.ld setup.o armv7m.o init-m.o test3.o +test3-kern.elf: cortexm.ld common.ld setup.o armv7m.o init-m.o testme.o test3.o test4-kern.elf: cortexm.ld common.ld setup.o armv7m.o init-m.o testme.o test4.o test5-kern.elf: cortexm.ld common.ld setup.o armv7m.o init-m.o testme.o test5.o test6-kern.elf: cortexm.ld common.ld setup.o armv7m.o init-m.o test6.o @@ -26,10 +26,10 @@ test10-kern.bin: check register exception handling register states test4-kern.bin: handling of external (NVIC) exceptions test5-kern.bin: thread mode unprivileged and process stack handling test13-kern.bin: UsageFaults +test3-kern.bin: exception masking and escalation Tests which aren't currently run: -test3-kern.bin: exception masking and escalation test6-kern.bin: unrecoverable exception test7-kern.bin: magic exception return from thread mode test8-kern.bin: test MPU diff --git a/runtests.sh b/runtests.sh index 12c5d99..9f39d03 100755 --- a/runtests.sh +++ b/runtests.sh @@ -57,4 +57,5 @@ dotest test10-kern.bin dotest test4-kern.bin dotest test5-kern.bin dotest test13-kern.bin +dotest test3-kern.bin exit $RET @@ -1,25 +1,28 @@ /* Test exception escalation in armv7-m */ #include "armv7m.h" +#include "testme.h" static -volatile int test; +unsigned testseq; + +#define SEQ() __atomic_add_fetch(&testseq, 1, __ATOMIC_RELAXED) + +#define CHECK_SEQ(N) testEqI(N, SEQ(), "SEQ " #N) static void hard(void) { + int test = SEQ(); + switch(test) { - case 2: - puts("8. in HardFault\n"); - break; - case 3: - puts("11. in HardFault\n"); - break; - case 5: - puts("17. in HardFault\n"); + case 8: + case 11: + case 17: + testPass("in HardFault"); break; default: - puts("Fail HardFault\n"); + testFail("Fail HardFault"); abort(); } } @@ -27,15 +30,15 @@ void hard(void) static void svc(void) { + int test = SEQ(); + switch(test) { - case 0: - puts("2. in SVC\n"); - break; - case 4: - puts("14. in SVC\n"); + case 2: + case 14: + testPass("in SVC"); break; default: - puts("Fail SVC\n"); + testFail("Fail SVC"); abort(); } } @@ -43,12 +46,14 @@ void svc(void) static __attribute__((unused)) void pendsv(void) { + int test = SEQ(); + switch(test) { - case 1: - puts("5. in PendSV\n"); + case 5: + testPass("in PendSV"); break; default: - puts("Fail PendSV\n"); + testFail("Fail PendSV"); abort(); } } @@ -59,48 +64,56 @@ void main(void) run_table.pendsv = pendsv; run_table.svc = svc; + testInit(12); + out32(SCB(0xd0c), 0x05fa0000 | (PRIGROUP<<8)); - test = 0; CPSIE(if); - puts("1. trigger SVC\n"); + SEQ(); + testDiag("trigger SVC"); SVC(42); - puts("3. Back in main\n"); + testDiag("Back in main"); + CHECK_SEQ(3); - test = 1; - puts("4. trigger PendSV\n"); + testDiag("trigger PendSV"); + SEQ(); out32((void*)0xe000ed04, 1<<28); - puts("6. Back in main\n"); + testDiag("Back in main"); + CHECK_SEQ(6); - test = 2; - puts("7. trigger HardFault\n"); + testDiag("trigger HardFault via SVC escalating to HF due to PRIMASK"); + SEQ(); CPSID(i); /* mask prio lower than -1 [0,255] */ SVC(42); - puts("9. Back in main\n"); + testDiag("Back in main"); + CHECK_SEQ(9); - test = 3; CPSIE(i); basepri(1); out32(SCB(0xd1c), PRIO(7,0)<<24); /* PRIO SVC */ //out32(SCB(0xd1c), 1<<21); /* PRIO PendSV */ - puts("10. trigger HardFault\n"); + testDiag("trigger HardFault via SVC escalating to HF due to priority"); + SEQ(); SVC(42); - puts("12. Back in main\n"); + testDiag("Back in main"); + CHECK_SEQ(12); - test = 4; out32(SCB(0xd1c), PRIO(0,0)<<24); /* PRIO SVC */ - puts("13. trigger SVC\n"); + testDiag("trigger SVC"); + SEQ(); SVC(42); - puts("15. Back in main\n"); + testDiag("Back in main"); + CHECK_SEQ(15); - test = 5; out32(SCB(0xd1c), PRIO(2,0)<<24); /* PRIO SVC */ basepri(2); - puts("16. trigger HardFault\n"); + testDiag("trigger HardFault via SVC escalating to HF due to BASEPRI"); + SEQ(); SVC(42); - puts("18. Back in main\n"); + testDiag("Back in main"); + CHECK_SEQ(18); - puts("Done\n"); + testDiag("Done"); } |