Zephyr Project Requirements
Exception and Error Handling

Exception and Error Handling

STATEMENT:

SPDX-License-Identifier: Apache-2.0

ZEP-SRS-16-1
1. Default exception handlers
UID: ZEP-SRS-16-1
STATUS: Draft
TYPE: Functional
COMPONENT: Exception and Error Handling
RELATIONS (Parent):
STATEMENT:

The Zephyr RTOS shall provide a default handler for each CPU exception defined by the underlying architecture.

ZEP-SRS-16-2
2. Default fatal error handler
UID: ZEP-SRS-16-2
STATUS: Draft
TYPE: Functional
COMPONENT: Exception and Error Handling
RELATIONS (Parent):
STATEMENT:

The Zephyr RTOS shall provide a default fatal error handler.

ZEP-SRS-16-3
3. Exceptions treated as fatal errors by default
UID: ZEP-SRS-16-3
STATUS: Draft
TYPE: Functional
COMPONENT: Exception and Error Handling
RELATIONS (Parent):
STATEMENT:

When an exception is handled by the default exception handler, the Zephyr RTOS shall treat the exception as a fatal error.

ZEP-SRS-16-4
4. Application-defined fatal error handler
UID: ZEP-SRS-16-4
STATUS: Draft
TYPE: Functional
COMPONENT: Exception and Error Handling
RELATIONS (Parent):
STATEMENT:

The Zephyr RTOS shall allow an application to provide, at build time, its own fatal error handler in place of the default handler.

ZEP-SRS-16-5
5. Triggering a fatal error in the current context
UID: ZEP-SRS-16-5
STATUS: Draft
TYPE: Functional
COMPONENT: Exception and Error Handling
RELATIONS (Parent):
STATEMENT:

The Zephyr RTOS shall provide a mechanism for software to raise a fatal error attributed to the current execution context.

ZEP-SRS-16-6
6. Triggering a fatal system error
UID: ZEP-SRS-16-6
STATUS: Draft
TYPE: Functional
COMPONENT: Exception and Error Handling
RELATIONS (Parent):
STATEMENT:

The Zephyr RTOS shall provide a mechanism for software to raise a fatal error that is treated as unrecoverable.

ZEP-SRS-16-7
7. Fatal error reason
UID: ZEP-SRS-16-7
STATUS: Draft
TYPE: Functional
COMPONENT: Exception and Error Handling
RELATIONS (Parent):
STATEMENT:

When a fatal error handler is invoked, the Zephyr RTOS shall provide a reason code identifying the type of error.

ZEP-SRS-16-8
8. Default fatal error policy
UID: ZEP-SRS-16-8
STATUS: Draft
TYPE: Functional
COMPONENT: Exception and Error Handling
RELATIONS (Parent):
STATEMENT:

When a fatal error is handled by the default fatal error handler, the Zephyr RTOS shall halt the system.

ZEP-SRS-16-9
9. System reset on fatal error
UID: ZEP-SRS-16-9
STATUS: Draft
TYPE: Functional
COMPONENT: Exception and Error Handling
RELATIONS (Parent):
STATEMENT:

Where reset on fatal error is enabled, when a fatal error is handled by the default fatal error handler, the Zephyr RTOS shall reset the system instead of halting it.

ZEP-SRS-16-10
10. Recovery from a fatal error in thread context
UID: ZEP-SRS-16-10
STATUS: Draft
TYPE: Functional
COMPONENT: Exception and Error Handling
RELATIONS (Parent):
STATEMENT:

When the application-provided fatal error handler returns following a recoverable fatal error attributed to a thread, the Zephyr RTOS shall terminate the offending thread and continue operation.

ZEP-SRS-16-11
11. No recovery from an unrecoverable fatal error
UID: ZEP-SRS-16-11
STATUS: Draft
TYPE: Functional
COMPONENT: Exception and Error Handling
RELATIONS (Parent):
STATEMENT:

Where kernel assertions are enabled, when the application-provided fatal error handler returns following an unrecoverable fatal error, the Zephyr RTOS shall halt the system.

ZEP-SRS-16-12
12. Fatal errors in interrupt context are unrecoverable
UID: ZEP-SRS-16-12
STATUS: Draft
TYPE: Functional
COMPONENT: Exception and Error Handling
RELATIONS (Parent):
STATEMENT:

If a fatal error other than a thread stack overflow occurs in interrupt context, then the Zephyr RTOS shall treat the error as unrecoverable.

ZEP-SRS-16-13
13. Fatal error diagnostics
UID: ZEP-SRS-16-13
STATUS: Draft
TYPE: Functional
COMPONENT: Exception and Error Handling
RELATIONS (Parent):
STATEMENT:

Where exception dump output is enabled, when a fatal error occurs, the Zephyr RTOS shall report diagnostic information identifying the reason for the error and the execution context in which it occurred.