Software updating method and device and intelligent equipment

CN120112889APending Publication Date: 2025-06-06YINWANG INTELLIGENT TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202280101501.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2022-10-29
Publication Date
2025-06-06

AI Technical Summary

Technical Problem

Existing smart devices require the controller to be powered on again during software update, which affects the update speed and convenience.

Method used

By dividing the active area and backup area in the storage area of ​​the controller, and detecting the data in the backup area when the function module is running, the latest software program can be run without re-powering on, and flash files are used for modular division and data calibration. to improve update efficiency and security.

Benefits of technology

It improves the speed and convenience of software updates, reduces the time required for updates, and enhances data security through modular division and verification mechanisms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120112889A_ABST
    Figure CN120112889A_ABST
Patent Text Reader

Abstract

The invention discloses a software updating method and device and intelligent equipment, and the method comprises the steps: detecting a second storage partition when a first function module is controlled to run a first program of a first storage partition, the first function module is a function module of first software of a controller, and the second function module is a function module of second software of the controller; a storage area of the controller comprises the first storage partition and the second storage partition; when data of a second program of the second storage partition is detected, the first function module is controlled to run the second program, and the data of the second program comprises data related to updating of the first function module. The method can be applied to intelligent equipment such as an intelligent vehicle and an electric vehicle, the latest software program can be operated without re-electrifying a controller of the intelligent equipment, and the software updating speed and convenience can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Software updating method, device and intelligent device Technical Field

[0001] The present application relates to the field of computer technology, and more specifically, to a method, apparatus, and intelligent device for updating software. Background Art

[0002] With the development of intelligent technology, the speed of software updates in intelligent devices is also gradually accelerating. During the life cycle of a smart device, multiple software updates may be required. Taking vehicles as an example, the software of the vehicle controller is usually updated through over the air (OTA) technology. When using OTA to update the software, the controller is usually required to have storage partitions, one of which is used to store new data. When the software needs to be updated, the new data is generally received and stored in the corresponding storage partition when the controller executes the application code. When the controller is powered on again, the boot loader of the controller jumps to the starting address to run the new software program. The process of re-powering the controller affects the speed and convenience of the software update process.

[0003] In view of this, an update solution that can run new software without re-powering the controller is in urgent need of development.

[0004] Summary of the Invention

[0005] The embodiments of the present application provide a method, apparatus, and intelligent device for updating software, which enable the controller to run the latest software program without re-powering on, thereby helping to improve the speed and convenience of software updates.

[0006] In a first aspect, a method for updating software is provided, which can be executed by a smart device; or, it can also be executed by a controller of the smart device; or, it can also be executed by a chip or circuit used for the smart device, which is not limited in this application.

[0007] The smart devices involved in this application may include road vehicles, water vehicles, air vehicles, industrial equipment, agricultural equipment, or entertainment equipment, etc. For example, the smart device can be a vehicle, which is a vehicle in a broad sense, and can be a vehicle (such as a commercial vehicle, a passenger car, a motorcycle, a flying car, a train, etc.), an industrial vehicle (such as a forklift, a trailer, a tractor, etc.), an engineering vehicle (such as an excavator, a bulldozer, a crane, etc.), agricultural equipment (such as a lawn mower, a harvester, etc.), amusement equipment, a toy vehicle, etc. The embodiments of this application do not specifically limit the type of vehicle. For another example, the smart device can be a vehicle such as an airplane or a ship. Alternatively, the smart device can also include devices such as a smart phone and a smart home.

[0008] The method includes: when controlling a first functional module to run a first program in a first storage partition, detecting a second storage partition, the first functional module is a functional module of a first software of a controller, and the storage area of ​​the controller includes the first storage partition and the second storage partition; when detecting data of a second program in the second storage partition, controlling the first functional module to run the second program, wherein the data of the second program includes data associated with the update of the first functional module.

[0009] In the above technical solution, when the control function module is running the software program in the first storage partition and detects that new software program data exists in the second storage partition, it can run the new software program in the second storage partition. This allows the latest software program to be run without re-powering the controller, helping to improve the speed and convenience of software updates. Furthermore, during the software update process, only the functional modules that require an update can be updated, reducing the time required for the software update.

[0010] In some possible implementations, a controller may include only one software, or may include two or more software.

[0011] In some possible implementations, the first software may include only the first functional module; or, in addition to the first functional module, the first software may also include other functional modules.

[0012] Taking the controller as a vehicle power steering controller as an example, the first software can be software that can implement power steering. The software can include functions such as sensor signal acquisition, torque calculation, and motor control. Based on the above functions, the software can be divided into multiple functional modules. For example, the software is divided into at least three functional modules, wherein the three functional modules are respectively used to implement the functions of sensor signal acquisition, torque calculation, and motor control. Exemplarily, the first functional module can be one of the above three functional modules; or, in some possible implementations, functions such as sensor signal acquisition, torque calculation, and motor control can be further refined into smaller functional modules, and the first functional module can also be one of the above smaller functional modules.

[0013] In some possible implementations, when controlling a first functional module to run a first program in a first storage partition, a second storage partition is detected, where the first functional module is a functional module of a controller, and a storage area of ​​the controller includes the first storage partition and the second storage partition; when detecting data of a second program in the second storage partition, the first functional module is controlled to run the second program, where the data of the second program includes data associated with the update of the first functional module.

[0014] In combination with the first aspect, in certain implementations of the first aspect, the data of the second program comes from a flash file, which includes first data and information about the first data, and the information is used to indicate the start and / or end of the first data; wherein the first data is any data of the program data of the M functional modules of the first software, the M functional modules include the first functional module, and M is an integer greater than or equal to 1.

[0015] In some possible implementations, the first software includes more than M functional modules, but only M functional modules need to be updated, and the flash file may only include data corresponding to the M functional modules.

[0016] Exemplarily, the information of the first data may include a start address and an end address of the first data in the storage area; or, the information of the first data may include a start address and a data length of the first data in the storage area.

[0017] In some possible implementations, the address allocated to the first data in the storage area is pre-set, and check information can be added to the end of the first data, and padding data is added after the check information. The padding data can indicate the end position of the first data, and the padding data can be understood as a type of information of the first data. Exemplarily, the starting position and end position of the storage data are pre-configured for the first functional module in the storage area of ​​the controller (e.g., the first storage partition and / or the second storage partition). For example, 300 bytes are pre-configured for the first functional module, and the first data occupies a total of 150 bytes in the second storage partition; if the check information length is 2 bytes, the 299th byte and the 300th byte are reserved for storing the check information, and the remaining bytes at the end of the first data (i.e., the 151st byte to the 298th byte) are used to store the padding data. It should be understood that the end position of the first data can be determined based on the padding data.

