Driving software architecture based on vehicle control unit and driving software design method

By introducing interface layer, chip layer and configuration layer into the driver software architecture of the vehicle controller, and using structure variables and function pointers to achieve abstract and flexible configuration of IO channels, the problem that existing IO driver software is difficult to be applicable to different microcontrollers is solved, and the applicability and efficiency of the driver software are improved.

CN120104103APending Publication Date: 2025-06-06SUZHOU YOUKONG ZHIXING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510188025.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-20
Publication Date
2025-06-06

AI Technical Summary

Technical Problem

The IO driver software of existing vehicle controllers is difficult to be applied to different microcontrollers due to its strong coupling with specific microcontrollers. The use of global variables and enumerated variables during development has caused excessive RAM and FLASH space to take up.

Method used

A driver software architecture based on vehicle controller is proposed, including interface layer, chip layer and configuration layer. The abstract and flexible configuration of IO channels are realized through structure variables and function pointers, reducing hardware dependence and code modification costs.

Benefits of technology

It realizes flexible communication between IO channels and upper-layer software, reduces the cost of code modification during hardware replacement, and improves the applicability and efficiency of the driver software.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120104103A_ABST
    Figure CN120104103A_ABST
Patent Text Reader

Abstract

The invention provides a driving software architecture based on a vehicle control unit. And the interface layer is used for providing a driving interface for the IO channel, and the driving interface can enable the IO channel to communicate with upper software. The interface type of the IO channel is defined through a function pointer type, and the chip layer carries out interface function development based on the function pointer type. The interface layer defines structures of all IO channels of the vehicle control unit through a first structural body variable type, and the chip layer defines a peripheral chip connected with a processor of the vehicle control unit through a second structural body variable type. The configuration layer instantiates a first structural body variable type used for defining structures of all IO channels of the vehicle control unit and a second structural body variable type used for defining a peripheral chip connected with a processor of the vehicle control unit. The configuration layer defines the relationship between the IO channel and the abstraction layer of the microcontroller or the relationship between the sub-module channels of the chip layer and the relationship between the pins of the peripheral chip and the sub-module channels of the abstraction layer through constants.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of software, and in particular to a driving software architecture and a driving software design method based on a vehicle controller. Background Art

[0002] At present, in the existing technology, the vehicle control unit (VCU) is the central control unit of new energy vehicles, responsible for the vehicle's torque management, brake energy feedback, network management, fault diagnosis and processing, vehicle status monitoring, etc., and is the core of the entire control system. In addition to exchanging signals with controllers such as the motor controller and battery management unit through CAN, the VCU also collects accelerator pedal signals, brake pedal signals, actuator and sensor signals through its own IO port. Whether the IO driver software is reliable and stable plays a very critical role in whether the VCU can run stably.

[0003] The IO circuits of different vehicle controllers vary greatly. The IO driver software and hardware developed by each manufacturer for a specific model of vehicle controller are highly coupled and difficult to apply to different microcontrollers. When developing IO driver software, ordinary global variables are usually used to describe the circuit structure, and the global variables are assigned values ​​through initialization functions, which will take up more RAM space. Enumeration variables are used to list the models of various high- and low-side chips, making the software engineering of a specific vehicle controller dependent on high- and low-side chips that are not used by the controller, and the final compiled software occupies unnecessary FLASH space. Summary of the invention

[0004] The present invention aims to solve at least one of the technical problems existing in the prior art or related art.

[0005] To this end, a first aspect of the present invention proposes a driving software architecture based on a vehicle controller.

[0006] A second aspect of the present invention provides a driving software design method based on a vehicle controller.

[0007] In view of this, a first aspect of the present invention provides a driving software architecture based on a vehicle controller, characterized in that it includes: an interface layer, the interface layer represents the structure of the IO channel of the vehicle controller by declaring a first structure variable type, the interface type of the IO channel is declared by a first function pointer type, and the interface layer is used to provide a driving interface for the IO channel, and the driving interface enables the IO channel to communicate with the upper-level software; a chip layer, the chip layer represents the peripheral chip connected to the processor of the vehicle controller by declaring a second structure variable type, and the chip layer develops interface functions based on the first function pointer type; a configuration layer, the configuration layer instantiates the first structure variable type and the second structure variable type, and the configuration layer represents the relationship between the IO channel and the abstract layer of the microcontroller, the relationship between the IO channel and the sub-module channel of the chip layer, and the relationship between the pins of the peripheral chip and the sub-module channel of the abstract layer through constants.

