Tool software running method, device, equipment and medium

By detecting anomalies in the foreground and background task scheduling of the tooling software, reading status information, and calling task functions, and by employing time-slice polling and state machine management, the problem of unstable operation of the tooling software was solved, thereby improving the stability and efficiency of the software operation.

CN116339207BActive Publication Date: 2025-11-18SHENZHEN COMEN MEDICAL INSTR
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310319406.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-22
Publication Date
2025-11-18
Estimated Expiration
2043-03-22

AI Technical Summary

Technical Problem

The tooling software is unstable due to abnormal task scheduling between the front-end and back-end, which affects the readability of the program logic and maintenance efficiency, and is prone to generating statements that are not related to business logic, which also affects the stability of the program.

Method used

By detecting whether the foreground and background task scheduling of the tooling software is abnormal, reading the status information of the system tasks, judging whether the scheduling conditions of the task function are met based on the first running interval and the first execution cycle, and calling the task function when the conditions are met, the task scheduling is performed using time slice polling and state machine management.

Benefits of technology

It improves the stability and efficiency of the tooling software, avoids prolonged CPU resource occupation, achieves multitasking, and reduces the CPU usage time per run.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116339207B_ABST
    Figure CN116339207B_ABST
Patent Text Reader

Abstract

The application provides a tool software running method, device, equipment and medium, whether the front and background task scheduling of tool software appears abnormal situation is detected, if the front and background task scheduling appears abnormal situation, the state information of system task is read, whether the scheduling condition of task function is met is judged according to the first running interval and the first execution period, if the scheduling condition of task function is met, the task function is called. That is, when the front and background task scheduling appears abnormal situation, the task function is called to avoid the situation of always executing a certain task, thereby ensuring the stability of software running. At the same time, the process of calling the task function belongs to the time slice polling mode, the execution time of CPU can be divided into blocks, and the execution state time is short enough, so that the effect of multitasking can be realized, the CPU single running occupation time is reduced, and the software running efficiency is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and more specifically to the method, apparatus, equipment and medium for running tooling software. Background Technology

[0002] Currently, due to the limitations of MCU internal resources and the lack of requirements for complex algorithms and data structures in the program, tooling software typically does not use an Operating System (OS) to avoid consuming most of the resources. Therefore, most common tooling software framework designs are front-end and back-end systems.

[0003] Because of the high coupling (correlation) between the main program and interrupts in the front-end and back-end systems, the main program and interrupts can easily become entangled. Careful handling is necessary to prevent unforeseen circumstances. This can also lead to some unrelated business statements that affect the program's logic and reduce its readability. In addition to affecting work efficiency when maintaining and porting tool programs, if the details are not fully taken into account, the stability of operation cannot be guaranteed.

[0004] Therefore, existing technologies need to be improved. Summary of the Invention

[0005] The main objective of this invention is to provide a method, apparatus, device, and medium for running tooling software, so as to at least solve the technical problem of poor stability in the operation of tooling software in related technologies.

[0006] A first aspect of the present invention provides a method for running tooling software, comprising:

[0007] Detect whether there are any abnormalities in the front-end and back-end task scheduling of the tooling software;

[0008] If an abnormal situation occurs in the foreground and background task scheduling, the status information of the system task is read; wherein, the status information of the system task includes the first running interval and the first execution cycle;

[0009] Determine whether the scheduling conditions of the task function are met based on the first running interval and the first execution cycle;

[0010] If the scheduling conditions of the task function are met, the task function is invoked.

[0011] A second aspect of the present invention provides a tooling software running apparatus, comprising:

[0012] The detection module is used to detect whether there are any abnormalities in the front-end and back-end task scheduling of the tooling software;

[0013] The reading module is used to read the status information of the system tasks if an abnormal situation occurs in the foreground and background task scheduling; wherein, the status information of the system tasks includes a first running interval and a first execution cycle;

[0014] The judgment module is used to determine whether the scheduling conditions of the task function are met based on the first running interval and the first execution cycle.

[0015] The calling module is used to invoke the task function if the scheduling conditions of the task function are met.

[0016] A third aspect of the present invention provides an electronic device, including a memory, a processor, and a bus;

[0017] The bus is used to enable communication between the memory and the processor;

[0018] The processor is used to execute computer programs stored in the memory;