[0018] In the above technical solution, modular division of the flash files according to the functional modules of the software can reduce the possibility of all data being unavailable due to a sudden interruption of data flashing.

[0019] In combination with the first aspect, in certain implementations of the first aspect, the flash file consists of M module data, the M module data correspond one-to-one to the M functional modules, the M module data include first module data, the first module data include the first data and first description information of the first data, and the first description information is used to describe the relationship between the first data and the first functional module.

[0020] Exemplarily, the first descriptive information may include identification information of the first functional module, for example, may include the first functional module ID; or, the first descriptive information may also include information of the storage space associated with the first functional module, for example, may include information of the starting position and / or ending position for storing the first data; or, the first descriptive information may also include information of the data length of the first data.

[0021] In combination with the first aspect, in some implementations of the first aspect, the first description information also includes first verification information, which is set at the header and / or tail of the first data and is used to perform integrity and / or consistency verification on the first data.

[0022] In the above technical solution, integrity and / or consistency verification is performed on the first data using the first verification information, which helps to improve data security.

[0023] In combination with the first aspect, in certain implementations of the first aspect, the flash file consists of description information and module data, the description information includes first description information of the first data, the first description information is used to describe the relationship between the first data and the first functional module, and the module data includes the first data.

[0024] Exemplarily, the description information may further include quantity information of the module data, where the quantity information is used to indicate that the module data includes data of several functional modules.

[0025] In combination with the first aspect, in some implementations of the first aspect, the flash file also includes second verification information, which is set at the header and / or tail of the flash file and is used to perform integrity and / or consistency verification on the flash file.

[0026] In the above technical solution, the integrity and / or consistency of the entire flash file is checked through the second verification information to prevent problems with the entire flash file when the data verification of each functional module passes, which helps to improve data security.

[0027] In combination with the first aspect, in certain implementations of the first aspect, the storage area also includes a third storage partition, which is used to store data of a third program of a second functional module. The second functional module is a new functional module of the first software. The method also includes: when the data of the third program is detected in the third storage partition, controlling the second functional module to run the third program.

[0028] In the above technical solution, storage space is reserved for the new functions of the first software. When the first software needs a new function, there is no need to reconfigure the controller because of the new function. It is only necessary to control the operation of the program in the reserved storage space when the data of the program in the reserved storage space is detected, so as to achieve the successful operation of the new function, which helps to reduce the cost of software updates and save the time required for software updates.

[0029] In combination with the first aspect, in certain implementations of the first aspect, the first functional module includes a first function and a second function, the interface address of the first function is associated with the first storage partition, and the interface address of the second function is associated with the second storage partition, and controlling the first functional module to run the second program includes: controlling the first functional module to change from scheduling the interface address of the first function to scheduling the interface address of the second function, and running the second program in the second storage partition through the interface address of the second function.

[0030] For example, the first function may be a function of the first functional module in the first storage partition, and the second function may be a function of the first functional module in the second storage partition. "The interface address of the first function is associated with the first storage partition" can be understood as meaning that data in the first storage partition can be read and / or a program in the first storage partition can be executed through the interface address.

[0031] In combination with the first aspect, in certain implementations of the first aspect, the address of the data of the second program in the second storage partition is a pre-set fixed address, and the storage area includes a fourth storage partition, which is used to store the fixed address; before controlling the first functional module to change from scheduling the interface address of the first function to scheduling the interface address of the second function, the method also includes: determining that the interface address of the second function is consistent with the fixed address in the fourth storage partition.

[0032] In the above technical solution, before controlling the execution of the second program in the second storage partition, the validity of the interface address is first determined, which can prevent the execution of unsafe programs when the interface address is tampered with, and helps to improve the security of the functional module.

[0033] In combination with the first aspect, in certain implementations of the first aspect, the data of the second program includes functional data and configuration data. Before controlling the first functional module to run the second program, the method also includes: performing integrity and / or consistency verification on the configuration data and the functional data, respectively.

[0034] In the above technical solution, the configuration data and the functional function data are verified separately, which can shorten the time required for data verification and improve the data verification efficiency.

[0035] In combination with the first aspect, in some implementations of the first aspect, the method further includes: controlling erasure of data of the first program in the first storage partition.

[0036] In the above technical solution, after running the updated program, the data of the old program is controlled to be erased so that the storage partition storing the old program data can be used to receive the new program data, so that the storage partition can receive the data required for the next program update.

[0037] In combination with the first aspect, in certain implementations of the first aspect, the storage area also includes a fifth storage partition, which is used to store identification information of the first functional module, and the identification information is used to indicate that data associated with the update of the first functional module has been written into the second storage partition. When data of the second program in the second storage partition is detected, the first functional module is controlled to run the second program, including: when data in the second storage partition and the identification information of the first functional module in the fifth storage partition are detected, the first functional module is controlled to run the second program in the second storage partition.

[0038] In the above technical solution, whether the data required for program update is written is determined based on the identification information. When the identification information of the first functional module is detected, it is determined that the first data is written. Otherwise, it is considered that the first data is not written, which helps to improve data retrieval efficiency.

[0039] In a second aspect, a device for updating software is provided, which includes: a detection unit, used to detect a second storage partition when controlling a first functional module to run a first program in a first storage partition, the first functional module being a functional module of a first software of a controller, and the storage area of ​​the controller including the first storage partition and the second storage partition; a processing unit, used to control the first functional module to run data of a second program in the second storage partition when the detection unit detects data of the second program in the second storage partition, wherein the data of the second program includes data associated with the update of the first functional module.

[0040] In combination with the second aspect, in certain implementations of the second aspect, the data of the second program comes from a flash file, which includes first data and information about the first data, and the information is used to indicate the start and / or end of the first data; wherein the first data is any data in the program data of the M functional modules of the first software, the M functional modules include the first functional module, and M is an integer greater than or equal to 1.

[0041] In combination with the second aspect, in certain implementations of the second aspect, the flash file consists of M module data, the M module data correspond one-to-one to the M functional modules, the M module data include first module data, the first module data include the first data and first description information of the first data, and the first description information is used to describe the relationship between the first data and the first functional module.

[0042] In combination with the second aspect, in some implementations of the second aspect, the first description information also includes first verification information, which is set at the header and / or tail of the first data and is used to perform integrity and / or consistency verification on the first data.

[0043] In combination with the second aspect, in certain implementations of the second aspect, the flash file consists of description information and module data, the description information includes first description information of the first data, the first description information is used to describe the relationship between the first data and the first functional module, and the module data includes the first data.

