An upgrading method and device for an embedded device, a storage medium and an embedded device

By acquiring and storing upgrade data and its baseline hash value in an embedded device, and using hash value comparison to determine the upgrade result, the problem of large computational load in verifying the correctness of upgrade data is solved, thus improving upgrade efficiency and security.

CN122111459APending Publication Date: 2026-05-29BOSCH AUTOMOTIVE PRODUCTS (SUZHOU) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BOSCH AUTOMOTIVE PRODUCTS (SUZHOU) CO LTD
Filing Date
2024-11-22
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

In the process of upgrading embedded devices, existing technologies require a large amount of computation and time to verify the correctness of upgrade data, which affects upgrade efficiency and may lead to device failure and security risks.

Method used

An upgrade data package, which acquires upgrade data and its baseline hash value, is stored in the non-volatile memory of the embedded device. The upgrade result is determined by comparing the consistency between the baseline hash value and the target hash value, thus reducing the computational workload of verifying the correctness of the upgrade data.

Benefits of technology

It improves the efficiency and accuracy of embedded device upgrades, reduces computational load, and avoids device failures and security risks caused by incorrect upgrade data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122111459A_ABST
    Figure CN122111459A_ABST
Patent Text Reader

Abstract

The application provides an upgrading method and device for an embedded device, a storage medium and the embedded device. According to the upgrading method for the embedded device, the embedded device can obtain an upgrading data packet carrying upgrading data and a reference hash value of the upgrading data. After the upgrading data is stored in a non-volatile memory of the embedded device, a target hash value of the upgrading data stored in the non-volatile memory is calculated. The consistency comparison result between the reference hash value and the target hash value is used to determine the upgrading result of the embedded device. Since the embedded device only needs to perform hash value calculation once when verifying the correctness of the upgrading data, the calculation amount when verifying the correctness of the upgrading data involved in the upgrading of the embedded device is reduced, and the upgrading efficiency of the embedded device is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of software upgrade technology, and in particular to an upgrade method, apparatus, storage medium, and embedded device for embedded devices. Background Technology

[0002] Embedded devices are widely used in smart home devices, automotive electronics, and industrial control due to their convenience, flexibility, reliability, scalability, and cost-effectiveness. With rapid technological advancements and evolving user needs, upgrading embedded devices to fix vulnerabilities, enhance functionality, or improve performance is crucial to ensuring they meet practical requirements and maintain normal operation. Currently, during software upgrades, any corrupted or incorrect upgrade data can lead to embedded device malfunctions, performance degradation, or even security risks. Therefore, it is necessary to verify the correctness of the upgrade data used for embedded device upgrades. However, this often involves significant computational loads and consumes considerable time, thus impacting upgrade efficiency. Summary of the Invention

[0003] Based on this, the present invention provides an upgrade method, apparatus, storage medium, and embedded device for embedded devices. By using this upgrade method for embedded devices, the amount of computation required to verify the correctness of the upgrade data involved in the upgrade of embedded devices can be reduced, which is beneficial to improving the upgrade efficiency of embedded devices.

[0004] On one hand, the present invention provides an upgrade method for embedded devices, the method comprising:

[0005] Use an embedded device to obtain an upgrade data packet carrying upgrade data and a base hash value of the upgrade data;

[0006] The upgrade data is stored in the non-volatile memory of the embedded device;

[0007] The upgrade result of the embedded device is determined based on the consistency comparison result between the base hash value and the target hash value of the upgrade data stored in the non-volatile memory.

[0008] Furthermore, in some embodiments, the step of using an embedded device to obtain an upgrade data packet carrying upgrade data and a base hash value of the upgrade data includes:

[0009] Using the target controller at the embedded device, an upgrade data packet carrying upgrade data and a base hash value of the upgrade data is obtained;

[0010] The non-volatile memory storing the upgrade data at the embedded device includes:

[0011] If the target controller is a designated controller that needs to be upgraded, then the upgrade data required for upgrading the target controller is stored in the first non-volatile memory at the target controller.

[0012] If the target controller is not a designated controller that needs to be upgraded, the target controller sends the upgrade data required for upgrading the designated controller to the designated controller; the designated controller stores the upgrade data in a second non-volatile memory at the designated controller.

[0013] Furthermore, in some embodiments, acquiring the upgrade data packet carrying upgrade data and a base hash value of the upgrade data using the target controller at the embedded device includes:

[0014] Using the target controller, the over-the-air (OTA) download host mounted on the embedded device is obtained, and the upgrade data package is downloaded from the OTA server; or,

[0015] The upgrade data packet is read from a mobile storage device that is wired to the embedded device using the target controller.

[0016] Furthermore, in some embodiments, the first non-volatile memory is a block storage device containing a plurality of preset block storage regions;

[0017] The storage of the upgrade data required for upgrading the target controller to a first non-volatile memory at the target controller includes:

[0018] Based on the preset correspondence information between the upgrade data carried in the upgrade data packet and the unique identifier of the target block storage area, the upgrade data is stored in the preset block storage area in the first non-volatile memory that corresponds to the unique identifier of the target block storage area.

[0019] Furthermore, in some embodiments, the second non-volatile memory is a block storage device comprising a plurality of preset block storage regions;

[0020] The step of sending the upgrade data required for upgrading the designated controller to the designated controller using the target controller includes:

[0021] The target controller sends the upgrade data and a unique identifier of the target block storage area, which has a preset correspondence with the upgrade data, carried in the upgrade data packet to the designated controller; the designated controller is specifically used to store the upgrade data in the preset block storage area in the second non-volatile memory that corresponds to the unique identifier of the target block storage area.

[0022] Furthermore, in some embodiments, the upgrade data package includes a preset extensible markup language file carrying the base hash value of the upgrade data and the unique identifier of the target block storage area that has a preset correspondence with the upgrade data.

[0023] Furthermore, in some embodiments, if the target controller belongs to a designated controller that needs to be upgraded, the method further includes:

[0024] Using the target controller, the upgrade data read from the first non-volatile memory is hashed based on a preset hash algorithm to obtain the target hash value; wherein, the preset hash algorithm is the hash algorithm used to generate the base hash value;