[0019] When the processor executes the computer program, it implements the steps in the method for running the tooling software provided in the first aspect.

[0020] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it implements the steps in the method for running the tooling software provided in the first aspect.

[0021] The tooling software operation method, apparatus, equipment, and medium of this invention detect whether there are any abnormalities in the foreground and background task scheduling of the tooling software. If an abnormality occurs, the system task status information is read, and the scheduling conditions of the task function are determined based on the first running interval and the first execution cycle. If the scheduling conditions are met, the task function is called. In other words, when this technical solution is implemented, if an abnormality occurs in the foreground and background task scheduling, calling the task function avoids the situation where a single task is continuously executed, thereby ensuring the stability of software operation. Furthermore, the process of calling the task function is a time-slice polling method, which can redistribute the CPU execution time into blocks, each with a corresponding state to complete. Since the execution state time is sufficiently short, multi-tasking can be achieved, reducing the CPU's single-run time and greatly improving software operating efficiency. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 A schematic diagram of the basic flow of the tooling software operation method provided in an embodiment of this application;

[0024] Figure 2 This is a schematic diagram illustrating the task execution of a front-end system and a back-end system according to an embodiment of this application;

[0025] Figure 3 A detailed flowchart illustrating the operation method of the tooling software provided in an embodiment of this application;

[0026] Figure 4 A schematic diagram of the program modules of a static code scanning device provided in an embodiment of this application;

[0027] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0028] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0029] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0030] It should be noted that related terms such as "first" and "second" can be used to describe various components, but these terms do not limit the component. These terms are only used to distinguish one component from another. For example, without departing from the scope of the invention, the first component can be referred to as the second component, and the second component can similarly be referred to as the first component. The term "and / or" refers to any one or more combinations of related and descriptive terms.

[0031] Please see Figure 1 and Figure 2 The present invention provides a method for running tooling software, which includes the following steps:

[0032] Step S101: Check whether there are any abnormalities in the front-end and back-end task scheduling of the tooling software.

[0033] It should be noted that the design of tooling software frameworks often combines a front-end system and a back-end system. The back-end system typically executes an application that runs in an infinite loop, calling corresponding functions to complete specific operations. The front-end system, on the other hand, typically executes interrupt service routines and handles asynchronous events.

[0034] Specifically, the foreground and background task scheduling of tooling software refers to the relationship between the execution of tasks by the foreground system and the background system. During detection, the execution status of both foreground and background tasks can be used to determine if any abnormalities have occurred. For example, this can be determined by analyzing whether the execution statuses of the two tasks are intertwined (mutually interfering). Generally, due to the high coupling (correlation) between the main program and interrupts, this can cause the main program (executed by the background system) and interrupts (executed by the foreground system) to become entangled, resulting in abnormalities in the foreground and background task scheduling. If this is not addressed, it will affect the stability of the tooling software. For example, for some peripherals, after the MCU (microcontroller) executes its statements, it will delay and wait for the peripheral to complete its preparation. During this time, the MCU does not perform any effective operations, wasting system resources and, in actual use, wasting the operator's time. Therefore, it is essential to determine whether abnormalities have occurred in the foreground and background task scheduling of the tooling software in order to execute subsequent processing steps.

[0035] It's important to further clarify that time-sensitive critical operations must be guaranteed through interrupt service routines. Because the information provided by an interrupt service routine isn't processed until the background program reaches the step where it needs to be processed, such a system is less timely in processing information than is practically possible. This results in task-level response time, and in the worst case, the task-level response time depends on the execution time of the entire loop. Since the execution time of a loop is not constant, the exact time it takes for the program to complete a specific part is also uncertain, ultimately causing anomalies in foreground and background task scheduling.

[0036] Step S102: If an abnormal situation occurs in the scheduling of foreground and background tasks, read the status information of the system tasks.

[0037] Specifically, if an anomaly occurs in the current background task scheduling, the system task status information is read, such as the first running interval and the first execution cycle of the system task. The difference between the running interval and the execution cycle is that the running interval refers to the time interval between the start of the last execution and the next execution, while the execution cycle refers to a point in time determined from (specified time + delay) or (current time + delay).

