Three Potential Problems and Testing Techniques of Embedded Software

This article will explain how to avoid those hidden and common mistakes, and introduce a few tips to help engineers find hidden errors in the software. Most software development projects rely on code inspection, structural testing, and functional testing to identify software defects. Although these traditional technologies are very important and can find most software problems, they cannot detect many common mistakes in today's complex systems.

Structural or white-box testing can effectively detect logic, control flow, calculations, and data errors in the code. This test requires an unobstructed view of the internal workings of the software (hence the term "white box" or "glass box") to understand the details of the software structure. It checks each conditional expression, math operation, input, and output. Due to the numerous details that need to be tested, the structure test checks one software unit at a time, usually a function or class.

Code reviews also use the same sophisticated techniques as finding defects and potential problems. As with white-box testing, reviews are usually performed for each unit of software because an effective review process requires a focused and exhaustive examination.

Unlike review and white-box testing, functional testing or black-box testing assumes that nothing is known about the implementation of the software. It tests the output driven by the controlled input. Functional testing consists of test procedures written by testers or developers that specify the expected program output for a specific set of program inputs. After the test runs, the tester compares the actual output with the expected output to find the problem. The black box test can effectively find out the unfulfilled requirements, interface problems, performance problems and errors in the most commonly used functions of the program.

Although these techniques can be combined to find most of the errors hidden in a particular software program, they also have limitations. Code review and white-box testing only focus on a small portion of the code at a time, ignoring the rest of the system. Black box testing usually treats the system as a whole, ignoring the implementation details. Some important issues can only be discovered by focusing on the details of their interactions within the entire system; traditional methods cannot reliably find these problems. The software system must be checked overall to find the specific cause of the problem. Since it is generally unlikely that detailed analysis of every detail in the program and its interaction with all other parts of the code is unlikely, the analysis should address specific aspects of the program that are already known to cause problems. This article will explore three potential problem areas:

* Stack Overflow * Competitive Conditions * Deadlock Readers can read the second part of this article online and it will explore the following issues:

* Timing issues * Reentrant conditions All of the above issues are common in systems using multi-task real-time design techniques.

The stack overflow processor uses the stack to store temporary variables, pass parameters to the called function, save thread state, and so on. If the system does not use virtual memory (in other words, it cannot transfer memory pages to disk to free up memory space for other purposes), the stack is fixed at the factory's size. If for some reason the stack goes beyond the amount of space allocated by the programmer, the program will become undefined. This instability can cause serious system failures. Therefore, it is important to ensure that the system can allocate enough stacks in the worst case.

The only way to ensure that a stack overflow never occurs is to analyze the code, determine the maximum stack usage of the program in every possible situation, and then check if enough stacks are allocated. It is unlikely that the test will trigger a particular instantaneous input combination and cause the system to appear worst-case.

The concept of stack depth analysis is relatively simple:

1. Create a call tree for each individual thread.

2. Determine the stack usage of each function in the call tree.

3. Check each call tree to determine which call path from the root to the outer "leaf" needs to use the most stack.

4. Add the maximum stack usage of each individual thread's call tree.

5. Determine the maximum stack usage for each interrupt service routine (ISR) in each interrupt priority class and compute the sum. However, if the ISR itself uses a stack of interrupted threads without a stack, then the maximum number of stacks used by the ISR should be added to each thread's stack.

6. For each priority, plus the number of stacks used to hold the processor state when an interrupt occurs.

7. If using an RTOS, add the maximum number of stacks required by the RTOS's own internal use (different from system calls raised by application code, which was included in Step 2).

In addition, there are two important issues to consider. First of all, only the call tree built from high-level language source code is probably not perfect. Most compilers use run-time libraries to optimize common computational tasks, such as multiplication and division of large-valued integers, floating-point operations, etc. These calls are only visible in the compiler-generated assembly language. The runtime library functions themselves may use a large amount of stack space, which must be included in the analysis. If you are using the C++ language, all the following types of functions (methods) must also be included in the call tree: structors, destructors, overloaded operators, replication constructors, and conversion functions. All function pointers must also be parsed and the functions they call are included in the analysis.

Hexagonal Wire Mesh

Hexagonal Wire Mesh,Hexagonal Wire Netting,Hexagonal Netting,Hex Wire Mesh

ANPING COWAN WIRE MESH & MACHINES CO., LTD , https://www.cowanfence.com