Real-time task scheduling system for adaptive MCU platforms

By using a real-time task scheduling system on an adaptive MCU platform, the problem of high coupling between the real-time task scheduling system and the hardware MCU platform is solved, achieving decoupling between the system software and the hardware MCU, and improving software reusability and development efficiency.

CN115480898BActive Publication Date: 2026-03-06LIANCHUANG AUTOMOBILE ELECTRONICS
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-22
Publication Date
2026-03-06

AI Technical Summary

Technical Problem

In existing technologies, real-time task scheduling systems are highly coupled with functional software and hardware MCU platforms, making it difficult for the software to adapt to different projects and MCU platforms, resulting in poor reusability and portability.

Method used

A real-time task scheduling system for an adaptive MCU platform is provided, including a system timer interrupt module, a static file module, a system configuration module, and an application module. It provides a reference clock source through a hardware MCU peripheral, generates a tick reference clock interrupt entry, and realizes open system initialization, task scheduling, and configuration parameters, supporting any hardware MCU platform and task scheduling function.

Benefits of technology

This decouples the system software from the hardware MCU, improving software reusability and portability, simplifying the development process, increasing development efficiency, and reducing costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115480898B_ABST
    Figure CN115480898B_ABST
Patent Text Reader

Abstract

This invention discloses a real-time task scheduling system for an adaptive MCU platform, comprising: a system timer interrupt module, which generates a corresponding tick reference clock interrupt entry point by providing a tick reference clock from a hardware MCU peripheral; a static file module including: a system initialization submodule, a system startup submodule, a system timing processing submodule, a system task scheduling processing submodule, and a system activation and startup task set function submodule; a system configuration module, which exposes all configuration parameters of the static file module for users to configure according to their needs; and an application module, which describes a collection of files for terminal task scheduling, and can integrate different main function task functions into corresponding periodic tasks to schedule and implement real-time execution of functional algorithms according to functional requirements. This invention can be adapted to any MCU platform with a system timer interrupt module peripheral, and has the technical advantages of easy implementation, easy integration, configurability, and high portability, which can significantly improve development efficiency and save development costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the automotive field, and in particular to a real-time task scheduling system for an adaptive MCU platform. Background Technology

[0002] In the development of embedded controller software, such as in-vehicle controllers, to meet system functional requirements, it is necessary to schedule various functional tasks. Depending on the complexity of the functions, a reasonable real-time task scheduling system is required. Simple controllers only need single-task scheduling, while complex controllers require multi-task real-time scheduling. Multi-task real-time systems need to consider factors such as the scheduling cycle of each task, priority allocation, and system operating efficiency. However, the following problems commonly exist in the implementation of such systems:

[0003] 1) The real-time task scheduling system software is highly coupled with the functional software, meaning that the task scheduling system is only adapted to a single project, and different projects require re-debugging, resulting in poor reusability and portability.

[0004] 2) The real-time task scheduling system software is highly coupled with the hardware MCU platform, meaning that the task scheduling system is only compatible with a single MCU platform. This means that any changes to the MCU platform require a reassessment of the software resource investment. (This mainly involves the current situation where the commonly used OS system combined with configuration-generated code is highly coupled with the MCU platform.) Summary of the Invention

[0005] The summary of this invention introduces a series of simplified concepts, all of which are simplifications of existing technologies in the field, and will be further explained in detail in the detailed description section. This summary is not intended to limit the key features and essential technical features of the claimed technical solution, nor is it intended to determine the scope of protection of the claimed technical solution.

[0006] The technical problem to be solved by the present invention is to provide a real-time task scheduling system that can be adapted to any hardware MCU platform and any adaptive MCU platform that requires real-time task scheduling function.

[0007] To solve the above-mentioned technical problems, the present invention provides a real-time task scheduling system for an adaptive MCU platform, comprising:

[0008] The system timer interrupt module uses a reference ticker clock source provided by the hardware MCU peripheral to generate the corresponding tick reference clock interrupt entry.

