Method, device, equipment and medium for switching embedded software upgrade mode
By receiving and burning all upgrade data and switching the usage method of memory partitions in embedded devices, the problem of not being able to switch to differential upgrades in the existing technology is solved, and the smooth upgrade of embedded software and optimization of memory partition space is achieved. .
Patent Information
- Application Number
- CN202111408662.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-24
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2041-11-24
Smart Images

Figure CN114253574B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a switching method, device, equipment and medium for an embedded software upgrade mode. Background Art
[0002] Embedded software refers to the system software running on embedded devices, which is usually composed of a real-time operating system (RTOS), driver software, protocols and corresponding applications. Embedded software will be continuously upgraded during actual application to fix vulnerabilities (English: bugs) in the software, improve and enhance the software's functions, and provide better services to users.
[0003] At present, there are two ways to upgrade embedded software: full upgrade and differential upgrade. For full upgrade, the embedded device needs to download the new version of the embedded software and burn the new version of the embedded software into the space reserved in advance for version upgrade in the storage partition (such as FLASH partition). However, with the continuous increase of functions in embedded software, the space required for the new version of embedded software is gradually increasing, and the reserved space cannot guarantee that it can meet the upgrade requirements of the embedded software. For differential upgrade, the embedded device needs to download the differential upgrade package for differential upgrade, and upgrade the existing version of the embedded software according to the differential upgrade package and the existing version of the embedded software. Since the size of the differential upgrade package is usually 5% of the size of the existing version of the embedded software, the embedded device only needs to reserve a small space to meet the upgrade requirements of the embedded software. Therefore, existing embedded devices usually use differential upgrade to upgrade embedded software.
[0004] However, since the production method used for early-production embedded devices is usually full upgrade, it cannot guarantee that the upgrade requirements of embedded software can be met. Therefore, how to switch the full upgrade method to the differential upgrade method to ensure the smooth upgrade of embedded software is an urgent problem to be solved. Summary of the invention
[0005] In order to solve the above-mentioned problems in the prior art, that is, to solve the problem that the existing embedded devices cannot switch the full upgrade mode to the differential upgrade mode, the embodiments of the present application provide a method, device, equipment and medium for switching the embedded software upgrade mode.
[0006] In a first aspect, an embodiment of the present application provides a method for switching an embedded software upgrade mode, comprising:
[0007] Receiving full upgrade data sent by the server, the full upgrade data including a full upgrade package and a firmware over the air upgrade FOTA application, the FOTA application being used to differentially upgrade the embedded software according to the differential upgrade package;
[0008] The storage partition includes a current version partition and a partition to be burned, and the full upgrade package and the FOTA application are burned to the partition to be burned;
[0009] If the partition to be burned is located in the first space of the storage partition and the current version partition is located in the second space of the storage partition, after obtaining the differential upgrade package, the differential upgrade package is stored in the second space;
[0010] If the partition to be burned is located in the second space of the storage partition and the current version partition is located in the first space of the storage partition, then after the download of the full upgrade package is completed, the full upgrade package is moved from the second space to the first space to overwrite the data of the current version partition, and the data in the partition to be burned is deleted for the storage of the differential upgrade package.
[0011] In the preferred technical solution of the above-mentioned switching method of the embedded software upgrade mode, the second space of the storage partition also includes a system judgment bit, and the method further includes:
[0012] receiving the differential upgrade package sent by the server, and storing the differential upgrade package in the second space of the storage partition;
[0013] The status of all preset bytes in the system judgment bit is obtained through the FOTA application, and the embedded software is differentially upgraded according to the status and the differential upgrade package, wherein the status includes set and unset.
[0014] Optionally, the system judgment bit includes a preset first byte, and after the differential upgrade package is stored in the partition to be burned, the method further includes:
[0015] The preset first byte is set.
[0016] Optionally, the system judgment bit further includes a preset second byte, and the obtaining of the status of all preset bytes in the system judgment bit through the FOTA application, and performing a differential upgrade on the embedded software according to the status and the differential upgrade package, includes:
[0017] Acquire, through the FOTA application, a state of the preset first byte of the system judgment bit;
[0018] When the state of the preset first byte is set and the state of the preset second byte is not set, differentially upgrading the embedded software using a differential upgrade package;
[0019] After the embedded software is successfully upgraded, the preset second byte is set.
[0020] Optionally, the system determination bit further includes a preset third byte, and after setting the preset second byte, the method further includes:
[0021] Acquire the status of the preset third byte through the FOTA application;
[0022] When the state is set, an upgrade result is sent to the server through the FOTA application, and the upgrade result is that the upgrade is successful.
[0023] Optionally, after the embedded software differential upgrade is interrupted, the method further includes:
[0024] Obtaining, through the FOTA application, an interruption position where the differential upgrade is interrupted;
[0025] The embedded software continues to be differentially upgraded according to the interruption position and the differential upgrade package.
[0026] In a second aspect, an embodiment of the present application provides a switching device for an embedded software upgrade mode, comprising:
[0027] A receiving module, used to receive full upgrade data sent by a server, wherein the full upgrade data includes a full upgrade package and a firmware over the air upgrade FOTA application, wherein the FOTA application is used to differentially upgrade the embedded software according to the differential upgrade package;
[0028] The burning module, the storage partition includes the current version partition and the partition to be burned, is used to burn the full upgrade package and the FOTA application to the partition to be burned
[0029] a processing module, configured to store the differential upgrade package in the second space after acquiring the differential upgrade package if the partition to be burned is located in the first space of the storage partition and the current version partition is located in the second space of the storage partition;
[0030] The processing module is also used to move the full upgrade package from the second space to the first space after the full upgrade package is downloaded if the partition to be burned is located in the second space of the storage partition and the current version partition is located in the first space of the storage partition, so as to overwrite the data of the current version partition and delete the data in the partition to be burned for storage of the differential upgrade package.
[0031] In the preferred technical solution of the switching device of the above embedded software upgrade mode, the second space of the storage partition also includes a system judgment bit, and the receiving module is further used to receive the differential upgrade package sent by the server and store the differential upgrade package in the second space of the storage partition;
[0032] The processing module is also used to obtain the status of all preset bytes in the system judgment bit through the FOTA application, and differentially upgrade the embedded software according to the status and the differential upgrade package, and the status includes set and unset.
[0033] Optionally, the system judgment bit includes a preset first byte, and after the differential upgrade package is stored in the partition to be burned, the processing module is further used to:
[0034] The preset first byte is set.
[0035] Optionally, the system determination bit further includes a preset second byte, and the processing module is specifically configured to:
[0036] Acquire, through the FOTA application, a state of the preset first byte of the system judgment bit;
[0037] When the state of the preset first byte is set and the state of the preset second byte is not set, differentially upgrading the embedded software using a differential upgrade package;
[0038] After the embedded software is successfully upgraded, the preset second byte is set.
[0039] Optionally, the system determination bit further includes a preset third byte, and after the preset second byte is set, the device further includes:
[0040] An acquisition module, used for acquiring the state of the preset third byte through the FOTA application;
[0041] A sending module is used to send an upgrade result to the server through the FOTA application when the state is set, and the upgrade result is a successful upgrade.
[0042] Optionally, after the embedded software differential upgrade is interrupted, the processing module is further used to:
[0043] Obtaining, through the FOTA application, an interruption position where the differential upgrade is interrupted;
[0044] The embedded software continues to be differentially upgraded according to the interruption position and the differential upgrade package.
[0045] In a third aspect, an embodiment of the present application provides an embedded device, comprising: a processor, a transceiver, a memory, and computer program instructions stored in the memory and executable on the processor, wherein the processor is used to implement the first aspect and the methods provided by various possible designs when executing the computer program instructions.
[0046] In a fourth aspect, an embodiment of the present application may provide a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect and the methods provided by various possible designs.
[0047] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, is used to implement the first aspect and the methods provided by various possible designs.
[0048] It can be understood by those skilled in the art that the switching method, device, equipment and medium of the embedded software upgrade mode provided in the embodiment of the present application include: by receiving the full upgrade data sent by the server, the full upgrade package and the FOTA application are burned to the partition to be burned, if the partition to be burned is located in the first space of the storage partition and the current version partition is located in the second space of the storage partition, then after obtaining the differential upgrade package, the differential upgrade package is stored in the second space; if the partition to be burned is located in the second space of the storage partition and the current version partition is located in the first space of the storage partition, then after the full upgrade package is downloaded, the full upgrade package is moved from the second space to the first space to achieve data coverage of the current version partition, and the data in the partition to be burned is deleted for storage of the differential upgrade package. By moving the full upgrade package and the FOTA application from the second space to the first space, the embedded software upgrade mode is switched from the full upgrade to the differential upgrade without increasing the storage partition space and returning to the factory, providing more available storage partition space for embedded devices, and ensuring the smooth upgrade of embedded software. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The preferred implementation of the method for switching the embedded software upgrade mode of the present application is described below with reference to the accompanying drawings and in combination with an embedded device. The accompanying drawings are:
[0050] Figure 1A A structural diagram of a first embodiment of a storage partition for full upgrade provided by the prior art;
[0051] Figure 1B A schematic diagram of the structure of a second storage partition embodiment for full upgrade provided by the prior art;
[0052] Figure 2 A structural diagram of a storage partition embodiment 1 for differential upgrade provided by the prior art;
[0053] Figure 3 A flowchart of a first embodiment of a method for switching an embedded software upgrade mode provided in an embodiment of the present application;
[0054] Figure 4 A schematic diagram of the structure of a first storage partition embodiment provided in an embodiment of the present application;
[0055] Figure 5 A flow chart of a second embodiment of a method for switching an embedded software upgrade mode provided in an embodiment of the present application;
[0056] Figure 6 A schematic diagram of the structure of the system judgment bit provided in the embodiment of the present application;
[0057] Figure 7 A schematic diagram of the structure of a switching device for an embedded software upgrade method provided in an embodiment of the present application;
[0058] Figure 8 A schematic diagram of the structure of an embedded device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] First, those skilled in the art should understand that these implementations are only used to explain the technical principles of the present application and are not intended to limit the scope of protection of the present application. Those skilled in the art can make adjustments to them as needed to adapt to specific application scenarios.
[0060] Secondly, it should be noted that in the description of the embodiments of the present application, terms such as "inside" and "outside" indicating directions or positional relationships are based on the directions or positional relationships shown in the accompanying drawings. This is only for the convenience of description and does not indicate or imply that the device or component must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it cannot be understood as a limitation on the present application.
[0061] In addition, it should be noted that in the description of the embodiments of the present application, unless otherwise clearly specified and limited, the terms "connected" and "connection" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the embodiments of the present application can be understood according to the specific circumstances.
[0062] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0063] Before introducing the embodiments of the present application, the application background of the embodiments of the present application is first explained:
[0064] As the degree of intelligence of home appliances gradually increases, embedded software is usually installed in embedded devices such as air conditioners, refrigerators, and washing machines, so that users can control embedded devices through embedded software, thereby realizing functions such as hardware initialization and networking and cloud access. Embedded software can generally run directly on the storage partition. For a small part that cannot run directly on the storage partition, the embedded software can be copied from FLASH to random access memory (RAM) after the system is started and run.
[0065] Embedded software needs to be continuously upgraded in the actual application process to fix the bugs in the software, improve and enhance the various functions of the software, and provide better services to users. At present, there are two main ways to upgrade a large number of existing embedded software: full upgrade and differential upgrade. The following will explain these two methods in detail.
[0066] 1), Figure 1A This is a schematic diagram of the structure of the first embodiment of the storage partition for full upgrade provided by the prior art. Figure 1AAs shown, the storage partition is divided into a first space of the storage partition and a second space of the storage partition, wherein the first space of the storage partition stores the embedded software of version A, and the second space of the storage partition is a reserved upgrade version area, which is used to store the new version of the embedded software when the embedded software needs to be upgraded. The size of the first space and the second space of the storage partition are the same. For example, if the first space of the storage partition where the embedded software of version A is located is 900KB, the size of the second space of the storage partition is also 900KB.
[0067] exist Figure 1A For full upgrade, the system of the embedded device will have an independent system boot area (English: Bootloader area) when it leaves the factory. The program code in the system boot area is usually used to do some necessary hardware initialization, verify whether the embedded software on the storage partition is valid and complete and not damaged, and further check whether the version information of the embedded software is valid. If the embedded software is complete and the version information is valid, it jumps to the first space of the storage partition, starts normal system initialization, enters the normal task cycle, and starts running the normal business function code of the embedded software.
[0068] Furthermore, after the embedded device leaves the factory, if the embedded software needs to be upgraded, the embedded device will start the Over-the-Air Technology (OTA) process, download the full code in batches, and then burn the full code into the reserved storage partition. Figure 1B This is a schematic diagram of the structure of the second storage partition embodiment of the full upgrade provided by the prior art. Figure 1B As shown in the figure, the embedded software of version B is an upgraded version of the embedded software of version A. After the burning is completed, the system of the embedded device will restart, and the Bootloader area will select the latest version of the embedded software with intact integrity to start. Figure 1B As shown, when the embedded software of version B is intact, the system will enter the partition where version B is located (that is, the second space of the storage partition) to start the embedded software of version B.
[0069] That is to say, when the embedded software is fully upgraded, it is not necessary to know the content of the old version of the embedded software. The new version can be downloaded directly. The old version of the embedded software is still retained in the storage partition, and the system startup code determines which version to start.
[0070] However, since nearly half of the space in the storage partition needs to be reserved for burning the new version of the embedded software, and as the functions in the embedded software become more and more complex, the code size also increases accordingly, reserving half of the space for upgrading the software can no longer meet the needs of software OTA upgrades. Furthermore, it takes a long time to download the new version of the embedded software, which is prone to errors and may cause upgrade errors.
[0071] 2), Figure 2 This is a schematic diagram of the structure of a storage partition embodiment 1 of differential upgrade provided by the prior art. Figure 2 As shown, the FLASH partition is divided into the first space of FLASH and the second space of FLASH, wherein the first space of FLASH stores the embedded software of version A, and the second space of FLASH includes the differential upgrade work area and the differential upgrade package area. Among them, since the size of the differential upgrade package is usually 5% of the size of the existing version of the embedded software, the size of the differential upgrade package area is only 5% of the first space of FLASH. Taking the size of the first space of FLASH as 900KB as an example, the size of the differential upgrade package area is 60KB, and the differential upgrade work area has nothing to do with the size of the embedded software, which can be 3 FLASH blocks, and the size of each FLASH block is 4KB, that is, the size of the differential upgrade work area is 12KB, and only 72KB of the second space needs to be reserved to upgrade the embedded software to the new version (that is, version B). Compared with the 900KB second space that needs to be reserved for the full upgrade, the available space is greatly improved.
[0072] However, since it has been confirmed to use full upgrade or differential upgrade when the embedded device product is released, and early embedded devices usually use full upgrade, there is no existing technology that can switch the full upgrade mode of the embedded devices that have been shipped to the differential upgrade mode, and the smooth upgrade of the embedded software cannot be guaranteed.
[0073] In view of the above problems, the application concept of the present application is as follows: Since there is no program code for generating a new version of embedded software according to the differential upgrade package and the current version of embedded software in the embedded device using the full upgrade, the embedded device cannot use the differential upgrade package for differential upgrade. Based on this, the applicant found that when the embedded software is fully upgraded, when downloading and burning the new version of the embedded software, it is also necessary to download and burn the firmware over-the-air (Firmware Over-The-Air, FOTA) application for differentially upgrading the embedded software according to the differential upgrade package. After that, when the embedded software is upgraded, the differential upgrade package can be downloaded according to the current version of the embedded software, and the FOTA application can be used to perform differential upgrades on the embedded software according to the differential upgrade package, which can solve the problem that the full upgrade mode cannot be switched to the differential upgrade mode in the prior art, thereby ensuring the smooth upgrade of the embedded software.
[0074] The technical solution of the present application is described in detail below through specific embodiments.
[0075] It should be noted that the following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0076] Figure 3 The flowchart of the switching method of the embedded software upgrade mode provided in the embodiment of the present application is shown in FIG. Figure 3 As shown, the method for switching the embedded software upgrade mode may include the following steps:
[0077] S31: receiving the full upgrade data sent by the server.
[0078] It should be understood that after the server sends the full upgrade data to the embedded device, the embedded device needs to accept the full upgrade data so as to subsequently upgrade the embedded software according to the full upgrade data.
[0079] Among them, the full upgrade data includes the full upgrade package and the FOTA application, and the FOTA application is used to perform differential upgrades on the embedded software according to the differential upgrade package.
[0080] Among them, the FOTA application can be an application existing in the prior art, which has the function of differentially upgrading the embedded software according to the differential upgrade package, or it can be an application generated by the user compiling the program code. The embodiment of the present application does not impose specific restrictions on this.
[0081] S32: Burn the full upgrade package and FOTA application to the partition to be burned.
[0082] The storage partition includes the current version partition and the partition to be burned. After receiving the full upgrade data, the embedded device needs to burn the full upgrade package and FOTA application in the full upgrade data to the stored partition to be burned, so that the new version of the embedded software can be run later.
[0083] In a specific implementation, when the embedded software has never been upgraded, only one version of the embedded software is burned in the storage partition, the partition where the embedded software is located is the current version partition, and the partition to be burned has no data stored and is empty.
[0084] Exemplarily, when the embedded software has not been upgraded before, assuming that the partition to be burned is located in the second space of the storage partition, and the current version partition is located in the first space of the storage partition, after receiving the full upgrade data, the embedded device burns the full upgrade package and FOTA application in the full upgrade data to the second storage space.
[0085] Figure 4 This is a schematic diagram of the structure of the first storage partition embodiment provided in the present application. Figure 4 As shown, the first space of the storage partition stores the embedded software with version A, which is the current version partition, and the second space of the storage partition is the partition to be burned. When the embedded device burns the full upgrade package and the FOTA application to the partition to be burned, the second space of the storage partition stores the new version of the full upgrade package ( Figure 4 Version B) of the embedded software and FOTA application.
[0086] In another specific implementation, when the embedded software has been fully upgraded, two versions of the embedded software are burned in the storage partitions respectively, the partition to be burned stores the older version of the embedded software, and the current version partition stores the newer version of the embedded software.
[0087] It should be understood that in this implementation, the partition to be burned may exist in the first space of the storage partition, or may exist in the second space of the storage partition.
[0088] Exemplarily, the embedded software was previously upgraded, and the partition to be burned stores an older version of the embedded software, and the current version partition stores a newer version of the embedded software. Assuming that version A is the old version and version B is the new version, the partition where version A is located is the partition to be burned, and the partition where version B is located is the current version partition.
[0089] In this exemplary embodiment, the embedded device burns the full upgrade package and the FOTA application program into the partition to be burned.
[0090] It should be understood that the first space may be the front space of the storage partition, and the second space may be the rear space of the storage partition.
[0091] S33: If the partition to be burned is located in the first space of the storage partition and the current version partition is located in the second space of the storage partition, after obtaining the differential upgrade package, the differential upgrade package is stored in the second space.
[0092] Exemplarily, after the full upgrade package and FOTA application are burned to the partition to be burned, assuming that the storage partition now has two versions of embedded software, version C and version D, version C is the new version (that is, the version corresponding to the full upgrade package), located in the first space, and version D is the old version relative to version C (that is, the current version mentioned above). After obtaining the differential upgrade package, the differential upgrade package is stored in the second space, overwriting the previous data.
[0093] S34: If the partition to be burned is located in the second space of the storage partition and the current version partition is located in the first space of the storage partition, then after the full upgrade package is downloaded, the full upgrade package is moved from the second space to the first space to overwrite the data of the current version partition, and the data in the partition to be burned is deleted for the storage of the differential upgrade package.
[0094] It should be understood that since the FOTA application needs to be in the first storage space when the embedded software is differentially upgraded, when the FOTA application is in the second storage space, the new version of the embedded software and the FOTA application need to be moved to the first storage space to facilitate the subsequent reception of the differential upgrade package and differential upgrade of the embedded software according to the differential upgrade package.
[0095] In a specific implementation, the embedded device obtains the version information of the embedded software in the storage partition through the Boatloader area, and starts the new version of the embedded software and FOTA application (that is, starts the embedded software and FOTA application burned in the partition to be burned). After that, the embedded device determines whether the FOTA application is in the first space of storage through the FOTA application. When the FOTA application is in the second space of storage and the current version partition is located in the second space of the storage partition, the new version of the embedded software and the FOTA application are moved to the first space of the storage partition, overwriting the content in the first space of the storage partition, realizing the data coverage of the current version partition, and deleting the data in the partition to be burned for subsequent differential upgrade package storage. After the embedded device completes the processing of the new version of the embedded software and the FOTA application, it restarts the new version of the embedded software and enters the normal task cycle. At this time, FLASH already has the function of differentially upgrading the embedded software.
[0096] The switching method of the embedded software upgrade mode provided in the embodiment of the present application, by receiving the full upgrade data sent by the server, the full upgrade package and the FOTA application are burned to the partition to be burned, if the partition to be burned is located in the first space of the storage partition and the current version partition is located in the second space of the storage partition, then after obtaining the differential upgrade package, the differential upgrade package is stored in the second space; if the partition to be burned is located in the second space of the storage partition and the current version partition is located in the first space of the storage partition, then after the full upgrade package is downloaded, the full upgrade package is moved from the second space to the first space to achieve data coverage of the current version partition, and the data in the partition to be burned is deleted for storage of the differential upgrade package. By moving the full upgrade package and the FOTA application from the second space to the first space, the embedded software upgrade mode is switched from full upgrade to differential upgrade without increasing the storage partition space and returning to the factory, providing more available storage partition space for embedded devices, and ensuring the smooth upgrade of embedded software.
[0097] Optionally, in some embodiments, the method for switching the embedded software upgrade mode further includes the following steps: sending a full upgrade request to the server.
[0098] When the embedded device has an upgrade requirement, the embedded device can send a full upgrade request to the server so that the server generates a full upgrade package according to the full upgrade request, wherein the full upgrade request includes the current version of the embedded software.
[0099] In a possible implementation, the embedded device can be connected to the server for communication. When a new version of the embedded software is released, the server sends the new version information of the embedded software to the embedded device. When the embedded device receives the new version information of the embedded software, the new version information of the embedded device can be displayed on the touch screen of the embedded device. When the user needs to upgrade the embedded software, the user clicks the corresponding control on the touch screen. In response to the user's click operation on the touch screen, the embedded device generates a full upgrade request and sends the full upgrade request to the server.
[0100] In another possible implementation, the user's terminal device can be respectively connected to the embedded device and the server for communication, and the terminal device can control the embedded device through the corresponding application program, and can also obtain the version information of the embedded software in the corresponding embedded device through the application program. When a new version of the embedded software is released, the server sends the new version information of the embedded software to the user's terminal device, and the terminal device displays the new version information of the embedded software through the application program. When the user needs to upgrade the embedded software, the corresponding control in the application program can be clicked. In response to the user's click operation on the application program, the terminal device generates a full upgrade request and sends the full upgrade request to the embedded device. The embedded device receives the full upgrade request sent by the user's terminal device and sends the full upgrade request to the server.
[0101] In another possible implementation, when a new version of the embedded software is released, the server sends the new version information of the embedded software to the embedded device. When the embedded device receives the new version information of the embedded software, it compares it with the current version information. When the new version information is inconsistent with the current version information, a full upgrade request is generated and sent to the server.
[0102] Correspondingly, the server receives the full upgrade request sent by the embedded device, generates full upgrade data according to the full upgrade request, and sends the full upgrade data to the embedded device.
[0103] Based on any of the above embodiments, Figure 5 The flowchart of the second embodiment of the switching method of the embedded software upgrade mode provided in the embodiment of the present application is as follows. Figure 5 As shown, the second space of the storage partition also includes a system judgment bit. After S34, the method for switching the embedded software upgrade mode may further include the following steps:
[0104] S51: receiving a differential upgrade package sent by a server, and storing the differential upgrade package in a second space of the storage partition.
[0105] In some embodiments, the differential upgrade working area of the second space of the storage partition includes a differential working storage block, and the differential working storage block includes a system determination bit.
[0106] S52: Obtain the status of all preset bytes in the system judgment bit through the FOTA application, and perform differential upgrade on the embedded software according to the status and the differential upgrade package.
[0107] The status includes set and not set.
[0108] In a specific implementation, the system judgment bit also includes a preset second byte, and the state of the preset first byte of the system judgment bit is obtained through the FOTA application; when the state of the preset first byte is set and the state of the preset second byte is not set, the embedded software is differentially upgraded using a differential upgrade package; after the embedded software is successfully upgraded, the preset second byte is set.
[0109] Based on the above implementation method, the system judgment bit also includes a preset third byte. Further, the embedded device obtains the status of the preset third byte through the FOTA application; when the status is set, the upgrade result is sent to the server through the FOTA application, wherein the upgrade result is a successful upgrade.
[0110] Figure 6 This is a schematic diagram of the structure of the system judgment bit provided in the embodiment of the present application. Figure 6 As shown, the system judgment bit includes a preset first byte, a preset second byte, a preset third byte, and a preset fourth byte, wherein the preset first byte is the first bit of the system judgment bit (that is, Bit0), which can be SYS_NEEDUPDATE, used to indicate whether the differential upgrade package has been downloaded. When the first bit is set, it indicates that the differential upgrade package is ready to upgrade the embedded software. Among them, the preset second byte is the second bit of the system judgment bit (that is, Bit1), which can be SYS_FOTADONE, used to indicate whether the embedded software has been successfully upgraded. After the embedded software is differentially upgraded successfully according to the differential upgrade package, the embedded device sets the second bit of the system judgment bit. The preset third byte is the third bit of the system judgment bit (that is, Bit2), which can be SYS_NEEDREPORT, used to indicate whether the upgrade result needs to be reported to the server. When the third bit of the system judgment bit is set, the embedded device sends the upgrade result to the server, and the upgrade result is a successful upgrade. The preset third byte is the fourth bit of the system judgment bit (that is, Bit3), which is a reserved bit and can be extended and used in actual applications later.
[0111] Under this implementation, further, if an unexpected situation such as power outage occurs during the upgrade process and the differential upgrade of the embedded software is interrupted, the embedded device obtains the interruption position where the differential upgrade is interrupted through the FOTA application; based on the interruption position and the differential upgrade package, the embedded software continues to be differentially upgraded, and the second position is set after the upgrade is completed.
[0112] Optionally, in some embodiments, before S51, the method for switching the embedded software upgrade mode may further include the following steps: using the FOTA application to send a differential upgrade request to the server.
[0113] It should be understood that, since the storage partition already has differential upgrade capability at this time, a differential upgrade request can be sent to the server so that the server generates a differential upgrade package according to the differential upgrade request.
[0114] The differential upgrade request includes the current version of the embedded software.
[0115] In a possible implementation, the embedded device can communicate with the server, and when a new version of the embedded software is released, the server sends the new version information of the embedded software to the embedded device. When the embedded device receives the new version information of the embedded software, the new version information of the embedded device can be displayed on the touch screen of the embedded device. When the user needs to upgrade the embedded software, the user clicks the corresponding control on the touch screen. In response to the user's click operation on the touch screen, the embedded device generates a differential upgrade request and sends the differential upgrade request to the server.
[0116] In another possible implementation, the user's terminal device can be respectively connected to the embedded device and the server for communication, and the terminal device can control the embedded device through the corresponding application program, and can also obtain the version information of the embedded software in the corresponding embedded device through the application program. When a new version of the embedded software is released, the server sends the new version information of the embedded software to the user's terminal device, and the terminal device displays the new version information of the embedded software through the application program. When the user needs to upgrade the embedded software, the user can click on the corresponding control in the application program. In response to the user's click operation on the touch screen, the terminal device generates a differential upgrade request and sends the differential upgrade request to the embedded device. The embedded device receives the differential upgrade request sent by the user's terminal device and sends the differential upgrade request to the server.
[0117] In another possible implementation, when a new version of the embedded software is released, the server sends the new version information of the embedded software to the embedded device. When the embedded device receives the new version information of the embedded software, it compares it with the current version information. When the new version information is inconsistent with the current version information, a differential upgrade request is generated and sent to the server.
[0118] Correspondingly, the server receives the differential upgrade request sent by the embedded device, generates a differential upgrade package according to the differential upgrade request, and sends the differential upgrade package to the embedded device.
[0119] In an embodiment of the present application, the status of all preset bytes in the system judgment bit is used to obtain the differential upgrade status, and the switch from full upgrade to differential upgrade is completed without the participation of upper-level software, thereby ensuring that various abnormal situations in the upgrade conversion process can be correctly handled.
[0120] The following are device embodiments of the present application, which can be used to execute the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
[0121] Figure 7 This is a schematic diagram of the structure of the switching device of the embedded software upgrade mode provided in the embodiment of the present application. Figure 7 As shown, the switching device of the embedded software upgrade mode includes:
[0122] A receiving module 71 is used to receive full upgrade data sent by a server, where the full upgrade data includes a full upgrade package and a firmware over the air upgrade FOTA application, where the FOTA application is used to perform a differential upgrade on the embedded software according to the differential upgrade package;
[0123] Burning module 72, storage partition includes current version partition and to-be-burned partition, used to burn the full upgrade package and FOTA application to the to-be-burned partition
[0124] The processing module 73 is used for storing the differential upgrade package in the second space after acquiring the differential upgrade package if the partition to be burned is located in the first space of the storage partition and the current version partition is located in the second space of the storage partition;
[0125] The processing module 73 is also used to move the full upgrade package from the second space to the first space after the download of the full upgrade package is completed, if the partition to be burned is located in the second space of the storage partition and the current version partition is located in the first space of the storage partition, so as to overwrite the data of the current version partition and delete the data in the partition to be burned for the storage of the differential upgrade package.
[0126] In a possible design of the embodiment of the present application, the second space of the storage partition also includes a system judgment bit, and the receiving module 71 is also used to receive the differential upgrade package sent by the server and store the differential upgrade package in the second space of the storage partition;
[0127] The processing module 73 is also used to obtain the status of all preset bytes in the system judgment bit through the FOTA application, and perform differential upgrade on the embedded software according to the status and the differential upgrade package, and the status includes set and unset.
[0128] Optionally, if the system judgment bit includes a preset first byte, after the differential upgrade package is stored in the partition to be burned, the processing module 73 is further used to:
[0129] Set the preset first byte.
[0130] Optionally, the system determination bit further includes a preset second byte, and the processing module 73 is specifically used to:
[0131] Obtain the status of the preset first byte of the system judgment bit through the FOTA application;
[0132] When the state of the preset first byte is set, and the state of the preset second byte is not set, differentially upgrading the embedded software using the differential upgrade package;
[0133] After the embedded software is successfully upgraded, the preset second byte is set.
[0134] Optionally, the system determination bit further includes a preset third byte, and after the preset second byte is set, the device further includes:
[0135] An acquisition module, used for acquiring the status of a preset third byte through a FOTA application;
[0136] The sending module is used to send the upgrade result to the server through the FOTA application when the state is set, and the upgrade result is successful upgrade.
[0137] Optionally, after the embedded software differential upgrade is interrupted, the processing module 73 is further used to:
[0138] Get the interruption position of the differential upgrade interruption through the FOTA application;
[0139] The embedded software is continuously differentially upgraded according to the interruption position and the differential upgrade package.
[0140] The switching device for embedded software upgrade mode provided in the embodiment of the present application can be used to execute the switching method for embedded software upgrade mode in any of the above embodiments. Its implementation principle and technical effect are similar and will not be repeated here.
[0141] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software calling through processing elements, and some modules can be implemented in the form of hardware. In addition, all or part of these modules can be integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.
[0142] Figure 8 This is a schematic diagram of the structure of the embedded device provided in the embodiment of the present application. Figure 8 As shown, the embedded device may include: a processor 81, a transceiver 82, a memory 83, and computer program instructions stored in the memory 83 and executable on the processor 81. When the processor 81 executes the computer program instructions, the method for switching the embedded software upgrade mode provided in any of the aforementioned embodiments is implemented.
[0143] Optionally, the above-mentioned components of the embedded device may be connected via a system bus.
[0144] The transceiver 82 is used to communicate with other computers, and the transceiver 82 constitutes a communication interface.
[0145] Optionally, in hardware implementation, the above Figure 7 In the embodiment shown: the receiving module 71 and the sending module correspond to the transceiver 82 in this embodiment. Figure 7 The processing module 73 in the illustrated embodiment corresponds to the processor 81 in this embodiment.
[0146] The memory 83 may be a separate storage unit or a storage unit integrated in a processor. The number of processors is one or more.
[0147] It should be understood that the processor 81 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the present application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor.
[0148] The system bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage.
[0149] All or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned memory (storage medium) includes: read-only memory (ROM), RAM, flash memory, hard disk, solid state drive, magnetic tape, floppy disk, optical disc and any combination thereof.
[0150] The embedded device provided in the embodiment of the present application can be used to execute the switching method of the embedded software upgrade mode provided in any of the above method embodiments. Its implementation principle and technical effects are similar and will not be repeated here.
[0151] An embodiment of the present application provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer, the computer executes the above-mentioned switching method of the embedded software upgrade mode.
[0152] The computer-readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory, electrically erasable programmable read-only memory, erasable programmable read-only memory, programmable read-only memory, read-only memory, magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0153] Optionally, a readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0154] An embodiment of the present application also provides a computer program product, which includes a computer program. The computer program is stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When the at least one processor executes the computer program, the above-mentioned switching method of the embedded software upgrade mode can be implemented.
[0155] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for switching an embedded software upgrade mode, characterized in that: include: Receiving full upgrade data sent by the server, the full upgrade data including a full upgrade package and a firmware over the air upgrade FOTA application, the FOTA application being used to differentially upgrade the embedded software according to the differential upgrade package; The storage partition includes a current version partition and a partition to be burned, and the full upgrade package and the FOTA application are burned to the partition to be burned; If the partition to be burned is located in the first space of the storage partition and the current version partition is located in the second space of the storage partition, after obtaining the differential upgrade package, the differential upgrade package is stored in the second space; If the partition to be burned is located in the second space of the storage partition and the current version partition is located in the first space of the storage partition, then after the download of the full upgrade package is completed, the full upgrade package is moved from the second space to the first space to overwrite the data of the current version partition, and the data in the partition to be burned is deleted for the storage of the differential upgrade package.
2. The method according to claim 1, characterized in that The second space of the storage partition also includes a system determination bit, and the method further includes: receiving the differential upgrade package sent by the server, and storing the differential upgrade package in the second space of the storage partition; The status of all preset bytes in the system judgment bit is obtained through the FOTA application, and the embedded software is differentially upgraded according to the status and the differential upgrade package, wherein the status includes set and unset.
3. The method according to claim 2, characterized in that The system judgment bit includes a preset first byte, then after storing the differential upgrade package in the partition to be burned, the method further includes: The preset first byte is set.
4. The method according to claim 3, characterized in that The system judgment bit also includes a preset second byte, and the state of all preset bytes in the system judgment bit is obtained through the FOTA application, and the embedded software is differentially upgraded according to the state and the differential upgrade package, including: Acquire, through the FOTA application, a state of the preset first byte of the system judgment bit; When the state of the preset first byte is set and the state of the preset second byte is not set, differentially upgrading the embedded software using a differential upgrade package; After the embedded software is successfully upgraded, the preset second byte is set.
5. The method according to claim 4, characterized in that The system determination bit also includes a preset third byte. After the preset second byte is set, the method further includes: Acquire the status of the preset third byte through the FOTA application; When the state is set, an upgrade result is sent to the server through the FOTA application, and the upgrade result is that the upgrade is successful.
6. The method according to claim 4 or 5, characterized in that: After the embedded software differential upgrade is interrupted, the method further includes: Obtaining, through the FOTA application, an interruption position where the differential upgrade is interrupted; The embedded software continues to be differentially upgraded according to the interruption position and the differential upgrade package.
7. A switching device for embedded software upgrade mode, characterized in that: include: A receiving module, used to receive full upgrade data sent by a server, wherein the full upgrade data includes a full upgrade package and a firmware over the air upgrade FOTA application, wherein the FOTA application is used to differentially upgrade the embedded software according to the differential upgrade package; The burning module, the storage partition includes the current version partition and the partition to be burned, is used to burn the full upgrade package and the FOTA application to the partition to be burned a processing module, configured to store the differential upgrade package in the second space after acquiring the differential upgrade package if the partition to be burned is located in the first space of the storage partition and the current version partition is located in the second space of the storage partition; The processing module is also used to move the full upgrade package from the second space to the first space after the full upgrade package is downloaded if the partition to be burned is located in the second space of the storage partition and the current version partition is located in the first space of the storage partition, so as to overwrite the data of the current version partition and delete the data in the partition to be burned for storage of the differential upgrade package.
8. An embedded device comprising: A processor, a transceiver, a memory, and computer program instructions stored in the memory and executable on the processor, wherein the processor is used to implement the switching method of the embedded software upgrade mode as described in any one of claims 1 to 6 when executing the computer program instructions.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method for switching the embedded software upgrade mode according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, it is used to implement the switching method of the embedded software upgrade mode as described in any one of claims 1 to 6.
Citation Information
Patent Citations
System upgrading method, system upgrading apparatus, and terminal
CN106406940A
Differential upgrading method, device and system
CN109672655A