[0025] A consistency comparison is performed between the target hash value and the baseline hash value to obtain the consistency comparison result between the baseline hash value and the target hash value.

[0026] Furthermore, in some embodiments, if the target controller is not among the designated controllers requiring upgrades, the method further includes:

[0027] The target controller sends the baseline hash value of the upgrade data to the designated controller; the designated controller is further configured to generate the target hash value for the upgrade data read from the second non-volatile memory using a preset hash algorithm, and to generate a consistency comparison result between the baseline hash value and the target hash value; wherein, the preset hash algorithm is the hash algorithm used to generate the baseline hash value;

[0028] The target controller is used to obtain information from the designated controller that reflects the consistency comparison results between the baseline hash value and the target hash value.

[0029] Furthermore, in some embodiments, the embedded device includes: an in-vehicle infotainment system (IVS) in the vehicle; the target controller includes a system-on-a-chip (SoC) in the IVS; and the designated controller includes at least one of a microcontroller unit, an electronic controller, and other SoCs in the vehicle.

[0030] Furthermore, in some embodiments, determining the upgrade result of the embedded device based on the consistency comparison result between the base hash value and the target hash value of the upgrade data stored in the non-volatile memory includes:

[0031] If the consistency comparison result reflects that the target hash value of the upgrade data is inconsistent with the baseline hash value, then it is determined that the embedded device has not been upgraded successfully.

[0032] After determining that the embedded device has failed to upgrade, the method further includes:

[0033] The embedded device is used to obtain the latest upgrade data packet, which carries the latest upgrade data and a preset base hash value of the latest upgrade data.

[0034] The latest upgrade data is stored in the non-volatile memory of the embedded device;

[0035] The upgrade result of the embedded device is determined based on the consistency comparison result between the preset baseline hash value and the specified hash value of the latest upgrade data stored in the non-volatile memory.

[0036] On the other hand, the present invention also provides an upgrade apparatus for embedded devices, comprising:

[0037] An acquisition module is used to acquire, using an embedded device, an upgrade data packet carrying upgrade data and a base hash value of the upgrade data;

[0038] A storage module is used to store the upgrade data in a non-volatile memory at the embedded device;

[0039] The determination module is used to determine the upgrade result of the embedded device based on the consistency comparison result between the base hash value and the target hash value of the upgrade data stored in the non-volatile memory.

[0040] On the other hand, the present invention also provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.

[0041] On the other hand, the present invention also provides an embedded device, comprising: a processor and a memory; wherein the memory stores computer-readable instructions adapted to be loaded by the processor and to execute the steps of the above-described method.

[0042] According to the upgrade method for embedded devices provided by the present invention, the embedded device can obtain an upgrade data packet carrying upgrade data and a reference hash value of the upgrade data. After storing the upgrade data in a non-volatile memory of the embedded device, a target hash value of the upgrade data stored in the non-volatile memory is calculated. The upgrade result of the embedded device is determined based on a consistency comparison result between the reference hash value and the target hash value. Since the embedded device only needs to perform a hash value calculation once when verifying the correctness of the upgrade data, the computational load involved in verifying the correctness of the upgrade data during the upgrade of the embedded device can be reduced, thereby improving the upgrade efficiency of the embedded device.

[0043] It should be understood that the description in the Summary of the Invention is not intended to limit the key or essential features of the embodiments of the present invention, nor is it intended to restrict the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0044] Figure 1 This is a flowchart illustrating an upgrade method for an embedded device provided by an embodiment of the present invention;

[0045] Figure 2 This is a schematic diagram illustrating an upgrade scenario for an embedded device, provided by an embodiment of the present invention.

[0046] Figure 3 This is a schematic diagram of the structure of an upgrade device for an embedded device provided in an embodiment of the present invention;

[0047] Figure 4 This is a schematic diagram of the structure of an embedded device provided in an embodiment of the present invention. Detailed Implementation

[0048] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0049] In the description of one or more embodiments of the present invention, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc., may refer to different or the same objects. Other explicit and implicit definitions may also be included below.

[0050] "Bit flip" refers to the phenomenon where a portion of data in a binary data stream unintentionally changes from 0 to 1 or from 1 to 0 due to errors or interference during data transmission or storage. Since bit flips occur during embedded device upgrades, or if communication anomalies or insufficient storage space exist, the upgraded data stored on the embedded device often differs from the actual upgraded data. This can lead to embedded device malfunctions, performance degradation, and even security risks. Therefore, it is necessary to verify the correctness of the upgrade data involved in the embedded device upgrade process to ensure the security and operational stability of the embedded device.

[0051] Currently, embedded devices typically write upgrade data to non-volatile memory and then perform a readback operation to obtain the actual upgrade data stored on the embedded device. By comparing the actual upgrade data stored on the embedded device with the real upgrade data bit by bit, if the two are inconsistent, it can be determined that the upgrade data has failed the correctness verification. Alternatively, the hash values ​​of the actual upgrade data stored on the embedded device and the real upgrade data can be calculated separately; if the hash values ​​are inconsistent, it can also be determined that the upgrade data has failed the correctness verification. However, due to the limited computing power of embedded devices, the above-mentioned correctness verification process for upgrade data often consumes a lot of computation and time, thus affecting the upgrade efficiency of embedded devices.

[0052] Based on this, how to reduce the amount of computation involved in verifying the correctness of upgrade data when upgrading embedded devices, and how to improve the efficiency of upgrading embedded devices, have become urgent technical problems to be solved.

[0053] Based on this, the present invention proposes an upgrade method for embedded devices. This method enables the embedded device to obtain an upgrade data packet carrying upgrade data and a reference hash value of the upgrade data. After storing the upgrade data in a non-volatile memory on the embedded device, a target hash value of the upgrade data stored in the non-volatile memory is calculated. The upgrade result of the embedded device is determined based on a consistency comparison between the reference hash value and the target hash value. Since the embedded device only needs to perform a hash value calculation once when verifying the correctness of the upgrade data, the computational load involved in verifying the correctness of the upgrade data during the upgrade of the embedded device can be reduced, thereby improving the upgrade efficiency of the embedded device.

