摘要 |
A method and a device for handling exceptions in an embedded system are disclosed. The method comprises: establishing an exception callback linked list for an application program when the application program is running; registering an exception handling function and the corresponding relation between the exception handling function and the exception information into the exception callback linked list by the application program; when the exception is captured, searching the corresponding relation between the exception handling function and the exception information to locate an exception handling function matching the captured exception, according to the exception information of the captured exception; after a matched exception handling function is located, calling and executing the matched exception handling function to perform the exception handling. By adopting the method and the device, the direct operation of the exception handling function to the bottom layer hardware is avoided, and the portability and robustness of the software are improved. |