Install a user fatal error handler.

USER_ERROR_HANDLER BIOS_Install_Error_Handler (                     USER_ERROR_HANDLER vector );



Far pointer to callback procedure.  Set to zero to un-install the handler.

Return Value

Old handler (since SC1x RTOS V1.25 and SC1x3/SC2x RTOS V1.20)


The user can install an error handler function, that will execute if a fatal error occurs in an application or inside of the @CHIP-RTOS.   Only one error handler callback is supported by the system.   Calling this API with a NULL vector will remove any previously installed handler.   Before a program exits, it must remove any installed callback.

A second call with a non-zero vector will replace any previous callback vector.

The callback function must have the following form:

    void huge _pascal Err_Handler (int error_code)

The error_code input parameter can have the following values:

    1: Invalid opcode (usually caused by corrupted memory). The current task will be suspended.
    2: Fatal kernel error (usually caused by corrupted memory or a task stack overflow)
    3: Fatal internal TCPIP error, calling task is supended
    4: TCPIP stack reaches memory limit
    5: TCPIP memory allocation error
    6: Ethernet bus error (hardware defect)
    7: Ethernet link error(SC13 only, cable not connected?)
    8: Flash write error -> Flash defect (IPC@CHIP® is no longer usable)
    9: Low Memory error -> called if an alloc (system or user) failed
    10: RTOS memory list corrupted
    11: Flash weak (SC1x3/SC2x only)
    12: Internal software error inside @CHIP-RTOS (SC1x3/SC2x only)
    13: The process that has registered to the watchdog manager under the given handle has failed to refresh the watchdog manager in time.
    14: End process error -> called if terminate program API does not find the task id

Error codes in the range[1000..9999] are reserved for Beck drivers or libraries. Currently the following codes are used:

    1000: GCLIB - The communication between the IPC@CHIP® and the graphics controller failed.

Error codes starting from 10000 can be used by user applications with the BIOS_Set_Error API.

In all cases (except error code 7 and 9, driver/library and application codes depend) we recommend to reboot the IPC@CHIP® (see below). If the flash device has a defect, the IPC@CHIP® is no longer usable

Do not use any message printing inside your error handler if errorcode is 3 or 4 and telnet is part of your STDIO.   In this case your exit handler would hang inside of the print call.

SC1x3/SC2x Comments

If a flash error (code 8) or flash weak (code 11) condition has been recorded, an immediate callback made from within this API will be made to the user.   Note that flash problem records are held in non-volatile memory and therefore the error may be residual from a previous power up session.   Due to their importance, these error records are held until the user explicitly resets the error history with the console ERRORS RESET command.

Refer to the ERRORS command documentation for an explanation of what is meant by "flash weak".

See Also


This library function invokes a RTOS software interrupt.

Supported since or modified in @CHIP-RTOS version


This API List
List of C Libraries
@CHIP-RTOS Main Index

End of document