[0054] Please see Figure 1 This is a flowchart illustrating an upgrade method for an embedded device according to an embodiment of the present invention. From a programming perspective, the entity executing this process can be a program mounted on the embedded device for managing the upgrade process. Alternatively, the entity executing this process can also be the embedded device or its target controller; there is no specific limitation on this.

[0055] The following is about Figure 1 The process shown will be described in detail. The upgrade method for embedded devices may specifically include the following steps:

[0056] Step S102: Use an embedded device to obtain an upgrade data packet carrying upgrade data and a base hash value of the upgrade data.

[0057] In this embodiment of the invention, the upgrade data package can refer to a collection of relevant data required to be obtained from the outside during the upgrade of an embedded device. The upgrade data package may contain at least upgrade data obtained from the outside, and a base hash value obtained by pre-calculating a hash of the reliable upgrade data from the outside. Generally, the hash value obtained by hashing the upgrade data carried in the acquired upgrade data package should be consistent with the base hash value. This indicates that the upgrade data was not damaged or erroneous during the acquisition process and is reliable upgrade data, thus allowing the upgrade data to be stored in the non-volatile memory of the embedded device to complete the upgrade operation.

[0058] In practical applications, the types and meanings of upgrade data included in upgrade packages can vary depending on the upgrade purpose. For example, when it is necessary to patch known security vulnerabilities to protect the security of devices and user data, the upgrade data may include patch data to address vulnerabilities in the application on the embedded device. Alternatively, when it is necessary to optimize and improve algorithms to enhance the device's response speed and processing power, the upgrade data may include program files for implementing the aforementioned optimization algorithms. Furthermore, when it is necessary to add new features to meet market demands and improve user experience, the upgrade data may include program files or other relevant files required to enable the embedded device to support the new features. Additionally, when it is necessary to ensure device compatibility with other technologies or platforms through upgrade operations in response to changes in infrastructure and industry standards, the upgrade data may include program files required to achieve the above objectives, new communication protocol content, etc.; no specific limitations are imposed on these aspects.

[0059] Step S104: Store the upgrade data in the non-volatile memory of the embedded device.

[0060] In this embodiment of the invention, non-volatile memory refers to memory whose stored data will not disappear when the current is turned off, making it suitable for long-term storage of important data. Therefore, to ensure the continuous and stable use of upgrade data by embedded devices to guarantee the normal operation of various functions, when upgrading the software program of the embedded device, the upgrade data needs to be stored in the non-volatile memory of the embedded device. In practical applications, the non-volatile memory can be implemented in various ways, such as using flash memory, UFS (Universal Flash Storage), hard disks, etc., without specific limitations.

[0061] Step S106: Determine the upgrade result of the embedded device based on the consistency comparison result between the base hash value and the target hash value of the upgrade data stored in the non-volatile memory.

[0062] In this embodiment of the invention, since the baseline hash value obtained in step S102 is a hash value obtained by performing hash calculation on real and reliable upgrade data in advance, when it is necessary to perform correctness verification on the upgrade data at the embedded device, it is necessary to perform hash calculation on the upgrade data stored in the non-volatile memory to obtain the target hash value.

[0063] If the consistency comparison determines that the baseline hash value and the target hash value are not consistent, it indicates that the upgrade data stored in the non-volatile memory of the embedded device is corrupted or erroneous and has failed the correctness verification. Therefore, an upgrade result reflecting that the embedded device has not been successfully upgraded can be generated.

[0064] If the consistency comparison determines that the base hash value and the target hash value are consistent, it means that the upgrade data stored in the non-volatile memory of the embedded device is real and reliable upgrade data, and it has passed the correctness verification. At this time, an upgrade result reflecting the successful upgrade of the embedded device can be generated directly; or, after determining whether other preset upgrade success conditions are met, a comprehensive decision can be made on whether the embedded device has been successfully upgraded, which is flexible.

[0065] Figure 1 The method described above eliminates the need for embedded devices to perform bit-by-bit comparisons between the upgrade data stored in non-volatile memory and the initially acquired upgrade data when verifying the correctness of upgrade data. It also eliminates the need for the embedded device to perform multiple hash calculations to obtain the hash values ​​of the initially acquired upgrade data and the upgrade data stored in non-volatile memory. This reduces the computational load involved in verifying the correctness of upgrade data during embedded device upgrades, thereby improving the efficiency of embedded device upgrades.

[0066] And because Figure 1 The method used in this study employs a base hash value obtained by pre-calculating the hash of genuine and reliable upgrade data. Therefore, it can effectively identify whether the upgrade data stored on the embedded device is genuine and reliable. This avoids the situation where the embedded device receives corrupted or erroneous upgrade data, and this corrupted or erroneous upgrade data is successfully stored in non-volatile memory, leading to an erroneous confirmation of a successful upgrade due to the identical hash values ​​of the two. This also helps ensure the accuracy of the upgrade results generated for embedded devices.

[0067] In one feasible implementation, the step of using an embedded device to obtain an upgrade data packet carrying upgrade data and a base hash value of the upgrade data may include:

[0068] Using the target controller at the embedded device, an upgrade data packet carrying upgrade data and a base hash value of the upgrade data is obtained.

[0069] Correspondingly, the non-volatile memory storing the upgrade data in the embedded device may include:

[0070] If the target controller is a designated controller that needs to be upgraded, then the upgrade data required for upgrading the target controller is stored in the first non-volatile memory at the target controller.

[0071] If the target controller is not a designated controller that needs to be upgraded, the target controller sends the upgrade data required for upgrading the designated controller to the designated controller; the designated controller stores the upgrade data in a second non-volatile memory at the designated controller.

[0072] In this embodiment of the invention, there may be multiple controllers at the embedded device, and different controllers may work independently or in cooperation with each other to realize various functions of the embedded device. Therefore, there may be a need to upgrade the vehicle for one or more controllers at the embedded device.

[0073] In this embodiment of the invention, an application for managing the upgrade process can typically be pre-deployed on the target controller of the embedded device. This application on the target controller then meets the upgrade requirements of each controller on the embedded device. The target controller can be selected based on actual needs; however, controllers with faster response times and larger storage capacities are generally preferred to ensure efficient and stable operation of the upgrade process.