[0009] The static file module includes:

[0010] The system initialization submodule is used to initialize all global variables.

[0011] The system startup submodule is used to load the configuration parameters of each scheduled task, including the startup activation offset time AlarmOffsetTime and the periodic scheduling time AlarmCycleTime for each task.

[0012] The system timing processing submodule counts down based on the minimum tick reference clock. When the start-up activation offset time AlarmOffsetTime or the periodic scheduling time AlarmCycleTime of each task is reached, the scheduling task state machine is triggered to the ready state, and the periodic trigger time AlarmCycleTime of the corresponding scheduling task is reset.

[0013] The system task scheduling and processing submodule initializes the task once and periodically polls the state machine of each scheduled task to see if it is in the ready state. If it is, it can trigger the running scheduled task and set the state machine variable of the scheduled task to the running state. When the periodic task scheduling is completed, it sets the state machine of the scheduled task to the pre-ready state. If it is not in the ready state, it triggers the idle task.

[0014] The system activation and startup task set function submodule integrates and encapsulates the system initialization module, system startup module, and system task scheduling and processing module in sequence.

[0015] The system configuration module exposes all configuration parameters of the static file module for users to configure according to their needs.

[0016] Optionally, the real-time task scheduling system of the adaptive MCU platform can be further improved, with the static file module and system configuration module consisting of .c files and .h files.

[0017] .C files are an important concept in programming. A "file" generally refers to a collection of data stored on external media. A batch of files is stored as data on external media (such as a disk). The operating system manages data in units of files; that is, if you want to find data stored on external media, you must first locate the specified file by its filename, and then read the data from that file.

[0018] .h files are header files for the C and C++ programming languages, and they have the following functions:

[0019] 1. Generally, only function declarations, macro definitions, and function prototypes are placed in the .h header file, while the actual implementation is in the .cpp file;

[0020] 2. For example: For example, in<math.h> The mathematical functions you see inside are only declared; their actual implementations are not provided.<math.cpp> in;

[0021] 3. During compilation, the compiler will automatically load the .CPP file that matches the .h file.

[0022] Optionally, to further improve the real-time task scheduling system of the adaptive MCU platform, the .c file should include its corresponding .h file, including: system initialization submodule, system startup submodule, system timing processing submodule, system task scheduling processing submodule, and system activation startup task set function submodule.

[0023] Optionally, the real-time task scheduling system of the adaptive MCU platform can be further improved by configuring the specific scheduling task functions, the start-up activation offset time AlarmOffsetTime, and the periodic scheduling time AlarmCycleTime parameters for each scheduling task in the .c file.

[0024] Optionally, the real-time task scheduling system of the adaptive MCU platform can be further improved by including sub-.h files in the .h file, which externally declare the system timing processing submodule and the system activation and startup task set function submodule to support the scheduling of external files.

[0025] Optionally, the real-time task scheduling system of the adaptive MCU platform can be further improved. The .h file can configure the time parameters of the minimum reference TickTimer of the system timer interrupt module, enumerate all scheduling tasks that support real-time scheduling, define the mapping relationship between real-time tasks and the function bodies of each task in the user application file, define the function body type and configuration parameter structure type of the scheduling task, which is used to configure the definition of the scalar quantity in the .c file and has an external declaration.

[0026] Optionally, the real-time task scheduling system of the adaptive MCU platform can be further improved by enumerating the priority configuration for triggering real-time task scheduling.

[0027] Optionally, the real-time task scheduling system of the adaptive MCU platform can be further improved by making the order of enumeration of each real-time scheduling task in the .h file consistent with the order of the configuration scale in the .c file.

[0028] Alternatively, the real-time task scheduling system of the adaptive MCU platform can be further improved by defining, before the enumeration of the maximum number of real-time tasks supported when configuring real-time periodic scheduling tasks, and defining, after configuring real-time periodic scheduling tasks, special tasks that are non-periodic scheduling.

