Method and system for firmware upgrade of a device

By employing a dynamic APP redirection address mechanism during device firmware upgrades, combined with the device's unique identification code, the problem of insufficient security during device upgrades is solved, thereby improving device security.

CN114546439BActive Publication Date: 2026-08-25WANBANG DIGITAL ENERGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210052279.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-18
Publication Date
2026-08-25
Estimated Expiration
2042-01-18

AI Technical Summary

Technical Problem

In existing technologies, the lack of encryption mechanisms for APP redirect addresses during device firmware upgrades results in insufficient upgrade security and makes the devices vulnerable to cracking.

Method used

The server determines the dynamic APP redirection address based on the device's unique identifier, generates the target firmware upgrade package, and sends it to the device. The device then uses the unique identifier to determine the APP redirection address and redirects to the APP program, thus achieving a secure device upgrade.

Benefits of technology

This increases the difficulty of cracking the device, enhances its security, and prevents the program from being maliciously copied and cracked.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114546439B_ABST
    Figure CN114546439B_ABST
Patent Text Reader

Abstract

The application provides a firmware upgrading method and system of a device, the method comprising: a server sending an upgrading request frame to the device; the device replying an answer frame to the server after receiving the upgrading request frame, the answer frame containing a unique identification code of the device; the server determining a target APP jump address according to the unique identification code, obtaining a target firmware upgrading package of the device according to the target APP jump address, and sending the target firmware upgrading package to the device; the device writing upgrading data of the target firmware upgrading package into an APP partition; the device locally reading the unique identification code and determining the target APP jump address according to the unique identification code; and the device jumping to an APP program according to the target APP jump address. Thus, the unique identification code and the APP jump address are bound, the APP jump address and the firmware upgrading package are corresponded, the upgrading and starting of the device are realized by using a dynamic APP jump address, the cracking difficulty of the device can be improved, and the security of the 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 firmware upgrade technology, and more specifically to a firmware upgrade method and a firmware upgrade system for a device. Background Technology