[0074] Specifically, the target controller can be used to obtain the upgrade data packets required for upgrading various controllers at the embedded device. Furthermore, if the current target controller needs an upgrade, the necessary upgrade data can be stored in the target controller's local first non-volatile memory. If other specified controllers need an upgrade, the target controller can send the necessary upgrade data to those controllers, storing the upgrade data in the specified controller's local second non-volatile memory. This allows each controller to subsequently operate normally and stably based on the locally persistently stored upgrade data.

[0075] In one feasible implementation, obtaining the upgrade data packet carrying upgrade data and a base hash value of the upgrade data using the target controller at the embedded device may include:

[0076] Using the target controller, the over-the-air (OTA) download host mounted on the embedded device is obtained, and the upgrade data package is downloaded from the OTA server; or,

[0077] The upgrade data packet is read from a mobile storage device that is wired to the embedded device using the target controller.

[0078] In this embodiment of the invention, the OTA Master can be an application responsible for initiating and managing the Over-The-Air (OTA) upgrade process. The OTA Master typically uses mobile communication technology to download upgrade data packets from an OTA server to the embedded device when it determines that the embedded device meets the upgrade requirements. Because the entire upgrade process can be completed without user intervention, it is convenient and fast, making it suitable for large-scale deployment.

[0079] In practical applications, an over-the-air (OTA) download host can be pre-deployed on the target controller, allowing the target controller to run the OTA download host's application and directly download the upgrade data package to the target controller's local machine, which is convenient and fast.

[0080] Alternatively, an over-the-air (OTA) download host can be deployed within other devices embedded in the device (e.g., a Telematics-BOX; or a gateway device). This allows the other devices to download the upgrade data package locally by running the OTA application, and then transmit the upgrade data package to the target controller using Ethernet technology. Specifically, the other devices and the target controller can each have their own internal network IP address (Internet Protocol Address), and the target ports used for transmitting upgrade data packages can be pre-configured. Once the other devices successfully download the upgrade data package, they can send the access address of the upgrade data package to the target controller using the internal network IP address and target port. This allows the target controller to obtain the upgrade data package by accessing the access address of the upgrade data package based on the internal network IP address and target port, offering good flexibility.

[0081] In addition, the aforementioned devices can pre-set access keys and / or encryption keys for the upgrade data packets and send these keys to the target controller based on the aforementioned intranet IP address and target port. This facilitates verification of whether the target controller has access rights to the upgrade data packets, or allows for encrypted transmission of the upgrade data packets, thereby improving data security. Furthermore, the target controller can also feed back its download progress information for the upgrade data packets to the aforementioned devices based on the aforementioned intranet IP address and target port, enhancing the controllability of the upgrade data packet transmission process.

[0082] In this embodiment of the invention, since the over-the-air upgrade scheme is prone to upgrade failure when the network is unstable, staff can also connect the mobile storage device containing the upgrade data package to the embedded device via a Universal Serial Bus (USB) or other hardware interface. This allows the target controller at the embedded device to obtain the upgrade data package by accessing the mobile storage device, thereby enabling manual upgrade of the embedded device under user intervention, which offers good flexibility.

[0083] In practical applications, the mobile storage device can also establish a short-range wireless connection with the embedded device via short-range wireless communication technologies such as Zigbee, WiFi, Bluetooth, Z-wave, or NFC, so that the target controller at the embedded device can obtain the upgrade data package from the mobile storage device. No specific limitations are made in this regard.

[0084] In one feasible implementation, the first non-volatile memory may be a block storage device containing multiple preset block storage areas.

[0085] Correspondingly, storing the upgrade data required for upgrading the target controller in the first non-volatile memory at the target controller may include:

[0086] Based on the preset correspondence information between the upgrade data carried in the upgrade data packet and the unique identifier of the target block storage area, the upgrade data is stored in the preset block storage area in the first non-volatile memory that corresponds to the unique identifier of the target block storage area.

[0087] In this embodiment of the invention, block storage is a data storage method that divides data into fixed-size blocks, each with a unique address, allowing for independent reading and writing. The block storage device can be a storage device that supports block storage of data. Specifically, the block storage device can pre-divide the non-volatile memory into multiple pre-defined block storage regions of the same size through logical partitioning, facilitating the subsequent storage of each data block separately. Since the block storage device can support parallel read and write operations on multiple pre-defined block storage regions, it is suitable for application scenarios requiring fast data access. Furthermore, the block storage device can allocate storage space on demand, supporting dynamic expansion and contraction of capacity, effectively improving storage resource utilization. Therefore, it can better meet the data storage needs of low-cost, miniaturized, and integrated embedded devices.

[0088] Based on this, a block storage device containing multiple preset block storage regions can be constructed in advance using the storage space of one or more first non-volatile memories at the target controller. The storage space size of each preset block storage region can be consistent, and each preset block storage region can have a unique identifier. Therefore, according to actual needs, the unique identifier of the target block storage region corresponding to the preset block storage region used to store each data block in the upgrade data can be predetermined, and this unique identifier can be carried in the upgrade data packet. This allows upgrade data to be stored as needed in the preset block storage region corresponding to the unique identifier of the target block storage region, providing good flexibility.

[0089] To facilitate understanding, an example is provided. Assume that a block storage device implemented based on a first non-volatile memory contains 10 preset block storage regions, each 1KB in size, and each preset block storage region has a unique identifier ranging from 0 to 9. If the upgrade data is 3KB in size, then 3 preset block storage regions are needed to store the upgrade data.

[0090] Assuming that the upgrade data needs to be stored in the first three preset block storage areas, the upgrade data packet can carry preset association information reflecting the unique identifiers (i.e., 0, 1, 2) between the upgrade data and the target block storage area. This allows the upgrade process to store the 1st KB of the upgrade data in the preset block storage area with unique identifier 0, the 2nd KB of the upgrade data in the preset block storage area with unique identifier 1, and the 3rd KB of the upgrade data in the preset block storage area with unique identifier 2, based on the preset association information.