[0044] In combination with the second aspect, in some implementations of the second aspect, the flash file also includes second verification information, which is set at the header and / or tail of the flash file and is used to perform integrity and / or consistency verification on the flash file.

[0045] In combination with the second aspect, in some implementations of the second aspect, the storage area further includes a third storage partition, the third storage partition is used to store data of a third program of a second functional module, the second functional module is a newly added functional module of the first software, and the processing unit is further used to: when the detection unit detects the data of the third program in the third storage partition, control the second functional module to run the third program. In combination with the second aspect, in some implementations of the second aspect, the first functional module includes a first function and a second function, the interface address of the first function is associated with the first storage partition, and the interface address of the second function is associated with the second storage partition, and the processing unit is used to: control the first functional module to change from scheduling the interface address of the first function to scheduling the interface address of the second function, and run the second program in the second storage partition through the interface address of the second function.

[0046] In combination with the second aspect, in certain implementations of the second aspect, the address of the data of the second program in the second storage partition is a pre-set fixed address, and the storage area includes a fourth storage partition, which is used to store the fixed address; before the control of the first functional module changes from scheduling the interface address of the first function to scheduling the interface address of the second function, the processing unit is also used to: determine that the interface address of the second function is consistent with the fixed address in the fourth storage partition.

[0047] In combination with the second aspect, in certain implementations of the second aspect, the data of the second program includes functional data and configuration data. Before controlling the first functional module to run the second program, the processing unit is also used to: perform integrity and / or consistency verification on the configuration data and the functional data, respectively.

[0048] In combination with the second aspect, in certain implementations of the second aspect, the processing unit is further used to: control erasure of data of the first program in the first storage partition.

[0049] In combination with the second aspect, in certain implementations of the second aspect, the storage area also includes a fifth storage partition, which is used to store identification information of the first functional module, and the identification information is used to indicate that the data associated with the update of the first functional module is written in the second storage partition, and the processing unit is used to: when the detection unit detects the data in the second storage partition and the identification information of the first functional module in the fifth storage partition, control the first functional module to run the second program of the second storage partition.

[0050] In a third aspect, a device for updating software is provided, the device comprising: a memory for storing a computer program; and a processor for executing the computer program stored in the memory, so that the device performs a method as in any possible implementation of the first aspect.

[0051] In a fourth aspect, a smart device is provided, which includes the apparatus in any possible implementation of the second aspect or the third aspect.

[0052] In combination with the fourth aspect, in some implementations of the fourth aspect, the intelligent driving device is a vehicle.

[0053] In a fifth aspect, a computer program product is provided, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the method in any one of the possible implementations of the first aspect.

[0054] It should be noted that the above-mentioned computer program code may be stored in whole or in part on a first storage medium, wherein the first storage medium may be packaged together with the processor or separately from the processor.

[0055] In a sixth aspect, a computer-readable medium is provided, wherein the computer-readable medium stores instructions. When the instructions are executed by a processor, the processor implements the method in any possible implementation of the first aspect.

[0056] In a seventh aspect, a chip is provided, which includes a circuit for executing the method in any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] FIG1 is a schematic block diagram of a system architecture required for implementing a method for updating software provided in an embodiment of the present application;

[0058] FIG2 is a schematic diagram of a storage area division of a controller provided in an embodiment of the present application;

[0059] 3 is a schematic diagram of address mapping between data of a program of a functional module and a storage partition provided by an embodiment of the present application;

[0060] FIG4 is a schematic flow chart of a method for updating software provided in an embodiment of the present application;

[0061] FIG5 is a schematic diagram of a flash file provided in an embodiment of the present application;

[0062] FIG6 is another schematic diagram of a flash file provided in an embodiment of the present application;

[0063] FIG7 is a schematic flow chart of data verification during the software update process provided by an embodiment of the present application;

[0064] FIG8 is a schematic block diagram of a device for updating software according to an embodiment of the present application;

[0065] FIG9 is another schematic block diagram of the apparatus for updating software provided in an embodiment of the present application. DETAILED DESCRIPTION

[0066] In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is a kind of association relationship that describes associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In this application, "at least one" refers to one or more, and "more than one" refers to two or more. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0067] In the embodiments of this application, prefixes such as "first" and "second" are used only to distinguish different description objects and have no limiting effect on the position, order, priority, quantity, or content of the described objects. The use of prefixes such as ordinal numbers in the embodiments of this application to distinguish description objects does not constitute a limitation on the described objects. For a statement of the described objects, please refer to the description in the context of the claims or embodiments, and the use of such prefixes should not constitute an unnecessary limitation.

[0068] In current vehicle controllers, software updates are often performed in the following ways:

[0069] First, when the vehicle is stationary, connect the host computer to the vehicle controller. The controller's bootloader writes the data of the new software program sent by the host computer into the controller. After the data writing is completed, the controller is powered on again and starts running the updated software program.

[0070] Secondly, under the condition that the vehicle's controller has storage partitions, the data of the new software program is written into the unused storage partition using OTA when the vehicle is running or stationary. When the controller is powered on again, the starting address jump is performed to run the new software program in the storage partition.

[0071] Both of the above methods require the controller to be powered on again before the new software program can be run, and do not have the ability to update and run in real time during the same power cycle.

[0072] In view of this, the present application provides a method, apparatus and intelligent device for updating software, which partitions the storage area of ​​the controller according to the functional modules, and each functional module that needs to be updated corresponds to at least two storage partitions, wherein one storage partition (hereinafter referred to as the active area) is used to store the data of the running software program, and the other storage partition (hereinafter referred to as the backup area) is used to store the data of the new software program. By solidifying the address of the configuration data and the main function interface of the functional module, and combining the address mapping between the active area and the backup area and the functional module, when the functional module is running the software program in the active area and detects that there is data of the new software program in the backup area, it can run the new software program in the backup area in the form of a pointer, so that the controller can run the latest software program without re-powering on, which helps to improve the speed and convenience of software updates.

[0073] It should be noted that, in this application, the software program is divided into one or more functional modules, each functional module can complete a sub-function of the software program, and the one or more functional modules as a whole can meet the required functions of the entire software program.

[0074] The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.

[0075] FIG1 is a schematic block diagram of a system architecture required for implementing a method for updating software provided in an embodiment of the present application. As shown in FIG1 , the system includes a communication bus, a controller, a gateway, and a host computer. Wherein, when the controller needs to perform a software update, the data of the new software program can be transmitted to the controller via a wireless communication system such as wireless fidelity (Wi-Fi) via a gateway; or, the data of the new software program can be transmitted to the controller via a host computer. Taking the system in a vehicle as an example, the communication bus can be a controller area network / local interconnect network bus (CAN / LIN bus), and the controller can include at least one of an electronic control unit (ECU), a microcontroller unit (MCU), a vehicle domain controller (VDC), a mobile data center (MDC), and a chassis domain controller (CDC), or the controller can also be other programmable electronic control units with a storage function.

