Home | | Embedded Systems Design | Exceptions

Chapter: Embedded Systems Design : Real-time operating systems

Exceptions

With most embedded systems, access to the low level exception handler is essential to allow custom routines to be written to support the system.

Exceptions

 

With most embedded systems, access to the low level exception handler is essential to allow custom routines to be written to support the system. This can include interrupt routines to control external peripherals, emulation routines to simulate instructions or facilities that the processor does not support — software floating point is a very good example of this — and other exception types.

 

Some of these exceptions are needed by the RTOS to pro-vide entry points into the kernel and to allow the timers and other facilities to function. As a result, most RTOSs already provide the basic functionality for servicing exceptions and provide access points into this functionality to allow the designer to add custom exception routines. This can be done in several ways:

 

                                                                        Patching the vector table

 

This is relatively straight forward if the vector is not used by the RTOS. If it is, then patching will still work but the inserted user exception routine must preserve the excep-tion context and then jump to the existing handler instead of using a return from exception type instruction to restore normal processing. If it is sharing an exception with the RTOS, there must be some form of checking so that the user handler does not prevent the RTOS routine from working correctly.

 

                                                                        Adding user routines to existing exception handlers

 

This is very similar to the previous technique in that the user routine is added to any existing RTOS routine. The differ-ence is that the mechanism is more formal and does not require vector table patching or any particular checking by the user exception handler.

                                                                         Generating a pseudo exception that is handled by separate user exception handler(s)

 

This is even more formal — and slower — and effectively replaces the processor level exception routine with a RTOS level version in which the user creates his own vector table and exception routines. Typically, all this is performed through special kernel calls which register a task as the handler for a particular exception. On completion, the handler uses a special return from the exception call into the RTOS kernel to signify that it has completed.

 

Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Embedded Systems Design : Real-time operating systems : Exceptions |


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.