[0091] Alternatively, when the upgrade data needs to be stored in the fifth to seventh preset block storage areas, the upgrade data packet can carry preset association information reflecting the unique identifiers (i.e., 4, 5, and 6) between the upgrade data and the target block storage areas. This allows the upgrade process to store the 1KB of upgrade data in the preset block storage area with the unique identifier 4, the 2KB of upgrade data in the preset block storage area with the unique identifier 5, and the 3KB of upgrade data in the preset block storage area with the unique identifier 6, based on the preset association information, providing good flexibility.

[0092] Alternatively, when the upgrade data needs to be stored in the fifth to seventh preset block storage areas, the upgrade data packet may only carry the preset association information reflecting the unique identifier of the first target block storage area (i.e., 4). Subsequently, the unique identifiers of other target block storage areas (i.e., 5 and 6) can be obtained by incrementing the unique identifier of the target block storage area. No specific limitation is made in this regard.

[0093] It is understood that the number of preset block storage areas included in the block storage device can be from tens to tens of thousands; the size of the storage space corresponding to each preset block storage area can be from several KB to hundreds of KB; and the size of the upgrade data can be from several KB to tens of MB; the above values ​​can be set according to actual needs, and no specific limitation is made thereto.

[0094] In practical applications, when multiple preset block storage areas are needed to store various data blocks contained in the upgrade data, the target controller can generate write data instructions to write each data block into the preset block storage area corresponding to the unique identifier of the target block storage area after determining the unique identifier of the target block storage area corresponding to the preset block storage area used to store each data block in the upgrade data. By executing each write data instruction in parallel, parallel write operations for each data block of the upgrade data can be achieved, which helps to improve the operating efficiency when storing upgrade data, and thus improves the upgrade efficiency for embedded devices.

[0095] In one feasible implementation, the second non-volatile memory can be a block storage device containing multiple preset block storage areas.

[0096] Correspondingly, sending the upgrade data required for upgrading the specified controller to the specified controller using the target controller may include:

[0097] The target controller sends the upgrade data and a unique identifier of the target block storage area, which has a preset correspondence with the upgrade data, carried in the upgrade data packet to the designated controller; the designated controller is specifically used to store the upgrade data in the preset block storage area in the second non-volatile memory that corresponds to the unique identifier of the target block storage area.

[0098] In this embodiment of the invention, a block storage device containing multiple preset block storage regions can be constructed in advance using the storage space of one or more second non-volatile memories at a designated controller. The principle of storing each data block in the upgrade data based on the block storage device at the second non-volatile memory can be consistent with the principle of storing each data block in the upgrade data based on the block storage device at the first non-volatile memory, and therefore will not be described in detail.

[0099] In practical applications, since the target controller and the designated controller are different controllers, the target controller typically cannot directly access or manipulate the block storage device at the designated controller to ensure data security at each controller. Therefore, the target controller needs to first send the upgrade data and a unique identifier of the target block storage area corresponding to the preset block storage area used to store the upgrade data to the designated controller. This allows the designated controller to automatically generate write data instructions to write each data block in the upgrade data into the preset block storage area corresponding to the unique identifier of the target block storage area. By executing each write data instruction in parallel, parallel write operations on each data block of the upgrade data are achieved, which helps improve the storage efficiency of the upgrade data and thus improves the upgrade efficiency of embedded devices.

[0100] In one feasible implementation, the upgrade data package may contain a preset extensible markup language file that carries the base hash value of the upgrade data and a unique identifier of the target block storage area that has a preset correspondence with the upgrade data.

[0101] In this embodiment of the invention, the preset Extensible Markup Language (XML) file can refer to a text format file generated using Extensible Markup Language (XML). Since XML allows users to customize tags and has good extensibility, it can be used seamlessly across different operating systems and applications to ensure data universality and compatibility. Furthermore, because XML requires adherence to strict syntax rules and XML-formatted data is easy to save and store long-term without being lost due to software or system updates, the correctness and consistency of the data it carries can be ensured. Based on this, the preset Extensible Markup Language file can carry the base hash value of the upgrade data and a unique identifier of the target block storage area that has a preset correspondence with the upgrade data. This ensures the reliability of the base hash value used when verifying the correctness of the upgrade data at the embedded device, and ensures the correct storage of upgrade data at the embedded device. This is beneficial for improving the normal operation of the embedded device upgrade process and also for improving the accuracy and reliability of the upgrade results generated for the embedded device.

[0102] To facilitate understanding, an example of the content carried by the default Extensible Markup Language (XML) file in the upgrade package is given here. For example, it could be:

[0103] <data>

[0104] <file path="system.img"index="0"size="4194304"md5="31d259…" / >

[0105] ……

[0106] < / data>

[0107] Here, "system.img" can be used to identify the upgrade data that needs to be stored; "0" can identify the unique identifier of the target block storage area corresponding to the preset block storage area storing the first data block in "system.img"; "4194304" can identify the amount of data that needs to be stored in the preset block storage area corresponding to the unique identifier of the target block storage area; "31d259…" can represent the base hash value of the upgrade data that needs to be stored in the preset block storage area corresponding to the unique identifier of the target block storage area.

[0108] It is understood that the content carried by the preset Extensible Markup Language (EXPLAIN) file can also be other forms of data, as long as the target controller can parse and obtain the base hash value of the upgrade data and the unique identifier of the target block storage area that has a preset correspondence with the upgrade data. Alternatively, files such as TXT files, images, or other formats can be used to carry the base hash value and the unique identifier of the target block storage area; no specific limitations are imposed on this.

[0109] In one feasible implementation, if the target controller belongs to a designated controller that needs to be upgraded, then Figure 1 The methods may also include:

[0110] Using the target controller, the upgrade data read from the first non-volatile memory is hashed based on a preset hash algorithm to obtain the target hash value; wherein, the preset hash algorithm is the hash algorithm used to generate the base hash value.

[0111] A consistency comparison is performed between the target hash value and the baseline hash value to obtain the consistency comparison result between the baseline hash value and the target hash value.

