Simulator development and embedded system kernel debugging

xiaoxiao2021-03-06  44

Simulator development and embedded system kernel debugging lmjx 2004-12-25

Limiao@yeah.net

First, the development of the simulator

1. What is a simulator?

The simulator is a set of applications that run on a OS (Linux or Windows), providing analog to the target board function, including interrupt systems, RAM, FLASH systems, and target OS to host OS tasks. Mapping.

2. The difference between the simulator and the virtual machine

The simulator is different from the virtual machine, the virtual machine from the perspective of the device simulates a target board, which is fine to provide support for each processor instruction, and the simulator simulates from the perspective of the function, the focus is on the target OS operation status Monitor and monitoring logic. Convenient to debug system kernels, as well as feasibility investigation in the initial stage of development. In addition, the simulator provides simulation at the C language level, so regardless of what the target OS is based on what CPU, as long as it is written in C, the simulator can provide analog to it.

3. How to develop simulators in a Windows environment

3.1. Basic construction of the simulator

A basic simulator can provide an analog, memory, and stack simulation of the interrupt system, and the simulation of the stack can run the embedded real-time kernel. Of course, we need an input and output devices to intervene and monitor embedding. The operation of the kernel.

3.2. Interrupt system

The interrupt system is the core of the simulator because the scheduling of the task is inherently completed (non-seizures system exceptions). Take SIMUOS as an example, there are 8 interrupt sources, including exceptions, clocks, serial ports, keyboards, and more. In order to mitigate the burden on the simulator, only one interrupt event is generated, and then the interrupt route is performed by query.

3.3. Task mapping

Task mapping is the main difference between the simulator and the virtual machine. The virtual machine does not require task mapping, so it is impossible to understand the running logic and operational state of the embedded core, and can only be inferred by observing the register. The simulator records each target OS task and unifies the operations of their operation and achieves the purpose of monitoring and intervention.

3.4. other

The simulation of the LCD and keyboard.

Second, real-time kernel transfer

1. Transplantation

The only premise of transplant is that we must have the source code of the target OS.

2. Precautions at the time of transplantation

Note that the interrupt system is hung, pay attention to the installation of the task manager.

3. Example in ucosii (seizure)

Ucosii is a priority preemptive real-time system core, which is widely used in industrial control, due to its source opening

Therefore, it is favored by students and the majority of embedded enthusiasts. However, for beginners, the embedded system is like a black box, although there is code to experience the charm of its runtime. Transplant it onto the simulator, we can not only observe UCOSII task management, but also set breakpoints to debug your own procedures. Transplanted source code and DEMO program please download: www.mshowtec.com

4. Example of RTKE (non-seouup)

RTKE is a real-time core application in the Philip phone solution. The maximum disadvantage of the kernel is non-preemptive, and a Task must give yourself to give the use of CPUs to make other high priority tasks to schedule. Therefore, it must be very careful in it, and we can track where each message is sent by the simulator, the usage status of each session, the state of the current memory, and the like. Demo program, please download it yourself: www.mshowtec.com

Third, the VC environment debugging

1. Advantages and disadvantages of debugging under simulator

The advantage is intuitive and convenient, the disadvantage is that many of the simulator is not a real hardware environment, so many of the hardware-dependent code cannot be commissioned, but for debugging system kernels and ordinary applications are already enough, especially in solving the system The lock problem is the most useful tool. 2. Debug means and method

You can use the debugging tool provided by the simulator itself to analyze the system state, or you can add your own Trace information in the OS code to track the operation of the system, please refer to the two examples provided above.

Fourth, small knot

Through the development of the simulator Simuos, and the transplantation of several real-time kernels, we found that under the embedded field is the basic education, and each of the engineers engaged in embedded development will only have a work in the embedded system. Comparative complete and profound understanding, if each university can make our students transplant one or even a few embedded system kernels during school, then our graduates will have significant improvement. SIMUOS This project is developed for this purpose, hoping to bring help to students or engineers who are learning or intending to study embedded development.

转载请注明原文地址:https://www.9cbs.com/read-76263.html

New Post(0)