[0002] Currently, encryption upgrade solutions mainly focus on encryption and decryption in data communication, upgrade processes, and data storage. In related technical solutions, when a device undergoes firmware upgrades, the app's (application's) jump address (i.e., the app's launch address) is often fixed and lacks corresponding encryption mechanisms as a guarantee. This often becomes a weak link in the device's security, resulting in serious compromises to the device's upgrade security. Summary of the Invention

[0003] To solve one of the above-mentioned technical problems, the present invention proposes the following technical solution.

[0004] A first aspect of the present invention provides a firmware upgrade method for a device, comprising: S1, The server sends an upgrade request frame to the device; S2, after receiving the upgrade request frame, the device replies with a response frame to the server, wherein the response frame contains the device's unique identification code; S3, the server determines the target APP redirection address based on the unique identification code, obtains the target firmware upgrade package of the device based on the target APP redirection address, and sends the target firmware upgrade package to the device; S4, the device writes the upgrade data of the target firmware upgrade package into the APP partition; S5, the device reads the unique identification code locally and determines the target APP redirection address based on the unique identification code; S6, the device redirects to the APP program according to the target APP redirection address.

[0005] In addition, the firmware upgrade method for the device according to the above embodiments of the present invention may also have the following additional technical features.

[0006] According to one embodiment of the present invention, determining the target APP redirection address based on the unique identification code includes: The unique identification code is encrypted to obtain the first feature code; Obtain the app's redirect URL pool; According to preset rules, the target APP jump address is determined based on the first feature code and the APP jump address pool.

[0007] According to an embodiment of the present invention, determining the target APP redirection address based on the first feature code and the APP redirection address pool according to a preset rule includes: Obtain the address range of the APP redirect address pool, and determine the address mask based on the address range of the APP redirect address pool; Determine the number of valid bytes N in the address mask, where N is an integer greater than or equal to 1; Extract the last N bytes of the first feature code as the second feature code; The third feature code is obtained by performing a bitwise AND operation between the second feature code and the address mask; The starting address of the APP jump address pool is obtained based on the address range of the APP jump address pool; The third feature code is added to the starting address of the APP jump address pool to obtain the target APP jump address.

[0008] According to one embodiment of the present invention, the firmware upgrade method for a device further includes: Generate a corresponding firmware upgrade package for each app jump address in the app jump address pool to obtain a correspondence table between app jump addresses and firmware upgrade packages. According to one embodiment of the present invention, generating a corresponding firmware upgrade package for each app jump address in the app jump address pool includes: Determine the start address, end address, and address interval of the APP jump address pool, and use the start address of the APP jump address pool as the current jump address; Get the linked file template; Generate a link file based on the current redirect address and the link file template; The linked file is compiled to obtain a binary file; The binary file is packaged to obtain the firmware upgrade package corresponding to the current jump address; Determine whether the firmware upgrade package corresponding to the end address of the APP jump address pool has been obtained; If the firmware upgrade package corresponding to the end address of the APP jump address pool is not obtained, the next APP jump address is obtained according to the current jump address and the address interval, and the next APP jump address is used as the current jump address. The process returns to the step of generating a link file according to the current jump address and the link file template until the firmware upgrade package corresponding to the end address of the APP jump address pool is obtained.

[0009] According to one embodiment of the present invention, the server obtains the target firmware upgrade package of the device based on the target APP redirection address, including: Obtain the mapping table between the APP redirect address and the firmware upgrade package; Based on the target APP jump address and the corresponding relationship table, the target firmware upgrade package corresponding to the target APP jump address is obtained.

[0010] According to one embodiment of the present invention, before the device reads the unique identifier locally, it further includes: The device verifies the APP partition data according to the target firmware upgrade package and determines that the verification is successful. The target firmware upgrade package includes: firmware length and firmware CRC (Cyclic Redundancy Check) code.

[0011] According to one embodiment of the present invention, the device verifies the APP partition data based on the target firmware upgrade package and determines that the verification is successful, including: The firmware CRC code of the APP partition data is calculated based on the firmware length to obtain the calculated firmware CRC code; Read the firmware CRC code saved in the APP partition to obtain the read firmware CRC code; The verification is considered successful when the calculated firmware CRC code matches the read firmware CRC code.

[0012] A second aspect of the present invention provides a firmware upgrade system for a device, comprising a device and a server, wherein the server includes a sending module and a generating module, and the device includes a reply module, a writing module, a determining module and a jump module; The sending module is used to send upgrade request frames to the device; The response module is used to send a response frame to the server after receiving an upgrade request frame, wherein the response frame contains a unique identification code of the device; The generation module is used to determine the target APP jump address based on the unique identification code, obtain the target firmware upgrade package of the device based on the target APP jump address, and send the target firmware upgrade package to the device; The writing module is used to write the upgrade data of the target firmware upgrade package into the APP partition; The determining module is used to read the unique identification code locally and determine the target APP redirection address based on the unique identification code; The redirection module is used to redirect to the APP program according to the target APP redirection address.

[0013] The firmware upgrade system of the device according to an embodiment of the present invention may also have the following additional technical features: According to an embodiment of the present invention, when the generating module or the determining module determines the target APP redirection address based on the unique identification code, it is specifically used for: The unique identification code is encrypted to obtain the first feature code; Obtain the app's redirect URL pool; According to preset rules, the target APP jump address is determined based on the first feature code and the APP jump address pool.

[0014] The technical solution of this invention involves the server determining the APP redirection address based on the device's unique identification code, obtaining the device's firmware upgrade package based on the APP redirection address, and sending the firmware upgrade package to the device. The device then determines the APP redirection address based on the unique identification code and redirects to the APP program according to the APP redirection address, completing the device upgrade and startup. Therefore, by binding the unique identification code and the APP redirection address, and associating the APP redirection address with the firmware upgrade package, and using a dynamic APP redirection address to achieve device upgrades and startup, the difficulty of cracking the device can be increased, thus enhancing device security. Attached Figure Description

[0015] Figure 1 This is a flowchart of a firmware upgrade method for an inverter device according to an embodiment of the present invention.

[0016] Figure 2 This is a schematic diagram of the partitioning of the FLASH memory inside the MCU in an embodiment of the present invention.

[0017] Figure 3 This is a flowchart illustrating a firmware upgrade method for an inverter device according to an embodiment of the present invention.

[0018] Figure 4 This is a flowchart illustrating how a corresponding firmware upgrade package is generated for each app redirect address, as an example of the present invention.

[0019] Figure 5 This is a flowchart illustrating the power-on startup process of a device according to an embodiment of the present invention.

[0020] Figure 6 This is a block diagram of the firmware upgrade system of the device according to an embodiment of the present invention. Detailed Implementation

[0021] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0022] Figure 1 This is a flowchart of a firmware upgrade method for a device according to an embodiment of the present invention.