[0008] In addition, the vehicle controller-based driving software architecture in the above technical solution provided by the present invention may also have the following additional technical features: In some technical solutions of the present invention, optionally, the interface layer includes: a DI module, the DI module is used to declare a third structure variable type for the circuit structure of the DI channel and an instance corresponding to the third structure variable type, the DI module obtains the first channel number of the Dio module of the abstract layer corresponding to the DI channel through the configuration layer, calls the interface of the Dio module, and initializes and reads the status of the interface of the DI channel; an AI module, the AI ​​module is used to declare a fourth structure variable type for the circuit structure of the AI ​​channel and an instance corresponding to the fourth structure variable type, the AI ​​module obtains the second channel number of the ADC module of the abstract layer corresponding to the AI ​​channel through the configuration layer, calls the interface of the Dio module, and initializes and reads the status of the interface of the DI channel. Use the interface of the ADC module to initialize the interface of the AI ​​channel and read the conversion result; the high and low side output module, the high and low side output module is used to declare the first number of the peripheral chip corresponding to the high and low side output channel, the second number of the high and low side output channel in the peripheral chip corresponding to the fifth structure variable type and the instance corresponding to the fifth structure variable type, the fifth structure variable type also includes function pointers for initializing, switching control and reading faults of the high and low side output channels. The high and low side output module obtains the first number and the second number through the configuration layer, and calls the function instance provided by the chip layer through the configuration layer to initialize, switch control and read faults of the high and low side output channels.

[0009] In some technical schemes of the present invention, optionally, the chip layer is a high-side and low-side chip module, and the high-side and low-side chip module declares the type of the module of the abstract layer connected to the pin of the peripheral chip and the sixth structure variable type of the third channel number of the module of the abstract layer connected to the pin of the peripheral chip. The high-side and low-side chip module obtains the channel number of the Dio module, Adc module or Pwm module of the abstract layer connected to different pins of the peripheral chip through the configuration layer based on the requirements of the function pointer type declared in the interface layer. The high-side and low-side chip module calls the interface provided by the Dio module, Adc module or Pwm module, passes in the channel number corresponding to the interface provided by the Dio module, Adc module or Pwm module, and runs the interface function corresponding to the channel number corresponding to the interface provided by the Dio module, Adc module or Pwm module.

[0010] In some technical solutions of the present invention, optionally, the configuration layer includes: high- and low-side chip configuration, the high- and low-side chip configuration instantiates the seventh structure variable type of the circuit structure of the peripheral chip declared by the high- and low-side chip module through constants, and the seventh structure variable type is used to characterize the channel and type of the sub-module of the abstract layer of the microcontroller used by the pin of the peripheral chip; DI module configuration, the DI module configuration instantiates the ninth structure variable type of the circuit structure of the DI channel declared by the DI module through constants, and the ninth structure variable type characterizes the first channel number of the Dio module of the abstract layer used by the DI channel; AI module configuration, the AI ​​module configuration instantiates the tenth structure variable type of the circuit structure of the AI ​​channel declared by the interface layer AI module through constants, and the tenth structure variable type characterizes the second channel number of the ADC module of the abstract layer used by each AI channel; high- and low-side output module configuration, the high- and low-side output module configuration instantiates the eleventh structure variable type of the first number and the second number declared by the high- and low-side output module through constants, and the eleventh structure variable type characterizes the first number and the second number, and the high- and low-side output module configuration uses the function interface name provided by the chip layer to implement initialization, switch control and read faults to instantiate the corresponding function pointer.

