This article provides some information about in-circuit ARM emulators and the benefits they bring to you as an embedded system designer. Based on your needs, you will make a more appropriate choice of development tools in product development.
1. Development cycle of embedded products
The first stage of a typical embedded microcontroller development project is to use a C compiler to generate target code from the source program. The generated target code will include physical addresses and some debugging information. Currently, the code can be executed and debugged using a software simulator, a target monitor, or an online emulator. The software simulator uses its CPU (such as x86) and its system resources to simulate the target CPU (such as P51XA) on a PC or workstation platform and execute the user's target code; the target monitor downloads the generated target code to the program memory of the user's target board and adds a monitor task software to the downloaded code to monitor and control the execution of the user's target code. The user uses a desktop computer to debug the program through the serial port or other debugging port on the target board.
Program debugging is achieved by setting breakpoints and stopping the program at a specified instruction location. When the program stops, the contents of the memory and registers are checked as clues to discover program errors.
After the program is debugged and all errors are found, the source code is modified and recompiled to generate an object code file in a standard format, such as Intel HEX. This object code will be stored in the non-volatile memory of the final product, such as EPROM or FLASH.
2. Why do we need an emulator?
Software simulators and target monitors provide an economical debugging method that is sufficient for many designs. However, there are also many occasions where simulators are needed to find program errors. In any case, simulators can reduce debugging time, simplify system integration, increase reliability, and optimize test steps, making them worthwhile. More often, engineers use software simulators and emulators at the same time at different stages of the project, especially in large development projects.
Software simulators and software debuggers offer only a few features beyond breakpoints, such as displaying port contents and code coverage. There is no means of detecting events and conditions and reacting to them, nor is there a way to record the MCU's bus cycles and determine what exactly happened during program execution. If your MCU has on-chip EPROM or FLASH memory and is running in single-chip mode, only an emulator can debug the system without seriously occupying and consuming MCU resources.
In-circuit emulators can easily do these things and provide many other functions. Emulators are the bridge between software and hardware. At some stage in the project, you must run the program on the actual hardware. Emulators can easily help you understand how to make full use of the emulator during the debugging stage.
3. What exactly is an emulator?
The emulator can replace the MCU in your target system and simulate its operation. The emulator runs just like the actual target processor, but adds other functions, allowing you to observe the program and data in the MCU and control the operation of the MCU through a desktop computer or other debugging interface. The emulator is an economical and effective means of debugging embedded software. Nohau's EMUL51XA-PC emulator series is used to debug Philips P51XA series MCUs, while the EMUL51-PC series emulators support 8051 series microcontrollers from many manufacturers.
Internal and External Modes
Internal mode means that the program and data are located inside the MCU chip in the form of FLASH or EPROM. The address and data bus are not visible to the user, and the chip pins saved are provided to the user as I/O ports. Internal mode is also called single-chip mode, and all program execution occurs in the internal ROM. In order to effectively emulate this chip, the emulator is required to use bondout or enhanced Hooks chips.
External mode is when the program memory, and possibly some data memory, is located outside the MCU, and address and data buses are needed to access this memory. External mode is also called extended mode. User chips, bondout chips, and enhanced hooks chips can all generate this operating mode. In this case, the address and data bus pins of the chip cannot be used as general I/O ports. Nohau's emulator uses these three chips to achieve effective program debugging.
5. Bondout, Enhanced Hooks Chips and Standard Product Chips
These terms refer to the three types of emulation processors used by the emulator to replace the target MCU. Only Bondout and Enhanced Hooks chips can achieve single-chip debugging, while standard product chips cannot. Compared with standard product chips, bondout chips have some additional pins that are connected to the circuit nodes of the silicon inside the chip, so they are also called "super-pin chips". P51XA series microcontroller emulators all use bondout chips, and EMUL51XA-PC is a good example.
Enhanced Hooks chips use machine cycles that are not available on various chip pins to provide address and data buses. Some 80C51 series emulators use enhanced Hooks chips. Interestingly, some of these enhanced Hooks chips are also standard product chips. Using enhanced Hooks chips as emulated CPUs requires some additional special function circuits to decompose the address and data buses and some necessary control signals from the multiplexed chip pins. The user's target board does not have these circuits, so all are still in single-chip working mode. Using bondout chips and enhanced Hooks chips can achieve extremely accurate simulation, from functions to chip power consumption.
6. Make the hardware work
Software simulators are great, but they can't take into account all the variables. The simulator designer must take everything into account, especially those that only appear after the hardware is built, such as capacitors, timings, inductors, chip versions, etc., which become more and more important as CPU speeds increase.
The target Monitor is much better because it runs on actual hardware. However, in order for the Monitor program to run, the target system must be a complete and working system. This is not the case with the simulator, which can run even when the target system hardware is incomplete or even without any hardware. However, the target Monitor can be installed in the program of the final product and can be activated at any time for debugging, so this is still a certain advantage for testing and maintenance.
7. Advantages of the simulator
The simulator has all the features of the simulator and target monitor, plus the following advantages:
1. Does not use target system or CPU resources
The target Monitor kernel generally requires 10K of ROM and 10-20 bytes of RAM and a free communication port. A good emulator will not use any of the above. The emulator should be invisible to the target system, which is the so-called "fully transparent emulation".
2. Hardware breakpoints
Software breakpoints are implemented by inserting a 2-byte TRAP instruction in the user's target code to divert the normal program flow to the debugger. If the program counter happens to fall on the second byte, the program will crash. The hardware breakpoint function of the Nohau emulator uses a comparator to compare the system bus state with the preset latch content to monitor access to the specified address without modifying any program memory content. Regional breakpoints need to be implemented using hardware breakpoints, but software breakpoints are still very convenient and useful, so Nohau's emulator provides both breakpoint functions.
When the user's target program is stored in ROM, software breakpoints cannot be used because the TRAP instruction cannot be inserted. For ROM program memory systems, only hardware breakpoints can be used. [page]
3. Tracing function (TRACE)
The trace function records all processor machine cycles and optional external signal levels in time. The trace function can record all instruction fetch operations and, in microcontrollers that use pipeline parallel processing mode, such as the P51XA, distinguish between instructions that were canceled in the pipeline and those that were successfully executed. The start of the trace is achieved through a conditional trigger, which allows filtering, that is, only the instruction cycles of interest are recorded and the rest are discarded. The software simulator and target monitor do not have trace memory and cannot implement the Trace function.
4. Conditional trigger
Conditional triggering is a very powerful and easy-to-use function that allows you to perform a pre-set action when certain events occur. The trigger conditions can include address, data, clock cycle and external signal. These conditions can trigger a breakpoint, start/stop trace recording, record a time stamp, and many other actions determined by the simulator function. This powerful tool can only be realized in the simulator. The conditional trigger function and trace function of Nohau simulator are organically combined, with three levels of time triggering, and the highest level trigger has a counting function.
5. Real-time display of memory and I/O port contents
After using the emulator, you can observe the contents of the memory and I/O ports in real time, not just software simulation. You can connect your favorite peripheral chip to the lower part of the Nohau emulator feature board and access it in the debug interface. If you know all the details of the peripheral, you can simulate the system very accurately.
In many cases, we may have found that some problems only appear after the actual hardware system is connected. Using a simulator can enable you to enter this stage from the beginning, so as to find problems early and complete the debugging task faster.
Because the RAM inside the emulator can replace the ROM in the target system, you can also easily debug and modify program code and data in the ROM target system.
Similarly, when the target system has not yet installed memory, you can use the emulation memory in the emulator to debug the system. The size, resolution and image address of the emulation memory can be selected by the user.
6. Hardware performance analysis
Software simulators and target monitors can only simulate system operation and then perform performance analysis, but they already do a good job; emulators go a step further and perform performance analysis on actual hardware, which increases accuracy. In addition, using actual hardware can reveal errors that cannot be found in software simulation. False interrupts and other faults may unexpectedly consume CPU resources, causing serious performance problems that are difficult to find. Using the performance analysis of the emulator, these problems are easily exposed.
7. Connect the emulator to the target system
Connecting the emulator to the target system is easy. Most problems are solved by the emulator company and its agents. Connecting requires two steps:
First, you need to select the appropriate adapter connection method, preferably welding and socket. The P51XA series MCU simulator supports two target connection methods: PLCC socket and surface mount. Clip-on adapters are expensive and unreliable, so they are not recommended for users.
Then, the software and jumpers on the emulator must be configured correctly to match the target board and the software initialization routine. This is simple and good technical support should cover this. Nohau's emulators usually work with the default settings.
For the P51XA series MCU, just solder a chip socket (PLCC or surface mount) on the user's target board, insert the EMUL51XA-PC feature board adapter connector, and run the debugging software on a PC or laptop. Then you can test the target system with the TIme.c test program provided with the simulation!
8. Conclusion
This article provides some information about in-circuit emulators and the benefits they bring to you as an embedded system designer. Based on your needs, you will make a more appropriate choice of development tools in product development.
Previous article:STM32-F2 MCU in factory automation
Next article:Analysis and summary of problems in ARM embedded systems
Recommended ReadingLatest update time:2024-11-16 17:51
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- EEWORLD University Hall----Live Replay: 3 hours of practice + analysis: TI engineers take you step by step to fully get started with MSP430
- Share the requirements and characteristics of current detection resistors
- The gap between the actual filter circuit and the simulation is too large
- Modify system time in docker container
- TI DSP bootloader and online upgrade
- Questions about creating schematic package in Orcad
- EEWORLD University Hall----Live Replay: Dadatong helps you unlock the new generation of ADAS technology
- What are the six axes in a six-axis robot?
- Three-phase sensorless sine wave BLDC drive (MS39549 and MS39545)
- October 21 Live Review: ADI Inertial MEMS Applications (including video, presentation documents, Q&A)