[0038] It should be understood that while the running interval and execution cycle may seem similar, the differences lie in the following: a. For Timer, the execution time of a TimerTask cannot be precisely determined; it depends on the execution time of preceding tasks. For example, if a preceding task enters an infinite loop, it will never have a chance to execute. b. The expected execution time of a task with an execution interval is uncertain; its specific execution time is impossible to determine. c. The expected execution time of a task with a execution cycle is determined, but its specific execution time is impossible to determine. d. Tasks with a time cycle execute periodically, while other tasks execute only once. e. TimerTasks can be canceled by setting their own status properties.

[0039] Step S103: Determine whether the scheduling conditions of the task function are met based on the first running interval and the first execution cycle.

[0040] Specifically, after obtaining the first running interval and the first execution cycle of the system task, the scheduling conditions of the task function are checked using the first running interval and the first execution cycle. The scheduling conditions of the task function can be pre-set to the condition that the first running interval is greater than the first execution cycle; therefore, the satisfaction of the scheduling conditions can be determined based on the relationship between the first running interval and the first execution cycle.

[0041] Step S104: If the scheduling conditions of the task function are met, call the task function.

[0042] Specifically, when the scheduling conditions for the task function are met based on the first running interval and the first execution cycle, indicating that the system task cannot be completed within a single time slice, a situation arises where a single task is continuously executed, resulting in a bare-metal loop (foreground / background system). In this case, calling the task function, such as an unpacking function, key scanning function, LED control function, or task scheduling detection function, prevents the continuous execution of a single task and ensures the stability of the software operation.

[0043] Furthermore, steps S101 to S104 above belong to the system-level task scheduling process (time-slice polling), used to schedule unpacking functions, key scanning functions, LED control functions, detection task scheduling functions, etc. In the above mechanism, for software programming with long tasks, the task needs to be divided into states, and each scheduling only completes one state (during this process, the execution time cannot be extended to a length longer than the time slice using a delay-like method; only a short delay shorter than the time slice can be executed). This allows the CPU execution time to be re-divided into blocks, each with a corresponding state to complete, and the execution state time is short enough to achieve the effect of multitasking, reducing the CPU's single-run time and greatly improving software running efficiency.

[0044] In an optional embodiment of this example, before step S101: detecting whether there is an abnormality in the foreground and background task scheduling of the tooling software, the method further includes: performing data initialization processing on the tooling software, clearing the interface corresponding to the microcontroller controlled by the tooling software, creating a system task through the tooling software, and setting the entry function and first execution cycle of the system task. Specifically, the data initialization processing of the tooling software refers to clearing the historical usage data of the tooling software, and the clearing of the microcontroller interface refers to adjusting the usage state of the interface to the initial state. After completing the above initial processing of software and hardware, a system task is created through the tooling software, and the entry function and first execution cycle of the system task are set, thus completing the preparation stage.

[0045] In an optional implementation of this embodiment, step S103, the step of determining whether the scheduling conditions of the task function are met based on the first running interval and the first execution cycle, specifically includes: calculating the difference between the first running interval and the first execution cycle, comparing the difference with 0 to obtain a comparison result, and determining whether the scheduling conditions of the task function are met based on the comparison result. Wherein, when the scheduling condition of the task function is preset to be that the first running interval is greater than the first execution cycle, the comparison result between the difference between the first running interval and the first execution cycle and 0 can reflect the size relationship between the first running interval and the first execution cycle, thereby accurately determining whether the scheduling conditions of the task function are met based on the comparison result. For example, if the comparison result is that the difference is greater than 0, then the task function is invoked.

[0046] In an optional embodiment of this example, the step of calling the task function in step S104 specifically includes: reading the status information of the tooling inspection task, detecting whether the second running interval is greater than the second execution cycle, if the second running interval is greater than the second execution cycle, determining whether the precondition of the tooling inspection task function is met, if the precondition of the tooling inspection task function is met, reading the tooling inspection task function and executing the corresponding statement, and incrementing the counter of the tooling inspection task by 1.

[0047] Specifically, the task functions include tooling inspection task functions. During the call to a task function, the status information of the inspection task is first read to obtain the task's status information, namely the second running interval and the second execution cycle. Then, based on the second running interval and the second execution cycle, it is determined whether a preset size relationship is met. If the second running interval is greater than the second execution cycle, it is further determined whether the preconditions of the task function are met. If the preconditions are met, the task function is finally read and the corresponding statements are executed, and the task function's counter is incremented by 1. That is, the above process of calling task functions belongs to the inspection task scheduling process (time-slice polling), used to schedule tooling inspection tasks, such as power supply voltage detection and power supply short circuit detection. The internal functions of the inspection task are executed in blocks (state machine management).

