Configuring the fatal error handler

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Sep 16 06:17:43 UTC 2015



On 16/09/15 00:49, Nick Withers wrote:
> 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 }
> ____
>
> I think a printk() would be preferred over a printf() in the handler,
> too (but am not sure about that).
>

Yes, in the fatal error handler the operating system is dead, so 
printf() usage leads to unpredictable results.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the users mailing list