Some students who learn embedded will think that embedded html is too difficult. Should you give up? Are there any tips for learning embedded? Wait, everyone must be familiar with these issues. Let’s learn about the major tips for embedded development of 7.
Click to get the 1V1 embedded learning plan, and now you will also get 100G of selected learning materials. (Long press and copy the search link)
https://s.pdb2.com/l/CMIsoKcnATFIF4M
Become a formal embedded development engineer - it is a difficult process that requires developers to maintain and manage every bit and byte of the system.
From a standardized and complete development cycle to strict execution and system inspection, there are many technologies for developing high-reliability embedded system . Today I will introduce you to 7 easy-to-operate and long-lasting techniques, which will be of great help to ensure that the system runs more reliably and catch abnormal behavior.
No.1Fill ROM
with known values Software developers are often very optimistic groups, just let their code run faithfully for a long time, that's all. This seems rather rare for microcontrollers to jump out of application space and execute in unintended code space. However, this happens no less chance than cache overflow or error pointer loss of reference. It does happen, and the system behavior after this happens will be uncertain, because by default the memory space is all 0xFF, or because the memory area is not usually written, the value in it may only be known by God.
No.2 Checking the application's CRC
0 A great benefit for embedded engineer is that our IDE and toolchain can automatically generate an application or memory space checksum (Checksum) to verify that the application is intact based on this checksum. Interestingly, in many of these cases, the checksum is only used when the program code is loaded to the device.
No.3 performs RAM check at startup
In order to build a more reliable and solid system, it is very important to ensure that the system hardware works normally. After all, the hardware will fail. (Luckily the software never fails, the software only does what the code wants it to do, whether it is correct or wrong). Verifying that there are no problems inside or outside the RAM at startup is a great way to make sure the hardware can work as expected.
No.4 Using the stack monitor
For many embedded developers, the stack seems to be a pretty mysterious force. When something strange started to happen and the engineers were finally stumped, they began to think about maybe something happened in the stack. The result is blindly adjusting the size and position of the stack, etc. But this error is often stack-independent, but how can it be so sure? After all, how many engineers have actually actually performed worst-case stack size analysis?
stack size is allocated statically at compile time, but the stack is used dynamically. As the code is executed, variables, returned addresses and other information required by the application are constantly stored in the stack. This mechanism causes the stack to grow in the memory it allocates. However, this growth can sometimes exceed the capacity limit determined at compile time, causing the stack to destroy data in adjacent memory areas.
No.5 Using MPU
In the past, it was difficult to find a memory protection unit (MPU) in a small and inexpensive microcontroller, but this situation has begun to change. MPUs are available now from high-end to low-end microcontrollers, and these MPUs provide embedded software developers with an opportunity to significantly improve their firmware robustness.
No.6 Establish a powerful watchdog system
One of the most popular watchdog implementations you often find is where the watchdog is enabled (this is a good start), but it can also be cleared with a periodic timer; the timer is enabled completely isolated from any situation that occurs in the program. The purpose of using a watchdog is to help ensure that if an error occurs, the watchdog will not be cleared, that is, when the work is suspended, the system will be forced to perform hardware resets for recovery. Using a timer independent of system activity allows the watchdog to remain cleared even if the system has failed.
No.7 Avoid volatile memory allocation
Engineers who are not used to working in resource-limited environments may attempt to use the features of their programming language that allows them to use volatile memory allocation. After all, this is a technique commonly used in calculator systems where memory is allocated only if necessary. For example, when developing in C, engineers may tend to use malloc to allocate space on the heap. There is an operation that will be executed, and once completed, you can use free to return the allocated memory for the use of the heap.
The above introduces 7 tips for embedded development. These tips are just to help everyone learn embedded more closely. However, the tutorial is a way to allow development technicians to obtain better embedded systems.
for (i = 0; i 8; i++)
{
SetData((data i) & 0x1);
SetClockHigh();
for (j = 0; j 5; j++);
SetClockLow();
for (j = 0; j 5; j++);
SetClockLow();
for (j = 0; j 5; j++);
}