[0112] In this embodiment of the invention, when verifying the correctness of upgrade data, it is typically necessary to use the same preset hash algorithm to generate the target hash value and the base hash value of the upgrade data to ensure their comparability. The preset hash algorithm may include, but is not limited to, algorithms implemented based on functions such as CRC32, MD5, and SHA-1.

[0113] In practical applications, when the target controller is a designated controller requiring upgrades, the upgrade data is typically stored locally on the target controller in a block storage device built on a first non-volatile memory. Therefore, the target controller can read the corresponding upgrade data blocks in parallel from a preset block storage area containing the upgrade data within this block storage device, and then generate target hash values ​​for each upgrade data block in parallel. Furthermore, it can compare the target hash values ​​of each upgrade data block with the base hash value in parallel, which improves the efficiency of verifying the correctness of the upgrade data. It is understood that when there are data blocks in the upgrade data whose target hash values ​​do not match the base hash values, it usually indicates that the upgrade data has been corrupted or erroneous during transmission or storage, thus failing the correctness verification. In this case, the embedded device typically cannot be successfully upgraded, which helps ensure the normal and stable operation of the embedded device.

[0114] In one feasible implementation, if the target controller is not among the designated controllers requiring upgrades, then Figure 1 The methods may also include:

[0115] The target controller sends the baseline hash value of the upgrade data to the designated controller; the designated controller is further configured to generate the target hash value for the upgrade data read from the second non-volatile memory using a preset hash algorithm, and to generate a consistency comparison result between the baseline hash value and the target hash value; wherein, the preset hash algorithm is the hash algorithm used to generate the baseline hash value.

[0116] The target controller is used to obtain information from the designated controller that reflects the consistency comparison results between the baseline hash value and the target hash value.

[0117] In this embodiment of the invention, when the target controller does not belong to the designated controller that needs to be upgraded, in order to ensure the data security at the designated controller and improve the efficiency of the correctness verification of the upgrade data, the designated controller can read each data block of the upgrade data from its local block storage device in parallel, and then generate the target hash value of each data block of the upgrade data in parallel, and compare the target hash value of each data block of the upgrade data with the base hash value in parallel, which is efficient and reliable.

[0118] Subsequently, in order to facilitate the target controller's management of the embedded device upgrade process, the designated controller can also send information reflecting the consistency comparison results between the base hash value and the target hash value of the upgrade data to the target controller. This allows the target controller to determine that the embedded device has not been successfully upgraded when it identifies data blocks in the upgrade data where the target hash value and the base hash value are inconsistent, which helps ensure the normal and stable operation of the embedded device.

[0119] Of course, if the computing resources at the designated controller are limited, the designated controller may also send the upgrade data read from the second non-volatile memory to the target controller, so that the target controller can calculate the target hash value of the upgrade data and perform a consistency comparison between the target hash value and the base hash value. Alternatively, the designated controller may send the target hash value of the upgrade data it has calculated to the target controller, so that the target controller can perform a consistency comparison between the target hash value and the base hash value. No specific limitations are imposed on this.

[0120] In one feasible implementation, the embedded device may include: an in-vehicle infotainment system (IVS) in the vehicle; the target controller may include a system-on-a-chip (SoC) in the IVS; and the designated controller may include at least one of a microcontroller unit, an electronic controller, and other SoCs in the vehicle.

[0121] Figure 2 This is a schematic diagram illustrating an upgrade scenario for an embedded device, provided by an embodiment of the present invention. For ease of understanding, it is combined with... Figure 2 Provide an explanation. For example... Figure 2As shown, when a software upgrade is required for vehicle 21, the system-on-chip (SOC) 201 in the vehicle's infotainment system can obtain an upgrade data packet from the OTA server 22 or the mobile storage device 23. If the SOC itself needs to be upgraded, it can store the upgrade data in the upgrade data packet to local non-volatile memory. If the microcontroller unit (MCU) in the vehicle's infotainment system needs to be upgraded, data transmission can be performed using the Serial Peripheral Interface (SPI) between the SOC and the MCU, allowing the MCU to obtain the necessary upgrade data. Furthermore, when microcontrollers 202, electronic controllers 202, or other system-on-a-chips 202 in other systems need to be upgraded, the system-on-a-chip 201 in the vehicle infotainment system can first use the SPI bus to transmit the relevant upgrade data to the microcontroller in the vehicle infotainment system, and then send the relevant upgrade data to the microcontrollers 202, electronic controllers 202, or other system-on-a-chips 202 in other systems via the AUTOSAR COM module in the microcontroller in the vehicle infotainment system based on the vehicle bus, thereby efficiently and conveniently meeting the upgrade needs for vehicle software.

[0122] It is understood that the embedded device can also be other embedded devices in vehicles that have upgrade requirements, or embedded devices in home appliances, medical devices, manufacturing equipment, etc. that have upgrade requirements, and no specific limitation is made in this regard.

[0123] In one feasible implementation, determining the upgrade result of the embedded device based on the consistency comparison result between the baseline hash value and the target hash value of the upgrade data stored in the non-volatile memory may include:

[0124] If the consistency comparison result reflects that the target hash value of the upgrade data is inconsistent with the baseline hash value, then it is determined that the embedded device has not been upgraded successfully.

[0125] Correspondingly, after determining that the embedded device has failed to upgrade, Figure 1 The methods may also include:

[0126] The embedded device is used to obtain the latest upgrade data packet, which carries the latest upgrade data and a preset base hash value of the latest upgrade data.

[0127] The latest upgrade data is stored in the non-volatile memory of the embedded device.

[0128] The upgrade result of the embedded device is determined based on the consistency comparison result between the preset baseline hash value and the specified hash value of the latest upgrade data stored in the non-volatile memory.

[0129] In this embodiment of the invention, if the consistency comparison result reflects that the target hash value of the upgrade data is inconsistent with the base hash value, it generally indicates that the upgrade data stored on the embedded device has failed the correctness verification. Therefore, it can be determined that the embedded device has not been successfully upgraded. In addition, to improve the success rate of upgrades for embedded devices, the following methods can also be used... Figure 1 The methods and embodiments described herein re-execute upgrade data acquisition, storage, and correctness verification operations on the embedded device to attempt to upgrade the embedded device again, which is convenient and quick.