[0076] In order to implement the method for updating software provided in the embodiment of the present application, it is necessary to divide the storage area of ​​the controller in advance and configure the address mapping between the storage partitions and the functional modules.

[0077] Exemplarily, the storage area of ​​the controller is partitioned according to the functional modules. For example, only one storage partition (such as an active area) can be set for functional modules that have no update requirements, and at least two storage partitions (for example, including an active area and a backup area) can be set for each functional module that has an update requirement. Figure 2 shows a schematic diagram of the storage area division of a controller provided by an embodiment of the present application. As shown in Figure 2, for all functional modules (i.e., functional modules 1 to m), an active area is divided for them in the storage area; for functional modules that have update requirements (such as functional modules 3 to m), a backup area is divided for them in the storage area. Among them, the active area is the storage partition required for the operation of the functional module, which is used to store the data of the running program; the backup area is the storage partition for storing the data of the new program of the functional module, and the new data is used to update the functional module. Exemplarily, a cache area can also be divided in the storage area to cache the data of the above-mentioned new program. Among them, the space of the cache area must be greater than or equal to the space required for the largest functional module to store program data. In some possible implementations, it is also possible to divide the storage area into reserved storage partitions, such as a reserved active area and a reserved backup area, which are respectively used to meet the operation requirements of the new functional modules and the update requirements of the new functional modules. For the new functional modules, it is also necessary to design interfaces and fix addresses in the above-mentioned reserved storage partitions. In some possible implementations, the number of new functional modules and the size of the occupied space need to be simulated and scheduled in the operating system in advance to prevent uncontrollable phenomena in the operating system scheduling timing or insufficient storage space. For example, when designing a new functional module, a timing analysis tool can be used to simulate the mounting test of the new functional module, and reserve appropriate storage space and interface addresses in the storage space and the operating system without affecting the safe operation of the controller.

[0078] Exemplarily, the data of the program of the functional module is composed of functional functions and configuration data. Each functional module may include one or more functional functions and configuration data. The one or more functional functions may be placed in a main function, or may be placed in multiple main functions. Each main function includes a logic code that implements the corresponding function of the functional module. Furthermore, the operating system of the controller realizes the normal operation of the functional module by calling the main function interface. In an embodiment of the present application, when configuring the address mapping between the storage partition and the functional module, the configuration data, functional function interface, and main function interface in the functional module are respectively set to correspond to the address in the storage area. Exemplarily, Figure 3 shows a schematic diagram of the address mapping between the data of the program of a functional module and a storage partition (active area or backup area). It should be understood that other configuration data can be found based on the first address of the configuration data in the storage area.

[0079] FIG4 shows a schematic flow chart of a method 400 for updating software provided in an embodiment of the present application. The method may be executed by a controller, for example, by an operating system of the controller. The method 400 may include:

[0080] S401 , detecting a second storage partition when controlling a first functional module to run a first program in a first storage partition, wherein the first functional module is a functional module of a first software of a controller, and a storage area of ​​the controller includes the first storage partition and the second storage partition.

[0081] Exemplarily, the first functional module can be one of the functional modules 3 to m in the above-mentioned embodiment, or it can be other functional modules with update requirements; the first storage partition can be an active area pre-configured for the first functional module; the second storage partition can be a backup area pre-configured for the first functional module.

[0082] S402 : When detecting data of a second program in a second storage partition, control the first functional module to run the second program, wherein the data of the second program includes data associated with the update of the first functional module.

[0083] In some possible implementations, before controlling the first functional module to run the second program, the validity, integrity and consistency of the data of the second program need to be checked. After the check is passed, the first functional module is controlled to run the second program of the second storage partition.

[0084] It should be understood that when the first functional module runs the second program of the second storage partition and detects the data of the new program of the first storage partition, the first functional module can be controlled to run the new data of the first storage partition.

[0085] In some possible implementations, in order to achieve alternating operation of programs in the first storage area and the second storage area, pointer variables for the configuration data of the first storage partition and the second storage partition, as well as function pointers pointing to the function functions of the first storage partition and the second storage partition can be pre-defined for the first functional module, and the addresses of the function functions in the first storage partition and the second storage partition can be solidified respectively. Furthermore, the function functions of the first functional module corresponding to the first storage partition and the second storage partition are defined. Exemplarily, the function function can use the if-else logic structure to determine the configuration data it calls. Furthermore, when the operating system controls the operation of the first functional module, during module initialization, the addresses of the configuration data of the pre-configured first functional module in the first storage partition and the second storage partition, as well as the address of the main function interface, are assigned to the pointer variable and the function pointer respectively. A function pointer pointing to the interface address of the first functional module in the first storage partition and the second storage partition is set in the main function of the first functional module, and only the program of one storage partition is run through conditional judgment.

[0086] In some possible implementations, when the operating system runs the program of the first functional module, it scans all reserved new module interface addresses. If it detects that there is new program data in the reserved storage partition, it means that there is a new functional module; then the operating system performs corresponding scheduling and runs the program of the new functional module.

[0087] In some possible implementations, the data of the second program is derived from a flash file. In order to perform software updates through the method for updating software provided in an embodiment of the present application, it is necessary to modularize the flash file (including the data for updating the software). Exemplarily, the flash file includes first data and information about the first data, which is used to indicate the start and / or end of the first data; wherein the first data is any data in the data of the program of the M functional modules of the first software, the M functional modules include the first functional module, and M is an integer greater than or equal to 1. In one example, as shown in FIG5 , for all functional modules of the software (such as functional modules 1 to n), keywords are used to segment the header and tail of each functional module so that when the controller receives the data, the start and end of each functional module data (i.e., the data of the new program mentioned above) can be determined. In another example, as shown in FIG6 , taking the first data as the data of functional module 1 as an example, the information of the first data can include the starting address of functional module 1, and at least one of the ending address and data length.

[0088] In some possible implementations, the flash file is composed of M module data, the M module data correspond one-to-one to the M functional modules, and the M module data include first module data, the first module data includes the first data and first descriptive information of the first data, and the first descriptive information is used to describe the relationship between the first data and the first functional module. For example, taking the flash file as the file shown in Figure 5 as an example, if the first data is the data of the program of functional module 1 (i.e., the functional module 1 data shown in the figure), then the first module data can be as shown in the dotted box 501 in Figure 5. Further, the first descriptive information can include adding a unique code (Identity document, ID) of the module to the header of the functional module data, or can also include one or more of the starting address, data length, end address, and security check value.