[0048] Thus, this technical solution forms a two-layer scheduling process: the first is a system-level task scheduling process (time-slice polling), used to schedule unpacking functions, button scanning functions, LED control functions, detection task scheduling functions, etc.; the second is a detection task scheduling process (time-slice polling), used to schedule tooling detection tasks, such as power supply voltage detection, power supply short circuit detection, etc., with the internal functions of the detection tasks executed in blocks (state machine management). This uses time-slice polling + state machine to achieve pseudo-multithreading, which can achieve multithreading when the execution time is short enough.

[0049] In an optional embodiment of this example, after determining whether the scheduling conditions of the task function are met based on the first running interval and the first execution cycle, the method further includes: if the scheduling conditions of the task function are not met, incrementing the counter of the task function by 1 and returning to the step of reading the status information of the system task. That is, when the scheduling conditions of the task function are not met, it is not an infinite loop situation, and there is no need to call the task function to avoid the foreground and background systems from becoming entangled, thus returning to the step of reading the status information of the system task.

[0050] Please see Figure 3 , Figure 3 The method described in this application embodiment is a refined method for running tooling software, which includes:

[0051] Step S301: Initialize the data of the tooling software, clear the interface of the microcontroller controlled by the tooling software, create a system task, and set the entry function and the first execution cycle.

[0052] Step S302: Obtain the foreground task execution status and background task execution status of the tooling software, and check whether any abnormalities occur based on the foreground task execution status and background task execution status.

[0053] Step S303: If an abnormal situation occurs in the foreground and background task scheduling, the status information of the system task is read; wherein, the status information of the system task includes the first running interval and the first execution cycle;

[0054] Step S304: Calculate the difference between the first running interval and the first execution cycle, compare the difference with 0 to obtain the comparison result, and determine whether the scheduling conditions of the task function are met based on the comparison result;

[0055] Step S305: If the scheduling conditions of the task function are met, read the status information of the tooling detection task and check whether the second running interval is greater than the second execution cycle.

[0056] Step S306: If the second running interval is greater than the second execution cycle, determine whether the preconditions of the tooling inspection task function are met. If the preconditions of the tooling inspection task function are met, read the tooling inspection task function and execute the corresponding statement, and increment the counter of the tooling inspection task by 1.

[0057] By implementing this technical solution, when anomalies occur in the foreground and background task scheduling, calling task functions prevents the continuous execution of a single task, thus ensuring the stability of software operation. Furthermore, the process of calling task functions uses a time-slice polling method, which redistributes CPU execution time into blocks, each with corresponding states to complete. Since the execution time of each state is sufficiently short, multitasking can be achieved, reducing the CPU's single-run time and significantly improving software operating efficiency.

[0058] Figure 4 This application illustrates a tooling software running apparatus provided in an embodiment of the present application, comprising:

[0059] Detection module 401 is used to detect whether there are any abnormalities in the front-end and back-end task scheduling of the tooling software;

[0060] The reading module 402 is used to read the status information of the system task if an abnormal situation occurs in the foreground and background task scheduling; wherein, the status information of the system task includes the first running interval and the first execution cycle;

[0061] The judgment module 403 is used to determine whether the scheduling conditions of the task function are met based on the first running interval and the first execution cycle;

[0062] Module 404 is invoked to call the task function if the scheduling conditions of the task function are met.

[0063] Based on the implementation of the above-mentioned tooling software running device, pseudo-multithreading is achieved by using time-slice polling + state machine. The execution time of the MCU is divided into blocks, and then the time of these blocks is allocated according to its own needs. When the execution time of your task (the task implemented in the time-slice polling method) is short enough, multithreading can be achieved, reducing the time occupied by the CPU in a single run and greatly improving the software running efficiency.

[0064] Figure 5 An electronic device provided in an embodiment of the present invention is shown. This electronic device can be used to implement the tooling software operation method in any of the foregoing embodiments. The electronic device includes:

[0065] The system includes a memory 501, a processor 502, a bus 503, and a computer program stored in the memory 501 and executable on the processor 502. The memory 501 and the processor 502 are connected via the bus 503. When the processor 502 executes the computer program, it implements the tooling software operation method described in the foregoing embodiments. The number of processors can be one or more.