[0029] Alternatively, the real-time task scheduling system of the adaptive MCU platform can be further improved, wherein the system task scheduling processing submodule schedules only one single-trigger initialization task after the system starts.

[0030] The working principle of the present invention is further explained as follows:

[0031] This invention mainly consists of four parts: a system timer interrupt module, a static file module, a system configuration module, and an application module (a scheduling task file for user applications).

[0032] The system timer interrupt module provides the smallest unit of clock source for the system. This part is provided by the timer peripheral of the hardware MCU. Each MCU has a general timer module. According to the datasheet, it is easy to implement the desired tick reference clock (usually a time base source at the US level) and generate the corresponding tick reference clock interrupt entry function. This tick interrupt is the underlying foundation for implementing the system.

[0033] The static file module contains the core, fixed code of the OS. It primarily utilizes a tick reference clock source to accumulate counters. When the counter for a scheduled task reaches the count required to trigger a certain periodic task, it immediately jumps to execute the corresponding periodic task. Different count thresholds trigger different periodic tasks, thus achieving the goal of flexibly adding or removing various periodic tasks (configurable periodic tasks must be greater than or equal to the tick reference clock and satisfy an integer multiple of the tick reference clock). It achieves personalized configuration of task priority by judging the order of triggering events for each periodic task; and it achieves personalized configuration of task offset start time by setting the initial value of the counter for each periodic task, thereby balancing the execution efficiency of each periodic task and optimizing and reducing the overall system load.

[0034] The system configuration module is a file for users to configure commonly used attribute parameters of scheduling tasks, including the number of scheduling tasks, task activation offset time, task trigger cycle, task priority, and minimum tick cycle. Users need to configure each parameter flexibly according to the actual needs of the specific project.

[0035] The application module (the scheduling task file for user applications) is a collection of terminal task scheduling files implemented by the system. Users only need to integrate different main function task functions into the corresponding periodic tasks according to their functional requirements to achieve real-time operation of the functional algorithms.

[0036] In the solution provided by this invention, after completing the design of the static file module, the configuration parameter file and the scheduling task file for user use are made available to the user. The static file module is fixed and does not require the user to do secondary programming development. Only the system configuration parameters need to be modified to automatically realize real-time scheduling tasks for the system to perform algorithmic scheduling applications.

[0037] This invention can achieve at least the following technical effects:

[0038] 1) The system software and hardware MCU provided by this invention have a high degree of decoupling and reusability, and can be adapted to any MCU platform with a system timer interrupt module peripheral.

[0039] 2) It is conducive to software platform management. The static code of the OS can be fixed and encapsulated and not open source to prevent users from accidentally modifying it.

[0040] 3) It is simple and efficient for users to use. They only need to adjust the parameters in the OS configuration file as needed to quickly generate scheduling tasks, which greatly improves software development efficiency. It has the technical advantages of being easy to implement, easy to integrate, configurable and highly portable, which can significantly improve development efficiency and save development costs. Attached Figure Description

[0041] The accompanying drawings are intended to illustrate the general characteristics of the methods, structures, and / or materials used in specific exemplary embodiments of the invention, supplementing the description in the specification. However, the drawings are schematic diagrams not drawn to scale and may not accurately reflect the precise structural or performance characteristics of any of the given embodiments. The drawings should not be construed as limiting or restricting the range of numerical values ​​or properties covered by exemplary embodiments of the invention. The invention will now be described in further detail with reference to the accompanying drawings and specific embodiments:

[0042] Figure 1 This is a schematic diagram of the overall architecture of the present invention.

[0043] Figures 2-8 Different process diagrams of the present invention.

[0044] Figure 9 This is a schematic diagram illustrating the effect of the present invention. Detailed Implementation