[0089] In some possible implementations, the flash file is composed of description information and module data, the description information includes first description information of the first data, the first description information is used to describe the relationship between the first data and the first functional module, and the module data includes the first data. For example, taking the flash file as the file shown in FIG6 as an example, the description information can be as shown in the portion framed by the dotted box 601 in FIG6, the description information can include relevant information of all functional modules of the software that need to be updated, and the module data can be as shown in the portion framed by the dotted box 602 in FIG6.

[0090] In some possible implementations, in the flash file shown in FIG5 , relevant information about the data may be added to the header and / or tail of each functional module data to enable the operating system to perform integrity and consistency checks on the received data. The security check value is used to perform a cyclic redundancy check (CRC) or other type of check on the functional module data. In some possible implementations, null bytes or other byte data may be padded at both the header and tail of the functional module data to align the file width.

[0091] In some possible implementations, a security check value (such as a check value for all module data) may be written into the header and / or tail of the flash file shown in FIG5 to verify the entire file.

[0092] In some possible implementations, in the flash file shown in FIG6 , a security check value (such as a check value of all module data) may be written at the head and / or tail of the flash file to verify the entire file.

[0093] The method for updating software provided in the embodiment of the present application can realize that when the functional module is running the software program in the active area and detects that there is new software program data in the backup area, the new software program in the backup area can be run, so that the controller can run the latest software program without re-powering on, which helps to improve the speed and convenience of software updates. In addition, by modularizing the software, only individual functional modules or new functional modules can be updated, and online real-time updates of the software can be achieved without recompiling the entire software, which helps to reduce the time required for software updates. In addition, the data block segmentation of the flash file according to the functional module can prevent the situation where the data flash is suddenly interrupted and all data is unavailable, and the security of the data can be improved by adding security checks.

[0094] By way of example, the following uses the C language environment as an example to illustrate the principle of implementing the alternating operation of data in the first and second storage areas in S402. It should be noted that the text within the symbols " / *...* / " is used to explain the meaning of the next code segment, and the text after the symbols " / / " is used to explain the meaning of the preceding code segment.

[0095] First, for the first functional module, pointer variables pointing to the configuration data of the first storage partition and the second storage partition can be defined respectively, as well as function pointers pointing to the functional functions of the first storage partition and the second storage partition corresponding to the first functional module. For example, the implementation code is as follows (lines 1 to 36), using memory mapping (memmap) for address fixation:

[0096]

[0097]

[0098] Furthermore, the function functions of the first functional module corresponding to the first storage partition and the second storage partition are defined respectively. The above function functions can determine the configuration data they call through logical structures such as if-else. For example, the implementation code is as follows (lines 37 to 75):

[0099]

[0100]

[0101] When the operating system controls the operation of the first functional module, during module initialization, the addresses of the configuration data of the pre-configured first functional module in the first storage partition and the second storage partition, as well as the address of the main function interface, are assigned to the pointer variable and the function pointer, respectively. A function pointer pointing to the interface address of the first functional module in the first storage partition and the second storage partition is set in the main function of the first functional module, and only the program in one storage partition is run through conditional judgment. For example, the following code (lines 76 to 104) can be used to implement running only the program in one storage partition at a time:

[0102]

[0103]

[0104] It should be understood that the above codes are only exemplary. In a specific implementation process, other languages ​​may be used to implement the alternating operation of the programs in the first storage area and the second storage area.

[0105] In some possible implementations, in order to achieve real-time updates of the first functional module during operation, the operating system, while controlling the execution of the program in the first storage area, will simultaneously scan the second storage area for new program data. If new program data is written to the second storage area and the validity, integrity, and consistency of the data are verified, the operating system controls the functional module to execute the program in the second storage area. For example, as shown in FIG7 , this process may include:

[0106] S701, controlling the execution of a program of a first functional module in a first storage partition.

[0107] S702: Detecting data of an update program in a cache area.

[0108] Exemplarily, the data of the update program may be data for updating the first functional module. It should be understood that the data of the update program includes configuration data and functional data of the first functional module.

[0109] S703: Determine whether the integrity and consistency check of the data of the update program passes.

[0110] Specifically, if the integrity and consistency check of the data of the update program passes, then S704 is executed; otherwise, S704' is executed.

[0111] S704: Control the writing of the data of the update program into the second storage partition.

[0112] S704', erasing the data of the update program in the cache area.

[0113] Furthermore, after erasing the data of the update program, the software update process ends.

[0114] S705: Determine whether the validity check of the data in the second storage partition passes.

[0115] S706: Determine whether the integrity and consistency check of the second storage partition configuration data passes.

[0116] Specifically, if the integrity and consistency check of the second storage partition configuration data passes, execute S7063; otherwise, execute S7061.

[0117] S707, determine whether the integrity and consistency check of the function data of the second storage partition passes.

[0118] Specifically, if the integrity and consistency check of the functional data of the second storage partition passes, execute S7073; otherwise, execute S7071.

[0119] S7061, rewrite the corresponding data from the cache area to the second storage partition and perform verification.

[0120] S7062: Determine whether the integrity and consistency check of the second storage partition configuration data passes.

[0121] Specifically, if the integrity and consistency check of the second storage partition configuration data passes, execute S7063; otherwise, execute S708.

[0122] S7063, control the second storage partition configuration data valid flag to be set.

[0123] S7064, the control function calls the second storage partition configuration data.

[0124] S7065, controlling erasure of the first storage partition configuration data.

[0125] S7071, rewrite the corresponding data from the cache area to the second storage partition and perform verification.

[0126] S7072, determine whether the integrity and consistency check of the second storage partition function data passes.

[0127] Specifically, if the integrity and consistency check of the functional data of the second storage partition passes, execute S7073; otherwise, execute S708.

[0128] S7073, control the second storage partition function data valid flag to be set.

[0129] S7074, control the main function to call the second storage partition function data.

[0130] S7075, control erasing the function data of the first storage partition.

[0131] S708: Determine that the verification has failed.

[0132] S709, controlling erasure of data corresponding to the second storage partition (and the cache area).

[0133] S710, end.

[0134] In some possible implementations, if the format of the flash data is as shown in Figure 5, when the operating system performs integrity and consistency checks, it can compare whether the module ID and address information recorded at the beginning and end of the first module data are consistent with the pre-set information, and compare whether the calculated check value is consistent with the security check value. If the comparison results are the same, the data is considered to be received completely and consistently.

[0135] It should be noted that when the storage area of ​​the controller is not configured with a cache area, after executing S701 , S702 to S704 may be skipped and S705 may be executed directly.

