zephyr/tests/arch/arm/arm_interrupt
Marc Herbert debade9121 tests: make find_package(Zephyr...) REQUIRED
... because it is (required).

This makes a difference when building with CMake and forgetting
ZEPHYR_BASE or not registering Zephyr in the CMake package registry.

In this particular case, REQUIRED turns this harmless looking log
statement:

-- Could NOT find Zephyr (missing: Zephyr_DIR)
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- ...
-- ...
-- ...
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (target_sources):
  Cannot specify sources for target "app" which is not built by
  this project.

... into this louder, clearer, faster and (last but not least) final
error:

CMake Error at CMakeLists.txt:5 (find_package):
  Could not find a package configuration file provided by "Zephyr" with
  any of the following names:

    ZephyrConfig.cmake
    zephyr-config.cmake

  Add the installation prefix of "Zephyr" to CMAKE_PREFIX_PATH or set
  "Zephyr_DIR" to a directory containing one of the above files.  If
  "Zephyr" provides a separate development package or SDK, be sure it
  has been installed.

-- Configuring incomplete, errors occurred!

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
..
src tests: arch: arm_interrupt: minor style fixes in comments/README 2020-05-27 11:57:55 +02:00
CMakeLists.txt tests: make find_package(Zephyr...) REQUIRED 2020-05-29 10:47:25 +02:00
README.txt tests: arch: arm_interrupt: minor style fixes in comments/README 2020-05-27 11:57:55 +02:00
prj.conf tests: arch: arm: interrupt: add test-case for user mode IRQ locking 2020-01-22 12:08:14 -06:00
testcase.yaml

README.txt

Title: Test to verify code fault handling in ISR execution context
       and the behavior of irq_lock() and irq_unlock() when invoked
       from User Mode. (ARM Only)

Description:

The first test verifies that we can handle system fault conditions
while running in handler mode (i.e. in an ISR). Only for ARM
Cortex-M targets.

The test also verifies
- the behavior of the spurious interrupt handler, as well as the
  ARM spurious exception handler.
- the ability of the Cortex-M fault handling mechanism to detect
  stack overflow errors explicitly due to exception frame context
  stacking (that is when the processor reports only the Stacking
  Error and not an additional Data Access Violation error with a
  valid corresponding MMFAR address value).

The second test verifies that threads in user mode, despite being able to call
the irq_lock() and irq_unlock() functions without triggering a CPU fault,
they won't be able to read or modify the current IRQ locking status.

---------------------------------------------------------------------------

Building and Running Project:

This project outputs to the console.  It can be built and executed on QEMU as
follows:

    ninja/make run

---------------------------------------------------------------------------

Troubleshooting:

Problems caused by out-dated project information can be addressed by
issuing one of the following commands then rebuilding the project:

    ninja/make clean    # discard results of previous builds
                        # but keep existing configuration info
or
    ninja/make pristine # discard results of previous builds
                        # and restore pre-defined configuration info

---------------------------------------------------------------------------

Sample Output:
*** Booting Zephyr OS build v2.3.0-rc1-295-g630f69889088  ***
Running test suite arm_interrupt
===================================================================
starting test - test_arm_interrupt
Available IRQ line: 70
E: >>> ZEPHYR FATAL ERROR 1: Unhandled interrupt on CPU 0
E: Current thread: 0x20400190 (unknown)
Caught system error -- reason 1
E: r0/a1:  0x00000003  r1/a2:  0x20401d6c  r2/a3:  0x00000003
E: r3/a4:  0x20401af8 r12/ip:  0x0295a8d1 r14/lr:  0x00401ad3
E:  xpsr:  0x61000056
E: Faulting instruction address (r15/pc): 0x00400622
E: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
E: Fault during interrupt handling

E: Current thread: 0x20400190 (unknown)
Caught system error -- reason 3
E: r0/a1:  0x00000004  r1/a2:  0x20401d6c  r2/a3:  0x00000004
E: r3/a4:  0x20401af8 r12/ip:  0x00000000 r14/lr:  0x00401ad3
E:  xpsr:  0x61000056
E: Faulting instruction address (r15/pc): 0x00400640
E: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
E: Fault during interrupt handling

E: Current thread: 0x20400190 (unknown)
Caught system error -- reason 4
ASSERTION FAIL [0] @ ../src/arm_interrupt.c:49
        Intentional assert

E: r0/a1:  0x00000004  r1/a2:  0x00000031  r2/a3:  0x80000000
E: r3/a4:  0x00000056 r12/ip:  0x00000000 r14/lr:  0x00401ad3
E:  xpsr:  0x41000056
E: Faulting instruction address (r15/pc): 0x00409b34
E: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
E: Fault during interrupt handling

E: Current thread: 0x20400190 (unknown)
Caught system error -- reason 4
E: ***** MPU FAULT *****
E:   Stacking error (context area might be not valid)
E: r0/a1:  0x2e706106  r1/a2:  0x739e3f03  r2/a3:  0xf1c99979
E: r3/a4:  0xe9973b26 r12/ip:  0x87d3b16f r14/lr:  0x01c98b2b
E:  xpsr:  0x80608800
E: Faulting instruction address (r15/pc): 0x885e4061
E: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
E: Current thread: 0x20400190 (unknown)
Caught system error -- reason 2
PASS - test_arm_interrupt
===================================================================
starting test - test_arm_user_interrupt
PASS - test_arm_user_interrupt
===================================================================
Test suite arm_interrupt succeeded
===================================================================
PROJECT EXECUTION SUCCESSFUL