[0011] The second aspect of the present invention provides a driving software design method based on a vehicle controller, which is used in the driving software architecture based on the vehicle controller in any of the above technical solutions, including: dividing the channel types according to the types of the IO channels of the vehicle controller, and obtaining the IO channel types, wherein the types of the IO channels of the vehicle controller include DI channels, AI channels, and high and low side output channels; setting an interface layer, based on the IO channel types, the interface layer establishes a sub-module of the abstract layer of the microcontroller corresponding to the IO channel type, the interface layer represents the circuit structure of the IO channel of the IO channel type corresponding to the sub-module through a structure variable, and realizes the driving of the IO channel of the IO channel type corresponding to the sub-module The interface layer represents the first channel number of the Dio module of the abstract layer corresponding to the DI channel through the third structure variable, the interface layer calls the interface of the Dio module to implement the driver interface of the DI channel, sets the DI module configuration in the configuration layer, and obtains the first channel number of the Dio module of the abstract layer of the microcontroller corresponding to the DI channel through the instance of the third structure variable defined in the DI module configuration; the interface layer represents the second channel number of the ADC module of the abstract layer corresponding to the AI ​​channel through the fourth structure variable, the interface layer calls the interface of the ADC module to implement the driver interface of the entire AI channel, sets the AI ​​module configuration in the configuration layer, and obtains the first channel number of the Dio module of the abstract layer of the microcontroller corresponding to the DI channel through the instance of the third structure variable defined in the AI ​​module configuration. Example, get the second channel number of the ADC module of the abstract layer of the microcontroller corresponding to the AI ​​channel; the interface layer represents the first number of the peripheral chip corresponding to the high and low edge output channel and the second number of the high and low edge output channel in the peripheral chip through the fifth structure variable defined by the high and low edge output module configuration, and the interface layer declares the interface type that the chip layer needs to implement based on the function pointer; set the high and low edge output module configuration in the configuration layer, and the interface layer obtains the first number of the peripheral chip corresponding to the high and low edge output channel, the second number of the high and low edge output channel in the peripheral chip, the initialization function name, and the switch control function name through the instance of the eleventh structure variable defined by the high and low edge output module configuration and read the fault code function name to realize the driving interface of the high and low side output channels; set the chip layer, establish a sub-module corresponding to the model of the peripheral chip in the chip layer based on the model of the peripheral chip of the vehicle controller, and use the structure variable in the sub-module to describe the pin composition of the corresponding peripheral chip; set the high and low side chip configuration in the configuration layer, based on the sub-module of the chip layer according to the function pointer type requirements declared in the interface layer, the chip layer obtains the channel of the sub-module of the microcontroller abstract layer and the channel number of the sub-module used by the pin of the peripheral chip through the instance of the seventh structure variable defined by the high and low side chip configuration, and calls the interface provided by the sub-module of the microcontroller abstract layer to implement the corresponding interface function;In the configuration layer, the corresponding source code file is established for the model of the vehicle controller. In the source code file, constants are used to instantiate the structure variable types declared in the chip layer and the interface layer to represent the circuit structure of the IO channel of the vehicle controller and the circuit structure of the peripheral chip connected to the vehicle controller. ;

[0012] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which: Figure 1 A schematic diagram of a driving software architecture based on a vehicle controller according to an embodiment of the present invention; Figure 2 The present invention is a flowchart of a method for designing driving software based on a vehicle controller according to an embodiment of the present invention. DETAILED DESCRIPTION

[0014] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.

[0015] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.

[0016] Refer to the following Figure 1 to Figure 2 The present invention describes a driving software architecture and a driving software design method based on a vehicle controller according to some embodiments of the present invention.

[0017] like Figure 1As shown, the first aspect of the present invention provides a driving software architecture based on a vehicle controller, including: an interface layer, the interface layer represents the structure of the IO channel of the vehicle controller by declaring a first structure variable type, the interface type of the IO channel is declared by a first function pointer type, and the interface layer is used to provide a driving interface for the IO channel, and the driving interface can enable the IO channel to communicate with the upper-level software; a chip layer, the chip layer represents the peripheral chip connected to the processor of the vehicle controller by declaring a second structure variable type, and the chip layer develops interface functions based on the first function pointer type; a configuration layer, the configuration layer instantiates the first structure variable type and the second structure variable type, and the configuration layer represents the relationship between the IO channel and the abstract layer of the microcontroller, the relationship between the IO channel and the sub-module channel of the chip layer, and the relationship between the pins of the peripheral chip and the sub-module channel of the abstract layer through constants.

[0018] The present invention provides a driving software architecture based on a vehicle controller, including an interface layer, a chip layer and a configuration layer. First, the interface layer is used to provide a driving interface for an IO channel, and the driving interface enables the IO channel to communicate with the upper software.

[0019] Secondly, the interface type of the IO channel is defined by the function pointer type. The chip layer develops interface functions based on the function pointer type, realizing flexible configuration of IO channel operations. When it is necessary to add a new IO channel or modify the function of an existing circuit, it is only necessary to modify the relevant function pointer pointing, without the need for large-scale reconstruction of the entire system.