[0136] It can be understood that after the functional data and configuration data of the first storage partition are controlled to be erased, the first storage partition can be used to store data required for the next software update.

[0137] In some possible implementations, the solutions in any of S704', S7065, S7075, and S709 are implemented using a function for erasing a storage area. For example, when designing a function for erasing a storage area, at least one of the following information needs to be included in the function's formal parameters: the starting address and length of the target location in the storage area, and the starting address and length of the data to be written. Furthermore, the function needs to be designed as a non-reentrant type, with corresponding return values ​​for the erasing results and errors during the process.

[0138] In some possible implementations, the aforementioned handling measure for data verification failure may be to copy the data multiple times and verify it. If a preset number of failures is exceeded, the data copying is stopped and an error type is returned. For example, the preset number of failures may be 10, 20, or other values.

[0139] In some possible implementations, when updating the first software in the above embodiment, the first software may have a corresponding new functional module after the update. In this case, the main function interface pointer of the new functional module can be set in advance in the operating system. When the operating system is running, it will scan the reserved storage partition (for example, the third storage partition) for storing the interface address of the new module. If it is detected that the reserved storage partition contains the data of the program of the new functional module and the verification result of the data is valid, the operating system will schedule the corresponding function pointer and run the function of the new module. Exemplarily, the operation of the new functional module can be implemented by the following code (lines 105 to 117):

[0140]

[0141] In some possible implementations, to improve security, before scheduling the pointer, a determination is made as to whether the address pointed to by the pointer is valid. If the address is valid, the pointer is scheduled; otherwise, an error value is returned and scheduling stops. In one example, the validity of the address can be determined by determining whether the address pointed to by the pointer is a null address. If the address is not a null address, the address is valid; otherwise, the address is invalid. In another example, upon determining that the address pointed to by the pointer is not a null address, a determination is made as to whether the address pointed to by the pointer is consistent with the address expected by the pointer. If they are consistent, the address is valid; otherwise, the address is invalid.

[0142] In some possible implementations, after the controller has partitioned all functional modules, the interface address data for all functional modules is stored in a specific area of ​​the controller (e.g., the fourth storage partition) for storage and hardening upon shipment. The interface addresses of all functional modules include the pre-designed interface addresses of newly added functional modules. Furthermore, when determining the validity of the backup area data, the operating system compares the pointer value with the pre-stored functional module interface addresses. If they match, the operating system proceeds to determine the validity of the backup area data; if not, the operating system returns a corresponding error value.

[0143] Since it takes a certain amount of time to write data into a storage area, the presence of data in the corresponding storage area does not mean that the data has been written. In some possible implementations, in order to improve the efficiency of software updates, after the data of the new program of the functional module is written, the functional module ID is written into an array or an allocated fixed storage area (such as the fifth storage partition). The operating system can determine which functional module data has been written by cyclically searching the array data or the functional module ID of the fixed storage area. Furthermore, the functional module data can be checked for security and consistency, and the functional module ID can be deleted from the fixed storage area after the check is successful.

[0144] The address allocation for configuration data and function functions in the above embodiments is designed to facilitate calling the main function within a functional module. In some possible implementations, for configuration data and function functions that need to be called across functional modules, a separate storage area is provided to store these cross-module configuration data and function functions. Configuration data that requires multiple read / write operations can also be protected using spin locks.

[0145] In the various embodiments of the present application, unless otherwise specified or there is a logical conflict, the terms and / or descriptions between the various embodiments are consistent and can be referenced by each other. The technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationships.

[0146] The method provided in the embodiments of the present application is described in detail above with reference to Figures 1 to 7 . The apparatus provided in the embodiments of the present application will be described in detail below with reference to Figures 8 and 9 . It should be understood that the description of the apparatus embodiment corresponds to the description of the method embodiment. Therefore, for matters not described in detail, reference can be made to the method embodiment above, and for the sake of brevity, no further description will be given here.

[0147] FIG8 shows a schematic block diagram of an apparatus 800 for updating software provided in an embodiment of the present application. The apparatus 800 includes a detection unit 810 and a processing unit 820 .

[0148] The apparatus 800 may include units for executing the method in Figure 4. Furthermore, each unit in the apparatus 800 and the other operations and / or functions described above are for implementing corresponding processes of the method embodiment in Figure 4.

[0149] When the apparatus 800 is used to execute the method 400 in FIG. 4 , the detection unit 810 may be used to execute S401 in the method 400 , and the processing unit 820 may be used to execute S402 in the method 400 .

[0150] Specifically, the detection unit 810 is used to: detect the second storage partition when controlling the first functional module to run the first program of the first storage partition, the first functional module is a functional module of the first software of the controller, and the storage area of ​​the controller includes the first storage partition and the second storage partition; the processing unit 820 is used to: when the detection unit 810 detects the data of the second program of the second storage partition, control the first functional module to run the second program, wherein the data of the second program includes data associated with the update of the first functional module.

[0151] In some possible implementations, the data of the second program comes from a flash file, which includes first data and information about the first data, and the information is used to indicate the start and / or end of the first data; wherein the first data is any data of the program data of the M functional modules of the first software, and the M functional modules include the first functional module, and M is an integer greater than or equal to 1.

[0152] In some possible implementations, the flash file consists of M module data, which correspond one-to-one to the M functional modules. The M module data include first module data, which include the first data and first description information of the first data, and the first description information is used to describe the relationship between the first data and the first functional module.

[0153] In some possible implementations, the first description information further includes first verification information, which is set at the header and / or tail of the first data and is used to perform integrity and / or consistency verification on the first data.

[0154] In some possible implementations, the flash file consists of description information and module data, the description information includes first description information of the first data, the first description information is used to describe the relationship between the first data and the first functional module, and the module data includes the first data.

[0155] In some possible implementations, the flash file further includes second verification information, which is set at the header and / or tail of the flash file and is used to perform integrity and / or consistency verification on the flash file.

[0156] In some possible implementations, the storage area also includes a third storage partition, which is used to store data of a third program of a second functional module. The second functional module is a new functional module of the first software. The processing unit 820 is also used to: when the detection unit 810 detects the data of the third program in the third storage partition, control the second functional module to run the third program.

[0157] Exemplarily, the third storage partition may include the reserved backup area and / or the reserved active area in the above embodiment.

[0158] In some possible implementations, the first functional module includes a first function and a second function, the interface address of the first function is associated with the first storage partition, and the interface address of the second function is associated with the second storage partition, and the processing unit 820 is used to: control the first functional module to change from scheduling the interface address of the first function to scheduling the interface address of the second function, and run the second program in the second storage partition through the interface address of the second function.