[0023] like Figure 1 As shown, the firmware upgrade method for this device includes the following steps S1 to S6.

[0024] S1, the server sends an upgrade request frame to the device.

[0025] In this embodiment of the invention, communication between the device and the server can be wired or wireless. Firmware upgrades for the device require interaction and cooperation between the server and the device.

[0026] Specifically, when a device needs a firmware upgrade, the server sends an upgrade request frame to the device to inform it that an upgrade is required. The upgrade request frame can be understood as a data frame requesting the inverter device to perform an upgrade.

[0027] S2. After receiving the upgrade request frame, the device replies with a response frame to the server. The response frame contains the device's unique identification code.

[0028] Among them, the unique identifier can refer to a unique identifier that distinguishes a device from other devices. When it exists on the device, it has uniqueness, immutability and non-replicability.

[0029] Specifically, after receiving an upgrade request frame, the device reads the unique identification code locally and then replies with a response frame to the server based on the unique identification code. Upon receiving the response frame, the server can extract the unique identification code from the response frame.

[0030] S3, the server determines the target APP redirection address based on the unique identification code, obtains the target firmware upgrade package of the device based on the target APP redirection address, and sends the target firmware upgrade package to the device.

[0031] It should be noted that the device to be upgraded in this embodiment of the invention includes an MCU (Microcontroller Unit), such as... Figure 2 As shown, the MCU's internal FLASH (Flash Memory) space includes a Bootloader partition and an Application partition (APP partition). The Bootloader partition is where the bootloader program is stored, and the Application partition is where the application program is stored.

[0032] In this embodiment of the invention, the APP jump address in the Bootloader determined by the server based on the unique identification code is called the target APP jump address. The APP jump address refers to the address where the Bootloader jumps to the APP, which is also the starting address of the APP program.

[0033] In this embodiment of the invention, the upgrade data package of the device determined by the server is referred to as the target firmware upgrade package.

[0034] Specifically, after obtaining the device's unique identifier, the server determines the target app's redirect address based on the unique identifier. The redirect addresses are different for different devices, and there is a mapping relationship between the app's redirect address and the unique identifier. Then, the server obtains the target firmware upgrade package for the device based on the target app's redirect address. That is, the device's firmware upgrade package is dynamically generated by the server based on the unique identifier and sent to the device; one device can correspond to one firmware upgrade package.

[0035] S4, the device writes the upgrade data of the target firmware upgrade package to the APP partition.

[0036] Specifically, before receiving the firmware upgrade package, the device needs to jump to the Bootloader program. After receiving the target firmware upgrade package, the device writes the upgrade data from the target firmware upgrade package to the APP partition and verifies that the data writing was successful, so that the device can perform a firmware upgrade. The firmware upgrade package includes information such as firmware length, firmware CRC code, and software version.

[0037] S5: The device reads the unique identifier locally and determines the target APP redirect address based on the unique identifier.

[0038] S6, the device redirects to the APP program according to the target APP redirect address.

[0039] Specifically, after successfully writing the upgrade data, the device reads a unique identifier locally and then uses this identifier to determine the target app's redirection address. Afterward, it redirects to the app based on this address, thus enabling secure device startup.

[0040] It should be noted that in this embodiment of the invention, both the server and the device determine the target APP redirection address based on a unique identification code. The method for determining the address of the server is the same as that for the device.

[0041] In this invention, the APP jump address of the bootloader, that is, the application's startup address, is not fixed; it is related to the device's unique identification code.

[0042] In related technologies, users are redirected to an app based on a fixed app redirect address. However, in this embodiment of the invention, the device's unique identifier is linked to the app redirect address. Since different devices have different app redirect addresses, a dynamic app redirect address is used, which avoids the problem that fixed app redirect addresses are easily cracked through disassembly and other methods.