[0045] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can fully understand other advantages and technical effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through different specific embodiments, and the details in this specification can also be applied based on different viewpoints, with various modifications or changes made without departing from the overall design concept of the invention. It should be noted that, unless otherwise specified, the following embodiments and features can be combined with each other. The following exemplary embodiments of the present invention can be implemented in many different forms and should not be construed as being limited to the specific embodiments set forth herein. It should be understood that these embodiments are provided to make the disclosure of the present invention thorough and complete, and to fully convey the technical solutions of these exemplary embodiments to those skilled in the art.

[0046] This invention provides a real-time task scheduling system for an adaptive MCU platform, comprising:

[0047] refer to Figure 1 Combination Figure 7 As shown, the main implementation consists of four parts: a system timer interrupt module, a static file module, a system configuration module, and an application module (such as...). Figure 7 (A flowchart showing the relationships between the various files).

[0048] The system timer interrupt module is provided by the hardware MCU peripheral. The specific implementation requires configuring the registers according to the MCU datasheet to obtain the tick reference clock, then loading the corresponding timer interrupt vector table, and finally generating the TickTimer interrupt entry function.

[0049] An example of a system timer interrupt module:

[0050] Configure the 500us TickTimer interrupt entry point as the void McuTickTimerInterrupt_IRQHandler(void) function body.

[0051] The static file module, consisting of .c and .h files, is the core of this real-time task scheduling system.

[0052] The .c file (which needs to include its corresponding .h file) mainly consists of the system initialization submodule, system startup submodule, system timing processing submodule, system task scheduling processing submodule, and system activation and startup task set function submodule. (See reference...) Figure 6 As shown.

[0053] The system initialization submodule is used to initialize all global variables used by this module;

[0054] The system startup submodule mainly loads the configuration parameters for each scheduled task, including the startup activation offset time AlarmOffsetTime and the periodic scheduling time AlarmCycleTime for each task.

[0055] The system timing processing submodule mainly uses the minimum tick reference clock provided by the system timer interrupt module to count down the Counter timer. When the AlarmOffsetTime or AlarmCycleTime of each task is reached, the corresponding state machine variable of the OS is set to the Ready state, and the periodic trigger time AlarmCycleTime of the corresponding scheduled task is reset for the next timer.

[0056] The system task scheduling submodule first triggers the scheduling task Init once to initialize the task (only once after the OS starts up). Then, it periodically polls the state machine variables of each scheduled task to see if they are in the Ready state, i.e., whether the scheduling time of the current scheduled task has been reached. If they are in the Ready state, the scheduled task can be triggered to run and the state machine variable is set to the Running state. When the periodic task scheduling is completed, the state machine is set to the ready state. If it is not in the Ready state, the idle task is triggered.

[0057] The system activation and startup task set function submodule mainly implements the integration and encapsulation of OS initialization functions, OS startup functions, and OS main function task scheduling and processing functions. It should be noted that the integration sequence must be scheduled and encapsulated in the order described above.

[0058] Secondly, the .h file (which needs to include the .h file in the configuration file) mainly declares the OS timing processing function and OS activation startup task set function externally to support the scheduling and use of external files.

[0059] Example, static file module instance:

[0060] refer to Figure 1 As shown, the Os.c file contains the following (Note: This file header must include the Os.h file).

[0061] OS scheduling task running status definition:

[0062]

[0063]

[0064] OS initialization function implementation: static void OS_Init(void), see reference. Figure 2 As shown;

[0065] OS startup function implementation: static void OS_ScheduledTaskStartFct(void), see reference. Figure 3 As shown;

[0066] OS timing handling function implementation: void OsTimer_IRQHandler(void), see reference Figure 4 As shown;

[0067] The OS main function task scheduling and processing function is implemented as follows: static void OS_MainFunction(void), see reference. Figure 5 As shown;

[0068] OS activation and startup task set function implementation: This implementation encapsulates the OS startup function, OS timing processing function, and OS activation and startup task set function. The scheduling must be integrated according to the following sequence: void OS_Start(void) { OS_Init(); OS_Scheduled TaskStartFct(); OS_MainFunction();}