[0159] In some possible implementations, the address of the data of the second program in the second storage partition is a pre-set fixed address, and the storage area includes a fourth storage partition, which is used to store the fixed address; before the control of the first functional module changes from scheduling the interface address of the first function to scheduling the interface address of the second function, the processing unit 820 is also used to: determine that the interface address of the second function is consistent with the fixed address in the fourth storage partition.

[0160] In some possible implementations, the data of the second program includes functional data and configuration data. Before controlling the first functional module to run the second program, the processing unit 820 is further used to perform integrity and / or consistency checks on the configuration data and the functional data, respectively.

[0161] In some possible implementations, the processing unit 820 is further configured to control erasure of data of the first program in the first storage partition.

[0162] In some possible implementations, the storage area also includes a fifth storage partition, which is used to store identification information of the first functional module, and the identification information is used to indicate that the data associated with the update of the first functional module is written in the second storage partition. The processing unit 820 is used to: when the detection unit 810 detects the data of the second storage partition and the identification information of the first functional module in the fifth storage partition, control the first functional module to run the second program of the second storage partition.

[0163] Exemplarily, the identification information of the first functional module may include the functional module ID in the above embodiment.

[0164] Exemplarily, the device 800 may be provided in the controller shown in FIG. 1 .

[0165] It should be understood that the division of the various units in the above device is merely a division of logical functions. In actual implementation, they may be fully or partially integrated into a single physical entity, or they may be physically separated. Furthermore, the units in the device may be implemented in the form of a processor calling software; for example, the device includes a processor connected to a memory storing instructions, and the processor calls the instructions stored in the memory to implement any of the above methods or the functions of the various units in the device. The processor may be a general-purpose processor, such as a CPU or a microprocessor, and the memory may be a memory within the device or external to the device. Alternatively, the units in the device may be implemented in the form of hardware circuits, and the functions of some or all of the units may be implemented through the design of the hardware circuits. The hardware circuits may be understood as one or more processors. For example, in one implementation, the hardware circuit is an ASIC, and the functions of some or all of the above units may be implemented through the design of the logical relationships between the components within the circuits. In another implementation, the hardware circuit may be implemented using a PLD, such as an FPGA, which may include a large number of logic gate circuits. The connections between the logic gate circuits are configured using a configuration file to implement the functions of some or all of the above units. All units of the above apparatus may be implemented entirely in the form of software called by a processor, or entirely in the form of hardware circuits, or partially in the form of software called by a processor and the rest in the form of hardware circuits.

[0166] In an embodiment of the present application, a processor is a circuit with the ability to process signals. In one implementation, the processor may be a circuit with the ability to read and execute instructions, such as a CPU, a microprocessor, a GPU, or a DSP. In another implementation, the processor may implement certain functions through the logical relationship of a hardware circuit, and the logical relationship of the hardware circuit may be fixed or reconfigurable, such as a hardware circuit implemented by an ASIC or PLD, such as an FPGA. In a reconfigurable hardware circuit, the process of the processor loading a configuration document to implement the configuration of the hardware circuit can be understood as the process of the processor loading instructions to implement the functions of some or all of the above units. In addition, it can also be a hardware circuit designed for artificial intelligence, which can be understood as an ASIC, such as an NPU, TPU, DPU, etc.

[0167] It can be seen that each unit in the above device can be one or more processors (or processing circuits) configured to implement the above method, such as: CPU, GPU, NPU, TPU, DPU, microprocessor, DSP, ASIC, FPGA, or a combination of at least two of these processor forms.

[0168] In addition, the various units in the above devices can be fully or partially integrated together, or can be implemented independently. In one implementation, these units are integrated together and implemented in the form of a system-on-a-chip (SOC). The SOC may include at least one processor for implementing any of the above methods or implementing the functions of the various units of the device. The type of the at least one processor can be different, for example, including a CPU and FPGA, a CPU and an artificial intelligence processor, a CPU and a GPU, etc.

[0169] Figure 9 is a schematic block diagram of a software updating device according to an embodiment of the present application. The software updating device 900 shown in Figure 9 may include: a processor 910, a transceiver 920, and a memory 930. The processor 910, the transceiver 920, and the memory 930 are connected via an internal connection path. The memory 930 is used to store instructions, and the processor 910 is used to execute the instructions stored in the memory 930, and the transceiver 920 receives / sends some parameters. In some possible implementations, the memory 930 can be coupled to the processor 910 via an interface or integrated with the processor 910.

[0170] It should be noted that the transceiver 920 may include but is not limited to a transceiver device such as an input / output interface to implement communication between the device 900 and other devices or a communication network.

[0171] The memory 930 may be a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM).

[0172] The transceiver 920 uses a transceiver device such as, but not limited to, a transceiver to implement communication between the apparatus 900 and other devices or a communication network.

[0173] In some possible implementations, the device 900 may be provided in the controller shown in FIG. 1 .

[0174] An embodiment of the present application further provides a smart device, which may include the above-mentioned device 800 or the above-mentioned device 900.

[0175] In some possible implementations, the smart device may be a vehicle.

[0176] An embodiment of the present application further provides a computer program product, which includes computer program code. When the computer program code runs on a computer, the computer implements the method in the embodiment of the present application.

[0177] An embodiment of the present application further provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on a computer, the computer implements the method in the embodiment of the present application.

[0178] An embodiment of the present application also provides a chip, including a circuit, for executing the method in the embodiment of the present application.

[0179] During implementation, each step of the above method can be completed by an integrated logic circuit of the hardware in the processor or by instructions in the form of software. The method disclosed in conjunction with the embodiments of the present application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or a power-on erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware. To avoid repetition, it will not be described in detail here.

[0180] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel 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.

[0181] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0182] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0183] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0184] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0185] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.

[0186] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A method for updating software, characterized in that: include: When controlling a first functional module to run a first program in a first storage partition, detecting a second storage partition, the first functional module being a functional module of a first software of a controller, and the storage area of ​​the controller including the first storage partition and the second storage partition; When data of a second program in the second storage partition is detected, the first functional module is controlled to run the second program, wherein the data of the second program includes data associated with the update of the first functional module.

2. The method according to claim 1, wherein The data of the second program comes from a flash file, and the flash file includes first data and information about the first data, and the information is used to indicate the start and / or end of the first data; wherein, the first data is any data of the program of the M functional modules of the first software, and the M functional modules include the first functional module, and M is an integer greater than or equal to 1.

3. The method according to claim 2, wherein The flash file consists of M module data, and the M module data correspond one-to-one to the M functional modules. The M module data include first module data, and the first module data includes the first data and first description information of the first data. The first description information is used to describe the relationship between the first data and the first functional module.