[0020] Finally, the interface layer defines the structure of all IO channels of the vehicle controller through the first structure variable type, the chip layer defines the peripheral chip connected to the processor of the vehicle controller through the second structure variable type, the configuration layer instantiates the first structure variable type used to define the structure of all IO channels of the vehicle controller and the second structure variable type used to define the peripheral chip connected to the processor of the vehicle controller, and the configuration layer defines the relationship between each IO channel and the abstract layer of the microcontroller or the relationship between the sub-module channel of the chip layer, and the relationship between the pins of the peripheral chip and the sub-module channel of the abstract layer through constants, and then through the configuration layer, the association of different layer modules such as the interface layer, chip layer, and microcontroller abstract layer is realized.

[0021] Specifically, the peripheral chips connected to the processor of the vehicle controller include high-side and low-side chips, power chips and other chips.

[0022] Further, in some embodiments of the present invention, the interface layer includes: a DI module, the DI module is used to declare a third structure variable type of the circuit structure of the DI channel and an instance corresponding to the third structure variable type, the DI module obtains the first channel number of the Dio module of the abstract layer corresponding to the DI channel through the configuration layer, calls the interface of the Dio module, and initializes and reads the status of the interface of the DI channel; an AI module, the AI ​​module is used to declare a fourth structure variable type of the circuit structure of the AI ​​channel and an instance corresponding to the fourth structure variable type, the AI ​​module obtains the second channel number of the ADC module of the abstract layer corresponding to the AI ​​channel through the configuration layer, calls the interface of the Dio module, and initializes and reads the status of the interface of the DI channel. Use the interface of the ADC module to initialize the interface of the AI ​​channel and read the conversion result; the high and low side output module, the high and low side output module is used to declare the first number of the peripheral chip corresponding to the high and low side output channel, the second number of the high and low side output channel in the peripheral chip corresponding to the fifth structure variable type and the instance corresponding to the fifth structure variable type, the fifth structure variable type also includes function pointers for initializing, switching control and reading faults of the high and low side output channels. The high and low side output module obtains the first number and the second number through the configuration layer, and calls the function instance provided by the chip layer through the configuration layer to initialize, switch control and read faults of the high and low side output channels.

[0023] In this embodiment, the interface layer includes a DI module, an AI module, and high-side and low-side output modules.

[0024] First, the DI module (Digital Input module) is used to declare the third structure variable type of the circuit structure of the DI channel and the instance corresponding to the third structure variable type. The DI module first obtains the first channel number of the Dio module (Digital Input / Output module) of the abstract layer corresponding to the DI channel through the configuration layer. After obtaining the first channel number, the interface of the Dio module is called to initialize the interface and read the status of the DI channel. The third structure variable type is declared to encapsulate the circuit structure of the underlying DI channel, abstract the physical hardware into a programmable object, and simplify hardware operations. Hardware dependencies are isolated, and the business logic code does not need to be changed when modifying the physical channel.

[0025] Secondly, the AI ​​module (Analog Input module) is used to declare the fourth structure variable type and the instance corresponding to the fourth structure variable type of the circuit structure of the AI ​​channel. The AI ​​module first obtains the second channel number of the ADC module (Analog-to-Digital Converter module) of the abstract layer corresponding to the AI ​​channel through the configuration layer. After obtaining the second channel number, the interface of the ADC module is called to initialize the interface of the AI ​​channel and read the conversion result. Hide the complex operations of the ADC hardware (such as clock configuration and reference voltage setting) and provide a unified reading interface. High-resolution sampling is achieved through the hardware abstraction layer of the ADC module, and the signal quality is improved by combining software filtering algorithms (such as sliding average).

[0026] Finally, the high-side and low-side output modules are used to declare the first number of the peripheral chip corresponding to the high-side and low-side output channels (high-side output channels and low-side output channels), the second number of the fifth structure variable type corresponding to the high-side and low-side output channels in the peripheral chip, and the instance corresponding to the fifth structure variable type. The fifth structure variable type also includes function pointers for initializing, switching and reading faults of the high-side and low-side output channels. The high-side and low-side output modules obtain the first number and the second number through the configuration layer, and call the function instances provided by the chip layer through the configuration layer to initialize, switch and read faults of the high-side and low-side output channels.