[0069] like Figure 1 As shown in the Os.h file (Note: This file header must include the Os_Cfg.h file):

[0070] The external declarations of OS timing processing functions and OS main function task scheduling processing functions are as follows, which can be integrated and called by external files that only need to include the Os.h file.

[0071] extern void OS_Start(void);

[0072] extern void OsTimer_IRQHandler(void);

[0073] The configuration module, also composed of .c and .h files, exposes all the configuration parameters referenced in the static file module, allowing users to customize them according to project needs.

[0074] The main configuration items in the .c file (which needs to include its corresponding .h file) are: the function for real-time scheduling of specific scheduling tasks, the start-up and activation offset time AlarmOffsetTime for each scheduling task, and the periodic scheduling time AlarmCycleTime parameter.

[0075] Secondly, the main configuration items in the .h file include: the time parameter of the minimum baseline TickTimer for the system timer interrupt module, and an enumeration of all scheduling tasks that support real-time scheduling (the enumeration order is the priority configuration for triggering real-time task scheduling, with 0 being the highest priority and 255 being the lowest priority). Next, macros are needed to define the mapping relationship between the real-time tasks scheduled in the static file and the various task function bodies in the user application file. Finally, the function body type and configuration parameter structure type of the scheduling task need to be defined, which are used for defining the configuration standard in the .c file. This configuration standard also needs to be declared externally so that the static file can include a reference.

[0076] In this configuration file, the order of enumerations of real-time scheduled tasks in the .h file must be consistent with the order of configuration scales in the .c file. In addition, when configuring real-time periodic scheduled tasks, they must be defined before the enumeration of the maximum number of real-time tasks supported, OS_ScheduledTasks_MAX_NUM. Tasks defined after it are special tasks for non-periodic scheduling, such as Os scheduled tasks, Init tasks, Os scheduled tasks, Idle tasks, etc.

[0077] Example configuration module instance:

[0078] like Figure 1 As shown, the Os_Cfg.c file contains the following (Note: This file header must include the Os_Cfg.h file).

[0079] External declaration of all scheduled tasks that support real-time scheduling:

[0080] extern void OS_ScheduledTask1msFct(void); / * A scheduled task triggered at 1ms intervals * /

[0081] extern void OS_ScheduledTask2p5msFct(void); / * A scheduled task triggered at 2.5ms intervals * /

[0082] extern void OS_ScheduledTask5msFct(void); / * A scheduled task triggered at 5ms intervals * /

[0083] extern void OS_ScheduledTask10msFct(void); / * A scheduled task triggered at 10ms intervals * /

[0084] extern void OS_ScheduledTask20msFct(void); / * A scheduled task triggered at 20ms intervals * /

[0085] extern void OS_ScheduledTask50msFct(void); / * A scheduled task triggered at 50ms intervals * /

[0086] extern void OS_ScheduledTask100msFct(void); / * A scheduled task triggered at 100ms intervals * /

[0087] extern void OS_ScheduledTask200msFct(void); / * A scheduled task triggered at 200ms intervals * /

[0088] extern void OS_ScheduledTask500msFct(void); / * A scheduled task triggered at 500ms intervals * /

[0089] extern void OS_ScheduledTask1000msFct(void); / * A scheduled task triggered at 1000ms intervals * /

[0090] Define a `const` type `table` structure to specify the configuration parameters, including the `AlarmOffsetTime` and `AlarmCycleTime` parameters (in microseconds) for each scheduled task, and a parameter to support function pointers pointing to the starting address of each scheduled task function stored during compilation.

[0091]

[0092]

[0093] like Figure 1 As shown, the Os_Cfg.h file contains the following:

[0094] Based on the configuration of the 500us baseline TickTimer system timer interrupt module instance, the macro definition is as follows:

[0095] #define OS_IRQ_TICK(500u) / *500us / tick* /

[0096] The enumeration defines the real-time scheduling tasks that need to be supported:

[0097]

[0098] Define the function body type for real-time scheduling tasks, and define the type for the configuration quantity of the 6-3-2 structure:

[0099]

[0100] An external declaration defines a `const` type `table` structure to specify configuration values ​​for module reference.

[0101] extern const stOs_scheduling_task_CfgType stOs_scheduling_task_Cfg[OS_scheduling_task_MAX_NUM];

[0102] The macro definition marks all externally declared scheduling tasks that support real-time scheduling or defines a const type table structure to indicate configuration variables, and establishes a mirror mapping relationship between the declared real-time scheduling task functions and the scheduling task function entities defined in the application module:

[0103] #define Schedule task(x) void x##Fct(void)

[0104] The application module is a .c file (which needs to include the .h header files involved in the static file module). It is a set of scheduling task function entities defined by the real-time scheduling or declaration of the static file module and the configuration module. The definition method is scheduling task (XXXX){ / *Integrate App function algorithm function here as needed* / }. Combined with the mirror mapping relationship described in 6-3-6, the name of XXXX must be the same as the enumeration name of each real-time scheduling task ID that needs to be supported by the enumeration definition.

[0105] Example application module instance:

[0106] like Figure 1 As shown, the scheduling task.c file integrates and defines all user-used periodic task real-time scheduling function entities (Note: this file header must include the Os.h file), as follows:

[0107]

[0108]

[0109]

[0110] refer to Figure 8 The porting, integration, and application process diagrams are further illustrated below:

[0111] Integration Process: First, integrate the .ch files generated from the system timer interrupt module, static file module, and system configuration module into the target embedded software development project and compile successfully. Second, nest the system timing processing submodule (OS timing processing function) generated from the static file module into the TickTimer interrupt entry function of the system timer interrupt module. Finally, nest the system activation and startup task set function submodule (OS activation and startup task set function) generated from the static file module into the very end of the void main(void) function body of the embedded software for timing scheduling, ensuring that all peripherals are initialized before the real-time task scheduling system OS starts and activates (typically in embedded software development projects, the PC pointer eventually points to the main function after the MCU startup program is completed). Before integrating and scheduling the functions, the required .h header files need to be included in the relevant files to ensure successful compilation after integration.

[0112] Example of an integration process:

[0113] Integrate the instantiation function of the system timing processing submodule (OS timing processing function) into the instantiation function body of the system timer interrupt module:

[0114] void McuTickTimerInterrupt_IRQHandler(void){OsTimer_IRQHandler()}

[0115] Integrate the instantiation function of the system timing processing submodule (OS timing processing function) into the void main(void) function body:

[0116] void main(void)

[0117] {

[0118] / *Mcu_Init();

[0119] Xxx_Init();

[0120] ...;

[0121] All peripherals have been initialized.

[0122] OS_Start();

[0123] }

[0124] The application module, based on the integration, allows users to quickly implement the desired periodic task scheduling function by simply modifying the configuration file and application file. Supported configuration items include: the minimum base time of the system timer interrupt module (TickTime, in µs), the addition and deletion of scheduled tasks, the scheduling priority of scheduled tasks, the activation offset time of scheduled tasks (OffsetTime, in µs), and the scheduling time of the scheduled task cycle (CycleTime, in µs).

[0125] Example application module instance:

[0126] If the baseline TickTimer configuration of the system timer interrupt module is changed from 500us to 1000us, the corresponding baseline TickTimer interrupt instantiation macro value only needs to be configured to 1000:

[0127] #define OS_IRQ_TICK(1000u) / *1000us / tick* /