[0066] Memory 501 can be high-speed random access memory (RAM) or non-volatile memory, such as disk storage. Memory 501 is used to store executable program code, and processor 502 is coupled to memory 501.

[0067] Furthermore, embodiments of this application also provide a computer-readable storage medium, which may be disposed in the electronic device in the above embodiments, and the computer-readable storage medium may be a memory.

[0068] The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the tooling software operation method described in the foregoing embodiments. Furthermore, the computer-readable storage medium can also be a USB flash drive, a portable hard drive, a read-only memory (ROM), RAM, a magnetic disk, or an optical disk, or any other medium capable of storing program code.

[0069] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.

[0070] The modules described as separate components may or may not be physically separate. Similarly, the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0071] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0072] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned readable storage medium includes various media capable of storing program code, such as USB flash drives, external hard drives, ROM, RAM, magnetic disks, or optical disks.

[0073] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0074] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0075] The above are merely preferred embodiments of the present invention and do not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A method for running tooling software, characterized in that, include: Detect whether there are any abnormalities in the front-end and back-end task scheduling of the tooling software; If an abnormal situation occurs in the foreground and background task scheduling, the status information of the system task is read; wherein, the status information of the system task includes the first running interval and the first execution cycle; Calculate the difference between the first running interval and the first execution cycle, and compare the difference with 0 to obtain the comparison result; Based on the comparison results, it is determined whether the scheduling conditions of the task function are met; wherein, the scheduling condition of the task function is that the running interval is greater than the execution cycle; If the scheduling conditions of the task function are met, the task function is invoked; If the scheduling conditions of the task function are not met, the counter bit of the task function is incremented by 1, and the process returns to the step of reading the status information of the system task.

2. The method for running the tooling software as described in claim 1, characterized in that, Before the step of detecting whether there is an abnormality in the foreground and background task scheduling of the tooling software, the method further includes: Perform data initialization processing on the tooling software; The interfaces corresponding to the microcontroller controlled by the aforementioned tooling software are cleared. The system task is created using the tooling software, and the entry function and first execution cycle of the system task are set.

3. The method for running the tooling software as described in claim 1, characterized in that, The step of invoking the task function if the scheduling conditions of the task function are met specifically includes: If the comparison result is that the difference is greater than 0, then the task function is invoked.

4. The method for running the tooling software as described in claim 1, characterized in that, The task functions include tooling inspection task functions; The step of calling the task function specifically includes: Read the status information of the tooling inspection task, wherein the status information of the tooling inspection task includes a second running interval and a second execution cycle; Detect whether the second running interval is greater than the second execution cycle; If the second running interval is greater than the second execution cycle, then determine whether the preconditions of the tooling detection task function are met; If the preconditions of the tooling inspection task function are met, the tooling inspection task function is read and the corresponding statement is executed, and the counter of the tooling inspection task is incremented by 1.

5. The method for running the tooling software as described in claim 1, characterized in that, The step of detecting whether there are any abnormalities in the foreground and background task scheduling of the tooling software specifically includes: Obtain the execution status of foreground and background tasks of the tooling software; The system checks for any abnormalities based on the execution status of the foreground and background tasks.

6. A tooling software running device, characterized in that, The detection module is used to detect whether there are any abnormalities in the front-end and back-end task scheduling of the tooling software; The reading module is used to read the status information of the system tasks if an abnormal situation occurs in the foreground and background task scheduling; wherein, the status information of the system tasks includes a first running interval and a first execution cycle; The judgment module is used to calculate the difference between the first running interval and the first execution cycle, compare the difference with 0 to obtain a comparison result, and determine whether the scheduling condition of the task function is met based on the comparison result; wherein, the scheduling condition of the task function is that the running interval is greater than the execution cycle; The calling module is configured to call the task function if the scheduling conditions of the task function are met; and to increment the counter bit of the task function by 1 and control the reading module to read the status information of the system task if the scheduling conditions of the task function are not met.

7. An electronic device, characterized in that, Includes memory, processor, and bus; The bus is used to enable communication between the memory and the processor; The processor is used to execute computer programs stored in the memory; When the processor executes the computer program, it implements the steps in the method for running the tooling software according to any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps in the method of running the tooling software according to any one of claims 1 to 5.