Know WinCe

zhaozj2021-02-11  241

Real-time system with Microsoft Windows CE

Describe the Embedded Application of Microsoft Windows CE Rapid Reactions often manages strict time reactions. For example, manufacturing process control, high-speed data acquisition equipment, telecommunications equipment, medical equipment, air "wired" control, weapon launch equipment, space navigation, and navigation, laboratory, experimental control, automotive engine control, robot system. In order to ensure this function, it means not only calculating accuracy, but also has the time of results, which must be reacted within the specified time parameter. The broad definition of real-time system is "system-defined system for any external stimulus, computer makes timely reactions", and standard definitions in Internet NewsGroup Corp RealTime Group. Real-time definition is: a real-time system has the correct correctness, not only on the correct logic, but also includes timely results. If the system time limit condition is not reached, the system is also invalid. Criterize the difference between real-time systems and real-time operating systems (RTOS), real-time system represents all system components - hardware, operating systems and applications - it needs to achieve system requirements, real-time operating system (RTOS) is just the entire real-time An integral part of the system, it must provide sufficient features to ensure that the entire real-time system meets the requirements. Similarly, it is also important to understand the difference between the fast operating system and the real-time operating system. Although it is very useful for an RTOS to achieve comprehensive requirements, it is not its own request. Internet Neusgronp Cornp.RealTime lists the requirements that must be achieved as a real-time operating system:

OS (operating system) must be multi-threaded and prioritized. OS must support thread priority. A priority inherited system must exist. OS must support predictable threads, synchronous transmission mechanisms.

In addition, OS behavior must be predictable, which means that the developer of real-time systems must be interrupted, system calls, and division of the system:

You must know that the data matching of the OS and device drives matches the maximum time. The device driver is used to handle an interrupt date and an interrupt application information about these drives must be clear. Interrupt response (from interrupt to runtime), must predict and meet functional requirements.

Each system call time must be predictable and independent of the number of objects. This paper discusses how the Microsoft Windows CE operating system reaches a real-time system requirement, and more meaningful is that Windows CE guarantees the upper limit of a time, it starts a real-time priority thread after receiving the interrupt. This paper discusses the "ODO" platform for microprocessors with Hinathi SH3 for a particular reference platform. Microsoft Windows CE An Introduction Microsoft Windows CE is designed to be a general-purpose operating system for small devices (it is typically a diskless system with limited memory). Windows CE can be used to set a hardware platform by designing a layer between kernel and hardware, this is a well-known hard disk compression layer (HAL), which is called OEMC (original device manufacturing) adaptation. Layer, ie oal; kernel compression layer, kaal. To avoid confusion with Microsoft's Windows NT operating system HAL) is not like other Microsoft Windows operating systems, Windows CE does not represent software applicable to all platforms. In order to be flexible to meet the extensive product demand, Windows CE uses standard mode, which means that it can be selected by a series of software modes to make the product customization. In addition, some available modes can also be part of their components, which means that these modes can be selected from a set of available components, thus becoming a standard mode, and can achieve the smallest mode of the system requirements, OEM can Reduce the operation of the storage script and the operating system. Windows CE For the VC 5.0 development system embedded kit, the system library, tools, text, and sample code provide OEMS to customize the Windows CE standard for a particular hardware platform. The embedded kit also includes a device driver package (DDK) and software development package (SDK), DDK provides additional text, SDK provider, header file, sample code, text, developers, based on Windows CE The platform is written. Windows CE provides the same program interface for other window operating system development functions, for example, 500 of the Windows CE version 1.01 supports approximately 1000 Microsoft WIN 32 API functions. This means a large number of different types of tools, third-party books, and the WIN 32 developer training tutorial, can replace or use developers of the Windows CE system. The real-time system developers can use, with an embedded kit for VDFF 5.0 to transfer the operating system to a specific platform and develop additional device drivers and real-time features for this platform. Threads and Thread Priority Level Windows CE is a priority multitasking operating system that allows multiple functions, processes, running Windows CE to support the maximum 32-bit synchronization process in the same time system. A process includes one or more threads, each thread represents a separate portion of the process, a thread is specified as the basic thread of the process, and the process can also create an extra number of additional threads, additional thread actual number, only available System resource is limited. Windows CE uses the priority-based time tablet algorithm to arrange thread execution, Windows CE supports eight different priorities, from 0 to 7, 0 represents the highest level, which is defined in header file Winbasw.h. Priority Description 0 (Maximum) Key Thread Priority (Top Priority Level) 1 Ultra-thread Priority 2 High Thank usual Thread Priority 3 Usually Thread Priority 4 Lower 5 Minimum Thread Priority 6 High Idle thread priority 7 (minimum) IDLE thread priority (minimum priority)