[0043] This invention, based on the aim of preventing malicious copying and cracking of device programs, proposes a firmware upgrade scheme for devices. This scheme combines a unique identification code within the device with a dynamic APP redirection address to achieve encrypted device upgrades. Compared to traditional schemes, this scheme encrypts and protects the product from the perspective of program redirection, increasing the difficulty of cracking the product and enhancing its security.

[0044] The technical solution of this invention involves the server determining the APP redirection address based on the device's unique identification code, obtaining the device's firmware upgrade package based on the APP redirection address, and sending the firmware upgrade package to the device. The device then determines the APP redirection address based on the unique identification code and redirects to the APP program according to the APP redirection address, completing the device upgrade and startup. Therefore, by binding the unique identification code and the APP redirection address, and associating the APP redirection address with the firmware upgrade package, and using a dynamic APP redirection address to achieve device upgrades and startup, the difficulty of cracking the device can be increased, thus enhancing device security.

[0045] In one embodiment of the present invention, determining the target APP jump address based on the unique identification code in steps S2 and S3 above may include: encrypting the unique identification code to obtain a first feature code; obtaining an APP jump address pool; and determining the target APP jump address based on the first feature code and the APP jump address pool according to a preset rule.

[0046] The APP jump address pool is a set of pre-prepared APP jump addresses, which can also be understood as the range of APP jump addresses pre-defined in the Bootloader partition. Specifically, the APP jump address pool can be determined in advance based on the size of the Bootloader program, the Application program, and the remaining FLASH in the MCU.

[0047] Among them, the preset rule can be a pre-defined rule that represents the relationship between the first feature code and the APP jump address. In actual situations, it can be specifically determined according to the needs.

[0048] Specifically, such as Figure 3As shown, after receiving the response frame sent by the device, the server extracts the unique identification code and encrypts it to obtain a feature code. In this embodiment, this feature code is referred to as the first feature code. Then, the server maps the first feature code to the APP jump address pool according to preset rules to obtain the target APP jump address. Next, the server obtains the corresponding target upgrade firmware package based on the target APP jump address and sends it to the device. The device writes the upgrade data from the package to the APP partition and verifies whether the writing was successful. After successful verification, the device reads its own unique identification code and uses the same method as the server to determine the target APP jump address based on the unique identification code. Finally, it jumps to the APP program according to the target APP jump address to complete the upgrade.

[0049] Further, according to preset rules, determining the target APP jump address based on the first feature code and the APP jump address pool may include: obtaining the address range of the APP jump address pool and determining the address mask based on the address range of the APP jump address pool; determining the number of valid bytes N of the address mask, where N is an integer greater than or equal to 1; extracting the last N bytes of the first feature code as the second feature code; performing a bitwise AND operation between the second feature code and the address mask to obtain the third feature code; obtaining the starting address of the APP jump address pool based on the address range of the APP jump address pool; and adding the third feature code to the starting address of the APP jump address pool to obtain the target APP jump address.

[0050] In this context, bitwise AND operation refers to performing a logical AND operation on each bit of the two data involved in the operation, according to their corresponding binary numbers.

[0051] Specifically, the difference between the end address and the start address of the APP jump address pool can be calculated first to obtain the address mask. The number of valid bytes N of the address mask is determined. The last N bytes of the first feature code are extracted as the second feature code. The second feature code and the address mask are bitwise ANDed to obtain the third feature code. The third feature code is added to the start address of the APP jump address pool to obtain the target APP jump address.

[0052] For example, if the device's unique identifier is SCN202203045533, and the first signature is 6caf81a24ad5c obtained through an encryption algorithm, the target app's redirect address can be obtained through the following steps: 1) The address range of the APP jump address pool is 0x8002000 to 0x80027FF, and the address mask determined according to this range is 7FF; 2) Based on the address mask, the number of valid bytes is determined to be 3; 3) Extract the last 3 bytes from the first feature code, i.e., d5c, and use it as the second feature code in the operation; 4) Perform a bitwise AND operation between the second feature code d5c and the address mask 7FF to obtain the third feature code 55C; 5) Add the third feature code 55C and the starting address 0x8002000 to get 0x800255C; 6) Use 0x800255C as the target APP's redirect address.