[0027] Furthermore, in some embodiments of the present invention, the chip layer is a high- and low-side chip module, and the high- and low-side chip module declares the type of the module of the abstract layer to which the pins of the peripheral chip are connected and the sixth structure variable type of the third channel number of the module of the abstract layer to which the pins of the peripheral chip are connected. The high- and low-side chip module obtains the channel number of the Dio module, Adc module or Pwm module of the abstract layer connected to different pins of the peripheral chip through the configuration layer based on the requirements of the function pointer type declared in the interface layer. The high- and low-side chip module calls the interface provided by the Dio module, Adc module or Pwm module, passes in the channel number corresponding to the interface provided by the Dio module, Adc module or Pwm module, and runs the interface function corresponding to the channel number corresponding to the interface provided by the Dio module, Adc module or Pwm module.

[0028] In this embodiment, the chip layer is a high- and low-side chip module, and the high- and low-side chip module declares the sixth structure variable type of the abstract layer module type connected to the pins of the peripheral chip and the module channel number (i.e., the third channel number) of the abstract layer connected to the pins of the peripheral chip.

[0029] Based on the requirements of the function pointer type declared in the interface layer, the high-side and low-side chip modules first obtain the channel number of the Dio module, Adc module or Pwm module (Pulse Width Modulation module) of the abstract layer connected to different pins of the peripheral chip through the configuration layer, and then call the interface provided by the Dio module, Adc module or Pwm module through the high-side and low-side chip modules, pass in the channel number corresponding to the interface provided by the Dio module, Adc module or Pwm module, and then run the interface function corresponding to the channel number corresponding to the interface provided by the Dio module, Adc module or Pwm module. The hardware differences are isolated through the abstract layer (DIO / ADC / PWM) and the configuration layer, which reduces the code modification cost when the hardware is replaced and improves the flexibility of configuration.

[0030] Further, in some embodiments of the present invention, the configuration layer includes: high- and low-side chip configuration, the high- and low-side chip configuration instantiates the seventh structure variable type of the circuit structure of the peripheral chip declared by the high- and low-side chip module through constants, and the seventh structure variable type is used to characterize the channel and type of the sub-module of the abstract layer of the microcontroller used by the pin of the peripheral chip; DI module configuration, the DI module configuration instantiates the ninth structure variable type of the circuit structure of the DI channel declared by the DI module through constants, and the ninth structure variable type characterizes the first channel number of the Dio module of the abstract layer used by the DI channel; AI module configuration, the AI ​​module configuration instantiates the tenth structure variable type of the circuit structure of the AI ​​channel declared by the interface layer AI module through constants, and the tenth structure variable type characterizes the second channel number of the ADC module of the abstract layer used by each AI channel; high- and low-side output module configuration, the high- and low-side output module configuration instantiates the eleventh structure variable type of the first number and the second number declared by the high- and low-side output module through constants, and the eleventh structure variable type characterizes the first number and the second number, and the high- and low-side output module configuration uses the function interface name provided by the chip layer to implement initialization, switch control and read faults to instantiate the corresponding function pointer.

[0031] In this embodiment, the configuration layer includes high and low side chip configuration, DI module configuration, AI module configuration and high and low side output module configuration.

[0032] First, the high-side and low-side chip configuration (high-side / low-side chip configuration) instantiates the seventh structure variable type of the circuit structure of the peripheral chip declared by the high-side and low-side chip module (high-side / low-side chip module) through constants. The seventh structure variable type is used to characterize the channel and type of the sub-module of the abstract layer of the microcontroller used by the pins of the peripheral chip.

[0033] Secondly, the DI module configuration instantiates the ninth structure variable type of the circuit structure of the DI channel declared by the DI module through constants, and the ninth structure variable type represents the first channel number of the Dio module of the abstract layer used by the DI channel. The AI ​​module configuration instantiates the tenth structure variable type of the circuit structure of the AI ​​channel declared by the interface layer AI module through constants, and the tenth structure variable type represents the second channel number of the ADC module of the abstract layer used by each AI channel.

[0034] Finally, the high and low side output module configuration instantiates the eleventh structure variable type of the first and second numbers declared by the high and low side output module through constants. The eleventh structure variable type represents the first and second numbers. The high and low side output module configuration uses the function interface names provided by the chip layer to implement initialization, switch control, and fault reading to instantiate the corresponding function pointers.

