• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

src/03-Apr-2024-523296

CMakeLists.txtD03-Apr-2024231 106

README.txtD03-Apr-20245.8 KiB147126

prj.confD03-Apr-2024152 76

testcase.yamlD03-Apr-2024659 2322

README.txt

1Title: Test to verify code fault handling in ISR execution context
2       and the behavior of irq_lock() and irq_unlock() when invoked
3       from User Mode. An additional test case verifies that null
4       pointer dereferencing attempts are detected and interpreted
5       as CPU faults. Tests supported only on Cortex-M architecture.
6
7Description:
8
9The first test verifies that we can handle system fault conditions
10while running in handler mode (i.e. in an ISR). Only for ARM
11Cortex-M targets.
12
13The test also verifies
14- the behavior of the spurious interrupt handler, as well as the
15  ARM spurious exception handler.
16- the ability of the Cortex-M fault handling mechanism to detect
17  stack overflow errors explicitly due to exception frame context
18  stacking (that is when the processor reports only the Stacking
19  Error and not an additional Data Access Violation error with a
20  valid corresponding MMFAR address value).
21
22The second test verifies that threads in user mode, despite being able to call
23the irq_lock() and irq_unlock() functions without triggering a CPU fault,
24they won't be able to read or modify the current IRQ locking status.
25
26An additional test case verifies that null pointer dereferencing (read)
27attempts are caught and successfully trigger a CPU exception in the case
28the read is attempted by privileged code.
29
30---------------------------------------------------------------------------
31
32Building and Running Project:
33
34This project outputs to the console.  It can be built and executed on QEMU as
35follows:
36
37    ninja/make run
38
39---------------------------------------------------------------------------
40
41Troubleshooting:
42
43Problems caused by out-dated project information can be addressed by
44issuing one of the following commands then rebuilding the project:
45
46    ninja/make clean    # discard results of previous builds
47                        # but keep existing configuration info
48or
49    ninja/make pristine # discard results of previous builds
50                        # and restore pre-defined configuration info
51
52---------------------------------------------------------------------------
53
54Sample Output:
55*** Booting Zephyr OS build zephyr-v2.4.0-3490-ga44a42e3f4d5  ***
56Running test suite arm_interrupt
57===================================================================
58START - test_arm_null_pointer_exception
59E: ***** Debug monitor exception *****
60Null-pointer exception?
61E: r0/a1:  0x20000000  r1/a2:  0x00000000  r2/a3:  0x20001e40
62E: r3/a4:  0x00003109 r12/ip:  0xfabf33ff r14/lr:  0x00003e7f
63E:  xpsr:  0x41000000
64E: Faulting instruction address (r15/pc): 0x00000f34
65E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
66E: Current thread: 0x20000148 (unknown)
67Caught system error -- reason 0
68 PASS - test_arm_null_pointer_exception
69===================================================================
70START - test_arm_interrupt
71Available IRQ line: 68
72E: >>> ZEPHYR FATAL ERROR 1: Unhandled interrupt on CPU 0
73E: Current thread: 0x20000148 (unknown)
74Caught system error -- reason 1
75E: r0/a1:  0x00000003  r1/a2:  0x200020b8  r2/a3:  0x00000003
76E: r3/a4:  0x20001e40 r12/ip:  0x00000000 r14/lr:  0x00002f47
77E:  xpsr:  0x61000054
78E: Faulting instruction address (r15/pc): 0x000009a6
79E: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
80E: Fault during interrupt handling
81
82E: Current thread: 0x20000148 (unknown)
83Caught system error -- reason 3
84E: r0/a1:  0x00000004  r1/a2:  0x200020b8  r2/a3:  0x00000004
85E: r3/a4:  0x20001e40 r12/ip:  0x00000000 r14/lr:  0x00002f47
86E:  xpsr:  0x61000054
87E: Faulting instruction address (r15/pc): 0x000009c4
88E: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
89E: Fault during interrupt handling
90
91E: Current thread: 0x20000148 (unknown)
92Caught system error -- reason 4
93ASSERTION FAIL [0] @ ../src/arm_interrupt.c:207
94        Intentional assert
95
96E: r0/a1:  0x00000004  r1/a2:  0x000000cf  r2/a3:  0x00000000
97E: r3/a4:  0x00000054 r12/ip:  0x00000000 r14/lr:  0x00002f47
98E:  xpsr:  0x41000054
99E: Faulting instruction address (r15/pc): 0x0000cab0
100E: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
101E: Fault during interrupt handling
102
103E: Current thread: 0x20000148 (unknown)
104Caught system error -- reason 4
105ASSERTION FAIL [0] @ WEST_TOPDIR/zephyr/drivers/timer/sys_clock_init.c:23
106E: ***** HARD FAULT *****
107E:   Fault escalation (see below)
108E: r0/a1:  0x00000004  r1/a2:  0x00000017  r2/a3:  0x00000000
109E: r3/a4:  0x0000000f r12/ip:  0x00000000 r14/lr:  0xfffffff1
110E:  xpsr:  0x4100000f
111E: Faulting instruction address (r15/pc): 0x0000cab0
112E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
113E: Fault during interrupt handling
114
115E: Current thread: 0x20000148 (unknown)
116Caught system error -- reason 0
117E: ***** USAGE FAULT *****
118E:   Stack overflow (context area not valid)
119E: r0/a1:  0xdde8d9e7  r1/a2:  0x5510538d  r2/a3:  0x00000d74
120E: r3/a4:  0x01000000 r12/ip:  0xdfcdaf37 r14/lr:  0xe4698510
121E:  xpsr:  0x53445600
122E: Faulting instruction address (r15/pc): 0xf9cfef45
123E: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
124E: Current thread: 0x20000148 (unknown)
125Caught system error -- reason 2
126 PASS - test_arm_interrupt
127===================================================================
128START - test_arm_esf_collection
129Testing ESF Reporting
130E: ***** USAGE FAULT *****
131E:   Attempt to execute undefined instruction
132E: r0/a1:  0x00000000  r1/a2:  0x00000001  r2/a3:  0x00000002
133E: r3/a4:  0x00000003 r12/ip:  0x0000000c r14/lr:  0x0000000f
134E:  xpsr:  0x01000000
135E: Faulting instruction address (r15/pc): 0x0000bec0
136E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
137E: Current thread: 0x20000080 (unknown)
138Caught system error -- reason 0
139 PASS - test_arm_esf_collection
140===================================================================
141START - test_arm_user_interrupt
142 PASS - test_arm_user_interrupt
143===================================================================
144Test suite arm_interrupt succeeded
145===================================================================
146PROJECT EXECUTION SUCCESSFUL
147