summaryrefslogtreecommitdiffstats
path: root/c-user/fatal-error/directives.rst
blob: 2d9a47661cc0de3d01f7d62c268f5ba1f9b5b1c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
.. SPDX-License-Identifier: CC-BY-SA-4.0

.. Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR)

Directives
==========

This section details the fatal error manager's directives.  A subsection is
dedicated to each of this manager's directives and describes the calling
sequence, related constants, usage, and status codes.

.. raw:: latex

   \clearpage

.. index:: announce fatal error
.. index:: fatal error, announce
.. index:: rtems_fatal

.. _rtems_fatal:

FATAL - Invoke the fatal error handler
--------------------------------------

CALLING SEQUENCE:
    .. code-block:: c

        void rtems_fatal(
          rtems_fatal_source fatal_source,
          rtems_fatal_code   error_code
        ) RTEMS_NO_RETURN;

DIRECTIVE STATUS CODES:
    NONE - This function will not return to the caller.

DESCRIPTION:
    This directive terminates the system.

NOTE:
    Registered :c:func:`atexit()` or :c:func:`on_exit()` handlers are not
    called.  Use :c:func:`exit()` in case these handlers should be invoked.

.. raw:: latex

   \clearpage

.. index:: panic
.. index:: rtems_panic

.. _rtems_panic:

PANIC - Print a message and invoke the fatal error handler
----------------------------------------------------------

CALLING SEQUENCE:
    .. code-block:: c

        void rtems_panic(
          const char *fmt,
          ...
        ) RTEMS_NO_RETURN RTEMS_PRINTFLIKE( 1, 2 );

DIRECTIVE STATUS CODES:
    NONE - This function will not return to the caller.

DESCRIPTION:
    This directive prints a message via :c:func:`printk` specified by the
    format and optional parameters and then terminates the system with the
    :c:macro:`RTEMS_FATAL_SOURCE_PANIC` fatal source.  The fatal code is set to
    the format string address.

NOTE:
    Registered :c:func:`atexit()` or :c:func:`on_exit()` handlers are not
    called.  Use :c:func:`exit()` in case these handlers should be invoked.

.. raw:: latex

   \clearpage

.. index:: shutdown RTEMS
.. index:: rtems_shutdown_executive

.. _rtems_shutdown_executive:

SHUTDOWN_EXECUTIVE - Shutdown RTEMS
-----------------------------------

CALLING SEQUENCE:
    .. code-block:: c

        void rtems_shutdown_executive(
            uint32_t result
        );

DIRECTIVE STATUS CODES:
    NONE - This function will not return to the caller.

DESCRIPTION:
    This directive is called when the application wishes to shutdown RTEMS.
    The system is terminated with a fatal source of ``RTEMS_FATAL_SOURCE_EXIT``
    and the specified ``result`` code.

NOTES:
    This directive *must* be the last RTEMS directive invoked by an application
    and it *does not return* to the caller.

    This directive may be called any time.

.. raw:: latex

   \clearpage

.. index:: exception frame
.. index:: rtems_exception_frame_print

.. _rtems_exception_frame_print:

EXCEPTION_FRAME_PRINT - Prints the exception frame
--------------------------------------------------

CALLING SEQUENCE:
    .. code-block:: c

        void rtems_exception_frame_print(
            const rtems_exception_frame *frame
        );

DIRECTIVE STATUS CODES:
    NONE

DESCRIPTION:
    Prints the exception frame via ``printk()``.

.. raw:: latex

   \clearpage

.. index:: fatal error
.. index:: rtems_fatal_source_text

.. _rtems_fatal_source_text:

FATAL_SOURCE_TEXT - Returns a text for a fatal source
-----------------------------------------------------

CALLING SEQUENCE:
    .. code-block:: c

        const char *rtems_fatal_source_text(
            rtems_fatal_source source
        );

DIRECTIVE STATUS CODES:
    The fatal source text or "?" in case the passed fatal source is invalid.

DESCRIPTION:
    Returns a text for a fatal source.  The text for fatal source is the
    enumerator constant.

.. raw:: latex

   \clearpage

.. index:: fatal error
.. index:: rtems_internal_error_text

.. _rtems_internal_error_text:

INTERNAL_ERROR_TEXT - Returns a text for an internal error code
---------------------------------------------------------------

CALLING SEQUENCE:
    .. code-block:: c

        const char *rtems_internal_error_text(
            rtems_fatal_code error
        );

DIRECTIVE STATUS CODES:
    The error code text or "?" in case the passed error code is invalid.

DESCRIPTION:
    Returns a text for an internal error code.  The text for each internal
    error code is the enumerator constant.

.. raw:: latex

   \clearpage

.. index:: announce fatal error
.. index:: fatal error, announce
.. index:: rtems_fatal_error_occurred

.. _rtems_fatal_error_occurred:

FATAL_ERROR_OCCURRED - Invoke the fatal error handler (deprecated)
------------------------------------------------------------------

CALLING SEQUENCE:
    .. code-block:: c

        void rtems_fatal_error_occurred(
            uint32_t  the_error
        ) RTEMS_NO_RETURN;

DIRECTIVE STATUS CODES:
    NONE - This function will not return to the caller.

DESCRIPTION:
    This directive processes fatal errors.  If the FATAL error extension is
    defined in the configuration table, then the user-defined error extension
    is called.  If configured and the provided FATAL error extension returns,
    then the RTEMS default error handler is invoked.  This directive can be
    invoked by RTEMS or by the user's application code including initialization
    tasks, other tasks, and ISRs.

NOTES:
    This directive is deprecated and should not be used in new code.

    This directive supports local operations only.

    Unless the user-defined error extension takes special actions such as
    restarting the calling task, this directive WILL NOT RETURN to the caller.

    The user-defined extension for this directive may wish to initiate a global
    shutdown.