Phenotype Internet of Things program upgrade method, device and equipment
By reading the startup address of the target application in the phenotypic IoT device and receiving and downloading the firmware data packets to be upgraded from the IoT cloud platform, the waste of manual upgrades and automatic upgrades in the existing technology is solved, and the automatic upgrade and continuous work of the device are realized.
Patent Information
- Application Number
- CN202510210609.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-25
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2045-02-25
AI Technical Summary
The program upgrade method of existing phenotypic IoT devices requires manual operation, waste of human resources, and it is difficult to automatically upgrade if unattended for a long time.
A phenotypic IoT program upgrade method is proposed. Through the boot program, the target application's startup address is read from the parameter storage area, the firmware data packet to be upgraded is received from the IoT cloud platform, and the startup address of the new application is downloaded and written to the automated program upgrade.
It realizes automatic upgrade of phenotypic IoT devices without being on duty for a long time, avoids manual intervention, ensures the sustainability of equipment work, and does not affect the collection or analysis of phenotypic data.
Smart Images

Figure CN119690484B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a phenotypic Internet of Things program upgrade method, device and equipment. Background Art
[0002] Phenotypic IoT devices are IoT devices used in the field of phenotypic measurement (for example, plants, animals, buildings, topography, etc.). Phenotypic IoT devices can collect phenotypic data in real time, around the clock, and transmit or analyze the collected phenotypic data, providing a basis for phenotypic research.
[0003] However, as the functions of phenotypic IoT devices increase or troubleshooting occurs, current methods of program upgrades for phenotypic IoT devices are all performed manually, which wastes human resources. Summary of the invention
[0004] In view of this, the purpose of this application is to propose a phenotypic Internet of Things program upgrade method, device and equipment to solve or partially solve the above-mentioned technical problems.
[0005] Based on the above purpose, the present application provides a method for upgrading a phenotypic Internet of Things program, wherein the phenotypic Internet of Things program is applied to a phenotypic Internet of Things device, wherein the phenotypic Internet of Things program includes: a boot program and multiple application programs;
[0006] The method comprises:
[0007] After the phenotypic IoT device is powered on, a boot program is run, a boot address of a target application to be run is read from a parameter storage area using the boot program, the target application is called through the boot address, and the target application is run, wherein the target application belongs to any one of a plurality of applications;
[0008] During the operation of the target application, a firmware data packet to be upgraded of the phenotype IoT program sent by the IoT cloud platform is received;
[0009] In response to the firmware data packet to be upgraded meeting the upgrade rule, determining the startup address of the new application corresponding to the firmware data packet to be upgraded, downloading the firmware data packet to be upgraded, and writing the firmware data packet to be upgraded into the startup address of the corresponding new application;
[0010] Add the startup address of the new application to the application address index variable in the parameter storage area, confirm that the initial upgrade of the phenotypic IoT program is completed, and restart;
[0011] The authentication information of the new application after restart is sent to the IoT cloud platform for the IoT cloud platform to judge the authentication information and determine whether the authentication information matches the firmware data packet to be upgraded of the sent phenotypic IoT program, and the phenotypic IoT program is upgraded successfully after the match is determined.
[0012] Based on the same inventive concept, the present application also provides a phenotypic Internet of Things program upgrade device, which is arranged in a phenotypic Internet of Things device, wherein the phenotypic Internet of Things program includes: a boot program and a plurality of application programs;
[0013] The device comprises:
[0014] A running module is configured to run a boot program after the phenotypic IoT device is powered on, use the boot program to read a startup address of a target application to be run from a parameter storage area, call the target application through the startup address, and run the target application, wherein the target application belongs to any one of a plurality of applications;
[0015] A receiving module is configured to receive a firmware data packet to be upgraded of a phenotype IoT program sent by an IoT cloud platform during the operation of the target application;
[0016] a writing module configured to, in response to the firmware data packet to be upgraded complying with the upgrade rule, determine the startup address of the new application corresponding to the firmware data packet to be upgraded, download the firmware data packet to be upgraded, and write the firmware data packet to be upgraded into the startup address of the corresponding new application;
[0017] The upgrade module is configured to add the startup address of the new application to the application address index variable in the parameter storage area, determine that the initial upgrade of the phenotypic IoT program is complete, and restart;
[0018] The authentication information sending module is configured to send the authentication information of the new application after restart to the Internet of Things cloud platform, so that the Internet of Things cloud platform can judge the authentication information and determine whether the authentication information matches the firmware data packet to be upgraded of the sent phenotype Internet of Things program, and after determining the match, the phenotype Internet of Things program is upgraded successfully.
[0019] Based on the same inventive concept, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the method as described above when executing the computer program.
[0020] Based on the same inventive concept, the present application also provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to execute the method as described above.
[0021] From the above, it can be seen that the phenotypic Internet of Things program upgrade method, device and equipment provided by the present application will divide the phenotypic Internet of Things program into a boot program and multiple applications, so that the boot program can be used to read the startup address of the target application to be run from the parameter storage area, and the target application is called through the startup address, so as to achieve the purpose of running the target application. During the operation process, after receiving the firmware data packet to be upgraded of the phenotypic Internet of Things program sent by the Internet of Things cloud platform, the firmware data packet to be upgraded will be automatically judged to determine whether it meets the corresponding upgrade rules. If it meets the rules, the startup address of the corresponding new application will be determined, and then the firmware data packet to be upgraded will be downloaded. After the download is completed, the firmware data packet to be upgraded will be written to the startup address of the corresponding new application; then the startup address of the new application is added to the application address index variable in the parameter storage area, so as to complete the initial upgrade of the phenotypic Internet of Things program, and then the phenotypic Internet of Things program will be restarted. After restarting, the authentication information of the new application will be obtained and sent to the Internet of Things cloud platform; finally, after the Internet of Things cloud platform determines that the authentication information matches the firmware data packet to be upgraded of the sent phenotypic Internet of Things program, it can be determined that the upgrade is successful. This process does not require human intervention and is simple and convenient to operate. It can enable the phenotypic IoT device to automatically upgrade when it is unattended for a long time, and continue to work after the upgrade, ensuring the continuity of the operation of the phenotypic IoT device during the upgrade process without affecting the collection or analysis of phenotypic data. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the present application or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0023] Figure 1 A flowchart of a method for upgrading a phenotypic Internet of Things program according to an embodiment of the present application;
[0024] Figure 2 A schematic diagram of communication interaction between a phenotypic IoT device and an IoT cloud platform according to an embodiment of the present application;
[0025] Figure 3 A schematic diagram of the division of the internal storage area of a single-chip microcomputer of a phenotypic Internet of Things device according to an embodiment of the present application;
[0026] Figure 4 A schematic diagram of the division of the internal storage area of a single-chip microcomputer of a phenotypic Internet of Things device according to another embodiment of the present application;
[0027] Figure 5 This is a structural block diagram of a phenotypic Internet of Things program upgrade device according to an embodiment of the present application;
[0028] Figure 6 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0029] In order to make the objectives, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0030] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should be the usual meanings understood by people with ordinary skills in the field to which the present application belongs. The "first", "second" and similar words used in the embodiments of the present application do not represent any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements or objects appearing in front of the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0031] Glossary:
[0032] OTA, Over-The-Air, online upgrade.
[0033] TLS, Transport Layer Security, Transport Layer Security Protocol.
[0034] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0035] The embodiment of the present application provides a method for upgrading a phenotypic Internet of Things program, wherein the phenotypic Internet of Things program is applied to a phenotypic Internet of Things device, wherein the phenotypic Internet of Things program includes: a boot program and multiple application programs, the number of which is at least two. The method for upgrading the phenotypic Internet of Things program mainly implements OTA online upgrading.
[0036] like Figure 1 As shown, the method includes:
[0037] Step 101, after the phenotypic IoT device is powered on, a boot program is run, and a boot address of a target application to be run is read from a parameter storage area using the boot program, the target application is called through the boot address, and the target application is run, wherein the target application belongs to any one of a plurality of applications.
[0038] In specific implementation, the boot program has the function of booting and starting, can determine the target application to be started, and directly read the startup address of the target application from the parameter storage area, so as to achieve the purpose of running the target application. The boot program can well realize the control and operation of multiple applications, and the operation is simple and convenient.
[0039] Step 102, during the operation of the target application, a firmware data packet to be upgraded of the phenotype IoT program sent by the IoT cloud platform is received, wherein one firmware data packet to be upgraded corresponds to one new application.
[0040] In specific implementation, during the operation of the target application, if a firmware data packet to be upgraded of a phenotype IoT program sent by the IoT cloud platform is received, some identity information of the firmware data packet to be upgraded will be obtained before downloading.
[0041] Step 103, in response to the firmware data packet to be upgraded meeting the upgrade rule, determining the startup address of the new application corresponding to the firmware data packet to be upgraded, downloading the firmware data packet to be upgraded, and writing the firmware data packet to be upgraded into the startup address of the corresponding new application.
[0042] In the specific implementation, the identity information of the firmware data packet to be upgraded is determined using the corresponding upgrade rules. If it does not meet the requirements, the upgrade process is stopped. If it meets the requirements, the corresponding startup address will be determined for the new application. In this way, after the firmware data packet to be upgraded is downloaded, the firmware data packet to be upgraded can be better written according to the startup address, so that the new application can be read, started and run according to the startup address later.
[0043] Step 104, add the startup address of the new application to the application address index variable in the parameter storage area, determine that the initial upgrade of the phenotypic IoT program is completed, and restart.
[0044] In specific implementation, in order to facilitate the boot program to read the startup address of the new application, the startup address of the new application will be added to the application address index variable in the parameter storage area, thereby realizing the association with the boot program. This completes the initial upgrade process on the side of the phenotypic IoT device.
[0045] Step 105, the authentication information of the new application after restart is sent to the IoT cloud platform, so that the IoT cloud platform can judge the authentication information and determine whether the authentication information matches the firmware data packet to be upgraded of the sent phenotypic IoT program, and after determining the match, the phenotypic IoT program is upgraded successfully.
[0046] In specific implementation, after the initial upgrade of the phenotypic IoT device is completed, it is restarted and the authentication information of the upgraded new application can be sent to the IoT cloud platform for verification to determine whether the upgrade is successful. If the upgrade is successful, the upgraded new application can be used. If the upgrade is unsuccessful, the above steps 102 to 105 will be executed again for re-upgrade.
[0047] Through the above scheme, the phenotype Internet of Things program will be divided into a boot program and multiple applications, so that the boot program can be used to read the startup address of the target application to be run from the parameter storage area, and the target application is called through the startup address, so as to achieve the purpose of running the target application. During the operation, after receiving the firmware data packet to be upgraded of the phenotype Internet of Things program sent by the Internet of Things cloud platform, the firmware data packet to be upgraded will be automatically judged to determine whether it meets the corresponding upgrade rules. If it meets the rules, the startup address of the corresponding new application will be determined, and then the firmware data packet to be upgraded will be downloaded. After the download is completed, the firmware data packet to be upgraded will be written to the startup address of the corresponding new application; then the startup address of the new application will be added to the application address index variable in the parameter storage area, so as to complete the initial upgrade of the phenotype Internet of Things program, and then the phenotype Internet of Things program will be restarted. After restarting, the authentication information of the new application will be obtained and sent to the Internet of Things cloud platform; finally, after the Internet of Things cloud platform determines that the authentication information matches the firmware data packet to be upgraded of the sent phenotype Internet of Things program, it can be determined that the upgrade is successful. This process does not require human intervention and is simple and convenient to operate. It can enable the phenotypic IoT device to automatically upgrade when it is unattended for a long time, and continue to work after the upgrade, ensuring the continuity of the operation of the phenotypic IoT device during the upgrade process without affecting the collection or analysis of phenotypic data.
[0048] In some embodiments, in response to the firmware data packet to be upgraded meeting the upgrade rule in step 103, the step includes:
[0049] Step 1031, obtaining the first device name and the first product key value in the firmware data packet to be upgraded.
[0050] Step 1032, comparing the first device name with the second device name of the phenotypic IoT device.
[0051] Step 1033, comparing the first product key value with the second product key value of the phenotypic IoT device.
[0052] Step 1034, determine that the first device name matches the second device name, and the first device name matches the second device name, and obtain the version number in the firmware data packet to be upgraded.
[0053] During specific implementation, the first device name and the first product key value are checked. If they match the second device name and the second product key value of the phenotypic IoT device respectively, it is determined that the firmware data packet to be upgraded is for the phenotypic IoT device, and the version number in the firmware data packet to be upgraded is obtained for further inspection.
[0054] Step 1035: Determine whether the version number in the firmware data package to be upgraded satisfies the upgrade rule.
[0055] In the specific implementation, the version number in the firmware data package to be upgraded is compared with the pre-set upgrade rules. If the upgrade rules are met, the firmware data package to be upgraded is acceptable and the next step of upgrade preparation is entered. In this way, if any of the name, key value, and version number does not match, the upgrade will be stopped.
[0056] Through the above solution, the name, key value, and version number can be compared and checked layer by layer, thus ensuring the accuracy of the upgrade process.
[0057] In some embodiments, step 1035 includes:
[0058] Step 10351, obtaining first digital information of the last predetermined number of digits (for example, the last 3 digits) in the version number of the firmware data packet to be upgraded, and determining the parity of the first digital information.
[0059] Step 10352, obtain the second digital information of the last predetermined number of digits (for example, the last 3 digits) in the version number of the current phenotypic IoT program, and determine the parity of the second digital information.
[0060] Step 10353: In response to the parity of the first digital information being different from the parity of the second digital information, determining that an upgrade rule is satisfied.
[0061] In a specific implementation, if the first digital information is an odd number and the second digital information is an even number, or if the first digital information is an even number and the second digital information is a random number, the upgrade rule will be met.
[0062] Through the above scheme, using parity for judgment can better ensure that the firmware data packet to be upgraded is a different version of the currently running phenotype IoT program and needs to be upgraded before the upgrade process is executed, thereby ensuring the accuracy of the upgrade process.
[0063] In some embodiments, determining the startup address of the new application corresponding to the firmware data packet to be upgraded in step 103, downloading the firmware data packet to be upgraded, and writing the firmware data packet to be upgraded into the startup address of the corresponding new application includes:
[0064] Step 103a, determining index data of the new application in the internal storage area of the phenotypic IoT device.
[0065] Step 103b: Determine the startup address of the new application based on the index data of the new application.
[0066] Step 103c, downloading the firmware data package to be upgraded, and writing the firmware data package to be upgraded into the corresponding startup address.
[0067] During specific implementation, in order to ensure that the firmware data packet to be upgraded can run normally, the index data of the internal storage area of the phenotype IoT device will be determined for the corresponding new application, so that the startup address of the new application can be determined based on the index data, and then the firmware data packet to be upgraded after downloading is written into the startup address of the new application, so that it can be associated with the boot program.
[0068] In addition, if Figure 2 As shown, the phenotypic IoT device and the IoT cloud platform are encrypted via TLS. Specifically, the MCU of the phenotypic IoT device interacts with the communication module via the serial port using TLS encrypted transmission, and the communication module interacts with the IoT cloud platform via wired and / or wireless TLS encrypted transmission. This ensures the correctness of the firmware data packet to be upgraded received by the phenotypic IoT device, and when downloading the firmware data packet to be upgraded, it can ensure that each sub-data packet of the received firmware data packet to be upgraded is correct.
[0069] Through the above scheme, the corresponding startup address can be determined for the firmware data packet to be upgraded, and then written into the startup address of the corresponding new application, so as to realize the association between the new application and the boot program. In this way, if the boot program wants to start the new application later, it can directly read the corresponding startup address to call the corresponding new application to start running, which is convenient and quick to operate.
[0070] In some embodiments, step 103a includes:
[0071] Step a1, determining the initial index data of the target application running in the phenotypic IoT device in the internal storage area of the phenotypic IoT device , the specific formula is:
[0072] ,in, is the actual startup address of the target application running in the phenotype IoT device, The base address of the application area in the internal storage area of the phenotype IoT device. The amount of space of the storage block corresponding to each application divided in the internal storage area of the phenotypic IoT device;
[0073] Step a2, based on the initial index data , determine the index data of the new application in the internal storage area of the phenotypic IoT device , the specific formula is:
[0074]
[0075] in, is the version number of the current phenotype IoT program, is the version number of the firmware data package to be upgraded, and N is the number of memory blocks in the internal storage area of the phenotypic IoT device used to store application programs. The internal storage area of the MCU of the phenotypic IoT device is divided as follows: Figure 3 shown.
[0076] Through the above solution, the index data can be accurately calculated, which facilitates the subsequent determination of the startup address based on the index data.
[0077] In some embodiments, step 103b includes:
[0078] Step b1, determining the amount of space of the storage block corresponding to each application divided in the internal storage area of the phenotypic IoT device .
[0079] Step b2, determining the base address for storing the application area in the internal storage area of the phenotypic IoT device .
[0080] Step b3, index data of the new application in the internal storage area of the phenotypic IoT device The amount of space associated with the storage block Multiply to obtain a multiplication result, and add the multiplication result to the base address Add together to get the startup address of the new application .
[0081] When implementing, the startup address of the new application The corresponding formula is: .
[0082] Through the above scheme, the startup address of the new application can be accurately calculated .
[0083] In some embodiments, downloading the firmware data package to be upgraded in step 103 includes:
[0084] Step S1, erasing the flash memory area corresponding to the firmware data package to be upgraded.
[0085] Step S2, downloading the firmware data package to be upgraded in sub-packages according to the preset sub-package space amount.
[0086] Step S3: each time a sub-data package is downloaded, the downloaded sub-data package is placed in the flash memory area.
[0087] Step S4, comparing the sub-data package put into the flash memory area with the downloaded sub-data package to obtain a comparison result.
[0088] Step S5, in response to the comparison result being successful, determining that the sub-data package placed in the flash memory area is correct, continuing to download the next sub-data package of the firmware package to be upgraded until all sub-data packages in the firmware package to be upgraded are downloaded.
[0089] Alternatively, in step S6, in response to the comparison result being a comparison failure, the upgrade process of the firmware data packet to be upgraded is terminated, and the upgrade process is restarted. After the restart, the firmware data packet to be upgraded sent by the IoT cloud platform is received again, and the process returns to the step of downloading the sub-packets according to the preset sub-packet space until all sub-packets in the firmware data packet to be upgraded are downloaded.
[0090] Through the above solution, the download process of the firmware data package to be upgraded can be ensured to be completed smoothly, and the accuracy of the downloaded firmware data package to be upgraded can also be ensured.
[0091] The following is a specific description of the phenotypic IoT program upgrade method using an embodiment in which the number of application programs N is 2:
[0092] 1. Division of FLASH storage area inside the MCU of phenotypic IoT devices
[0093] When N=2, the internal FLASH storage area of the microcontroller is divided into four parts, namely the boot program storage area, parameter storage area, application storage area 1, and application storage area 2. Figure 4 As shown:
[0094] 2. Validity determination of the firmware data package to be upgraded
[0095] Assume that there is a phenotypic IoT device that can work normally. The boot program storage area of the FLASH inside the microcontroller stores the boot program, the parameter storage area stores the parameters required for the normal operation of the device, and the application storage area 1 stores the application, whose version number is V1.00.001. In order to add a certain function to the device, it is decided to initiate an OTA remote upgrade from the IoT cloud platform. The version number of the firmware data package to be upgraded is V1.01.001.
[0096] According to the validity judgment method of the firmware data package to be upgraded, the program version currently running on the phenotypic IoT device is V1.00.001, and the last three digits of its version number are odd numbers. Therefore, the last three digits of the version number of the next valid and upgradeable firmware data package to be upgraded should be even numbers. In this embodiment, the version number of the firmware data package to be upgraded pushed by the IoT cloud platform is V1.01.001, and the last three digits of its version number are odd numbers. Since it does not meet the upgrade rules, when the phenotypic IoT device receives the upgrade message pushed by the IoT cloud platform, it will not perform OTA upgrade.
[0097] Similarly, suppose that the above-mentioned phenotypic IoT device has a program BUG and needs to be repaired. Therefore, it is necessary to push the repaired program firmware from the IoT cloud platform to the phenotypic IoT device. Assuming that the version number of the firmware is V1.01.002, since the last three digits of the version number of the firmware to be upgraded are even numbers, it meets the rules described in 3.1. Therefore, when the phenotypic IoT device receives the OTA upgrade of the firmware pushed by the IoT cloud platform, it will determine that the firmware to be upgraded is a valid firmware and prepare for the next step of upgrading.
[0098] 3. Determination of the storage area of the firmware data package to be upgraded
[0099] If the version number of the program currently running on the phenotypic IoT device is V1.00.001, and the last three digits are odd numbers, when the phenotypic IoT device receives a firmware data packet with version number V1.01.002 pushed to it by the IoT cloud platform, since the last three digits are even numbers, it will be determined that the firmware data packet to be upgraded complies with the upgrade rules and is a valid and upgradeable firmware data packet, and the storage area required to be burned for the firmware data packet to be upgraded will be further calculated.
[0100] According to the storage area allocation strategy of the firmware data package to be upgraded, it can be calculated that the firmware to be upgraded that passes the validity check will be burned into the application storage area 2.
[0101] Assuming that the version number of the target application currently running on the phenotypic IoT device is V1.01.002, and the application is stored in application storage area 2, then when the phenotypic IoT device receives the firmware data packet to be upgraded with version number V1.02.005 pushed by the IoT cloud platform, the phenotypic IoT device will determine that the firmware data packet to be upgraded is a valid and upgradeable firmware data packet, and according to the formula given in the above embodiment, calculate that the storage area required to burn the firmware data packet to be upgraded is application storage area 1.
[0102] 4. Download the firmware package to be upgraded
[0103] After the phenotypic IoT device calculates the storage area to be burned for the firmware to be upgraded (assuming that the calculated storage area to be burned is application storage area 2), it will perform the following operations:
[0104] 1. Erase the application storage area 2 of the FLASH inside the microcontroller.
[0105] 2. Set the size of each downloaded data packet to 1024 bytes.
[0106] 3. Write the received 1024 bytes of data into application storage area 2 in sequence.
[0107] 4. Read the 1024 bytes of data written in step 3 from the FLASH inside the microcontroller, and compare the read data with the data written in step 3.
[0108] 5. If all the data are the same, the data is written correctly, and the next 1024-byte data packet is requested from the IoT cloud platform, and the download progress of the firmware data packet to be upgraded is reported to the IoT cloud platform.
[0109] 6. If the data comparison shows a discrepancy, it is determined that the firmware data packet to be upgraded has failed to be written, the current upgrade process is terminated, and the phenotypic IoT device is restarted.
[0110] 7. After restarting the phenotypic IoT device, repeat steps 3 to 5 until the firmware data package to be upgraded is downloaded.
[0111] According to the above steps, after the download of the entire firmware to be upgraded is completed, the data of the firmware to be upgraded has been written into the internal FLASH of the microcontroller. Since the data interaction between the phenotypic IoT and the IoT cloud platform is encrypted by TLS, it can be guaranteed that every firmware data packet to be upgraded received by the phenotypic IoT device is correct. In addition, in the process of writing the firmware data packet to be upgraded into the internal FLASH of the microcontroller, the written data is compared with the read data to ensure that the written firmware data packet to be upgraded is correct.
[0112] 5. Firmware upgrade success judgment
[0113] When the phenotypic IoT device has downloaded all the data of the firmware data package to be upgraded and successfully written the firmware data package to be upgraded into the FLASH inside the microcontroller, it will update the application startup address in the parameter storage area of the FLASH inside the microcontroller and then restart. When the phenotypic IoT restarts, it will retrieve the latest application startup address, jump to the latest application startup address, and execute the corresponding program code. After restarting, the phenotypic IoT device will report the version number of the currently running target application to the IoT cloud platform. The IoT cloud IoT cloud platform determines whether the OTA upgrade of the phenotypic IoT device is successful based on this.
[0114] It should be noted that the method of the embodiment of the present application can be performed by a single device, such as a computer or an IoT cloud platform. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the described method.
[0115] It should be noted that the above describes some embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0116] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present application also provides a phenotypic Internet of Things program upgrade device, which is arranged in a phenotypic Internet of Things device, wherein the phenotypic Internet of Things program includes: a boot program and a plurality of application programs;
[0117] refer to Figure 5 , the device comprises:
[0118] The running module 201 is configured to run a boot program after the phenotypic IoT device is powered on, use the boot program to read a startup address of a target application to be run from a parameter storage area, call the target application through the startup address, and run the target application, wherein the target application belongs to any one of a plurality of applications;
[0119] The receiving module 202 is configured to receive a firmware data packet to be upgraded of the phenotype IoT program sent by the IoT cloud platform during the operation of the target application program;
[0120] The writing module 203 is configured to, in response to the firmware data packet to be upgraded meeting the upgrade rule, determine the startup address of the new application corresponding to the firmware data packet to be upgraded, download the firmware data packet to be upgraded, and write the firmware data packet to be upgraded into the startup address of the corresponding new application;
[0121] The upgrade module 204 is configured to add the startup address of the new application to the application address index variable in the parameter storage area, determine that the initial upgrade of the phenotypic IoT program is complete, and restart;
[0122] The authentication information sending module 205 is configured to send the authentication information of the new application after restart to the Internet of Things cloud platform, so that the Internet of Things cloud platform can judge the authentication information and determine whether the authentication information matches the firmware data packet to be upgraded of the sent phenotype Internet of Things program, and after determining the match, the phenotype Internet of Things program is upgraded successfully.
[0123] In some embodiments, the writing module 203 includes an upgrade rule determination unit configured to:
[0124] Obtaining a first device name and a first product key value in the firmware data packet to be upgraded;
[0125] comparing the first device name with a second device name of a phenotypic IoT device;
[0126] comparing the first product key value with a second product key value of the phenotypic IoT device;
[0127] Determine that the first device name matches the second device name, and the first device name matches the second device name, and obtain the version number in the firmware data packet to be upgraded;
[0128] Determine whether the version number in the firmware data package to be upgraded satisfies the upgrade rule.
[0129] In some embodiments, the upgrade rule determination unit is specifically configured to:
[0130] Obtaining first digital information of the last predetermined number of digits in the version number of the firmware data packet to be upgraded, and determining the parity of the first digital information;
[0131] Obtain second digital information of the last predetermined digit in the version number of the current phenotypic IoT program, and determine the parity of the second digital information;
[0132] In response to the parity of the first digital information being different from the parity of the second digital information, it is determined that an upgrade rule is satisfied.
[0133] In some embodiments, the writing module 203 includes a download writing unit configured to:
[0134] Determine the index data of the new application in the internal storage area of the phenotypic IoT device;
[0135] Determine a startup address of the new application based on the index data of the new application;
[0136] The firmware data package to be upgraded is downloaded and written into the corresponding startup address.
[0137] In some embodiments, the download writing unit is specifically configured to:
[0138] Determine initial index data of the target application running in the phenotypic IoT device in the internal storage area of the phenotypic IoT device , the specific formula is:
[0139] ,in, is the actual startup address of the target application running in the phenotype IoT device, The base address of the application area in the internal storage area of the phenotype IoT device. The amount of space of the storage block corresponding to each application divided in the internal storage area of the phenotypic IoT device;
[0140] Based on the initial index data , determine the index data of the new application in the internal storage area of the phenotypic IoT device , the specific formula is:
[0141]
[0142] in, is the version number of the current phenotype IoT program, is the version number of the firmware data package to be upgraded, and N is the number of storage blocks in the internal storage area of the phenotypic IoT device that are used to store application programs.
[0143] In some embodiments, the download writing unit is further configured to:
[0144] Determine the amount of space in the memory block corresponding to each application divided in the internal storage area of the phenotypic IoT device ;
[0145] Determine the base address of the internal storage area of the phenotypic IoT device for storing the application area ;
[0146] Index data in the internal storage area of the phenotypic IoT device for new applications The amount of space associated with the storage block Multiply to obtain a multiplication result, and add the multiplication result to the base address Add together to get the startup address of the new application .
[0147] In some embodiments, the download writing unit is further configured to:
[0148] Erasing the flash memory area corresponding to the firmware data package to be upgraded;
[0149] Downloading the firmware data package to be upgraded in sub-packages according to the preset sub-package space amount;
[0150] Each time a sub-data package is downloaded, the downloaded sub-data package is placed in the flash memory area;
[0151] Compare the sub-data package put into the flash memory area with the downloaded sub-data package to obtain a comparison result;
[0152] In response to the comparison result being successful, it is determined that the sub-data package placed in the flash memory area is correct, and the next sub-data package of the firmware package to be upgraded is continuously downloaded until all sub-data packages in the firmware package to be upgraded are downloaded completely; or
[0153] In response to the comparison result being a comparison failure, the upgrade process of the firmware data packet to be upgraded is terminated, and the upgrade process is restarted. After the restart, the firmware data packet to be upgraded sent by the Internet of Things cloud platform is received again, and the process returns to the step of downloading the sub-packets according to the preset sub-packet space until all sub-packets in the firmware data packet to be upgraded are downloaded.
[0154] For the convenience of description, the above device is described in terms of functions divided into various modules. Of course, when implementing the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0155] The device of the above embodiment is used to implement the corresponding method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.
[0156] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in any of the above embodiments when executing the program.
[0157] Figure 6 A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and the device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other through the bus 1050 in the device.
[0158] The processor 1010 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0159] The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 1020 and are called and executed by the processor 1010.
[0160] The input / output interface 1030 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0161] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0162] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010 , the memory 1020 , the input / output interface 1030 , and the communication interface 1040 ).
[0163] It should be noted that, although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040 and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.
[0164] The electronic device of the above embodiment is used to implement the corresponding method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.
[0165] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the method described in any of the above embodiments.
[0166] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0167] The computer instructions stored in the storage medium of the above embodiments are used to enable the computer to execute the method described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0168] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a computer program product, including computer program instructions. When the computer program instructions are run on a computer, the computer executes the method described in any of the above embodiments, which has the beneficial effects of the corresponding method embodiments and will not be repeated here.
[0169] It is understandable that before using the technical solutions of each embodiment of the present application, the type, scope of use, usage scenarios, etc. of the personal information involved will be informed to the user in an appropriate manner, and the user's authorization will be obtained.
[0170] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly remind the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can independently choose whether to provide personal information to the electronic device, application, IoT cloud platform, storage medium or other software or hardware that performs the operation of the technical solution of the present application according to the prompt message.
[0171] As an optional but non-limiting implementation, in response to receiving the user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0172] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation method of this application. Other methods that meet relevant laws and regulations may also be applied to the implementation method of this application.
[0173] A person skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application (including the claims) is limited to these examples. In line with the concept of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.
[0174] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present application difficult to understand, the known power / ground connections to the integrated circuit (IC) chip and other components may or may not be shown in the provided drawings. In addition, the device may be shown in the form of a block diagram to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present application are to be implemented (that is, these details should be fully within the scope of understanding of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present application, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details or with changes in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0175] Although the present application has been described in conjunction with specific embodiments of the present application, many alternatives, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the discussed embodiments.
[0176] The embodiments of the present application are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of the present application.
Claims
1. A method for upgrading a phenotypic Internet of Things program, characterized in that: The phenotypic IoT program is applied to the phenotypic IoT device, wherein the phenotypic IoT program includes: a boot program and a plurality of application programs; The method comprises: After the phenotypic IoT device is powered on, a boot program is run, a boot address of a target application to be run is read from a parameter storage area using the boot program, the target application is called through the boot address, and the target application is run, wherein the target application belongs to any one of a plurality of applications; During the operation of the target application, a firmware data packet to be upgraded of the phenotype IoT program sent by the IoT cloud platform is received, wherein one firmware data packet to be upgraded corresponds to one new application; In response to the firmware data packet to be upgraded meeting the upgrade rule, determining index data of the new application in the internal storage area of the phenotypic IoT device; Determine a startup address of the new application based on the index data of the new application; Download the firmware data package to be upgraded, and write the firmware data package to be upgraded into the corresponding startup address; Add the startup address of the new application to the application address index variable in the parameter storage area, confirm that the initial upgrade of the phenotypic IoT program is completed, and restart; Send the authentication information of the new application after restart to the IoT cloud platform, so that the IoT cloud platform can judge the authentication information, determine whether the authentication information matches the firmware data packet to be upgraded of the sent phenotype IoT program, and after determining the match, the phenotype IoT program is successfully upgraded; The step of determining index data of the new application in the internal storage area of the phenotypic IoT device includes: Determine initial index data of the target application running in the phenotypic IoT device in the internal storage area of the phenotypic IoT device , the specific formula is: ,in, is the actual startup address of the target application running in the phenotype IoT device, The base address of the application area in the internal storage area of the Table IoT device. The amount of space of the storage blocks corresponding to each application divided in the internal storage area of the phenotypic IoT device; Based on the initial index data , determine the index data of the new application in the internal storage area of the phenotypic IoT device , the specific formula is: in, is the version number of the current phenotype IoT program, is the version number of the firmware data package to be upgraded, and N is the number of storage blocks in the internal storage area of the phenotypic IoT device that are used to store application programs.
2. The method according to claim 1, characterized in that The step of responding that the firmware data packet to be upgraded complies with an upgrade rule comprises: Obtaining a first device name and a first product key value in the firmware data packet to be upgraded; comparing the first device name with a second device name of a phenotypic IoT device; comparing the first product key value with a second product key value of the phenotypic IoT device; Determine that the first device name matches the second device name, and the first device name matches the second device name, and obtain the version number in the firmware data packet to be upgraded; Determine whether the version number in the firmware data package to be upgraded satisfies the upgrade rule.
3. The method according to claim 2, characterized in that Determining that the version number in the firmware data packet to be upgraded meets the upgrade rule includes: Obtaining first digital information of the last predetermined number of digits in the version number of the firmware data packet to be upgraded, and determining the parity of the first digital information; Obtain second digital information of the last predetermined digit in the version number of the current phenotypic IoT program, and determine the parity of the second digital information; In response to the parity of the first digital information being different from the parity of the second digital information, it is determined that an upgrade rule is satisfied.
4. The method according to claim 1, characterized in that: The step of determining the startup address of the new application based on the index data of the new application includes: Determine the amount of space in the memory block corresponding to each application divided in the internal storage area of the phenotypic IoT device ; Determine the base address of the internal storage area of the phenotypic IoT device for storing the application area ; Index data in the internal storage area of the phenotypic IoT device for new applications The amount of space associated with the storage block Multiply to obtain a multiplication result, and add the multiplication result to the base address Add together to get the startup address of the new application .
5. The method according to claim 1, characterized in that The downloading of the firmware data package to be upgraded includes: Erasing the flash memory area corresponding to the firmware data package to be upgraded; Downloading the firmware data package to be upgraded in sub-packages according to the preset sub-package space amount; Each time a sub-data packet is downloaded, the downloaded sub-data packet is placed in the flash memory area; Compare the sub-data package put into the flash memory area with the downloaded sub-data package to obtain a comparison result; In response to the comparison result being successful, it is determined that the sub-data package placed in the flash memory area is correct, and the next sub-data package of the firmware package to be upgraded is continuously downloaded until all sub-data packages in the firmware package to be upgraded are downloaded completely; or In response to the comparison result being a comparison failure, the upgrade process of the firmware data packet to be upgraded is terminated, and the upgrade process is restarted. After the restart, the firmware data packet to be upgraded sent by the Internet of Things cloud platform is received again, and the process returns to the step of downloading the sub-packets according to the preset sub-packet space until all sub-packets in the firmware data packet to be upgraded are downloaded.
6. A phenotypic Internet of Things program upgrade device, characterized in that: Set in a phenotypic IoT device, wherein the phenotypic IoT program includes: a boot program and a plurality of application programs; The device comprises: A running module is configured to run a boot program after the phenotypic IoT device is powered on, use the boot program to read a startup address of a target application to be run from a parameter storage area, call the target application through the startup address, and run the target application, wherein the target application belongs to any one of a plurality of applications; The receiving module is configured to receive a firmware data packet to be upgraded of the phenotype IoT program sent by the IoT cloud platform during the operation of the target application, wherein one firmware data packet to be upgraded corresponds to one new application; a writing module configured to, in response to the firmware data packet to be upgraded complying with the upgrade rule, determine the startup address of the new application corresponding to the firmware data packet to be upgraded, download the firmware data packet to be upgraded, and write the firmware data packet to be upgraded into the startup address of the corresponding new application; The upgrade module is configured to add the startup address of the new application to the application address index variable in the parameter storage area, determine that the initial upgrade of the phenotypic IoT program is complete, and restart; An authentication information sending module is configured to send the authentication information of the new application after restart to the IoT cloud platform, so that the IoT cloud platform can judge the authentication information, determine whether the authentication information matches the firmware data packet to be upgraded of the sent phenotype IoT program, and determine that the phenotype IoT program is successfully upgraded after the match is determined; The writing module includes a download writing unit configured as follows: Determine the index data of the new application in the internal storage area of the phenotypic IoT device; Determine a startup address of the new application based on the index data of the new application; Download the firmware data package to be upgraded, and write the firmware data package to be upgraded into the corresponding startup address; Download the write unit, which is specifically configured as follows: Determine initial index data of the target application running in the phenotypic IoT device in the internal storage area of the phenotypic IoT device , the specific formula is: ,in, is the actual startup address of the target application running in the phenotype IoT device, The base address of the application area in the internal storage area of the Table IoT device. The amount of space of the storage blocks corresponding to each application divided in the internal storage area of the phenotypic IoT device; Based on the initial index data , determine the index data of the new application in the internal storage area of the phenotypic IoT device , the specific formula is: in, is the version number of the current phenotype IoT program, is the version number of the firmware data package to be upgraded, and N is the number of storage blocks in the internal storage area of the phenotypic IoT device that are used to store application programs.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 5 is implemented.
8. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Remote firmware upgrading method for Internet-of-Things terminal equipment with master-slave machine structure
CN112910714A
Program upgrading method based on ZYNQ redundant backup
CN114924778A