Probe Code Insertion for RTOS Stack Overflow Prevention
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In eco-friendly vehicles, the real-time operating system (RTOS) managing electronic control devices faces challenges in monitoring and preventing stack overflow, which can lead to program crashes and safety issues due to unmanaged memory usage, particularly in the stack area.
Innovation Solution
A method and apparatus that insert a probe code into interrupt service routines and functions with maximum call depth to calculate and monitor memory usage, comparing it against set thresholds, and performing fail-safe logic to prevent overflow, thereby ensuring safe operation and visualization of memory usage paths.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If a real-time operating system (RTOS) is used to manage control systems in eco-friendly vehicles, then the system can handle multiple electronic control devices and maintain real-time performance, but the risk of stack overflow increases due to unmanaged memory usage in the stack area
Solution Approach 1:
The patent applies preliminary action by inserting probe codes into functions and interrupt service routines before execution to proactively monitor and calculate stack usage. This allows the system to detect potential stack overflow conditions before they occur, enabling preventive measures to be taken while maintaining real-time performance requirements.
2Reliability
If probe codes are inserted into functions and interrupt service routines to monitor memory usage, then stack overflow can be detected and prevented, but the device complexity increases due to additional monitoring code and threshold comparison logic
Solution Approach 1:
The monitoring system applies self-service by having the probe codes automatically calculate stack usage and compare it against threshold values without requiring external intervention. The system monitors itself through embedded probe codes that execute alongside the main program, reducing the need for separate complex monitoring infrastructure.
3Reliability
If threshold values are set for memory usage to prevent stack overflow, then system safety is improved, but the ease of operation decreases due to the need to configure and manage threshold values
Solution Approach 1:
The patent applies parameter changes by allowing threshold values to be dynamically adjusted based on function call depth and stack usage patterns. The system can modify threshold parameters adaptively rather than requiring fixed manual configuration, making the system safer while reducing operational complexity through automated parameter management.
Data Source
AI summary
An operating method of an electronic control device for performing at least one program including a plurality of functions includes: recognizing a function call depth of the plurality of functions; inserting a probe code into an interrupt service routine (ISR) and a maximum depth function with a maximum function call depth; calculating a use amount of a memory area when the maximum depth function with the probe code inserted into the maximum depth function is performed; and when the probe code is executed, outputting the maximum function call depth or the function call depth of the plurality of functions and the use amount when the ISR is performed.