[0035] Specifically, the DI module obtains the first channel number of the Dio module of the abstract layer corresponding to the DI channel through the DI module configuration, the AI ​​module obtains the second channel number of the ADC module of the abstract layer corresponding to the AI ​​channel through the AI ​​module configuration, and the high and low side output modules obtain the first number and the second number through the high and low side output module configuration.

[0036] In one specific embodiment, the driving software architecture based on the vehicle controller proposed by the present invention is as follows: The interface layer includes a DI module, an AI module, and high- and low-side output modules, which are used to provide driver interfaces for the DI channel, the AI ​​channel, and the high- and low-side output channels (high-side output channel and low-side output channel), respectively. The driver interfaces enable the DI channel, the AI ​​channel, and the high- and low-side output channels (high-side output channel and low-side output channel) to communicate with the upper-layer software.

[0037] Secondly, the interface type of the high-side and low-side output channels (high-side output channel and low-side output channel) is defined by the function pointer type, and the high-side and low-side chip modules develop interface functions of the Dio module, Adc module or Pwm module based on the function pointer type.

[0038] Finally, the configuration layer instantiation is used to define the relationship between the DI channel and the DI module configuration, the relationship between the AI ​​channel and the AI ​​module configuration, the relationship between the high-side and low-side output channels (high-side output channel and low-side output channel) and the high-side and low-side output module configurations, and the relationship between the high-side and low-side chip configurations and the high-side and low-side chip modules. The configuration layer then realizes the association of modules at different levels, such as the interface layer, chip layer, and microcontroller abstract layer.

[0039] like Figure 2As shown, the second aspect of the present invention provides a vehicle controller-based driving software design method, which is used in the vehicle controller-based driving software architecture described in any of the above embodiments, including: Step 102, classifying the channel types according to the types of the IO channels of the vehicle controller to obtain the IO channel types, wherein the types of the IO channels of the vehicle controller include DI channels, AI channels, and high and low side output channels; Step 104, setting an interface layer. Based on the IO channel type, the interface layer establishes a submodule of the abstract layer of the microcontroller corresponding to the IO channel type. The interface layer represents the circuit structure of the IO channel of the IO channel type corresponding to the submodule through a structure variable, and implements the driver interface of the IO channel of the IO channel type corresponding to the submodule. Step 106, the interface layer represents the first channel number of the Dio module of the abstract layer corresponding to the DI channel through the third structure variable, the interface layer calls the interface of the Dio module to implement the driver interface of the DI channel, sets the DI module configuration in the configuration layer, and obtains the first channel number of the Dio module of the abstract layer of the microcontroller corresponding to the DI channel through the instance of the third structure variable defined by the DI module configuration; Step 108, the interface layer represents the second channel number of the ADC module of the abstract layer corresponding to the AI ​​channel through the fourth structure variable, the interface layer calls the interface of the ADC module to implement the driver interface of the entire AI channel, sets the AI ​​module configuration in the configuration layer, and obtains the second channel number of the ADC module of the abstract layer of the microcontroller corresponding to the AI ​​channel through the instance of the fourth structure variable defined by the AI ​​module configuration; Step 110, the interface layer represents the first number of the peripheral chip corresponding to the high and low edge output channels and the second number corresponding to the high and low edge output channels in the peripheral chip through the fifth structure variable defined by the high and low edge output module configuration, and the interface layer declares the interface type that the chip layer needs to implement based on the function pointer; Step 112, setting the high and low side output module configuration in the configuration layer, the interface layer obtains the first number of the peripheral chip corresponding to the high and low side output channel, the second number corresponding to the high and low side output channel in the peripheral chip, the initialization function name, the switch control function name and the fault code reading function name through the instance of the eleventh structure variable defined in the high and low side output module configuration, so as to realize the driving interface of the high and low side output channel; Step 114, setting a chip layer, establishing a submodule corresponding to the model of the peripheral chip of the vehicle controller at the chip layer, and using a structure variable in the submodule to describe the pin configuration of the corresponding peripheral chip; Step 116, setting the high and low side chip configuration in the configuration layer, based on the requirements of the sub-module of the chip layer according to the function pointer type declared in the interface layer, the chip layer obtains the channel of the sub-module of the microcontroller abstract layer and the channel number of the sub-module used by the pin of the peripheral chip through the instance of the seventh structure variable defined in the high and low side chip configuration, and calls the interface provided by the sub-module of the microcontroller abstract layer to implement the corresponding interface function; Step 118, create a corresponding source code file for the model of the vehicle controller in the configuration layer, use constants in the source code file to instantiate the structure variable types declared in the chip layer and interface layer, and characterize the circuit structure of the IO channel of the vehicle controller and the circuit structure of the peripheral chip connected to the vehicle controller.