[0128] If you need to configure the addition and deletion of scheduled tasks (since adding and deleting are two inverse processes, we will only perform instantiation of adding scheduled tasks here; how to delete them will not be elaborated), for example, if you need to add a new scheduled task "App10ms" based on the instantiation of the system configuration module configuration file, and this scheduled task has a higher priority than the existing scheduled task "10ms" but a lower priority than the scheduled task "5ms", and the activation offset time "OffsetTime" of this scheduled task is 12.5ms, and the periodic scheduling time is 10ms, you only need to add the following configuration item to quickly achieve real-time scheduling of the scheduled task "App10ms":

[0129] Add an external declaration for the scheduled task App10ms to the configuration.c file of the system configuration module:

[0130] extern void OS_ScheduledTask1msFct(void); / * A task that triggers scheduling at 1ms intervals * /

[0131] extern void OS_ScheduledTask2p5msFct(void); / * Tasks that are scheduled at 2.5ms intervals * /

[0132] extern void OS_ScheduledTask5msFct(void); / * A task that triggers scheduling at 5ms intervals * /

[0133] extern void OS_ScheduledTaskApp10msFct(void); / * A task that triggers scheduling at 10ms intervals * /

[0134] extern void OS_ScheduledTask10msFct(void); / * A task that triggers scheduling at 10ms intervals * /

[0135] extern void OS_ScheduledTask20msFct(void); / * A task that triggers scheduling at 20ms intervals * /

[0136] extern void OS_ScheduledTask50msFct(void); / * A task that triggers scheduling at 50ms intervals * /

[0137] extern void OS_ScheduledTask100msFct(void); / * A task that triggers scheduling at 100ms intervals * /

[0138] extern void OS_ScheduledTask200msFct(void); / * A task that triggers scheduling at 200ms intervals * /

[0139] extern void OS_ScheduledTask500msFct(void); / * A task that triggers scheduling at 500ms intervals * /

[0140] extern void OS_ScheduledTask1000msFct(void); / * A task that triggers scheduling at 1000ms intervals * /

[0141] In the system configuration module configuration.c file, find the scheduling task parameter configuration table, which is the stOs scheduling task Cfg parameter table that defines the const type table structure and specifies the configuration quantity. Based on the scheduling priority requirements of the new task, add the scheduling task App10ms configuration parameter information between the scheduling task 5ms and scheduling task 10ms configuration parameter tables.

[0142]

[0143] In the system configuration module configuration.h file, find the enumerated task index ID configuration table, which is the Os scheduling task IdType parameter table for the real-time scheduling task definitions that the enumeration defines. Combined with the scheduling priority requirements of the newly added task, add the scheduling task App10ms configuration ID information between the scheduling task 5ms and scheduling task 10ms configuration IDs.

[0144]

[0145]

[0146] Add the scheduled task function entity (App10ms) to the application module .c file as defined above:

[0147]

[0148]

[0149]

[0150] The real-time task scheduling system implemented by this invention eliminates the need for secondary programming development. Users only need to integrate the relevant files and quickly configure the system according to their functional requirements to achieve the desired real-time tasks, such as... Figure 9 For example, if you need to add a new scheduled task, App10ms, in addition to the already implemented scheduled tasks 5ms, 10ms, and 20ms, you only need to update the enumeration definition, external declaration, and configuration parameters of this task in the configuration file. The key parameters are: CycleTime is 10ms, OffsetTime is 12.5ms when this task is first activated after system startup (OsStart), and during system operation (OsRunning), the scheduled task App10ms is triggered for execution with a priority lower than the scheduled task 5ms and higher than the scheduled task 10ms.

[0151] Unless otherwise defined, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. It will also be understood that, unless expressly defined herein, terms such as those defined in a general dictionary shall be interpreted as having the meaning consistent with their meaning in the relevant field context, and not as having an idealized or overly formal meaning.

[0152] The present invention has been described in detail above through specific embodiments and examples, but these are not intended to limit the invention. Many modifications and improvements can be made by those skilled in the art without departing from the principles of the invention, and these should also be considered within the scope of protection of the present invention.

Claims