[0130] In addition, when the target controller is not one of the designated controllers requiring upgrade, the designated controller can also feed back its upgrade progress information to the target controller via Ethernet technology or other data transmission methods, allowing the target controller to determine the upgrade result of the embedded device based on this information. Alternatively, the target controller can set a timer for the upgrade process of the designated controller. If the timer detects that the designated controller has not fed back its own operating status information within a preset time period, it can also be determined that the embedded device upgrade has failed, offering good flexibility.

[0131] In practical applications, critical data and configurations of the current version can be backed up before each upgrade operation of the embedded device. If an upgrade problem occurs, it can be quickly restored to the previous stable version, avoiding the embedded device from becoming unusable due to upgrade failure, thus ensuring the normal operation of the embedded device and making it highly practical.

[0132] Please see Figure 3 This is a schematic diagram of an upgrade device for an embedded device provided in an embodiment of the present invention. Figure 3 As shown, the upgrade device 03 for embedded devices can be implemented through software, hardware, or a combination of both. According to some embodiments, the upgrade device 03 for embedded devices may include an acquisition module 31, a storage module 32, and a determination module 33, specifically:

[0133] The acquisition module 31 is used to acquire an upgrade data packet carrying upgrade data and a base hash value of the upgrade data using an embedded device.

[0134] Storage module 32 is used to store the upgrade data in a non-volatile memory at the embedded device.

[0135] The determining module 33 is used to determine the upgrade result of the embedded device based on the consistency comparison result between the base hash value and the target hash value of the upgrade data stored in the non-volatile memory.

[0136] Optionally, the acquisition module 31 may include:

[0137] The acquisition unit is used to acquire an upgrade data packet carrying upgrade data and a base hash value of the upgrade data using a target controller at the embedded device.

[0138] Storage module 32 may include:

[0139] A storage unit is configured to store the upgrade data required for upgrading the target controller to a first non-volatile memory at the target controller if the target controller is a designated controller that needs to be upgraded.

[0140] The sending unit is configured to send the upgrade data required for upgrading the designated controller to the designated controller if the target controller is not a designated controller that needs to be upgraded; the designated controller is configured to store the upgrade data in a second non-volatile memory at the designated controller.

[0141] Optionally, the acquisition unit may include:

[0142] The first acquisition subunit is configured to use the target controller to acquire the over-the-air (OTA) download host mounted on the embedded device and download the upgrade data package from the OTA server; or...

[0143] The second acquisition subunit is used to read the upgrade data packet from a mobile storage device that is wired to the embedded device using the target controller.

[0144] Optionally, the first non-volatile memory may be a block storage device containing multiple preset block storage areas.

[0145] The storage unit may include:

[0146] The storage subunit is used to store the upgrade data in the first non-volatile memory to the preset block storage area corresponding to the unique identifier of the target block storage area, based on the preset correspondence information between the upgrade data carried in the upgrade data packet and the unique identifier of the target block storage area.

[0147] Optionally, the second non-volatile memory can be a block storage device containing multiple preset block storage areas.

[0148] The transmitting unit may include:

[0149] The sending subunit is used to send the upgrade data and the unique identifier of the target block storage area that has a preset correspondence with the upgrade data carried in the upgrade data packet to the designated controller using the target controller; the designated controller is specifically used to store the upgrade data in the preset block storage area in the second non-volatile memory that corresponds to the unique identifier of the target block storage area.

[0150] Optionally, the upgrade data package may include a preset extensible markup language file containing the base hash value of the upgrade data and a unique identifier of the target block storage area that has a preset correspondence with the upgrade data.

[0151] Optionally, if the target controller belongs to a designated controller that needs to be upgraded, then Figure 3 The device may also include:

[0152] The computing unit is used to perform hash calculation on the upgrade data read from the first non-volatile memory using the target controller, based on a preset hash algorithm, to obtain the target hash value; wherein the preset hash algorithm is the hash algorithm used to generate the base hash value;

[0153] A consistency comparison unit is used to perform a consistency comparison process between the target hash value and the benchmark hash value to obtain a consistency comparison result between the benchmark hash value and the target hash value.

[0154] Optionally, if the target controller is not among the designated controllers requiring upgrades, then Figure 3 The device may also include:

[0155] The sending module is configured to send the base hash value of the upgrade data to the designated controller using the target controller; the designated controller is further configured to generate the target hash value for the upgrade data read from the second non-volatile memory using a preset hash algorithm, and to generate a consistency comparison result between the base hash value and the target hash value; wherein the preset hash algorithm is the hash algorithm used to generate the base hash value.

[0156] The comparison result acquisition module is used to acquire information from the designated controller that reflects the consistency comparison result between the benchmark hash value and the target hash value using the target controller.

[0157] Optionally, the embedded device may include: an in-vehicle infotainment system (IVS) in the vehicle; the target controller includes a system-on-a-chip (SoC) in the IVS; and the designated controller includes at least one of a microcontroller unit, an electronic controller, and other SoCs in the vehicle.

[0158] Optionally, the determining module 33 can be specifically used for:

[0159] If the consistency comparison result reflects that the target hash value of the upgrade data is inconsistent with the baseline hash value, then it is determined that the embedded device has not been upgraded successfully.

[0160] Figure 3 The device may also include:

[0161] The latest upgrade data packet acquisition module is used to acquire the latest upgrade data packet carrying the latest upgrade data and a preset base hash value of the latest upgrade data using the embedded device.

[0162] The latest upgraded data storage module is used to store the latest upgraded data in the non-volatile memory of the embedded device.

[0163] The latest upgrade result determination module is used to determine the upgrade result of the embedded device based on the consistency comparison result between the preset benchmark hash value and the specified hash value of the latest upgrade data stored in the non-volatile memory.

[0164] The above-described apparatus embodiments correspond to the method embodiments, and detailed descriptions can be found in the description of the method embodiments section, which will not be repeated here. The apparatus embodiments are derived based on the corresponding method embodiments and have the same technical effects as the corresponding method embodiments; detailed descriptions can be found in the corresponding method embodiments.