Levels 0 and 1 are usually as real-time processes and device drivers, and level 2-4 is made as threads and usual functions. The level 5-7 is made lower than other functional levels, and the level 6 is current state and has a stable connection. The only thread priority is depends on the thread priority, the thread arrangement of advanced priority is prioritized, the same priority thread, runs in a cycle priority, that is, each thread accepts custom time or time slice, quantitative time default value For 25 milliseconds (Windows CE 2.0 supports changes in the MIPS platform to change the quantitative time). The lower priority thread is running until the higher thread is completed, but also until they or give up or stop. An important exception is the highest priority thread (level 0, critical time priority) is not shared with other threads, which continuously until they are completed. Unlike other Microsoft window operating systems, Windows CE is fixed, it does not match the interrupt based on this introduction priority, they can temporarily change, but can only pass the Windows CE core to avoid so-called "priority inversion". The priority of the priority refers to the low priority thread when they compete with the same resource, hinder the utilization of high priority threads on resources. In order to correct this situation and liberate higher priority threads, Windows CE allows low priority to inherit, strict thread priority, and runs higher priority until it releases the resources used. For example, if a thread runs at the highest priority run attempts to take the mutex, the thread of the low-level priority becomes advanced priority, and runs until it releases the mutex. The priority is inverted for all threads of the system. For example, even the kernel thread running at the priority 1 can be converted to the level 0, and if the priority 0 thread runs the memory code, block errors will cause block errors. Based on the priority multi-task design, ensure that the thread running at the lowest level is performed in a pre-known time period. This paper discusses the setting response later, for the specified platform and formula, and obtain numbers by other platforms. In DAK and SDK tools, thread status and priority are displayed, and depicts the specified real-time system operation profile. Thread synchronization real-time system must guarantee the process and thread synchronization, for example, if a part of the real-time application is completed before another part is obtained, the management process of this application may be unstable, and the synchronization will ensure that it is correct. Like other Windows operating systems, Windows CE provides a rich "wait object" for threads, including key departments, events, muters, some waiting objects, allowing a thread to slow down its operation and wait until the specified event occur. Windows CE places the mutex, key section, and event requests "first in first out, priority (FIFO)" sequence: Different first first out sequence sequences define eight different priorities, at a given priority The thread request will be placed at the end of the priority list, and when the priority is inverted, the scheduler adjusts these sequences. In addition to waiting for objects, Windows CE supports standard WIN 32 time API functions, these from kernel applications, software interrupts will get time intervals, which are used to manage real-time applications. By calling the GetTickCont function, it can return a few milliseconds, the thread can use the system interval. For more detailed time information, the Windows CE kernel also supports Win 32 API functions QueryPerformanRecounter and QueryperFormantefrequency. OEM must provide hardware and software support for these calls, which provides a higher time resolution and OAL interface other.

Other aspects Consider Windows CEs provide an important storage system, for example, when some of which is currently running Windows CE, Windows CE supports an important 2GB address space, each process is coupled to its own 32MB Physical space, when it needs to generate a memory paging interrupt (this may affect the thread execution time), physical memory for thread code or data memory page. Memory paging input and output will be lower than real-time processes. In the real-time process, memory is still free to appear, but this ensures that the actual memory management of the background will win real-time system priority. Real-time threads should be locked in memory to prevent these irrelevant memory pairs from hindering their operation, they may occupy the actual memory management system. Windows CE allows mapping, which will share the same physical memory in a plurality of processes, resulting in a coordinated process or drive and mapping fast data transfer, and memory maps can dramatically enhance real-time operation. Interrupt processing: IRQS ISRS and ISTS real-time applications are set in the specified time interval, react to external events, real-time application use interrupt as a way to ensure that external events are known by the operating system. In Windows, the kernel and OEM adaptation layer (OAL) are set to optimize interrupts and scheduling of other parts of the system. Windows CE balanced operation and makes it easier by dividing the interrupt process into two parts: it is divided into interrupt service programs (ISR) and interrupt service threads (IST). Each hardware interrupt application line (IRQ) is connected to one ISR. When the interrupt is established and interrupted, the kernel calls the registered ISR, ISR is as short as possible as possible for the interrupt core mode portion. It first places the kernel on the appropriate IST. ISR performs its minimum processing and returns a ID number to the kernel, the kernel checks the interrupt ID number returns, and sets the relevant event, the interrupt service thread wait event. When the kernel sets the event, the IST stops waiting and start execution, additional interrupt processes, the interrupt processing is actually appearing in the IST, two highest thread priorities (level 0 and 1), usually specified as ISTS, to ensure these The thread is running fast enough. As mentioned earlier, in the most advanced ISTS cannot be occupied by other threads, these threads continue to perform until they are cut or give up. Windows CE cannot support group interrupts, which means that when another interrupt is processed, another different acceptance service, that is, if the kernel is in an ISR, it will always be executed until the ISR is ended for the new IRQ start ISR. This will cause delays between hardware interrupts and ISR starts, delay, and response time interrupt responses. Interrupt response This paper, the Intervupt Latency phrase mainly refers to a relatively interrupted, and the processing response is, that is, the time interrupts to the processor to the interrupt start processing. The Windows CE interrupt response time is a thread on the memory (when the memory response does not exist). This makes the calculation the worst event response to the total time of possible-interrupt service programs (ISR) start and interrupt service thread (IST) start D, until the total time of interrupt processing can be determined by the time calculated in ISR and IST. ISR Response General Formula is defined as follows: ISR Start Time = Value1 Disr_current SUM (Disr_higher)