1. A real-time task scheduling system for an adaptive MCU platform, characterized in that, Comprising: a system timing interrupt module, which provides a tick reference clock by a hardware MCU peripheral, and generates a corresponding tick reference clock interrupt entry; a static file module comprising: a system initialization submodule, which is used to initialize all global variables used; a system startup submodule, which is used to load various scheduling task configuration parameters, including the startup activation offset time AlarmOffsetTime and the periodic scheduling time AlarmCycleTime of each task; a system timing processing submodule, which is based on the minimum tick reference clock countdown, and triggers the scheduling task state machine to be in the preparation state when the startup activation offset time AlarmOffsetTime or the periodic scheduling time AlarmCycleTime of each task is reached, and resets the periodic trigger time AlarmCycleTime of the corresponding scheduling task; a system task scheduling processing submodule, which initializes a single trigger task, and periodically polls each scheduling task state machine to determine whether it is in the preparation state, and if so, triggers the running scheduling task, and sets the scheduling task state machine variable to the running state, and when the periodic task scheduling is completed, sets the scheduling task state machine to the pre-preparation state, and if not, triggers the idle task; a system active startup task set function submodule, which integrates and encapsulates the system initialization module, the system startup module, and the system task scheduling processing module in order; a system configuration module, which opens all configuration parameters of the static file module for user configuration according to needs; an application module, which is used to describe a collection file of terminal task scheduling, and can integrate different main function task functions in corresponding periodic tasks to realize real-time running of function algorithms according to functional needs.

2. The real-time task scheduling system for adaptive MCU platform of claim 1, wherein: The static file module, the system configuration module, and the application module are composed of.c files and.h files.

3. The real-time task scheduling system for adaptive MCU platform of claim 2, wherein: The.c files include corresponding.h files, including the system initialization submodule, the system startup submodule, the system timing processing submodule, the system task scheduling processing submodule, the system task scheduling processing submodule, and the system active startup task set function submodule.

4. The real-time task scheduling system for adaptive MCU platform of claim 3, wherein: The.c files can configure real-time scheduling specific scheduling task functions, and the startup activation offset time AlarmOffsetTime and the periodic scheduling time AlarmCycleTime parameters of each scheduling task.

5. The real-time task scheduling system for adaptive MCU platform of claim 3, wherein: The.h files include the.h files in the configuration file, and externally declare the system timing processing submodule and the system active startup task set function submodule to support scheduling use of external files.

6. The real-time task scheduling system for adaptive MCU platform of claim 5, wherein: The.h files can configure the time parameters of the source minimum reference TickTimer of the system timing interrupt module, enumerate all scheduling tasks supporting real-time scheduling, define the mapping relationship between real-time tasks and each task function body in the user application file, define the function body type of the scheduling task and the configuration parameter structure type, which is used for definition of the configuration calibration quantity in the.c file, and has external declaration.

7. The real-time task scheduling system for adaptive MCU platform of claim 6, wherein: The enumeration order is the priority configuration of triggering real-time task scheduling.

8. The real-time task scheduling system of the adaptive MCU platform according to claim 7, characterized in that: The enumeration of the real-time scheduling tasks in the configuration file.h is consistent with the order of the configuration parameters in the.c file.

9. The real-time task scheduling system of adaptive MCU platform according to claim 7, characterized in that: When configuring the real-time periodic scheduling tasks, the enumeration quantity supporting the maximum number of real-time tasks is defined before the configuration of the real-time periodic scheduling tasks, and the special tasks defined after the configuration of the real-time periodic scheduling tasks are non-periodic scheduling tasks.

10. The real-time task scheduling system for adaptive MCU platform of claim 1, wherein: The system task scheduling processing submodule only schedules the single-trigger initialization task once after the system is started.

Citation Information

Patent Citations

  • Reception device, reception method, transmission device, and transmission method

    CN104488281A

  • Workflow technology-based testing data real-time interpretation system

    CN105426299A