Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Program C Ansi Programming Embedded Systems in C and C++ phần 3 ppt
MIỄN PHÍ
Số trang
13
Kích thước
140.0 KB
Định dạng
PDF
Lượt xem
1018

Program C Ansi Programming Embedded Systems in C and C++ phần 3 ppt

Nội dung xem thử

Mô tả chi tiết

4.4 Simulators and Other Tools

Of course, many other debugging tools are available to you, including simulators, logic analyzers, and oscilloscopes.

A simulator is a completely host-based program that simulates the functionality and instruction set of the target

processor. The human interface is usually the same as or similar to that of the remote debugger. In fact, it might be

possible to use one debugger frontend for the simulator backend as well, as shown in Figure 4-2. Although

simulators have many disadvantages, they are quite valuable in the earlier stages of a project when there is not yet

any actual hardware for the programmers to experiment with.

Figure 4-2. The ideal situation: a common debugger frontend

Debugging Tip #2: If you ever encounter a situation in which the target processor is behaving differently from how

you think it should from reading the data book, try running the same software in a simulator. If your program works

fine there, then you know it's a hardware problem of some sort. But if the simulator exhibits the same weirdness as

the actual chip, you'll know you've been misinterpreting the processor documentation all along.

By far, the biggest disadvantage of a simulator is that it only simulates the processor. And embedded systems

frequently contain one or more other important peripherals. Interaction with these devices can sometimes be

imitated with simulator scripts or other workarounds, but such workarounds are often more trouble to create than the

simulation is valuable. So you probably won't do too much with the simulator once you have the actual embedded

hardware available to you.

Once you have access to your target hardware-and especially during the hardware debugging-logic analyzers and

oscilloscopes can be indispensable debugging tools. They are most useful for debugging the interactions between the

processor and other chips on the board. Because they can only view signals that lie outside the processor, however,

they cannot control the flow of execution of your software like a debugger or an emulator can. This makes these

tools significantly less useful by themselves. But coupled with a software debugging tool like a remote debugger or

an emulator, they can be extremely valuable.

A logic analyzer is a piece of laboratory equipment that is designed specifically for troubleshooting digital hardware.

It can have dozens or even hundreds of inputs, each capable of detecting only one thing: whether the electrical signal

it is attached to is currently at logic level 1 or 0. Any subset of the inputs that you select can be displayed against a

timeline as illustrated in Figure 4-3. Most logic analyzers will also let you begin capturing data, or "trigger," on a

particular pattern. For example, you might make this request: "Display the values of input signals 1 through 10, but

don't start recording what happens until inputs 2 and 5 are both zero at the same time."

Tải ngay đi em, còn do dự, trời tối mất!