4. The method according to claim 3, wherein The first description information further includes first verification information, which is set at the header and / or tail of the first data and is used to perform integrity and / or consistency verification on the first data.

5. The method according to claim 2, wherein The flash file consists of description information and module data. The description information includes first description information of the first data, where the first description information is used to describe the relationship between the first data and the first functional module. The module data includes the first data.

6. The method according to any one of claims 2 to 5, characterized in that The flash file further includes second verification information, which is set at the header and / or tail of the flash file and is used to perform integrity and / or consistency verification on the flash file.

7. The method according to any one of claims 1 to 6, characterized in that The storage area further includes a third storage partition, the third storage partition being used to store data of a third program of a second functional module, where the second functional module is a newly added functional module of the first software, and the method further includes: When the third storage partition detects data of the third program, the second functional module is controlled to run the third program.

8. The method according to any one of claims 1 to 7, characterized in that The first functional module includes a first function and a second function, an interface address of the first function is associated with the first storage partition, and an interface address of the second function is associated with the second storage partition, and controlling the first functional module to run the second program includes: The first functional module is controlled to change the interface address for scheduling the first function to the interface address for scheduling the second function, and the second program in the second storage partition is run through the interface address of the second function.

9. The method according to claim 8, wherein The address of the data of the second program in the second storage partition is a preset fixed address, and the storage area includes a fourth storage partition, and the fourth storage partition is used to store the fixed address; Before controlling the first functional module to change the interface address for scheduling the first function to the interface address for scheduling the second function, the method further includes: It is determined that the interface address of the second function is consistent with the fixed address in the fourth storage partition.

10. The method according to any one of claims 1 to 9, characterized in that The data of the second program includes functional data and configuration data. Before controlling the first functional module to run the second program, the method further includes: Integrity and / or consistency checks are performed on the configuration data and the functional function data respectively.

11. The method according to any one of claims 1 to 10, characterized in that The method further comprises: Controlling erasure of data of the first program in the first storage partition.

12. The method according to any one of claims 1 to 11, characterized in that The storage area further includes a fifth storage partition, the fifth storage partition being used to store identification information of the first functional module, the identification information being used to indicate that data associated with an update of the first functional module has been completely written into the second storage partition, and upon detecting data of a second program in the second storage partition, controlling the first functional module to run the second program includes: When the data in the second storage partition and the identification information of the first functional module in the fifth storage partition are detected, the first functional module is controlled to run the second program in the second storage partition.

13. A device for updating software, characterized in that: include: a detection unit, configured to detect the second storage partition when controlling a first functional module to run a first program in a first storage partition, wherein the first functional module is a functional module of a first software of a controller, and a storage area of ​​the controller includes the first storage partition and the second storage partition; The processing unit is configured to control the first functional module to run the second program when the detection unit detects data of the second program in the second storage partition, wherein the data of the second program includes data associated with the update of the first functional module.

14. The device according to claim 13, wherein The data of the second program comes from a flash file, and the flash file includes first data and information about the first data, and the information is used to indicate the start and / or end of the first data; wherein, the first data is any data of the program of the M functional modules of the first software, and the M functional modules include the first functional module, and M is an integer greater than or equal to 1.

15. The device according to claim 14, wherein The flash file consists of M module data, and the M module data correspond one-to-one to the M functional modules. The M module data include first module data, and the first module data includes the first data and first description information of the first data. The first description information is used to describe the relationship between the first data and the first functional module.

16. The device according to claim 15, characterized in that The first description information further includes first verification information, which is set at the header and / or tail of the first data and is used to perform integrity and / or consistency verification on the first data.

17. The device according to claim 14, wherein The flash file consists of description information and module data. The description information includes first description information of the first data, where the first description information is used to describe the relationship between the first data and the first functional module. The module data includes the first data.

18. The device according to any one of claims 14 to 17, characterized in that The flash file further includes second verification information, which is set at the header and / or tail of the flash file and is used to perform integrity and / or consistency verification on the flash file.

19. The device according to any one of claims 13 to 18, characterized in that The storage area further includes a third storage partition, the third storage partition being used to store data of a third program of a second functional module, the second functional module being a newly added functional module of the first software, and the processing unit being further used to: When the detection unit detects the data of the third program in the third storage partition, the second functional module is controlled to run the third program.

20. The device according to any one of claims 13 to 19, characterized in that The first functional module includes a first function and a second function, an interface address of the first function is associated with the first storage partition, and an interface address of the second function is associated with the second storage partition, and the processing unit is configured to: The first functional module is controlled to change the interface address for scheduling the first function to the interface address for scheduling the second function, and the second program in the second storage partition is run through the interface address of the second function.

21. The device as claimed in claim 20, characterized in that The address of the data of the second program in the second storage partition is a preset fixed address, and the storage area includes a fourth storage partition, and the fourth storage partition is used to store the fixed address; Before controlling the first functional module to change the interface address for scheduling the first function to the interface address for scheduling the second function, the processing unit is further configured to: It is determined that the interface address of the second function is consistent with the fixed address in the fourth storage partition.

22. The device according to any one of claims 13 to 21, characterized in that The data of the second program includes functional data and configuration data. Before controlling the first functional module to run the second program, the processing unit is further configured to: Integrity and / or consistency checks are performed on the configuration data and the functional function data respectively.

23. The device according to any one of claims 13 to 22, characterized in that The processing unit is further configured to: Controlling erasure of data of the first program in the first storage partition.

24. The device according to any one of claims 13 to 23, characterized in that The storage area further includes a fifth storage partition, the fifth storage partition being used to store identification information of the first functional module, the identification information being used to indicate that data associated with an update of the first functional module has been written into the second storage partition, and the processing unit being used to: When the detection unit detects the data in the second storage partition and the identification information of the first functional module in the fifth storage partition, the first functional module is controlled to run the second program in the second storage partition.

25. A device for updating software, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the computer program stored in the memory, so that the apparatus performs the method according to any one of claims 1 to 12.

26. A smart device, characterized in that: Comprising the apparatus of any one of claims 13 to 25.

27. The smart device according to claim 26, wherein: The smart device is a vehicle.

28. A computer-readable storage medium, characterized in that Instructions are stored thereon, and when the instructions are executed by a processor, the processor is caused to implement the method according to any one of claims 1 to 12.

29. A chip, characterized in that: The chip comprises a circuit for performing the method according to any one of claims 1 to 12.

30. A computer program product, characterized in that The computer program product comprises: a computer program code, and when the computer program code is run on a computer, the computer is caused to perform the method according to any one of claims 1 to 12.