Configuring the fatal error handler
soja-misc at aries.uberspace.de
soja-misc at aries.uberspace.de
Wed Sep 16 09:07:49 UTC 2015
Am 2015-09-16 00:49, schrieb Nick Withers:
> On Tue, 2015-09-15 at 15:58 +0200, soja-misc at aries.uberspace.de wrote:
>> Hi,
>>
>> We have problems configuring the fatal error handler in RTEMS.
>> Following
>> the documentation we did the following:
>>
>> void
>> fatalErrorHandler(Internal_errors_Source source, bool isInternal,
>> uint32_t errorCode);
>>
>> rtems_extensions_table User_extensions = {
>> NULL, // task_create_extension,
>> NULL, // task_start_extension
>> NULL, // task_restart_extension
>> NULL, // task_delete_extension,
>> NULL, // task_switch_extension,
>> NULL, // task_begin_extension
>> NULL, // task_exitted_extension
>> &fatalErrorHandler // fatal_extension
>> };
>>
>> #define CONFIGURE_INITIAL_EXTENSIONS User_extensions
>>
>> #define CONFIGURE_INIT
>>
>> #include "system.h"
>>
>> void
>> fatalErrorHandler(Internal_errors_Source source, bool isInternal,
>> uint32_t errorCode)
>> {
>> printf("Fatal error handler: %i, %i, %lu\n", source,
>> isInternal,
>> errorCode);
>> while (1)
>> {
>> }
>> }
>>
>> "system.h" has mainly the configuration options for number of
>> tasks/semaphores/etc.
>>
>> Now if I call rtems_fatal_error_occurred in my init task like below I
>> would expect to get a printout of the fatalErrorHandler function, but
>> I
>> only get the message from before. Is there something else necessary
>> to
>> register the error handler?
>
> Don't know that this helps, but I use this formulation successfully on
> the MVME3100:
> ____
>
> void fatal_extension(Internal_errors_Source the_source,
> bool is_internal,
> Internal_errors_t the_error);
>
> #define CONFIGURE_INITIAL_EXTENSIONS { .fatal = fatal_extension }
We use the c++ compiler, but if I define the extensions like this
#define CONFIGURE_INITIAL_EXTENSIONS { NULL, NULL, NULL, NULL, NULL,
NULL, NULL, fatalErrorHandler }
it works and the error handler is called.
Weird that it is not possible to pass the variable name...
Anyways thank you very much for the tip. Now it works.
> ____
>
> I think a printk() would be preferred over a printf() in the handler,
> too (but am not sure about that).
>
Thanks, I tried printk before as well, but it didn't change anything.
>> rtems_task task_system_init(rtems_task_argument /*ignored*/)
>> {
>> printf("Do fatal error\n");
>> rtems_fatal_error_occurred(33);
>>
>> }
>>
>> Best regards,
>>
>> Jan
>> _______________________________________________
>> users mailing list
>> users at rtems.org
>> http://lists.rtems.org/mailman/listinfo/users
More information about the users
mailing list