Embedded System Exception Handling via Callback Linked List
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Conventional exception handling mechanisms in embedded systems suffer from poor portability and robustness due to hardware architecture dependencies, leading to decreased reliability and potential system failures when handling exceptions, especially in complex multi-task environments where secondary exceptions can propagate and cause system instability.
Innovation Solution
The implementation of a method using an exception callback linked list structure that allows for multi-level exception handling, enabling registration and execution of exception handling functions at task, application, and system levels, thereby avoiding direct hardware operations and enhancing portability and robustness.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If conventional exception handling mechanism is used, then exception can be handled at task level, but exception handling program has poor portability and robustness due to hardware architecture dependencies
Solution Approach 1:
The patent introduces an intermediary layer between hardware exceptions and handling functions. The exception monitoring device captures exceptions and uses a dispatch table (software intermediary) to match exception types with handling functions, eliminating direct hardware architecture dependencies in the handling program itself while maintaining reliable exception handling.
Solution Approach 2:
The patent segments the exception handling system into distinct components: exception capture module, dispatch table (mapping exception types to handlers), and handling function execution module. This segmentation allows the core handling logic to be architecture-independent while the capture layer handles hardware-specific details, improving portability without sacrificing reliability.
2Device complexity
If conventional exception handling mechanism is used, then simple task-level processing is achieved, but secondary exceptions during handling cannot be resolved and may spread to application programs
Solution Approach 1:
The patent implements nested exception handling where the exception monitoring device wraps around the application program, creating multiple protective layers. When an exception occurs, it is handled at the monitoring device level rather than propagating to the application program. This nested structure allows complex multi-layer protection while maintaining a relatively simple interface for application developers.
Solution Approach 2:
The patent establishes exception monitoring and handling mechanisms beforehand (prior cushioning) to prevent secondary exceptions from spreading. The dispatch table and handling functions are pre-configured to catch and resolve exceptions before they can propagate to application programs, cushioning the system against exception-related failures.
3Reliability
If exception handling program is modified for each exception according to processor architecture, then specific exceptions can be handled, but development complexity increases and robustness decreases
Solution Approach 1:
The patent creates a universal exception handling mechanism through the dispatch table that can handle multiple exception types through a single software layer. Rather than writing architecture-specific handling code for each exception type, the system uses a universal dispatch mechanism that maps various exception types to appropriate handlers, reducing development complexity while maintaining comprehensive exception handling capability.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
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.