[0053] It should be noted that in this embodiment of the invention, one device corresponds to one firmware upgrade package. Theoretically, 1000 firmware packages correspond to 1000 devices. Which firmware package corresponds to which device is encrypted, making it very difficult for outsiders to crack. Even if one obtains one firmware package and attempts to upgrade other devices, the upgrade will fail. Therefore, this embodiment of the invention requires generating firmware upgrade packages for the devices. The specific generation process is described below: In one embodiment of the present invention, the device firmware upgrade method may further include: generating a corresponding firmware upgrade package for each APP jump address in the APP jump address pool, so as to obtain a correspondence table between APP jump addresses and firmware upgrade packages.

[0054] Specifically, a pre-prepared pool of app redirect addresses can be obtained first, and the redirect addresses of each app in the pool (including the start address and the end address) can be determined. Then, a corresponding firmware upgrade package can be generated for each app redirect address, thereby generating a correspondence table between app redirect addresses and firmware upgrade packages. The file names of each firmware upgrade package are different.

[0055] Furthermore, generating a corresponding firmware upgrade package for each APP jump address in the APP jump address pool may include: obtaining the start address, end address, and address interval of the APP jump address pool, and using the start address of the APP jump address pool as the current jump address; obtaining a link file template; generating a link file based on the current jump address and the link file template; compiling the link file to obtain a binary file; packaging the binary file to obtain the firmware upgrade package corresponding to the current jump address; determining whether the firmware upgrade package corresponding to the end address of the APP jump address pool has been obtained; if the firmware upgrade package corresponding to the end address of the APP jump address pool has not been obtained (indicating that the APP jump address pool has not been completely traversed and needs to be traversed further), obtaining the next APP jump address based on the current jump address and the address interval, using the next APP jump address as the current jump address, and returning to the step of generating a link file based on the current jump address and the link file template, until the firmware upgrade package corresponding to the end address of the APP jump address pool is obtained, that is, the traversal of the APP jump address pool is complete.

[0056] The address interval refers to the interval between two adjacent APP jump addresses, and the link file template is prepared in advance.

[0057] Specifically, such as Figure 4 As shown, firstly, the starting address, ending address, and address interval in the APP jump address pool are determined. The starting address is used as the current jump address. The current jump address can be used as input. The input link file template is used to generate a link file. The link file is compiled to generate a binary file. The binary file is packaged to generate a firmware upgrade package. During the packaging process, information such as firmware length, firmware CRC code, and software version is added. This generates the firmware upgrade package corresponding to the starting address. Then, the next APP jump address in the jump address pool is obtained based on the sum of the starting address and the address interval. This next APP jump address is used as the current jump address. According to the previous steps, the firmware upgrade package corresponding to the next APP jump address is obtained. This process is repeated until the firmware upgrade package corresponding to the ending address is obtained, which means that each APP jump address in the APP jump address pool has been traversed.

[0058] After generating the firmware upgrade package, the firmware upgrade package can be placed in the cloud for remote upgrade. The cloud here refers to the server mentioned in the embodiments of this invention.

[0059] After generating the firmware upgrade package corresponding to each APP jump address, a correspondence table can be created based on the correspondence to obtain the correspondence between APP jump addresses and firmware upgrade packages for subsequent use.

[0060] In one embodiment of the present invention, step S3 above, in which the server obtains the target firmware upgrade package of the device based on the target APP jump address, may include: obtaining a correspondence table between the APP jump address and the firmware upgrade package; and obtaining the target firmware upgrade package corresponding to the target APP jump address based on the target APP jump address and the correspondence table.

[0061] Specifically, after obtaining the target APP redirect address, the server can further obtain the correspondence table between the APP redirect address pool and the firmware upgrade package. From the various firmware upgrade packages in the correspondence table, the server selects the target upgrade firmware package corresponding to the target APP redirect address.

[0062] In one embodiment of the present invention, before the device reads the unique identification code locally, the method may further include: the device verifying the APP partition data according to the target firmware upgrade package and determining that the verification is successful, wherein the target firmware upgrade package includes: firmware length and firmware CRC code.

[0063] Specifically, such as Figure 5As shown, during device upgrade startup, the device first powers on and enters the Bootloader program. Then, it reads the local unique identifier to obtain the target app's redirection address, and then redirects to the app based on that address. Before reading the unique identifier, the device needs to verify that the upgrade data of the target firmware upgrade package has been correctly written to the app partition. Therefore, it verifies the app partition data based on the firmware upgrade package and confirms successful verification.