Value1 = Response value by the kernel processing process

Disr_current = interrupts the ISR duration in the time program. This value ranges from 0 to the longest ISR duration

SUM (Disr_hig) = All the higher level ISRS duration before ISR, that is, interrupts arriving between time Vahe1 DISR-CUMENEU, for example, consider an embedded system with critical priority ISR, because ISR is set to the most Advanced, this is the ISRS DISR-Higher value of 0. When there is no other ISRS minimum response, in the program, it is the longest ISR cycle in the Value1 plus system in the program. When the interrupt arrives, it is exactly the longest ISR in the system. The IST response cycle is defined as follows: IST start time = value2 sum (dist) sum (Disr)

Value2 = response value by the kernel

SUM (dist) = All appearance in ISR and IST, starting priority ISTS and thread context transition time.

SUM (DISR) = other ISRS durations run between the interrupt (?) ISR and its IST run.

The simplest example - embedded system with a critical ISR and a critical thread (no other 0 priority thread) - No other ISTS can be interrupted between ISR and IST, however in key level ISR Other ISRS in the start of IST it can be processed. Once ISRS can be obtained, it can be processed, which is easy to imagine a pathological condition, involving a continuous ISRS stream, resulting in uncertain delay. The start of IST cannot appear because OEM is controlled to the interrupt in the system. Because OEMs are designed for specific operating systems, traditional Windows CE versions are designed. OCM uses target operating environment restrictions to optimize system design. To reduce the response time, OEM control ISR and IST processing time interrupt priority thread priority. The Value1 and Walue2 representatives in the formula, the processing time in the Windows CE kernel, which is an OEM that is not controlled, and the research work involves these confirmation values. Make sure that both different ways to operate in real-time operation of Windows CEs are used to ensure Windows CE operations:

Internal inspection or analysis of kernel code, OEM, and ISV (Independent Solder Salers) by the Windows CE development group, using some of the Future Windows CE version embedded toolkit (for VCFT) to ensure a specific configuration.

The embedded kits of Windows CE About VC include the following tools:

(A tool version and INTRTICT.ext application for the kernels of time-study, the maximum, minimum, average time of the interrupt process. Microsoft can also develop other timing tools for customers.

The Windows CE development group has checked the kernel code to confirm that it can be marked by the worst case, it is independent of the number of system objects. In order to use this check, the kernel is characterized into a set of kcalls or system calls, and the kernel shutdown priority is that they are kernel programs, and other threads are not allowed, the worst event time, this time, real-time processes, standard operation, it The worst event KCALL time can be obtained in the kernel (Note: These time does not affect the ISRS, only affect threads, such as ISTS). The development group found that this has no non-lasting loop in KCalls, which means: and all KCalls can represent a single-way branch, code path, and ensure that the worst event time is possible to find the worst event time through KCALL and independent of the input parameter. Finding the actual worst event time includes using in strum ented Kemal, this is just a kernel version, which is edited after setting the application environment, kcall_profice = 1 to ensure additional time-time function, this Instrument KEMEL is different from Debug Kemel The Instrument TED is used for a retail kernel, which is used to get a time-time value, which is often the uniqueness of shipping products, and the only difference between Retail Kernal and Instrument Kernel is its equipment. InstrumentTed Kernel records all KCall time, including minimal, maximum peace time, and can print into debug interfaces by calling dedicated API functions, Instrument Kernel usually runs in a strong state, then call DumpkCall Prefile Get time. Interrupt Test Application Software INTRTIME.EXE, in the Windows CE standard version collects the interrupt minute delay information, the application controls the system time in the test. Therefore, it is not suitable when the system needs time controller. For example, this application cannot be used with the kernel INSTRUMENTED version because it also requires time control. In the Windows CE 2 version (Beta version) test response, the intertime application runs 1000 interrupt tests on the ODOSH3 reference platform, the internal run is 58.98MHz, the external frequency of 14.745MHz, this test is in a standard H / PC configuration, it Includes all modes and combinations of Windows CE. Only the main operation system process is performed (Nk.exe, Filesys.exe, Gwes.exe, Device. EXE, Shell.exe, and Explover.exe), no user initial interrupt (touch screen, keyboard, or other application) in the test Software can report the following ISR and IST start, minimum, and maximum time: the maximum response, minimum (1000 test) ISR start 1.3-7.5 microsecond IST start 93-275 microseconds most test results, distributed in minimum value Near When testing ISR start time, minimum value 1.3 and 1.6 microseconds, there are 293 and 549 times, with 84% of the test, similar more than 90% (1000 times 923) START-OF-IST test Respond to 102 microseconds or less. The Intertime application also uses a user-specified number of system objects to test ISR and IST start time.

Although it is very primitive, it verifies that the ISR start time is independent of the number of system objects, and the test is set to 1000 times (except for special changes) and thread priority is 5 or 7. ISR starts the maximum rear stage thread, number (one event for each thread) Priority 8.4078.65 (Note: only 100 times) 79.010 (Note: only 100 times) 514.810519.210517.010712.820511.050 (Note: only 100 times) 710.050715.0100515.61007

This value is not a function of the number of system objects. Different values ​​may be studied by the interrupt when the kernel state is displayed, and the development group is currently studying to identify the ISR start the worst time value. Pushing by these results, assuming that the ISR starts a minimum representation of the best. At this time, Disr_current and SUM (Disr_htgbor) are 0, the smallest value 1 = ISR start value = 1.3 microseconds, similar settings are the best case, SUM (DIST) and SUM (Disr) are 0, the Value minimum = .Ist start value = 93 microseconds, single from the test results, it is not determined, value 1 or value 2 max. Additional time-time information can be collected by Instrument Kernel, spending time Valume2 before IST starting, can be calculated by the following formula: Value2 = DKCall DNEXTTHREAD

DKCall =. kernel call time; when eliminating priority, spend a part of the amount of time in the kernel.

DNEXTTHREAD = Next.Thread kernel call period. It costs time in IST.

In fact, at the level 0 level thread scheduling is fast than the next Thread, but this formula estimates the upper limit. The following table shows the worst event results when using Instrument Kernel, with the INTRTIME test.

The maximum value of the kernel call model (Ad-hoc.testing) maximum time value (the kernel call) 266 microseconds NEXT Thread237 microsecond total value 503 microseconds

Instrument Kernel shows that the Value 2 is 500 microseconds. This value is two worst events total time, far exceeds the results obtained by the Intritime application, also greater than the actual worst event time. For example: Through NextThread scheduling a thread of 0, it will not result in the worst event, which means that 500 microseconds are a conservative value higher than the actual worst event value. Intertime Utility is very useful for the worst event value from the overall observation, INSTRUMENTTED KEMEL For values ​​that can get the worst event, by kernel depicts the response reasons - an IST runs in these events, but runs at the kernel non-preferential part It will be hindered, and the worst event response of the system can be calculated by the sum of the worst events of each part. Note All test results in this paper are based on the internal Windows CE's beta. The currently existing operating systems and applications will continue to be corrected, and additional tests are performed to obtain system operations under different operating conditions. These values ​​will continue to be updated and published. To reflect on the current operating system version. to sum up

Microsoft Windows CE kernel is designed to reach RTOS minimal requirements to make Windows CEs in many different types of embedded and real-time systems as operating systems;

Windows CE multi-thread and priority, Windows CE supports personal thread priority; Windows CE supports priority inheritance to adjust the title level to modify the priority; Windows CE supports a predictable thread synchronization mechanism, including waiting objects Such as mutex critical parts, name or unnamed event object, is sorted based on thread priority. Windows CE also supports the connection with the system controller: OEM can control the interrupt processing supported by the system, that is, by executing ISRS and ISTS, it makes up for the interrupt processing software; OEM completes IRQS that mapped to the interrupt ID number, and It is associated with interrupt processing software (ISR and IST), depicting tools and applications can utilize record processing interrupt maximum time. Interrupt response is predictable and restricted. When the priority is canceled, the upper limit is expected to spend total amount in the core, match the conversion time, and the ISRS and ISTS application processing time executed by OEM. Each system call time is predictable, unrelated to the number of system objects, using the INSTRUMENTTED KERNEL system call time to ensure Windows CE kernel design guarantee interrupts and their related lines

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

New Post(0)