Summary of the invention
Fundamental purpose of the present invention is to provide a kind of method and apparatus of BOOT software guiding APP software, can be under situation less than engineering site, and the BOOT software of changing, upgrade, it can solve BOOT software can't the guiding APP software issue.
To achieve these goals, according to the first embodiment of the present invention, provide a kind of method of BOOT software guiding APP software.
This method may further comprise the steps: first step, handle and compression APP software; Second step, establishment BOOT ' software, wherein, BOOT ' software can decompress(ion) and guiding APP software; Third step is merged into the middleware software bag with APP software and BOOT ' software, and the middleware software bag pressure is contracted; The 4th step, BOOT software decompresses the middleware software bag, jumps to BOOT ' software and guides BOOT ' software; And the 5th step, BOOT ' software contracts the APP software decoding, and guiding APP software.
Wherein, in first step, when handling APP software, the start address skew desired value that APP software is videoed in internal memory, and the compression algorithm of using in the compression algorithm of using in this step and the third step is identical.
And BOOT ' software can be by the BOOT software of long-range veneer guiding operation.
In addition, in third step, in the middleware software bag that merges, the length after the compression of BOOT ' software, block of information data, padding data and be fixed value; Wherein, the block of information data comprise: the start address that length after the length before the compression of APP software, the compression of APP software and APP software are videoed in internal memory.
In addition, in the 5th step, BOOT ' software is reduced to buffer zone according to the block of information data with the APP software decoding, again the data of buffer zone are moved to the reflection of APP software in internal memory, then, BOOT ' software jumps to the start address of reflection, thereby finishes the guiding to APP software.
To achieve these goals, according to a second embodiment of the present invention, provide a kind of device of BOOT software guiding APP software.
This device comprises: the APP software processing module is used for handling and compression APP software; BOOT ' software programming module is used to work out BOOT ' software, and wherein, BOOT ' software can decompress(ion) and guiding APP software; Middleware software bag generation module is used for APP software and BOOT ' software are merged into the middleware software bag, and the middleware software bag pressure is contracted; A decompression module is used for the middleware software bag is decompressed; The secondary decompression module is used for the APP software decoding is contracted.
Wherein, after a decompression module decompressed the middleware software bag, BOOT software jumped to BOOT ' software and guides BOOT ' software.After the secondary decompression module contracts the APP software decoding, BOOT ' software guiding APP software.
Wherein, in the middleware software bag, the length after BOOT ' the software compression, block of information data, padding data and be fixed value; Wherein, the block of information data comprise: the start address that length after the length before the compression of APP software, the compression of APP software and APP software are videoed in internal memory.
By technique scheme, the present invention can realize the remote update of BOOT software and upgrading.
Embodiment
Describe the present invention below with reference to the accompanying drawings in detail.
First embodiment
At first the first embodiment of the present invention is described with reference to Fig. 1 to 4.
Fig. 1 is the process flow diagram according to the method for the BOOT software guiding APP software of first embodiment of the invention, Fig. 2 is the synoptic diagram that the reflection of the position of APP software in internal memory in the prior art is shown, Fig. 3 is that the method that illustrates according to first embodiment of the invention merges the back synoptic diagram that video in the position in internal memory with BOOT ' software and APP software, and Fig. 4 is the synoptic diagram that illustrates according to the position reflection in internal memory of APP in the method for first embodiment of the invention.
As shown in Figure 1, may further comprise the steps according to the method for the BOOT software guiding APP software of the first embodiment of the present invention: step S102, handle also compression APP software; Step S104, establishment BOOT ' software, wherein, BOOT ' software can decompress(ion) and guiding APP software; Step S106 merges into the middleware software bag with APP software and BOOT ' software, and the middleware software bag pressure is contracted; Step S108, BOOT software decompresses the middleware software bag, jumps to BOOT ' software and guides BOOT ' software; And step S110, BOOT ' software contracts the APP software decoding, and guiding APP software.
Wherein, in step S102, when handling APP software, the start address skew desired value that APP software is videoed in internal memory, and the compression algorithm of using among the compression algorithm of using in this step and the step S106 is identical.
And BOOT ' software can be by the BOOT software of long-range veneer guiding operation.
In addition, in step S106, in the middleware software bag that merges, the length after the compression of BOOT ' software, block of information data, padding data and be fixed value; Wherein, the block of information data comprise: the start address that length after the length before the compression of APP software, the compression of APP software and APP software are videoed in internal memory.
In addition, in step S110, BOOT ' software is reduced to buffer zone according to the block of information data with the APP software decoding, again the data of buffer zone are moved to the reflection of APP software in internal memory, then, BOOT ' software jumps to the start address of reflection, thereby finishes the guiding to APP software.
Further describe embodiments of the invention with reference to instantiation below.
The method step of this example is as follows:
(1) as shown in Figure 2, the position of A is that the BOOT software of network element master control borad in the prior art is moved internal memory 0x300000 to after with the APP software decoding and begun the place among the figure, APP software suitable value of start address skew of videoing in internal memory in this example, this value is the A ' among Fig. 4.In the prior art during APP running software at reflection in the internal memory shown in the A~B among Fig. 2, during this programme APP running software at reflection in the internal memory shown in A '~B ' of Fig. 4;
(2) compression APP software;
(3) the APP software that establishment BOOT ' software, this BOOT ' software can guide step (1) compiling behind the decompress(ion) to generate; And the use decompression algorithm corresponding with step 12, the APP software of energy decompress(ion) step (2) compression, wherein, this BOOT ' can be by the BOOT of long-range veneer guiding operation.BOOT ' is videoing shown in A~C of Fig. 3 in the internal memory.
(4) merge, compress, this step comprises following processing: the APP software of BOOT ' software and step (2) compression is merged into the middleware software bag, middleware software bag A~F as shown in Figure 4 after the merging, BOOT ' software size, block of information data, padding data three sum are fixed value, wherein the block of information data comprise APP software compression back length, the preceding length of compression and the start address of videoing at least in internal memory, and this is in the start address of videoing in the internal memory and is the A ' among Fig. 4; And the middleware software bag pressure that merges contracted, the compression algorithm of compressing APP in the compression algorithm during this is handled and the prior art is identical.
(5) because the APP software of can the decompress(ion) former scheme compression of long-range board B OOT software, the middleware software bag is much smaller than the APP software of former scheme, so compression middleware software bag of BOOT software energy decompression step (4), the reflection that middleware software wraps in the internal memory behind the decompress(ion) compression middleware software bag is the A~F among Fig. 3, simultaneously, because long-range board B OOT software can guide former option A PP software, therefore also can guide BOOT ' software.
(6) after BOOT ' software is directed operation, the block of information data that partly provide according to D~E of Fig. 3: length before APP software compression back length and the compression, the APP software decoding of the compression of the E of Fig. 3~F part is reduced to buffer zone, again the data of buffer zone are moved to A '~B ', BOOT ' jumps to A ' then, thereby finishes the guiding to APP software.Because length is in full accord with APP software before APP software compression back length and the compression, so the APP software that BOOT ' always can successful decompress(ion) compresses; Because data " start address of videoing in internal memory " are in full accord with APP software in the block of information, so BOOT ' can stably successful guiding APP software.
A ' some place among Fig. 3 moves internal memory 0x400000 for the method for this example to after with the APP software decoding and begins the place, afterwards according to step (1), APP software is handled.And the dld file and the makefile file of APP software have also been revised in this example: mem1:o=0x00300000 l=0x1D00000 in the dld file is revised as mem1:o=0x00400000 l=0x1C00000; To compile the ram.hex file reorientation that generates simultaneously is 0x400000, promptly revises the create-rule of makefile, will
ram.bin:ram.hex
hex2bin?ram.hex?ram_nocomp.bin?300000
Be revised as:
ram.bin:ram.hex
hex2bin?ram.hex?ram_nocomp.bin?400000。
According to step (2) compression ram_nocomp.bin, as follows then:
deflate<ram_nocomp.bin>APP.BIN
According to above-mentioned steps (3), establishment BOOT ' software, BOOT ' software and former APP software class are the former APP software of scaled-down version seemingly, only need comprise basic BSP, embedded OS and decompression algorithm.Its function is decompress(ion) and the APP software that guides this programme.This decompression algorithm is improved the decompression algorithm that BOOT software adopts.
According to step (4), BOOT ' and APP.BIN are merged.The merging method is for creating an intermediate file, and this example of length of this document is 0x100000 and APP.BIN sum.According to Fig. 2, A~E accounts for the memory headroom of 0x100000, and A~C partly is BOOT ', the block of information data of D~E part, and E~F is that APP.BIN takies, C~D partly is a padding data.Identical with Fig. 2 and Fig. 4, A is 0x300000.
A~E partial-length and A fix, and BOOT ' just can determine block of information data start address D, obtains the block of information data from D~E.The data structure of the block of information data of D~E part is as follows:
struct?zipBootInfo
{
Char ii_bootName[64]; / * BOOT ' software document name */
Unsigned long liiBootLen; / * BOOT ' software document length */
Unsigned long lBootCRC32; / * BOOT ' software document check code */
Unsigned long lBootResv[4]; The correlation reserved word of/* BOOT ' software
*/
Char zipAPPName[64]; / * APP software document name */
Unsigned long lzipAPPLen; / * APP software document compression back length
*/
Unsigned long lAPPCRC32; / * APP software document check code */
Unsigned long lUnzipAPPLen; Length before the compression of/* APP software document
*/
Unsigned long*plAPPStartAddr; The APP software of/* operation is at internal memory
In start address */
Unsigned long lAPPResv[2]; The correlation reserved word of/* APP software document
*/
Unsigned long lThisVersion; The version * of/* PC merging software/
Unsigned long lReserve[4]; / * reserved word */
};
Afterwards, similar with step (2), the middleware software bag after being combined according to step (4) compresses.
With the Flash flash memory of the middleware software bag remote download after the merging of step (4) compression to the NCP plate, because the middleware software bag after merging is much smaller than APP software, according to step (6), the BOOT software of NCP plate can successful decompress(ion) it, thereby by BOOT software guiding BOOT ' software.The middleware software of BOOT software decoding compression wraps in reflection in the internal memory such as the A~F among Fig. 3.
Execution in step (6) afterwards, the block of information data of the D that BOOT ' software obtains according to step (5)~E part, E~F part A PP.BIN is unziped to core buffer and obtains ram_nocomp.bin, the address of block of information data plAPPStartAddr indication moved the ram_nocomp.bin of core buffer to again by BOOT ' software, and last BOOT ' software jumps to the guiding that plAPPStartAddr promptly finishes APP software.
Adopt above-mentioned steps,, obtain the middleware software bag, by the BOOT ' in the middleware software bag of the BOOT software decoding on the long-range veneer, guiding compression by processing to APP software; Pass through the operation of BOOT ' guiding APP software again, realized in the former long-range board B OOT software guiding APP software operation of operation through second-compressed, secondary decompress(ion) and secondary boot, thereby avoided the engineering site to change the problem of BOOT software, solved the problem that BOOT software can't guiding APP software.
Second embodiment
Describe the second embodiment of the present invention with reference to Fig. 5 below, Fig. 5 is device 500 block diagrams according to the BOOT software guiding APP software of second embodiment of the invention.
As shown in Figure 5, this device comprises: APP software processing module 502 is used for handling and compression APP software; BOOT ' software programming module 504 is used to work out BOOT ' software, and wherein, BOOT ' software can decompress(ion) and guiding APP software; Middleware software bag generation module 506 is used for APP software and BOOT ' software are merged into the middleware software bag, and the middleware software bag pressure is contracted; A decompression module 508 is used for the middleware software bag is decompressed; Secondary decompression module 510 is used for the APP software decoding is contracted.
Wherein, after a decompression module 508 decompressed the middleware software bag, BOOT software jumped to BOOT ' software and guides BOOT ' software.In addition, after secondary decompression module 510 contracts the APP software decoding, BOOT ' software guiding APP software.
Wherein, in the middleware software bag, the length after BOOT ' the software compression, block of information data, padding data and be fixed value; Wherein, the block of information data comprise: the start address that length after the length before the compression of APP software, the compression of APP software and APP software are videoed in internal memory.
The above is the preferred embodiments of the present invention only, is not limited to the present invention, and for a person skilled in the art, the present invention can have various changes and variation.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.