[0064] Furthermore, the device verifies the APP partition data based on the target firmware upgrade package and determines that the verification is successful. This may include: calculating the firmware CRC code of the APP partition data based on the firmware length to obtain the calculated firmware CRC code; reading the firmware CRC code stored in the APP partition to obtain the read firmware CRC code; and determining that the verification is successful when the calculated firmware CRC code matches the read firmware CRC code.

[0065] Specifically, the device calculates the firmware CRC code based on the firmware length in the firmware upgrade package and reads the firmware CRC code stored in the APP partition. If the two are consistent, it means that the upgrade data of the target firmware upgrade package has been correctly written to the APP partition, and the verification is successful.

[0066] Upon successful verification, the device uses the unique identifier to determine the target app redirection address, redirecting the user to the app and completing the startup process.

[0067] Based on the above parameters, the technical solution of this invention obtains the identification code from the server, encrypts it to obtain the feature code, maps it to the jump address pool to obtain the APP jump address, and obtains the matching firmware package according to the jump address and firmware correspondence table to realize the differential upgrade of the firmware package; by reading the unique identification code during the device power-on stage and obtaining the APP jump address according to certain rules, the security of product upgrades and startup is improved.

[0068] Corresponding to the firmware upgrade method of the device in the above embodiments, the present invention also proposes a firmware upgrade system for the device.

[0069] Figure 6 This is a block diagram of the firmware upgrade system of the device according to an embodiment of the present invention.

[0070] like Figure 6 As shown, the system includes a device and a server, which communicate wirelessly with each other. The server includes a sending module 10 and a generating module 20, and the device includes a reply module 30, a writing module 40, a determining module 50, and a jump module 60.

[0071] The system includes: a sending module 10 for sending an upgrade request frame to the device; a reply module 30 for replying to the server with a response frame after receiving the upgrade request frame, wherein the response frame contains the device's unique identifier; a generation module 20 for determining the target APP jump address based on the unique identifier, obtaining the target firmware upgrade package for the device based on the target APP jump address, and sending the target firmware upgrade package to the device; a writing module 40 for writing the upgrade data of the target firmware upgrade package to the APP partition; a determination module 50 for reading the unique identifier locally and determining the target APP jump address based on the unique identifier; and a jump module 60 for jumping to the APP program based on the target APP jump address.

[0072] In one embodiment, when determining the target APP jump address based on the unique identifier, the generating module 20 or the determining module 50 may specifically be used to: encrypt the unique identifier to obtain a first feature code; obtain an APP jump address pool; and determine the target APP jump address based on the first feature code and the APP jump address pool according to preset rules.

[0073] It should be noted that the specific implementation method of the firmware upgrade system of this device can be found in the specific implementation method of the firmware upgrade method of the above-mentioned device. To avoid redundancy, it will not be described in detail here.

[0074] The firmware upgrade system of the device in this embodiment of the invention binds a unique identification code and an APP jump address, and associates the APP jump address with the firmware upgrade package. It uses a dynamic APP jump address to upgrade and start the device, which can increase the difficulty of cracking the device and improve the security of the device.

[0075] In the description of this invention, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. "A plurality of" means two or more, unless otherwise explicitly specified.

[0076] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present invention.

Claims

1. A firmware upgrade method for a device, characterized in that, Includes the following steps: S1, The server sends an upgrade request frame to the device; S2, after receiving the upgrade request frame, the device replies with a response frame to the server, wherein the response frame contains the device's unique identification code; S3, the server determines the target APP jump address according to the unique identification code, the server obtains the target firmware upgrade package of the device according to the target APP jump address, and sends the target firmware upgrade package to the device. The APP jump address in the Bootloader determined by the server according to the unique identification code is called the target APP jump address. The APP jump address refers to the address where the Bootloader jumps to the APP, which is also the starting address of the APP program. S4, the device writes the upgrade data of the target firmware upgrade package into the APP partition; S5, the device reads the unique identification code locally and determines the target APP redirection address based on the unique identification code; S6, the device redirects to the APP program according to the target APP redirection address. Determining the target APP redirect address based on the unique identifier includes: encrypting the unique identifier to obtain a first feature code; obtaining an APP redirect address pool; and determining the target APP redirect address based on the first feature code and the APP redirect address pool according to a preset rule.

