Electronic control unit updating method, apparatus, device, and storage medium
By using the file reading function of the Flutter application, cross-platform updates of electronic control units are achieved, solving the problem that program updates can only run on a single operating system, and enabling electronic control unit updates on Android, iOS and Windows systems.
Patent Information
- Application Number
- CN202411393374.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2044-09-30
AI Technical Summary
In the existing technology, the program update device can only run on one operating system, which means that it needs to be redeveloped when the operating system changes, making it inconvenient to update the electronic control unit.
It utilizes the file reading function provided by Flutter applications to achieve cross-platform acquisition and transmission of update data, supporting Android, iOS and Windows operating systems, and transmits update data to the electronic control unit via the CAN protocol.
It enables cross-platform updates of electronic control units on different operating systems, avoiding development difficulties caused by operating system changes and improving the versatility and flexibility of updated equipment.
Smart Images

Figure CN119759384B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automotive electronic control technology, and in particular to an electronic control unit update method, apparatus, device, and storage medium. Background Technology
[0002] The electronic control unit (ECU) is a crucial component of a vehicle's control system. As vehicle control algorithms evolve, the ECU needs to be updated to ensure the vehicle's performance meets the requirements of these algorithms.
[0003] In related technologies, mobile electronic control units (ECUs) can be updated using wireless diagnostic tools or Controller Area Network (CAN) devices. Alternatively, ECU updates can be performed by downloading or loading local ECU update files from a server using native Android software.
[0004] However, the program update device in the relevant technology can only run on one operating system. When program updates are required based on other operating systems, the software of the program update device needs to be developed again. Summary of the Invention
[0005] The purpose of this invention is to provide an electronic control unit (ECU) update method, apparatus, device, and storage medium, aiming to solve the technical problem in the related art that program update devices cannot run on multiple platforms simultaneously, and that when the operating system changes, the software of the program update device needs to be redeveloped, making it inconvenient to update the ECU.
[0006] To achieve the above objectives, the present invention adopts the following technical solution:
[0007] In a first aspect, this application provides an electronic control unit update method, applied to a program update device, comprising: in response to an operation of obtaining update data, obtaining update data from a data source based on the file reading function provided by a Flutter application in the program update device, wherein the file reading function provided by the Flutter application matches the operating system type; and sending the update data to the electronic control unit, thereby enabling the electronic control unit to update based on the update data.
[0008] The electronic control unit (ECU) update method provided in this application, in response to an operation to obtain update data, retrieves update data from a data source based on the file reading function provided by the Flutter application, which is compatible with the operating system of the update device. The update data is then sent to the ECU, enabling the ECU to update itself. It is understood that different operating systems operate differently when reading data; that is, their file reading functions differ. In this application, the file reading function provided by the Flutter application installed on the update device is compatible with the device's operating system. Therefore, regardless of the ECU's operating system, update data can be retrieved from the data source using the file reading function provided by the Flutter application. In other words, the ECU update method provided in this application does not limit the operating system used by the update device and can complete the update of the ECU, demonstrating the ability to update the ECU across platforms.
[0009] In some embodiments, the method further includes: obtaining a target Flutter application toolkit that matches the operating system used by the program update device; and building a Flutter application based on the target Flutter application toolkit.
[0010] In some embodiments, sending the update data to the electronic control unit includes: sending the update data to a CAN device via the CAN protocol, so that the CAN device sends the update data to the electronic control unit via CAN communication.
[0011] In some embodiments, the CAN protocol stack includes an application layer, which encapsulates communication service interfaces and parameter configuration service interfaces related to diagnostic messages, enabling the program update device to interact with CAN devices and / or data sources through the communication service interfaces and / or parameter configuration service interfaces.
[0012] In some embodiments, the CAN protocol stack further includes a presentation layer and a session layer. The presentation layer is used to encode and convert the instructions received by the application layer and then send them to the session layer. The encoding conversion includes at least one of the following: binary to hexadecimal conversion, binary to decimal conversion.
[0013] In some embodiments, the session layer uses the Dart language's Socket library to communicate with the CAN device.
[0014] In some embodiments, when the operating system used by the application update device is Android, the file reading function is written in Java or Kotlin; when the operating system used by the application update device is iOS, the file reading function is written in Objective-C or Swift; and when the operating system used by the application update device is Windows, the file reading function is written in C++ or C#.
[0015] In some embodiments, when the operating system used by the update device is Android, the target Flutter application toolkit is built based on Gradle, and the update device builds the Flutter application by running the `Flutter build apk` command; when the operating system used by the update device is iOS, the target Flutter application toolkit is built based on Xcode, and the update device builds the Flutter application by running the `Flutter build ios` command; when the operating system used by the update device is Windows, the update device builds the Flutter application by running the `Flutter build windows` command.
[0016] Secondly, this application provides an electronic control unit update system, including: a data source, a program update device, and an electronic control unit; the data source is used to store update data; the program update device is used to, in response to an operation of obtaining update data, obtain update data from the data source based on the file reading function provided by the Flutter application in the program update device, wherein the file reading function provided by the Flutter application matches the operating system type; and send the update data to the electronic control unit, so that the electronic control unit updates based on the update data.
[0017] Thirdly, this application provides an electronic control unit update device, including a first acquisition unit and an update unit: the first acquisition unit is used to acquire update data from a data source based on the file reading function provided by the Flutter application in the program update device in response to the operation of acquiring update data, and the file reading function provided by the Flutter application matches the operating system type; the update unit is used to send the update data to the electronic control unit, so that the electronic control unit updates based on the update data.
[0018] In some embodiments, the apparatus further includes: a second acquisition unit and a construction unit; the second acquisition unit is configured to acquire a target Flutter application toolkit that matches the operating system used by the program update device; the construction unit is configured to build a Flutter application based on the target Flutter application toolkit.
[0019] In some embodiments, the above-mentioned updating unit is specifically used to send update data to a CAN device via the CAN protocol, so that the CAN device sends the update data to the electronic control unit via CAN communication.
[0020] In some embodiments, the CAN protocol stack includes an application layer, which encapsulates communication service interfaces and parameter configuration service interfaces related to diagnostic messages, enabling the program update device to interact with CAN devices and / or data sources through the communication service interfaces and / or parameter configuration service interfaces.
[0021] In some embodiments, the CAN protocol stack further includes a presentation layer and a session layer. The presentation layer is used to encode and convert the instructions received by the application layer and then send them to the session layer. The encoding conversion includes at least one of the following: binary to hexadecimal conversion, binary to decimal conversion.
[0022] In some embodiments, the session layer uses the Dart language's Socket library to communicate with the CAN device.
[0023] In some embodiments, when the operating system used by the application update device is Android, the file reading function is written in Java or Kotlin; when the operating system used by the application update device is iOS, the file reading function is written in Objective-C or Swift; and when the operating system used by the application update device is Windows, the file reading function is written in C++ or C#.
[0024] In some embodiments, when the operating system used by the update device is Android, the target Flutter application toolkit is built based on Gradle, and the update device builds the Flutter application by running the `Flutter build apk` command; when the operating system used by the update device is iOS, the target Flutter application toolkit is built based on Xcode, and the update device builds the Flutter application by running the `Flutter build ios` command; when the operating system used by the update device is Windows, the update device builds the Flutter application by running the `Flutter build windows` command.
[0025] Fourthly, this application provides an apparatus comprising: a processor and a memory configured to store processor-executable instructions; wherein the processor is configured to execute the instructions to implement any of the optional electronic control unit update methods described in the first aspect above.
[0026] Fifthly, this application provides a computer-readable storage medium storing instructions that, when executed by a device, enable the device to perform any of the optional electronic control unit update methods described in the first aspect.
[0027] In a sixth aspect, this application provides a computer program product including computer instructions that, when executed on a processor of a device, enable the device to perform any of the optional electronic control unit update methods described in the first aspect above. Attached Figure Description
[0028] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0029] Figure 1 This is a schematic diagram of an electronic control unit update system provided in an embodiment of this application;
[0030] Figure 2 A flowchart illustrating an electronic control unit update method provided in this application embodiment;
[0031] Figure 3 A flowchart illustrating another electronic control unit update method provided in this application embodiment;
[0032] Figure 4 This is a schematic diagram of the ISO seven-layer network model;
[0033] Figure 5 This is a schematic diagram illustrating the construction of Flutter applications on different operating systems, as provided in the embodiments of this application.
[0034] Figure 6 This is a schematic diagram of the structure of the cross-platform plugin for CAN communication and file services provided in the embodiments of this application;
[0035] Figure 7 A diagram illustrating the page of a Flutter application running on a device undergoing an application update.
[0036] Figure 8 A flowchart illustrating an updated electronic control unit provided in this application embodiment;
[0037] Figure 9 This is a schematic diagram of an electronic control unit update device provided in an embodiment of this application;
[0038] Figure 10 A block diagram of a device provided in an embodiment of this application. Detailed Implementation
[0039] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0040] In the description of this invention, it should be understood that the terms "upper," "lower," "left," "right," "front," "rear," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or relative positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Unless otherwise specified, the above-described orientation can be flexibly set in practical applications, provided that the relative positional relationship shown in the accompanying drawings is satisfied.
[0041] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, unless otherwise stated, "a plurality of" means two or more.
[0042] In embodiments of the invention, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, article, or apparatus that includes that element.
[0043] In embodiments of the present invention, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" or "for example" in embodiments of the present invention should not be construed as being more preferred or advantageous than other embodiments or designs. Rather, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0044] In the description of this specification, specific features, structures, materials, or characteristics may be combined in any suitable manner in one or more embodiments or examples.
[0045] Terminology Explanation:
[0046] 1. An Electronic Control Unit (ECU) is a miniaturized computer management center. It takes signal (data) acquisition, computation, processing, analysis, judgment, and decision-making as input, and outputs control commands to instruct actuators. It also provides stable power or reference voltage to sensors. In this application, the electronic control unit can be a vehicle ECU.
[0047] 2. Flutter, a cross-platform application development framework. Flutter is an open-source application development framework from Google that allows a single codebase to support six operating systems: Android, iOS, the World Wide Web, Windows, macOS, and Linux. In this application, Flutter allows developers to write code and then compile it into applications that can run on iOS, Android, and Windows.
[0048] 3. Controller Area Network (CAN) is a serial communication protocol bus used for real-time applications, primarily for vehicle communication.
[0049] 4. Unified Diagnostic Services (UDS) enables precise fault diagnosis and maintenance operations through a well-defined set of instructions (such as reading fault codes and data streams). It resides at the application layer.
[0050] 5. Dart is a computer programming language that is object-oriented, class-defined, and single-inheritance. Dart is the primary development language for Flutter applications. In this application, Flutter allows developers to write code using Dart and then compile it into applications that can run on iOS, Android, and Windows operating systems.
[0051] With the rapid development of automotive technology, especially the continuous upgrading of vehicle control algorithms, the ECU, as a core component of the automotive control system, must also be updated in terms of performance and function to meet higher demands.
[0052] In related technologies, ECU updates are based on the design process requirements of a specific vehicle model. A PC-based program flashing host computer is developed specifically based on diagnostic protocols. The application program, in the form of an S19 file, is transmitted via a CAN network according to a communication protocol to update the ECU program. This process typically requires preparing the S19 file of the application to be updated on the PC in advance. The CAN box is then connected to the PC via a USB cable and to the vehicle's ECU via a DB9 connection. The PC-based program flashing host computer updates the ECU program by selecting the S19 file. However, this method only allows the program flashing tool to run on a PC, resulting in a limitation on the operating platform.
[0053] Alternatively, related technologies can also update ECU programs using diagnostic tools. This method can update a specific ECU installed in the vehicle or upgrade an ECU that has been removed or installed before installation. Mobile ECU software upgrade solutions can be implemented using wireless diagnostic tools or wireless CAN devices. However, for mobile ECU software upgrade solutions, since WiFi wireless CAN device or diagnostic tool suppliers generally provide Android SDKs for the purchaser to perform secondary development on native Android, some domestic automotive controller suppliers currently use native Android apps for mobile ECU programming. Software upgrades are performed by downloading or loading local ECU update files from a server through the native Android app.
[0054] It can be seen that the program update device in the relevant technology can only run on one operating system. When it is necessary to update the program based on other operating systems, the software of the program update device needs to be redeveloped, which makes it inconvenient to update the electronic control unit.
[0055] Based on this, this application provides an electronic control unit (ECU) update method applied to a program update device. This method, in response to an operation to obtain update data, retrieves update data from a data source based on the file reading function provided by the Flutter application, which is compatible with the operating system of the program update device. The updated data is then sent to the ECU, enabling the ECU to update based on the updated data. It is understood that different operating systems operate differently when reading data; that is, different operating systems have different file reading functions. In this application, the file reading function provided by the Flutter application installed on the program update device is compatible with the operating system of the program update device. Therefore, regardless of the operating system of the program update device, it can read update data from the data source based on the file reading function provided by the Flutter application. In other words, the ECU update method provided in this application does not limit the operating system used by the program update device and can complete the update of the ECU, possessing the characteristic of cross-platform ECU update capability.
[0056] It should be understood that the electronic control unit update method provided in this application can be applied to electronic control unit update systems, such as... Figure 1 As shown, the electronic control unit update system includes: a data source 100, a program update device 200, and an electronic control unit 300.
[0057] Data source 100 is used to store updated data.
[0058] The application update device 200 is used to retrieve update data from the data source 100 based on the file reading function provided by the Flutter application in the application update device 200 in response to an operation to obtain update data. The file reading function provided by the Flutter application is matched to the operating system type.
[0059] The program update device 200 is also used to send update data to the electronic control unit 300, so that the electronic control unit 300 updates itself based on the update data.
[0060] It should be understood that the embodiments of this application do not limit the operating system used by the program update device 200. The operating system used by the program update device 200 can be an Android system, an iOS system, or a Windows system.
[0061] In some embodiments, such as Figure 1As shown, the control unit update system also includes a CAN device 400. The program update device 200 communicates with the CAN device 400 via Wi-Fi, and the electronic control unit 300 is connected to the CAN device 400 via a D-type data interface connector (DB9). After obtaining update data from the data source 100, the program update device 200 sends the update data to the electronic control unit 300 via the CAN device 400, so that the electronic control unit 300 updates according to the update data.
[0062] It should be understood that in related technologies, the program update device 200 and the CAN device 400 need to be connected via a Universal Serial Bus (USB), which presents a limitation on the length of the connection cable. This application, however, uses Wi-Fi to connect the program update device 200 and the CAN device, thus avoiding the limitation on the length of the communication bus for updating the electronic control unit.
[0063] The data source 100 can be a device with data storage capabilities, such as a server.
[0064] It should be noted that the data source 100 and the program update device 200 can be integrated devices or two separate devices with communication connections. This application embodiment does not impose any restrictions on this.
[0065] In this embodiment, the program update device 200 can be a terminal device, such as a personal computer (PC), laptop computer, mobile device, tablet computer, etc. This embodiment does not limit the specific form of the electronic device. Alternatively, the program update device 200 can be a single server or a server cluster composed of multiple servers. In some implementations, the server cluster can be a distributed cluster server. This embodiment does not limit the specific form of the program update device 200.
[0066] It should be pointed out that, Figure 1 The structure shown does not constitute a limitation on the electronic control unit update system. In other embodiments, the system may include fewer or more components than shown, or combine certain components, or have different component arrangements. This application does not impose any limitations on this.
[0067] It should be understood that the electronic control unit update method provided in this application embodiment can be applied to... Figure 1 The electronic control unit update system shown includes a program update device. For example... Figure 2 As shown, the electronic control unit update method provided in this application includes S201-S202.
[0068] S201. In response to the operation of obtaining updated data, obtain updated data from the data source based on the file reading function provided by the Flutter application in the program update device.
[0069] The file reading functionality provided by Flutter applications is compatible with various operating system types. Flutter applications are programs developed based on the Flutter platform. Because Flutter is a cross-platform application development framework, Flutter applications can run on multiple operating systems.
[0070] It should be noted that the methods for file reading differ across operating systems. In this application, the operating systems include Android, iOS, and Windows.
[0071] In some embodiments, when the operating system used by the program update device is Android, the file reading function is written in Java or a statically typed programming language (Kotlin).
[0072] Understandably, Android is an open-source mobile operating system based on the Linux kernel, but its application layer is primarily written in Java and runs through the Dalvik or ART (Android Runtime) virtual machine. Java, as an object-oriented programming language, has become the foundation for building the Android system and its application framework due to its simplicity, efficiency, and cross-platform compatibility. Kotlin, as another statically typed programming language, has also been widely adopted in Android development in recent years because of its high interoperability with Java and its more concise syntax and richer functionality. Therefore, when the operating system used by the device updating the application is Android, file reading functionality can be written in either the Java programming language (Java) or the statically typed programming language (Kotlin).
[0073] The process of retrieving updated data using Java or Kotlin generally includes: determining the data reading path, creating a FileInputStream object, reading the data, and closing the stream. The data reading path can be from the application's internal storage, external storage, or a specific directory. In this application, the data reading path is to read updated data from a data source, which can be local or a server. Local can be understood as internal storage, and server can be understood as external storage.
[0074] In other embodiments, when the operating system used by the device updating the program is iOS, the file reading function is written in Objective-C or Swift.
[0075] Understandably, iOS is a mobile operating system developed by developers. Leveraging the efficient execution of C and the object-oriented capabilities of Smalltalk, developers specifically created the Objective-C language. Due to its tight integration with Apple's systems, Objective-C has become one of the standard languages for Apple application development. Swift, as an alternative to Objective-C, is widely used for its simpler syntax and more powerful features. Therefore, when the device being updated uses the iOS operating system, file reading functionality can be written in either Objective-C or Swift.
[0076] The process of retrieving updated data using Objective-C or Swift generally includes: determining the path to read the data and reading the data. In Objective-C, the `stringWithContentsOfFile:encoding:error:` method of `NSString` is used to read the data.
[0077] In some other embodiments, when the operating system used by the program update device is Windows, the file reading function is written in C++ or C#.
[0078] It's understandable that Windows is an operating system based on multiple programming languages, primarily C++, C#, C, and assembly language. C++ is a compiled language; its programs are compiled into machine code before execution, resulting in high execution efficiency. Furthermore, C++ offers excellent compatibility, making it the foundation for building application frameworks on Windows. C#, as a high-level language, with the support of the .NET framework, enables the rapid development of secure and reliable applications. When the operating system of the device being updated is Windows, file reading functionality can be written in C++ or C#.
[0079] The process of retrieving updated data using C++ or C# generally involves two steps: determining the path to read the data and reading the data. When using C++, the header file needs to be included, and ifstream can be used to read updated data. In C#, file reading functionality can be written within the .NET environment.
[0080] As one possible implementation, when the electronic control unit is updated based on the update data, the user clicks the "update" button in the program update device. This means that the program update device receives the control command to update the electronic control unit. The program update device then retrieves the update data from the data source using the file reading function provided by the Flutter application. The data source can be local or a server.
[0081] S202. Send the updated data to the electronic control unit so that the electronic control unit can update based on the updated data.
[0082] It should be understood that in some embodiments, the continuity and stability of the ECU's operation are crucial for controlling vehicle operation. Allowing updates while the ECU is operational could lead to ECU malfunction due to unexpected interruptions during the update process (such as sudden power outages or unstable network connections), thereby affecting the normal operation and safety of the vehicle. Therefore, updates cannot be completed while the electronic control unit is operational.
[0083] Based on this, as a feasible approach, before the program update device sends the update data to the electronic control unit, the program update device can send a program update request to the electronic control unit to obtain the status of the electronic control unit. The update can then be performed when the electronic control unit is not in operation, thus avoiding the impact of updating the electronic control unit on the vehicle's driving.
[0084] Specifically, before the program update device sends the update data to the electronic control unit, the program update device can send a program update request to the electronic control unit. After receiving the program update request, the electronic control unit confirms whether it can perform the update and replies to the program update device with a message indicating whether the update can be performed or not. If the program update device receives a reply indicating that the update can be performed, it sends the update data to the electronic control unit.
[0085] It should be noted that there can be multiple electronic control units (ECUs). Therefore, the program update request sent by the program update device to the ECU carries the identifier of the ECU. The program update device can send the update data to the ECU corresponding to the identifier, so that the ECU corresponding to the identifier can update based on the update data.
[0086] The electronic control unit (ECU) update method of this application, in response to the operation of obtaining update data, retrieves update data from a data source based on the file reading function provided by the Flutter application, which is compatible with the operating system of the update device, and sends the update data to the ECU, enabling the ECU to update based on the update data. It is understood that different operating systems operate differently when reading data; that is, different operating systems have different file reading functions. The file reading function provided by the Flutter application installed on the update device in this application is compatible with the operating system of the update device. Therefore, regardless of the operating system of the update device, update data can be read from the data source based on the file reading function provided by the Flutter application. In other words, the ECU update method provided in this application does not limit the operating system used by the update device and can complete the update of the ECU, possessing the characteristic of cross-platform ECU update capability.
[0087] It should be noted that the technical solutions in this application only describe the operating systems of Android, iOS and Windows, and do not constitute a limitation on the solutions. The technical solutions in this application are also applicable to other operating systems for which Flutter is applicable.
[0088] Combination Figure 1 ,like Figure 3 As shown, in one implementation provided in this application embodiment, a Flutter application needs to be built in the operating system before obtaining the updated data. Therefore, the above-mentioned electronic control unit update method may also include S301-S302.
[0089] S301. Obtain the target Flutter application toolkit that matches the operating system used by the device being updated.
[0090] It is understandable that different operating systems have different performance, compatibility, and other characteristics, so the construction process of Flutter application toolkits for different operating systems is also different.
[0091] In some embodiments, where the operating system used by the device updating the application is Android, the target Flutter application toolkit is built based on the open-source project automation build tool (Gradle).
[0092] Understandably, Gradle supports cross-platform compatibility, incremental builds for high efficiency, and Android Studio's built-in support for Gradle allows developers to manage the build process, leading to its widespread use in building Flutter application toolkits on Android systems. Therefore, when the device being updated uses the Android operating system, the target Flutter application toolkit can be built using the Gradle open-source automated build tool.
[0093] In some embodiments, where the operating system used by the device updating the application is iOS, the target Flutter application toolkit is built based on the integrated development environment (Xcode) running on the Mac OS X operating system.
[0094] Understandably, Xcode is the official integrated development environment (IDE) provided by the iOS system. Xcode offers comprehensive development tools and framework support, improving development efficiency and reducing development difficulty. At the same time, Xcode reduces the cost and time of cross-platform development, making it one of the preferred tools for iOS application development. Therefore, when the device being updated uses the iOS operating system, the target Flutter application toolkit can be built using the integrated development environment (Xcode) running on the Mac OS X operating system.
[0095] In some embodiments, Flutter provides the necessary build logic, configuration, and dependencies for Windows systems, allowing developers to build Flutter applications on Windows without needing to install or configure additional toolkits. If the device being updated is running Windows, a new Flutter project can be created using Visual Studio and the `Flutter create` command, with the option to add Windows support during creation, to build the Flutter application on Windows.
[0096] It should be noted that the process of building Flutter applications for each operating system has been written into the program when developing Flutter applications. When building Flutter applications, you only need to call the Flutter application toolkit that matches the operating system to build the Flutter application in the operating system.
[0097] S302. Build a Flutter application based on the target Flutter application toolkit.
[0098] In some embodiments, when the operating system used by the application update device is Android, the application update device builds a Flutter application by running the `Flutter build apk` command. Specifically, this process includes running the `Flutter build apk` command to build an APK file. This command compiles Dart code to machine code and packages all necessary resources into a single APK file, which can be installed and run on the Android device.
[0099] In some embodiments, when the operating system used by the app update device is iOS, the app update device builds a Flutter application by running the `Flutter build ios` command. The specific process includes running the `Flutterbuild ios` command to build the iOS application. This command generates an Xcode project, in which the Archive feature can be used to package the application and publish it to the App Store or distribute it via Ad Hoc.
[0100] In some embodiments, when the operating system used by the program update device is Windows, the program update device builds a Flutter application by running the `Flutter build windows` command. Specifically, running the `Flutter build windows` command generates an executable file (.exe) that can be run on the Windows system.
[0101] In this embodiment, the process of building the Flutter application for each operating system is already written in the program during the development of the Flutter application. When building the Flutter application, it is only necessary to call the Flutter application toolkit that matches the operating system to build the Flutter application on the operating system. That is, regardless of the type of operating system of the application update device, the Flutter application can be built on the application update device.
[0102] In one implementation of the embodiments of this application, combined with Figure 1 The aforementioned update data will be sent to the electronic control unit, specifically including S401.
[0103] S401: The update data is sent to the CAN device via the CAN protocol, so that the CAN device can send the update data to the electronic control unit via CAN communication.
[0104] In some embodiments, such as Figure 4As shown, the ISO seven-layer network model, from bottom to top, includes: physical layer, data link layer, network layer, transport layer, session layer, presentation layer, and application layer. This model enables communication between different systems and networks. In this application, the ISO seven-layer network model is used to enable communication between a CAN device and a program update device.
[0105] As a feasible implementation method, the CAN protocol stack includes an application layer. The application layer encapsulates the communication service interface and parameter configuration service interface related to diagnostic messages, enabling the program update device to interact with the CAN device and / or data source through the communication service interface and / or parameter configuration service interface.
[0106] For example, the communication service interface may include: a data sending request interface (N_USData_request), a request confirmation service interface (N_USData_comfirm), a first frame indication service interface (N_USData_FF_indication), and a data indication service interface (N_USData_indication), and the parameter configuration service interface may include a parameter configuration request service interface (N_ChangeParameter_request) and a parameter configuration confirmation service interface (N_ChangeParameter_comfirm).
[0107] The interface includes: a data transmission request service, a request confirmation service, and a first frame indication service. The first data indication service indicates the start or completion of receiving update data. The parameter configuration request service indicates the adjustment of parameters for sending update data. The parameter configuration confirmation service confirms whether the parameters have been successfully adjusted after responding to the parameter configuration request.
[0108] In some embodiments, since CAN devices and vehicle controllers (i.e., electronic control units) need to comply with the ISO 15765-2 standard at the network and transport layers, the CAN protocol stack also includes a presentation layer and a session layer. The presentation layer is used to encode and convert the instructions received by the application layer and then send them to the session layer. The session layer uses the Dart language's Socket library to implement data communication with the CAN device.
[0109] The encoding conversion includes at least one of the following: binary to hexadecimal conversion, and binary to decimal conversion. Encoding conversion enables the mutual conversion between encodings conforming to the UDS standard and encodings conforming to the ISO 15765-2 standard.
[0110] It should be noted that in the ISO seven-layer network model, the session layer provides a method for establishing connections between physical devices and enabling communication between devices. In this application, the session layer provides a method for program updating devices to establish connections with CAN devices, and uses the Dart language Socket library to implement data communication with CAN, specifically including: establishing TCP / IP connections, sending message data, listening to data, and closing connections.
[0111] In the embodiments of this application, such as Figure 5 As shown, Figure 5 The diagram illustrates how to build Flutter applications on different operating systems, including: a cross-platform plugin for CAN communication and file services, specific burning services, the Flutter application, and building the Flutter application on Android, iOS, and Windows systems respectively using the commands build apk, build ios, and build windows.
[0112] The Flutter application utilizes a cross-platform plugin for CAN communication and file services to implement CAN communication and file service functions. The CAN communication function establishes communication between the program update device and the CAN device for quality inspection. The file service function acquires update data and sends it to the CAN device via the CAN protocol, enabling the CAN device to transmit the update data to the electronic control unit via CAN communication.
[0113] The specific programming service involves acquiring updated data and updating the electronic control unit based on that data.
[0114] like Figure 6 As shown, Flutter applications can provide a platform channel, which enables CAN communication and file service plugins to communicate with Android, iOS and Windows systems.
[0115] like Figure 7 As shown, Figure 7 This is a diagram illustrating the page of a Flutter application running on a device undergoing an application update.
[0116] The Flutter application page includes a project type search box and a barcode scan button, so updated data can be obtained by entering information in the search box or scanning the barcode. "Connect to CAN" indicates establishing communication with a CAN device. "Start programming" indicates updating the electronic control unit.
[0117] The following example illustrates the method for updating an electronic control unit provided in this application.
[0118] For example, such as Figure 8As shown, the process of updating the electronic control unit based on updated data may include:
[0119] S801, Diagnostic Session Mode.
[0120] It's important to note that entering session mode is a prerequisite for UDS flashing. Session mode distinguishes the execution status of diagnostic services under different permissions. There are three types: default session, programming session, and extended session. Flashing can be performed in programming session mode.
[0121] S802, Secure Access.
[0122] It should be noted that when flashing the UDS program, you can request a seed and a key to unlock the ECU, thereby obtaining read and write permissions.
[0123] S803, erase the original data of the ECU.
[0124] S804, Request to download updated data.
[0125] S805, Transmit updated data.
[0126] S806, Transmission Exit.
[0127] S807, Has data transmission been completed?
[0128] S808. Check data integrity.
[0129] S809, Reset.
[0130] The above embodiments use the UDS flashing process as an example to illustrate the process of updating the electronic control unit (ECU) based on updated data. Since the ECU update processes of different automotive ECU suppliers or OEMs may vary, they all comply with the ISO 14229-1 standard. Therefore, this application does not limit the specific process of updating the ECU based on updated data.
[0131] The foregoing mainly describes the solutions provided by the embodiments of this application from a methodological perspective. To achieve the above functions, the electronic control unit update device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0132] This application embodiment can, based on the above method, exemplarily divide the electronic control unit (ECU) update device into functional modules. For example, the ECU update device may include functional modules corresponding to each functional division, or two or more functions may be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division; in actual implementation, there may be other division methods.
[0133] This application also provides an electronic control unit update system, including: a data source, a program update device, and an electronic control unit; the data source is used to store update data; the program update device is used to, in response to an operation of obtaining update data, obtain update data from the data source based on the file reading function provided by the Flutter application in the program update device, wherein the file reading function provided by the Flutter application matches the operating system type; and send the update data to the electronic control unit, so that the electronic control unit updates based on the update data.
[0134] In some embodiments, the aforementioned program update device is further configured to obtain a target Flutter application toolkit that matches the operating system used by the program update device; and to build a Flutter application based on the target Flutter application toolkit.
[0135] In some embodiments, the above-described program update device is used to send update data to a CAN device via the CAN protocol, so that the CAN device sends the update data to the electronic control unit via CAN communication.
[0136] In some embodiments, the CAN protocol stack includes an application layer, which encapsulates communication service interfaces and parameter configuration service interfaces related to diagnostic messages, enabling the program update device to interact with CAN devices and / or data sources through the communication service interfaces and / or parameter configuration service interfaces.
[0137] In some embodiments, the CAN protocol stack further includes a presentation layer and a session layer. The presentation layer is used to encode and convert the instructions received by the application layer and then send them to the session layer. The encoding conversion includes at least one of the following: binary to hexadecimal conversion, binary to decimal conversion.
[0138] In some embodiments, the session layer uses the Dart language's Socket library to communicate with the CAN device.
[0139] In some embodiments, when the operating system used by the application update device is Android, the file reading function is written in Java or Kotlin; when the operating system used by the application update device is iOS, the file reading function is written in Objective-C or Swift; and when the operating system used by the application update device is Windows, the file reading function is written in C++ or C#.
[0140] In some embodiments, when the operating system used by the update device is Android, the target Flutter application toolkit is built based on Gradle, and the update device builds the Flutter application by running the `Flutter build apk` command; when the operating system used by the update device is iOS, the target Flutter application toolkit is built based on Xcode, and the update device builds the Flutter application by running the `Flutter build ios` command; when the operating system used by the update device is Windows, the update device builds the Flutter application by running the `Flutter build windows` command.
[0141] Figure 9 A schematic diagram of a possible structure of the electronic control unit update device involved in the above embodiments is shown. (Refer to...) Figure 9 The electronic control unit update device 900 includes: a first acquisition unit 901 and an update unit 902.
[0142] The first acquisition unit 901 is used to respond to the operation of acquiring updated data by acquiring updated data from the data source based on the file reading function provided by the Flutter application in the program update device. The file reading function provided by the Flutter application is matched with the operating system type.
[0143] The update unit 902 is used to send update data to the electronic control unit, so that the electronic control unit can update based on the update data.
[0144] In some embodiments, the apparatus further includes: a second acquisition unit and a construction unit; the second acquisition unit is configured to acquire a target Flutter application toolkit that matches the operating system used by the program update device; the construction unit is configured to build a Flutter application based on the target Flutter application toolkit.
[0145] In some embodiments, the update unit 902 is specifically used to send update data to a CAN device via the CAN protocol, so that the CAN device sends the update data to the electronic control unit via CAN communication.
[0146] In some embodiments, the CAN protocol stack includes an application layer, which encapsulates communication service interfaces and parameter configuration service interfaces related to diagnostic messages, enabling the program update device to interact with CAN devices and / or data sources through the communication service interfaces and / or parameter configuration service interfaces.
[0147] In some embodiments, the CAN protocol stack further includes a presentation layer and a session layer. The presentation layer is used to encode and convert the instructions received by the application layer and then send them to the session layer. The encoding conversion includes at least one of the following: binary to hexadecimal conversion, binary to decimal conversion.
[0148] In some embodiments, the session layer uses the Dart language's Socket library to communicate with the CAN device.
[0149] In some embodiments, when the operating system used by the application update device is Android, the file reading function is written in Java or Kotlin; when the operating system used by the application update device is iOS, the file reading function is written in Objective-C or Swift; and when the operating system used by the application update device is Windows, the file reading function is written in C++ or C#.
[0150] In some embodiments, when the operating system used by the update device is Android, the target Flutter application toolkit is built based on Gradle, and the update device builds the Flutter application by running the `Flutter build apk` command; when the operating system used by the update device is iOS, the target Flutter application toolkit is built based on Xcode, and the update device builds the Flutter application by running the `Flutter build ios` command; when the operating system used by the update device is Windows, the update device builds the Flutter application by running the `Flutter build windows` command.
[0151] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0152] Figure 10 A block diagram of the device involved in the above embodiments is shown. Figure 10 As shown, device 1000 includes, but is not limited to, processor 1001 and memory 1002.
[0153] The aforementioned memory 1002 is used to store the executable instructions of the aforementioned processor 1001. It is understood that the aforementioned processor 1001 is configured to execute instructions to implement the obstacle detection method in the above embodiments.
[0154] It should be noted that those skilled in the art will understand that Figure 10 The device structure shown does not constitute a limitation on the device; the device may include, but is not limited to, other types of devices. Figure 10 This may indicate more or fewer components, or a combination of certain components, or a different arrangement of components.
[0155] The processor 1001 is the control center of the device, connecting various parts of the device through various interfaces and lines. It performs various functions and processes data by running or executing software programs and / or modules stored in the memory 1002, and by calling data stored in the memory 1002, thereby providing overall monitoring of the device. The processor 1001 may include one or more processing units. Optionally, the processor 1001 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 1001.
[0156] The memory 1002 can be used to store software programs and various data. The memory 1002 may primarily include a program storage area and a data storage area. The program storage area may store the operating system, application programs required by at least one functional module (such as a determination unit, processing unit, etc.), etc. Furthermore, the memory 1002 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0157] In an exemplary embodiment, this application also provides a vehicle including the aforementioned device.
[0158] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 1002 including instructions, which can be executed by a processor 1001 of the device 1000 to implement the methods in the above embodiments.
[0159] In actual implementation, Figure 9 The first acquisition unit 901 and update unit 902 can both be generated by... Figure 10The processor 1001 calls the computer program stored in the memory 1002 to implement the process. The specific execution process can be found in the description of the method section in the previous embodiment, and will not be repeated here.
[0160] Optionally, the computer-readable storage medium may be a non-transitory computer-readable storage medium, such as a read-only memory (ROM), random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device.
[0161] In an exemplary embodiment, this application also provides a computer program product including one or more instructions, which can be executed by the processor 1001 of the device to perform the methods described above.
[0162] It should be noted that when one or more instructions in the computer-readable storage medium or computer program product are executed by the processor of the device, they implement the various processes of the above method embodiments and achieve the same technical effect as the above method. To avoid repetition, they will not be described again here.
[0163] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0164] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0165] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the classified units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0166] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0167] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, essentially, or the part that contributes to the prior art, or a complete or partial classification of the technical solution, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0168] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for updating an electronic control unit, characterized in that, Applied to devices for program updates, including: Obtain the target Flutter application toolkit that matches the operating system used by the device being updated; The Flutter application is built based on the target Flutter application toolkit; In response to the operation of obtaining updated data, the updated data is obtained from the data source based on the file reading function provided by the Flutter application in the program update device, wherein the file reading function provided by the Flutter application is matched with the operating system type; The updated data is sent to the electronic control unit, so that the electronic control unit updates based on the updated data; When the operating system used by the device updating the program is Android, the file reading function is written in Java or Kotlin. If the operating system used by the device updating the program is iOS, the file reading function is written in Objective-C or Swift. If the operating system used by the program to update the device is Windows, the file reading function is written in C++ or C#.
2. The method according to claim 1, characterized in that, Sending the updated data to the electronic control unit includes: The update data is sent to the CAN device via the CAN protocol, so that the CAN device sends the update data to the electronic control unit via CAN communication.
3. The method according to claim 2, characterized in that, The CAN protocol stack includes an application layer, which encapsulates communication service interfaces and parameter configuration service interfaces related to diagnostic messages, enabling the program update device to interact with the CAN device and / or the data source through the communication service interfaces and / or the parameter configuration service interfaces.
4. The method according to claim 3, characterized in that, The CAN protocol stack also includes a presentation layer and a session layer. The presentation layer is used to encode and convert the instructions received by the application layer and then send them to the session layer. The encoding and conversion includes at least one of the following: binary to hexadecimal conversion and binary to decimal conversion.
5. The method according to claim 4, characterized in that, The session layer uses the Dart language's Socket library to communicate with the CAN device.
6. The method according to any one of claims 1-5, characterized in that, When the operating system used by the program update device is Android, the target Flutter application toolkit is built based on Gradle, and the program update device builds the Flutter application by running the Flutter build apk command; When the operating system used by the program update device is iOS, the target Flutter application toolkit is built based on Xcode, and the program update device builds the Flutter application by running the Flutter build ios command; When the operating system used by the program update device is Windows, the program update device builds the Flutter application by running the Flutter build windows command.
7. An electronic control unit update system, characterized in that, include: Data source, program update equipment, and electronic control unit; The data source is used to store updated data; The program update device is used to: acquire a target Flutter application toolkit that matches the operating system used by the program update device; build the Flutter application based on the target Flutter application toolkit; in response to the operation of acquiring update data, acquire the update data from a data source based on the file reading function provided by the Flutter application in the program update device, wherein the file reading function provided by the Flutter application matches the operating system type; send the update data to an electronic control unit, so that the electronic control unit updates based on the update data; when the operating system used by the program update device is an Android system, the file reading function is written in Java or Kotlin; when the operating system used by the program update device is an iOS system, the file reading function is written in Objective-C or Swift; when the operating system used by the program update device is a Windows system, the file reading function is written in C++ or C#.
8. An electronic control unit update device, characterized in that, Includes a first acquisition unit and an update unit: The first acquisition unit is configured to acquire a target Flutter application toolkit that matches the operating system used by the program update device; construct the Flutter application based on the target Flutter application toolkit; and, in response to the operation of acquiring update data, acquire the update data from the data source based on the file reading function provided by the Flutter application, wherein the file reading function provided by the Flutter application matches the operating system type. The update unit is used to send the update data to the electronic control unit, so that the electronic control unit updates based on the update data; when the operating system used by the program update device is Android, the file reading function is written in Java or Kotlin; when the operating system used by the program update device is iOS, the file reading function is written in Objective-C or Swift; when the operating system used by the program update device is Windows, the file reading function is written in C++ or C#.
9. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the method as described in any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that, When the computer-executable instructions stored in the computer-readable storage medium are executed by the processor of the device, the device is capable of performing the method as described in any one of claims 1 to 6.
11. A computer program product, said computer program product comprising computer instructions, characterized in that, When the computer instructions are executed on the processor of the device, the device is enabled to perform the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Form dynamic implementation method and device, equipment and storage medium
CN115544992A
Method and apparatus for implementing user interface
WO2022042162A1