[0165] The present invention also provides a storage medium that can store a computer program. When the computer program is executed by a processor, it can implement the upgrade method for embedded devices as described in the above embodiments. For the specific execution process, please refer to the detailed description in the above embodiments, which will not be repeated here.

[0166] In one embodiment, the present invention also provides Figure 4 The diagram shows the structure of the embedded device. Figure 4At the hardware level, the embedded device may include a processor 41 and a memory 45, and may also include an internal bus 42, a network interface 43, a memory 44, and other hardware required for business operations. The processor 41 can read corresponding computer-readable instructions from the memory 45 into memory and then execute them to implement the above-described upgrade method for the embedded device. For the specific execution process, please refer to the detailed descriptions in the above embodiments, which will not be repeated here.

[0167] Finally, the various embodiments in this invention are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for embodiments such as storage media and embedded devices, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments.

[0168] The above description is merely an embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of the present invention should be included within the scope of the claims of the present invention.

Claims

1. An upgrade method for an embedded device, comprising: Use an embedded device to obtain an upgrade data packet carrying upgrade data and a base hash value of the upgrade data; The upgrade data is stored in the non-volatile memory of the embedded device; The upgrade result of the embedded device is determined based on the consistency comparison result between the base hash value and the target hash value of the upgrade data stored in the non-volatile memory.

2. The method according to claim 1, wherein obtaining the upgrade data packet carrying upgrade data and the base hash value of the upgrade data using an embedded device comprises: Using the target controller at the embedded device, an upgrade data packet carrying upgrade data and a base hash value of the upgrade data is obtained; The non-volatile memory storing the upgrade data at the embedded device includes: If the target controller is a designated controller that needs to be upgraded, then the upgrade data required for upgrading the target controller is stored in the first non-volatile memory at the target controller. If the target controller is not a designated controller that needs to be upgraded, the target controller sends the upgrade data required for upgrading the designated controller to the designated controller; the designated controller stores the upgrade data in a second non-volatile memory at the designated controller.

3. The method according to claim 2, wherein obtaining the upgrade data packet carrying upgrade data and a base hash value of the upgrade data using the target controller at the embedded device comprises: Using the target controller, obtain the over-the-air (OTA) download host mounted on the embedded device, and download the upgrade data package from the OTA server; or, The upgrade data packet is read from a mobile storage device that is wired to the embedded device using the target controller.

4. The method according to claim 2, wherein the first non-volatile memory is a block storage device comprising a plurality of preset block storage regions; The storage of the upgrade data required for upgrading the target controller to a first non-volatile memory at the target controller includes: Based on the preset correspondence information between the upgrade data carried in the upgrade data packet and the unique identifier of the target block storage area, the upgrade data is stored in the preset block storage area in the first non-volatile memory that corresponds to the unique identifier of the target block storage area.

5. The method according to claim 2, wherein the second non-volatile memory is a block storage device comprising a plurality of preset block storage regions; The step of sending the upgrade data required for upgrading the designated controller to the designated controller using the target controller includes: The target controller sends the upgrade data and a unique identifier of the target block storage area, which has a preset correspondence with the upgrade data, carried in the upgrade data packet to the designated controller; the designated controller is specifically used to store the upgrade data in the preset block storage area in the second non-volatile memory that corresponds to the unique identifier of the target block storage area.

6. The method according to claim 4 or 5, wherein the upgrade data package contains a preset extensible markup language file carrying the base hash value of the upgrade data and the unique identifier of the target block storage area that has a preset correspondence with the upgrade data.

7. The method according to claim 2, wherein if the target controller belongs to a designated controller that needs to be upgraded, the method further comprises: Using the target controller, the upgrade data read from the first non-volatile memory is hashed based on a preset hash algorithm to obtain the target hash value; wherein, the preset hash algorithm is the hash algorithm used to generate the base hash value; A consistency comparison is performed between the target hash value and the baseline hash value to obtain the consistency comparison result between the baseline hash value and the target hash value.

8. The method according to claim 2, wherein if the target controller is not a designated controller requiring upgrade, the method further comprises: The target controller sends the base hash value of the upgrade data to the designated controller. The designated controller is further configured to generate the target hash value for the upgrade data read from the second non-volatile memory using a preset hash algorithm, and to generate a consistency comparison result between the base hash value and the target hash value; wherein the preset hash algorithm is the hash algorithm used to generate the base hash value; The target controller is used to obtain information from the designated controller that reflects the consistency comparison results between the baseline hash value and the target hash value.

9. The method according to claim 2, wherein the embedded device comprises: Vehicle-mounted equipment at the vehicle location; The target controller includes a system-on-a-chip at the vehicle infotainment device; The designated controller includes at least one of the following: a microcontroller unit, an electronic controller, and other system-on-a-chip at the vehicle.

10. The method according to any one of claims 1-9, wherein determining the upgrade result of the embedded device based on a consistency comparison result between the base hash value and the target hash value of the upgrade data stored in the non-volatile memory comprises: If the consistency comparison result reflects that the target hash value of the upgrade data is inconsistent with the baseline hash value, then it is determined that the embedded device has not been upgraded successfully. After determining that the embedded device has failed to upgrade, the method further includes: The embedded device is used to obtain the latest upgrade data packet, which carries the latest upgrade data and a preset base hash value of the latest upgrade data. The latest upgrade data is stored in the non-volatile memory of the embedded device; The upgrade result of the embedded device is determined based on the consistency comparison result between the preset baseline hash value and the specified hash value of the latest upgrade data stored in the non-volatile memory.

11. An upgrade device for an embedded device, comprising: An acquisition module is used to acquire, using an embedded device, an upgrade data packet carrying upgrade data and a base hash value of the upgrade data; A storage module is used to store the upgrade data in a non-volatile memory at the embedded device; The determination module is used to determine the upgrade result of the embedded device based on the consistency comparison result between the base hash value and the target hash value of the upgrade data stored in the non-volatile memory.

12. A storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1 to 10.

13. An embedded device, comprising: A processor and a memory; wherein the memory stores computer-readable instructions adapted to be loaded by the processor and to perform the steps of the method as claimed in any one of claims 1 to 10.