[0040] In the claims, specification and drawings of the present invention, the term "multiple" refers to two or more than two. Unless otherwise clearly defined, the orientation or positional relationship indicated by the terms "upper" and "lower" is based on the orientation or positional relationship shown in the drawings, which is only for the purpose of more conveniently describing the present invention and making the description process simpler, rather than indicating or implying that the device or element referred to must have the specific orientation described, be constructed and operated in a specific orientation, so these descriptions cannot be understood as limiting the present invention; the terms "connect", "install", "fix" and the like should be understood in a broad sense. For example, "connection" can be a fixed connection between multiple objects, or a detachable connection between multiple objects, or an integral connection; it can be a direct connection between multiple objects, or an indirect connection between multiple objects through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood based on the specific circumstances of the above data.

[0041] In the claims, specification and drawings of the present invention, the description of the terms "one embodiment", "some embodiments", "specific embodiments" and the like means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In the claims, specification and drawings of the present invention, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0042] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A driving software architecture based on a vehicle controller, characterized in that: include: An interface layer, wherein the interface layer represents the structure of the IO channel of the vehicle controller by declaring a first structure variable type, the interface type of the IO channel is declared by a first function pointer type, and the interface layer is used to provide a driver interface for the IO channel, and the driver interface enables the IO channel to communicate with the upper layer software; A chip layer, wherein the chip layer represents a peripheral chip connected to a processor of a vehicle controller by declaring a second structure variable type, and the chip layer develops an interface function based on the first function pointer type; A configuration layer, wherein the configuration layer instantiates the first structure variable type and the second structure variable type, and the configuration layer characterizes, through constants, the relationship between the IO channel and the abstract layer of the microcontroller, the relationship between the IO channel and the submodule channel of the chip layer, and the relationship between the pins of the peripheral chip and the submodule channel of the abstract layer.

2. The driving software architecture based on the vehicle controller according to claim 1 is characterized in that: The interface layer comprises: A DI module, wherein the DI module is used to declare a third structure variable type for the circuit structure of the DI channel and an instance corresponding to the third structure variable type, wherein the DI module obtains the first channel number of the Dio module of the abstract layer corresponding to the DI channel through the configuration layer, calls the interface of the Dio module, and initializes the interface of the DI channel and reads the status; An AI module, wherein the AI ​​module is used to declare a fourth structure variable type for the circuit structure of the AI ​​channel and an instance corresponding to the fourth structure variable type, wherein the AI ​​module obtains the second channel number of the ADC module of the abstract layer corresponding to the AI ​​channel through the configuration layer, calls the interface of the ADC module, initializes the interface of the AI ​​channel, and reads the conversion result; A high- and low-side output module, the high- and low-side output module is used to declare the first number of the peripheral chip corresponding to the high- and low-side output channel, the second number of the fifth structure variable type corresponding to the high- and low-side output channel in the peripheral chip, and the instance corresponding to the fifth structure variable type, the fifth structure variable type also includes function pointers for initializing, switching control, and reading faults of the high- and low-side output channels. The high- and low-side output module obtains the first number and the second number through the configuration layer, and calls the function instance provided by the chip layer through the configuration layer to initialize, switch control, and read faults of the high- and low-side output channels.

3. The driving software architecture based on the vehicle controller according to claim 2 is characterized in that: The chip layer is a high- and low-side chip module, which declares the type of the module of the abstract layer to which the pins of the peripheral chip are connected and the sixth structure variable type of the third channel number of the module of the abstract layer to which the pins of the peripheral chip are connected. The high- and low-side chip modules obtain the channel number of the Dio module, Adc module or Pwm module of the abstract layer connected to different pins of the peripheral chip through the configuration layer based on the requirements of the function pointer type declared in the interface layer. The high- and low-side chip modules call the interface provided by the Dio module, Adc module or Pwm module, pass in the channel number corresponding to the interface provided by the Dio module, Adc module or Pwm module, and run the interface function corresponding to the channel number corresponding to the interface provided by the Dio module, Adc module or Pwm module.