2. The firmware upgrade method for the device according to claim 1, characterized in that, According to preset rules, the target APP redirection address is determined based on the first feature code and the APP redirection address pool, including: Obtain the address range of the APP redirect address pool, and determine the address mask based on the address range of the APP redirect address pool; Determine the number of valid bytes N in the address mask, where N is an integer greater than or equal to 1; Extract the last N bytes of the first feature code as the second feature code; The third feature code is obtained by performing a bitwise AND operation between the second feature code and the address mask; The starting address of the APP jump address pool is obtained based on the address range of the APP jump address pool; The third feature code is added to the starting address of the APP jump address pool to obtain the target APP jump address.

3. The firmware upgrade method for the device according to claim 1, characterized in that, Also includes: For each APP jump address in the APP jump address pool, a corresponding firmware upgrade package is generated to obtain a correspondence table between APP jump addresses and firmware upgrade packages.

4. The firmware upgrade method for the device according to claim 3, characterized in that, Generate a corresponding firmware upgrade package for each app redirect address in the app redirect address pool, including: Determine the start address, end address, and address interval of the APP jump address pool, and use the start address of the APP jump address pool as the current jump address; Get the linked file template; Generate a link file based on the current redirect address and the link file template; The linked file is compiled to obtain a binary file; The binary file is packaged to obtain the firmware upgrade package corresponding to the current jump address; Determine whether the firmware upgrade package corresponding to the end address of the APP jump address pool has been obtained; If the firmware upgrade package corresponding to the end address of the APP jump address pool is not obtained, the next APP jump address is obtained according to the current jump address and the address interval, and the next APP jump address is used as the current jump address. The process returns to the step of generating a link file according to the current jump address and the link file template until the firmware upgrade package corresponding to the end address of the APP jump address pool is obtained.

5. The firmware upgrade method for the device according to claim 3, characterized in that, The server obtains the target firmware upgrade package for the device based on the target APP redirect address, including: Obtain the mapping table between the APP redirect address and the firmware upgrade package; Based on the target APP jump address and the corresponding relationship table, the target firmware upgrade package corresponding to the target APP jump address is obtained.

6. The firmware upgrade method for the device according to claim 1, characterized in that, Before the device reads the unique identifier locally, the method further includes: The device verifies the APP partition data according to the target firmware upgrade package and determines that the verification is successful. The target firmware upgrade package includes: firmware length and firmware CRC code.

7. The firmware upgrade method for the device according to claim 6, characterized in that, The device verifies the APP partition data according to the target firmware upgrade package and determines that the verification is successful, including: The firmware CRC code of the APP partition data is calculated based on the firmware length to obtain the calculated firmware CRC code; Read the firmware CRC code saved in the APP partition to obtain the read firmware CRC code; The verification is considered successful when the calculated firmware CRC code matches the read firmware CRC code.

8. A firmware upgrade system for a device, characterized in that, The device includes a device and a server, the server including a sending module and a generating module, and the device including a reply module, a writing module, a determining module and a redirecting module; The sending module is used to send upgrade request frames to the device; The response module is used to send a response frame to the server after receiving an upgrade request frame, wherein the response frame contains a unique identification code of the device; The generation module is used to determine the target APP jump address according to the unique identification code, obtain the target firmware upgrade package of the device according to the target APP jump address, and send the target firmware upgrade package to the device. The APP jump address in the Bootloader determined by the server according to the unique identification code is called the target APP jump address. The APP jump address refers to the address where the Bootloader jumps to the APP, which is also the starting address of the APP program. The writing module is used to write the upgrade data of the target firmware upgrade package into the APP partition; The determining module is used to read the unique identification code locally and determine the target APP redirection address based on the unique identification code; The redirection module is used to redirect to the APP program according to the target APP redirection address. When determining the target APP jump address based on the unique identification code, the generation module or the determining module is specifically used to: encrypt the unique identification code to obtain a first feature code; obtain an APP jump address pool; and determine the target APP jump address according to a preset rule based on the first feature code and the APP jump address pool.

Citation Information

Patent Citations

  • Method of starting up a computing device in a network, server and network of computing devices for the implementation thereof

    US20120179900A1