BRIEF DESCRIPTION OF THE DRAWINGS
Preferred embodiments of the present invention are subsequently described by referring to the enclosing drawings, wherein:
FIG. 1 shows a configuration diagram of the bootloader.
FIG. 2 shows a flowchart for the network upgrading programming mechanism.
FIG. 3 shows a representation diagram of the BFC difference algorithm.
FIG. 4 shows a comparison diagram for various types of difference algorithms.
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
First of all, FIG. 1 shows a configuration diagram of the bootloader, which comprises of three layers: hardware initialization, driver for wireless devices, and decoding program of the difference algorithm.
In the bottom layer, the hardware initialization is used to, when the sensor is starting or resetting, initialize the status of the hardware such as SDRAM, clock, power management unit, etc. Because the wireless communication may be proceeded via UART, interfaces, such as USB or UART, etc., must also be initialized in order to equip with wireless communication capability.
The second layer is the driver for wireless devices, which will allow the bootloader to have the wireless communication capability. Since the bootloader is necessary to have the ability of transmitting or receiving packets, the second layer will be provided with a communication protocol.
The top layer of the bootloader is the decoding program of the difference algorithm, which is capable of decoding and reconstructing the script file coming from the server of the host end. In the host end, the server will compare the difference between the new and old image files and then encode the result into a script file, which will then be transmitted to each sensor end by means of the electromagnetic wave. When the sensor end receives the script file, it will employ the decoding program of the difference algorithm to recover the new image file and then store it in the flash memory. In the present invention, the bootloader can be used to download or execute different algorithm, and therefore provide the user with a variety of selections, accordingly.
FIG. 2 shows a flowchart for the network upgrading programming mechanism. Firstly, beginning with the host end, the flowchart starts with the first stage, namely the encoding stage, which at first compares the difference between the new and old versions' image files, and then generates a script file for the upgrading instruction. Then in the second stage, the transmission stage, the script file is sent from the host end to the sensor end via the wireless communication means. Next, in the third stage, decoding and recovering, when the sensor end receives the script file, the image file will be recovered in the memory by utilizing the decoding program of the difference algorithm, and then store it in the flash memory.
In the following, reference is made to FIG. 3 in order to describe the BFC (Binary File Comparison) difference algorithm.
If a new image file is about to be generated, the new and old versions' image files are compared firstly to precisely find out the difference between these two files. As shown in FIG. 3, because the identical block 1 of the old image file only changes its position in the new image file while the content does not change, therefore a “copy 1” instruction can be issued in the script file indicating that the identical block 1 in the old image file can be directly copied to the new image file. Similarly, it is only necessary to execute a “copy 2” instruction for the identical block 2 of the old image file. However, the situation for the identical block 3 is a little bit different. Because generally it is still the same with only a small part of the block is different, and it is adjacent to the identical block 2, therefore the “copy 2, 3” instruction can be executed first to copy the identical blocks 2 and 3 together to the new image file, while a “repair” instruction must be attached in order to subsequently modify the point of difference between the new and old versions (the black block shown in the figure). Finally, write the part that does not exist in the old image file into the new image file by using an “insert” instruction (not shown in the figure).
FIG. 4 shows a comparison diagram of different sizes of files generated by different algorithm. After comparing the result by using the above mentioned method, the present invention, except the part that is necessary to be upgraded, all other contents in the old image files that do not change or only have a minor modification can be easily accomplished by a set of simple instructions, which can further reduce the size of the to-be-transmitted script file to a minimum; and therefore the objective of fast transmission and reduction of the energy consumption can be achieved.
According to FIG. 4, the difference algorithm proposed in the present invention has the best compression efficiency. In [1] the makediff algorithm is used whereas the Rsync algorithm is adopted in [2]. Our BFC algorithm in the comparison of each data item has the highest compression rate in every respect and is therefore able to greatly reduce the time and energy consumption during the upgrading process.
Although the present invention is disclosed in the preferred embodiments described above, the inventive idea should not be limited only to those. The present invention can also be applied to digital television satellite broadcast, high-speed Ethernet network, high-speed wireless local area network, and wireless metropolitan network, etc. It will be understood by those skilled in the art that various other changes in the form and details may be made without departing from the spirit and scope of the present invention. It is to be understood that various changes may be made in adapting to different embodiments without departing from the broader concepts disclosed herein and comprehended by the claims that follow.
LIST OF REFERENCE NUMERALS
1 Bootloader
2 Decoding program of the difference algorithm
3 Driver for wireless devices
4 Hardware initialization