4. The driving software architecture based on the vehicle controller according to claim 3 is characterized in that: The configuration layer includes: High and low edge chip configuration, the high and low edge chip configuration instantiates the seventh structure variable type of the circuit structure of the peripheral chip declared by the high and low edge chip module through constants, and the seventh structure variable type is used to characterize the channel number and type of the submodule of the abstract layer of the microcontroller used by the pin of the peripheral chip; DI module configuration, wherein the DI module configuration instantiates a ninth structure variable type of the circuit structure of the DI channel declared by the DI module through a constant, wherein the ninth structure variable type represents a first channel number of the Dio module of the abstract layer used by the DI channel; AI module configuration, wherein the AI ​​module configuration instantiates a tenth structure variable type of the circuit structure of the AI ​​channel declared by the interface layer AI module through a constant, and the tenth structure variable type represents a second channel number of the ADC module of the abstract layer used by each AI channel; The high-side and low-side output module configuration instantiates the eleventh structure variable type with the first number and the second number declared by the high-side and low-side output module through constants, and the eleventh structure variable type represents the first number and the second number. The high-side and low-side output module configuration uses the function interface name provided by the chip layer to implement initialization, switch control and read faults to instantiate the corresponding function pointer.

5. A vehicle controller-based driving software design method, used for the vehicle controller-based driving software architecture as claimed in any one of claims 1 to 4, characterized in that: include: According to the types of the IO channels of the vehicle controller, the channel types are divided to obtain the IO channel types, where the types of the IO channels of the vehicle controller include DI channels, AI channels, and high and low side output channels; An interface layer is set up. Based on the IO channel type, the interface layer establishes a submodule of the abstract layer of the microcontroller corresponding to the IO channel type. The interface layer represents the circuit structure of the IO channel of the IO channel type corresponding to the submodule through a structure variable, and realizes the driver interface of the IO channel of the IO channel type corresponding to the submodule; The interface layer represents the first channel number of the Dio module of the abstract layer corresponding to the DI channel through the third structure variable. The interface layer calls the interface of the Dio module to implement the driver interface of the DI channel, sets the DI module configuration in the configuration layer, and obtains the first channel number of the Dio module of the abstract layer of the microcontroller corresponding to the DI channel through the instance of the third structure variable defined by the DI module configuration. The interface layer represents the second channel number of the ADC module of the abstract layer corresponding to the AI ​​channel through the fourth structure variable. The interface layer calls the interface of the ADC module to implement the driver interface of the entire AI channel, sets the AI ​​module configuration in the configuration layer, and obtains the second channel number of the ADC module of the abstract layer of the microcontroller corresponding to the AI ​​channel through the instance of the fourth structure variable defined by the AI ​​module configuration. The interface layer defines the fifth structure variable through the high and low edge output module configuration to represent the first number of the peripheral chip corresponding to the high and low edge output channel and the second number corresponding to the high and low edge output channel in the peripheral chip. The interface layer declares the interface type that the chip layer needs to implement based on the function pointer. The high and low side output module configuration in the configuration layer is set. The interface layer obtains the first number of the peripheral chip corresponding to the high and low side output channel, the second number corresponding to the high and low side output channel in the peripheral chip, the initialization function name, the switch control function name and the fault code reading function name through the instance of the eleventh structure variable defined in the high and low side output module configuration, so as to realize the driving interface of the high and low side output channel; Set up the chip layer, and establish a submodule corresponding to the model of the peripheral chip based on the model of the peripheral chip of the vehicle controller at the chip layer, and use structure variables in the submodule to describe the pin structure of the corresponding peripheral chip; Set the high and low-side chip configuration in the configuration layer. Based on the requirements of the function pointer type declared in the interface layer by the sub-module of the chip layer, the chip layer obtains the channel and the channel number of the sub-module of the abstract layer of the microcontroller used by the pin of the peripheral chip through the instance of the seventh structure variable defined by the high and low-side chip configuration, and calls the interface provided by the sub-module of the abstract layer of the microcontroller to implement the corresponding interface function. In the configuration layer, a corresponding source code file is created for the model of the vehicle controller. In the source code file, constants are used to instantiate the structure variable types declared in the chip layer and the interface layer to represent the circuit structure of the IO channel of the vehicle controller and the circuit structure of the peripheral chip connected to the vehicle controller.