Summary of the invention
The object of the embodiment of the present invention is to provide a kind of flash partition table document generating method and data updating method thereof, device, is intended to solve the problem that extendability is strong not, maintenance workload is large, product development efficiency is low of existing flash partition table file generated technology.
First aspect, described flash partition table document generating method comprises the steps: to define the structure array of a descriptor that comprises each flash subregion; Described structure array is compiled, generate the file of obj form; The file of described obj form is carried out to binary data copy function, generate partition table file.
In the possible implementation of the first of first aspect, described method also comprises: by the file compiling link of described obj form to a plurality of executable images the inside that uses flash; Described partition table file is packaged as to the first reflection together with described a plurality of executable images, and described the first reflection is sent to the ROMPaq of production board end.
Second aspect, described partition table data updating method comprises the steps: to judge that whether the new partition table file getting is identical with current partition table file; When the determination result is NO, according to attribute bit descriptor in the descriptor of described current partition table file, read protected partition data to extra buffer; Upgrading described current partition table file is described new partition table file; Described protected partition data in described extra buffer is write again in the attribute bit descriptor of descriptor of described current partition table file.
In the possible implementation of the first of second aspect, described method also comprises: in the electrifying startup stage, obtain partition table file by boot loader from flash fixed address; According to the attribute bit descriptor in the descriptor of described partition table file, judge whether partition data is valid data; Be, obtain the partition data that flash fixed address is preserved, no, obtain the partition data that the partition table symbol content in executable image comprises; Effective partition data is left in shared drive.
In conjunction with the possible implementation of the first of second aspect, in the possible implementation of the second, described method also comprises: at multinuclear, access in the situation of single flash space, at each core, be loaded after startup, each is checked the flash driver of answering and from described shared drive, reads described effective partition data, and described effective partition data is changed and saved as and check with each the flash answering and drive adaptive activation bit.
In the third possible implementation of second aspect, described method also comprises: whether judgement has in the descriptor that a plurality of subregions of identical partitions functional identity, different zone name are corresponding subregion count value all identical; When judgment result is that while being, it is efficient zoned that the most front subregion of skew first address is set, and other non-effective subregions are backup subregion; When the determination result is NO, the subregion that subregion count value maximum is set is efficient zoned, and other non-effective subregions are backup subregion.
The third possible implementation in conjunction with second aspect, in the 4th kind of possible implementation, described method also comprises: when carrying out subregion upgrading, the subregion of regeneration block count value minimum is maximal value, and described maximal value is that current efficient zoned subregion count value adds the value after 1; The subregion that subregion count value maximum corresponding in current a plurality of subregion is set is efficient zoned, and other non-effective subregions are backup subregion.
The third aspect, described flash partition table file creating apparatus comprises: array define unit, for defining the structure array of a descriptor that comprises each flash subregion; File destination generation unit, for described structure array is compiled, generates the file of obj form; Partition table generation unit, for the file of described obj form is carried out to binary data copy function, generates partition table file.
In the possible implementation of the first of the third aspect, described device also comprises: compiling link unit, for by the file compiling link of described obj form to a plurality of executable images the inside that uses flash; Packaged unit, for described partition table file is packaged as to the first reflection together with described a plurality of executable images, and videos and is sent to the ROMPaq of production board end described first.
Fourth aspect, described partition table data update device comprises: whether judging unit is identical with current partition table file for judging the new partition table file getting; Protected data acquiring unit, when being no when described judging unit Output rusults, according to attribute bit descriptor in the descriptor of described current partition table file, reads protected partition data to extra buffer; Table updating block is described new partition table file for upgrading described current partition table file; Protected data writing unit, for again writing the described protected partition data of described extra buffer in the attribute bit descriptor of descriptor of described current partition table file.
In the possible implementation of the first of fourth aspect, described device also comprises: file acquisition unit in the electrifying startup stage, obtains partition table file from flash fixed address by boot loader; Validity judging unit, for according to the attribute bit descriptor of the descriptor of described partition table file, judges whether partition data is valid data; Data acquisition first module, for when described validity judging unit Output rusults is when being, obtains the partition data that flash fixed address is preserved; Data acquisition second unit, when being no when described validity judging unit Output rusults, obtains the partition data that the partition table symbol content in executable image comprises; Storage unit, for leaving effective partition data in shared drive.
In conjunction with the possible implementation of the first of fourth aspect, in the possible implementation of the second, described device also comprises: multinuclear addressed location, for accessing in the situation of single flash space at multinuclear, at each core, be loaded after startup, each is checked the flash driver of answering and from described shared drive, reads described effective partition data, and described effective partition data is changed and saved as and check with each the flash answering and drive adaptive activation bit.
In the third possible implementation of fourth aspect, described device also comprises: count value judging unit, and whether the descriptor subregion count value of have identical partitions functional identity for judging, a plurality of subregions of different zone name are corresponding is all identical; Efficient zoned the first dispensing unit, for when described count value judging unit Output rusults is when being, it is efficient zoned that the most front subregion of skew first address is set, other non-effective subregions are backup subregion; Efficient zoned the second dispensing unit, when being no when described count value judging unit Output rusults, the subregion that subregion count value maximum is set is efficient zoned, other non-effective subregions are backup subregion.
The third possible implementation in conjunction with fourth aspect, in the 4th kind of possible implementation, described device also comprises: count value updating block, for when carrying out subregion upgrading, the subregion of regeneration block count value minimum is maximal value, and described maximal value is that current efficient zoned subregion count value adds the value after 1; Efficient zoned setting unit, is efficient zoned for the subregion of the subregion count value maximum that current a plurality of subregion is corresponding is set, and other non-effective subregions are backup subregion.
The embodiment of the present invention is by defining the structure array of a descriptor that comprises each flash subregion, this structure array is compiled, generate the file of obj form, again the file of this obj form is carried out to binary data copy function, generate partition table file, solved the problem that extendability is strong not, maintenance workload is large, product development efficiency is low of existing flash partition table file generated technology, strengthened the extendability of flash partition table file generated technology, reduce the workload to partition table file, improved product development efficiency.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
The embodiment of the present invention compiles by the structure array of the descriptor that comprises each flash subregion in the definition of veneer side, generate the file of obj form, again the file of this obj form is carried out to binary data copy function, generate partition table file, realized the unified management of a plurality of flash subregions and this way to manage have not been distinguished to operating system, there is the advantage such as extensibility, maintainability flexibly.
Below in conjunction with specific embodiment, specific implementation of the present invention is described in detail:
embodiment mono-:
Fig. 3 shows the realization flow of the flash partition table document generating method that first embodiment of the invention provides, and details are as follows:
In step S301, the structure array of a descriptor that comprises each flash subregion of definition.
Particularly, management data structures at a flash subregion of veneer side definition, this management data structures can comprise the descriptors such as the zone name, skew first address, size of data, the total size of subregion, load address, operation address, sectoring function ID, attribute bit descriptor, subregion count value of each subregion, wherein, zone name is comprised of " name character string ", and unique not reproducible; Skew first address is that subregion is for the skew of flash first address (0); Size of data is the actual size that takies of each subregion; The total size of subregion is the max cap. of subregion; Load address refers to the ram address of partition data; The ram operation address that operation address is partition data; The ID of sectoring function ID represents symbol, a corresponding function class of ID, and multi partition functional identity can repeat to realize backup; Zone attribute position descriptor is explained with certain the bit position in 4 byte datas, general data or other special datas while describing this partition data as certain bit position (file system reflection), certain bit position describes whether this subregion is effective, protected, whether starting shooting automatically loads etc.; Subregion count value is used for record partitioning update times, and whether in the situation that has a plurality of subregions to have identical function ID, judge is up-to-date subregion etc.Finally, after the descriptor of each subregion in flash space is defined, all subregions form a structure array, and this structure array is placed on separately to a .c file the inside, and this .c file only comprises this structure array.
In addition; this zone attribute position descriptor can be used the altogether data description position of 32bit of 4 bytes, specific definition the various attributes of a certain partition table, such as; data type attribute, data validity attribute, data protection attribute, data carry attribute, as follows:
(1) data type attribute: this attribute bit defines the data type (taking 1 to a plurality of bits) of this subregion, such as, general binary data (such as the pure data data for nand), special data (such as the band spare district data for yaffs file system reflection), the types such as other growth data types (NAND type or NOR data).
(2) data validity attribute: this attribute bit defines the validity of this partition data, takies 1 bit position, and attribute can be used for effectively representing this partition data, can read and write; Attribute is that this partition data of invalid representation cannot be used, and cannot read, only to write.
(3) data protection attribute: whether this attribute bit defines this partition data protected in escalation process, take a bit position, when if attribute is protected, represent that this partition data is protected, if congenerous subregion flash address and the size of latter two version change, need to guarantee that the legacy data of this function division is not destroyed after version switches; If it is not protected not protected in escalation process that attribute for not protected, represents this partition data.
(4) data carry attribute: whether this attribute bit defines this partition data needs carry at certain application scenarios, the description on opportunity of every kind of carry takies a bit position, specific operation is carried out at corresponding special scenes in this bit place value position, such as there being following scene: the normal startup file system of C core carry; The carry of the block device subregion that A core journey starts; The file partition carry of upgrade mode; Produce the file partition carry of ray mode; Other extended scenes.
In embodiments of the present invention, the above attribute bit of a subregion is arranged, can accomplish time-sharing multiplex and the concurrent multiplexing of subregion.For example, to the bit position of a subregion setting (1), (3), (4), be true, at normally start/downloading mode of C core, start/produce ray mode so and start under these three scenes and all can carry out carry to this subregion, meet application demand.All subregions are carried out to similar differentiation bit position as required to be arranged to form and enriches subregion application combination.
In step S302, this structure array is compiled, generate the file of obj form.
In step S303, the file of this obj form is carried out to binary data copy function, generate partition table file.
Particularly, after having defined the structure array of a descriptor that comprises each flash subregion, to depositing the .c file of this structure array, compile, directly the source code in this structure array is compiled to action in other words, can generate the intermediate file of obj form, then the file of this obj form is carried out to binary data copy, in compiling link process, can as issue orders by execution: " Objcopy – O binary-binary-without-bss ftable.obj ftable.bin ", generate one independently, content only comprises the partition table file of the pure binary data of this structure array, such as ftable.bin file.
In embodiments of the present invention, by the structure array in a descriptor that comprises each flash subregion of veneer side definition, the management of realization to multi-platform flash, and this way to manage is not distinguished operating system, be applicable to the platform product of linux and non-linux mixed form, and due to a plurality of partition informations of the formal description with structure array, the partition table file generating is also the binary data that comprises this array on this structure array basis, have maintainable very neatly, extensibility etc., as: newly-increased flash subregion application, only need to revise line code, just can pass through the application distribution situation of all whole flash of order printing etc., in addition, only need to revise partition table file (partition table .bin), do not need to revise the dynamic adjustment that any code compilation can be realized flash subregion, or do not need to revise code and just can increase a file partition etc. newly, can reduce maintenance workload, improve product development efficiency etc.
In embodiments of the present invention, after executing above-mentioned steps, this flash partition table also needs to write in flash, specifically comprises:
By the file compiling link of this obj form to a plurality of executable images the inside that uses flash;
This partition table file is packaged as to the first reflection together with the plurality of executable image, and this first reflection is sent to the ROMPaq of production board end, so that this ROMPaq enters flash according to the address described in this partition table file by each reflection programming, upgrade in this partition table file the descriptor of corresponding partition data size and subregion count value simultaneously, and after the equal programming of all reflections is complete, this partition table file after upgrading is write to the constant offset address of first piece of flash.
In specific implementation process, source code in said structure body array is in whole product compilation process, also can compiling link to all working procedures reflection the insides that use flash, also can be linked to a plurality of executable images the inside of platform, can realize the two-way backup of partition table data, this executable image has the executable images such as boot loader Booloader, real time operating system VxWorks.
In production board upgrading scene, this partition table file is packed together with other executable images (as reflections such as bootloader, VxWorkss), by suitable upgrading approach, pass to the ROMPaq of production board end as first image, ROMPaq can enter flash each reflection programming according to the described address of partition table file.Actual size and the subregion count value of taking of partition space corresponding to descriptor the inside of the list file of regeneration block simultaneously.All reflections all programming complete after, the partition table file having upgraded can be written into the constant offset address of first piece of flash, the size that in flash fixed address, the real data size in partition table can download actual reception and write flash according to veneer side in addition dynamically updates, and has finally reached the partition table of generation is write to the object that flash fixed address is preserved.In addition, the embedded system that this flash partition table document generating method also can the be extended to comparison broad sense configurable method that powers on, configurable to powering on of flash subregion.If flash partition table array is changed into another data structure, compile out equally a .bin file, be upgraded to equally fixed address, can also meet the various application scenarioss such as differentiation configuration between internal memory, hardware version numbers, LED lamp etc. needs implementation platform.
embodiment bis-:
Fig. 4 shows the realization flow of the partition table data updating method that second embodiment of the invention provides, and these partition table data generate the data in partition table file for the step by above-described embodiment one, and details are as follows:
In step S401, whether the new partition table file that judgement gets is identical with current partition table file, is, performs step S402, no, performs step S405, keeps this current partition table file constant;
In step S402, according to attribute bit descriptor in the descriptor of this current partition table file, read protected partition data to extra buffer.
In step S403, upgrading this current partition table file is this new partition table file.
In step S404, this protected partition data in this extra buffer is write again in the attribute bit descriptor of descriptor of this current partition table file.
In the software version update replacement process of veneer, situation about changing is planned in the use that likely occurs flash, now, may there is difference in some critical data address and former and later two versions of size definition on flash, the partition address that will look for novelty like this still can correctly read the data of old partition address.
The partition table data updating method that the embodiment of the present invention provides or the title flash partition protecting upgrading flow process based on partition table mechanism can meet this requirement.Particularly; new partition table file is passed to upgrading module as first image; whether newer partition table file is identical with current already present partition table file (old partition table); if it is not identical; first read in current partition table file protected data temporary to extra buffer, data in this current partition table file whether protected in the descriptor of current partition table file attribute bit descriptor decide.Reading protected partition data to extra buffer; can utilize new partition table file to replace current partition table file in flash driving; again the temporary protected data of extra buffer is write back in flash; at this time destination address is the address of new table subregion; also use corresponding data in the new table of protected data replacement; realized the object of the male cousin's data that drive with new table data replacement flash; further, by above-mentioned steps, can continue the upgrading write operation of other subregion mirror images.Thereby the comparison of the embodiment of the present invention by the old and new's subregion can realize two critical datas between different editions and protect.
Further, as shown in Figure 5, this partition table data updating method also comprises:
In step S501, in the electrifying startup stage, by boot loader, from flash fixed address, obtain partition table file.
In step S502, according to the attribute bit descriptor in the descriptor of this partition table file, judge whether partition data is valid data, is, performs step S503, no, perform step S504.
In step S503, obtain the partition data that flash fixed address is preserved.
In step S504, obtain the partition data that the partition table symbol content in executable image comprises.
In step S505, effective partition data is left in shared drive.
In the electrifying startup stage of veneer, partition table file is activated loading procedure and reads out from the fixed address of flash, head zone bit by judgement partition data is identified the validity of partition data, be specially by with each partition table file in the zone attribute position of each subregion data validity attribute in describing identify.If this partition data is effective, the partition data that preferentially obtains and use flash fixed address to preserve, if this partition data is invalid, the partition table data of using compiling link to be comprised to the partition table symbol content inside executable image (as bootloader).Wherein, these partition table data are as preliminary data, the difference of the partition data of preserving with fixed address is above: it is a default value that the partition data of list item the inside takies size, this default value is larger than the actual valid data of subregion, and the partition data of the data table items that flash fixed address is preserved the inside takies size and the actual valid data of subregion are in the same size.Further effective partition data is stored in to veneer shared drive, access when starting for a plurality of core.
In embodiments of the present invention, based on above-mentioned steps, this partition table data updating method also further comprises:
At multinuclear, access in the situation of single flash space, at each core, be loaded after startup, each is checked the flash driver of answering and from this veneer shared drive, reads this effective partition data, and this effective partition data is changed and saved as and check with each the flash answering and drive adaptive activation bit.
Particularly, multinuclear is accessed in the situation of single flash space, each core is loaded after startup, they can read public partition table data by flash driver separately from above-mentioned shared drive, also read effective partition data, and the flash that these partition data information are changed and saved as separately drives adaptive partition information, such as saving as linux, be converted to MTD partition data information etc.
The partition table data updating method that the embodiment of the present invention provides is in conjunction with partition table data double-way backup instances, make the preferential partition table that leaves flash fixed address the inside in that uses of board software, next uses the partition table of executable image the inside link, and multinuclear can read the partition table data in shared drive, and the flash that can be saved as multinuclear drives adaptive partition information.
embodiment tri-:
Fig. 6 shows the realization flow of the partition table data updating method that third embodiment of the invention provides, and these partition table data generate the data in partition table file for the step by above-described embodiment one, and details are as follows:
In embodiments of the present invention, after the use providing based on above-described embodiment two is newly shown the partition table data upgrading of male cousin's data that data replacement flash drives, this partition table data updating method also comprises the steps:
In step S601, whether judgement has in the descriptor that a plurality of subregions of identical partitions functional identity, different zone name are corresponding subregion count value all identical, is, performs step S602, no, performs step S603.
In step S602, it is efficient zoned that the most front subregion of skew first address is set, and other non-effective subregions are backup subregion.
In step S603, the subregion that subregion count value maximum is set is efficient zoned, and other non-effective subregions are backup subregion.
In specific implementation process, with subregion count value unit in the descriptor of subregion, usually realize many back mechanisms of the subregion with identical partitions functional identity.For a plurality of subregions with identical partitions functional identity, different zone name, the subregion value initial value of each subregion is 0.
When edition upgrading, always get older subregion (subregion count value the is less) renewal of upgrading, it is efficient zoned that this subregion is further set, and is always getting newer subregion (subregion count value is larger) as efficient zoned in formal use.Such as, to plan two subregions with identical partitions functional identity, but the zone name of two subregions is not all example, but is not limited to this example.The subregion count value initial value of these two subregions is all 0.Now judge the subregion count value that these two subregions are corresponding identical, it is efficient zoned adopting forward subregion, and the most front subregion of skew first address is also set is efficient zoned, and other non-effective subregions are backup subregion.Afterwards, the subregion count value that these two subregions are corresponding is no longer identical, and the subregion that subregion count value maximum is set is efficient zoned, and other non-effective subregions are backup subregion.
In addition, when carrying out subregion upgrading, this partition table data updating method also comprises:
The subregion of regeneration block count value minimum is maximal value, and this maximal value is that current efficient zoned subregion count value adds the value after 1;
The subregion that subregion count value maximum corresponding in current a plurality of subregion is set is efficient zoned, and other non-effective subregions are backup subregion.
Particularly, when subregion is upgraded, invalid partition data or claim non-effective partition data can be searched to and write, corresponding subregion count value can be set as maximal value simultaneously, this maximal value is that current efficient zoned subregion count value adds the value after 1, in current a plurality of subregions after arranging, the subregion of corresponding subregion count value maximum is efficient zoned, and other non-effective subregions are backup subregion.If upgrading, can find older subregion according to count value again again, carry out Data Update, become new efficient zoned.By that analogy, the partition data before always upgrading last time of backup partition data.
One of ordinary skill in the art will appreciate that all or part of step realizing in above-described embodiment method is to come the hardware that instruction is relevant to complete by program, described program can be stored in a computer read/write memory medium, described storage medium, as ROM/RAM, disk, CD etc.
embodiment tetra-:
Fig. 7 shows the structure of the flash partition table file creating apparatus that fourth embodiment of the invention provides, and for convenience of explanation, only shows the part relevant to the embodiment of the present invention.
This flash partition table file creating apparatus comprises array define unit 71, file destination generation unit 72 and partition table generation unit 73, wherein:
Array define unit 71, for defining the structure array of a descriptor that comprises each flash subregion.
Wherein, the descriptor of each flash subregion can comprise the elements such as zone name, skew first address, size of data, the total size of subregion, load address, operation address, sectoring function ID, attribute bit descriptor, subregion count value.This zone name is comprised of " name character string ", and unique not reproducible; Skew first address is that subregion is for the skew of flash first address (0); Size of data is the actual size that takies of each subregion; The total size of subregion is the max cap. of subregion; Load address refers to the ram address of partition data; The ram operation address that operation address is partition data; The ID of sectoring function ID represents symbol, a corresponding function class of ID, and multi partition functional identity can repeat to realize backup; Zone attribute position descriptor is explained with certain the bit position in 4 byte datas, general data or other special datas while describing this partition data as certain bit position (file system reflection), certain bit position describes whether this subregion is effective, protected, whether starting shooting automatically loads etc.; Subregion count value is used for record partitioning update times, and whether in the situation that has a plurality of subregions to have identical function ID, judge is up-to-date subregion etc.In addition, this zone attribute position descriptor is used 4 bytes data description position of 32bit altogether, specific definition the various attributes of a certain partition table, such as, data type attribute, data validity attribute, data protection attribute, data carry attribute.Finally, after the descriptor of each subregion in flash space is determined, all subregions form a structure array, and this structure array is placed on separately to a .c file the inside, and this .c file only comprises this structure array.
File destination generation unit 72, for this structure array is compiled, generates the file of obj form.
Partition table generation unit 73, for the file of this obj form is carried out to binary data copy function, generates partition table file.
In embodiments of the present invention, by 72 pairs of partition table array source codes of file destination generation unit, compile action, generate the intermediate file of obj form, by partition table generation unit 73, further the file of this obj form is carried out to binary data copy function, generate partition table file, in compiling link process, specifically can as issue orders by execution: " Objcopy – O binary-binary-without-bss ftable.obj ftable.bin ", generate one independently, content only comprises the partition table file of the pure binary data of this structure array, such as ftable.bin file.
In addition, this flash partition table file creating apparatus also comprises:
Compiling link unit, for by the file compiling link of this obj form to a plurality of executable images the inside that uses flash; And
Packaged unit, for this partition table file is packaged as to the first reflection together with the plurality of executable image, and is sent to the ROMPaq of production board end by this first reflection.
Thereby in whole product compilation process, triggering compiling link unit makes source code compiling link in this structure array inside the working procedure reflection of all flash of using, also can be linked to a plurality of executable images the inside of platform, can realize the two-way backup of partition table data.This ROMPaq enters flash according to the address described in this partition table file by each reflection programming, upgrade in this partition table file the descriptor of corresponding partition data size and subregion count value simultaneously and after the equal programming of all reflections is complete, this partition table file after renewal is write to the constant offset address of first piece of flash.
In embodiments of the present invention, this flash partition table file creating apparatus carries out flash zone configuration with veneer side code, generate thus an independently partition table file for bin form, together with the structure array source code of this partition table and current version, compile generation, can be with version updating, also because definition class formation body array is managed a plurality of flash subregions, the extendability of partition table file is strengthened, the workload of its maintenance is reduced, product development efficiency improves, and has unified the way to manage of each subregion of flash and use-pattern etc.
embodiment five:
Fig. 8 shows the structure of the partition table data update device that fifth embodiment of the invention provides, and for convenience of explanation, only shows the part relevant to the embodiment of the present invention.
This partition table data update device comprises judging unit 81, protected data acquiring unit 82, table updating block 83 and protected data writing unit 84, wherein:
Whether judging unit 81 is identical with current partition table file for judging the new partition table file getting.
Protected data acquiring unit 82, when being no when these judging unit 81 Output rusults, according to attribute bit descriptor in the descriptor of this current partition table file, reads protected partition data to extra buffer.
Table updating block 83 is this new partition table file for upgrading this current partition table file.
Protected data writing unit 84, for again writing this protected partition data of this extra buffer in the attribute bit descriptor of descriptor of this current partition table file.
In embodiments of the present invention; new partition table file is passed to upgrading module as first image; whether the newer partition table file of judging unit 81 is identical with current already present partition table file (old partition table); if it is not identical; first by protected data acquiring unit 82, read protected data in current partition table file and keep in to extra buffer, data in this current partition table file whether protected in the descriptor of current partition table file attribute bit descriptor decide.Reading protected partition data to extra buffer; can utilize table updating block 83 that new partition table file is replaced to current partition table file in flash driving; by protected data writing unit 84, the temporary protected data of extra buffer is write back in flash again; at this time destination address is the address of new table subregion; also use corresponding data in the new table of protected data replacement; realized the object of the male cousin's data that drive with new table data replacement flash; further, by continuing the upgrading write operation of other subregion mirror images.Thereby the comparison of the embodiment of the present invention by the old and new's subregion can realize two critical datas between different editions and protect.And in the software version update replacement process of veneer, situation about changing is planned in the use that occurs flash, when the address of critical data on flash and former and later two versions of size definition may occur difference, new partition address correctly can be read to the data of old partition address.
As shown in Figure 9, this partition table data update device also comprises file acquisition unit 91, validity judging unit 92, data acquisition first module 93, data acquisition second unit 94 and storage unit 95, wherein:
File acquisition unit 91 in the electrifying startup stage, obtains partition table file from flash fixed address by boot loader;
Validity judging unit 92, for according to the attribute bit descriptor of the descriptor of this partition table file, judges whether partition data is valid data;
Data acquisition first module 93, for when these validity judging unit 92 Output rusults are when being, obtains the partition data that flash fixed address is preserved;
Data acquisition second unit 94, when being no when these validity judging unit 92 Output rusults, obtains the partition data that the partition table symbol content in executable image comprises; And
Storage unit 95, for leaving effective partition data in shared drive.
In embodiments of the present invention, in the electrifying startup stage of veneer, by file acquisition unit 91, required partition table being activated to loading procedure reads out from the fixed address of flash, validity judging unit 92 is according to the attribute bit descriptor in the descriptor of this partition table file, judge whether partition data is valid data, when judgment result is that while being, trigger data is obtained the partition data that first module 93 is obtained and used flash fixed address to preserve, when the determination result is NO, trigger data is obtained the partition data that second unit 94 obtains and uses the partition table symbol content in executable image to comprise, finally by storage unit 95, effective partition data is left in the shared drive of veneer, make board software can follow the partition table that flash fixed address the inside is left in preferential use in, next uses the principle of the partition table of executable image the inside link.Specific implementation flow process can, with reference to the realization flow of partition table data updating method in above-described embodiment two, not repeat them here.
In addition, this partition table data update device also comprises: multinuclear addressed location, for accessing in the situation of single flash space at multinuclear, at each core, be loaded after startup, each is checked the flash driver of answering and from this shared drive, reads this effective partition data, and this effective partition data is changed and saved as and check with each the flash answering and drive adaptive activation bit.By this multinuclear addressed location, can make multinuclear be activated after loading, all can read the partition table data in shared drive, and the flash that this partition table data message can be changed and saved as separately drives adaptive partition information.
embodiment six:
Figure 10 shows the structure of the partition table data update device that sixth embodiment of the invention provides, and for convenience of explanation, only shows the part relevant to the embodiment of the present invention.
This partition table data update device comprises count value judging unit 101, efficient zoned the first dispensing unit 102 and efficient zoned the second dispensing unit 103, wherein:
Count value judging unit 101, whether the descriptor subregion count value of have identical partitions functional identity for judging, a plurality of subregions of different zone name are corresponding is all identical.
Efficient zoned the first dispensing unit 102, for when these count value judging unit 101 Output rusults are when being, it is efficient zoned that the most front subregion of skew first address is set, other non-effective subregions are backup subregion.
Efficient zoned the second dispensing unit 103, when being no when these count value judging unit 101 Output rusults, the subregion that subregion count value maximum is set is efficient zoned, other non-effective subregions are backup subregion.
Further, this partition table data update device also comprises:
Count value updating block, for when carrying out subregion upgrading, the subregion of regeneration block count value minimum is maximal value, this maximal value is that current efficient zoned subregion count value adds the value after 1; And
Efficient zoned setting unit, is efficient zoned for the subregion of the subregion count value maximum that current a plurality of subregion is corresponding is set, and other non-effective subregions are backup subregion.
In embodiments of the present invention, there is identical partitions functional identity, in a plurality of subregions of different zone name, the subregion value initial value of each subregion is 0, now, in the descriptor of the plurality of subregion of count value judging unit 101 judgement, subregion count value is all identical, skew first address the most front subregion is set is efficient zoned to efficient zoned the first dispensing unit 102, other non-effective subregions are backup subregion, when if in the descriptor of the plurality of subregion of count value judging unit 101 judgement, subregion count value is incomplete same, the subregion that efficient zoned the second dispensing unit 103 arranges subregion count value maximum is efficient zoned, other non-effective subregions are backup subregion, with subregion count value unit in the descriptor of this subregion, usually realize many back mechanisms of the subregion with identical partitions functional identity.
When subregion is upgraded, invalid partition data or claim non-effective partition data can be searched to and write, count value updating block is made as maximal value by its corresponding subregion count value simultaneously, this maximal value is that current efficient zoned subregion count value adds the value after 1, in the current a plurality of subregions of efficient zoned setting unit, the subregion of corresponding subregion count value maximum is set to efficient zonedly, and other non-effective subregions are backup subregion.If upgrading, can find older subregion according to count value again again, carry out Data Update, become new efficient zoned.By that analogy, the partition data before always upgrading last time of backup partition data.
The embodiment of the present invention is by the structure array in a descriptor that comprises each flash subregion of veneer side definition, this structure array is compiled to action, generate the file of obj form, again the file of this obj form is carried out to binary data copy function, generate partition table file, simultaneously by the file compiling link of this obj form to a plurality of executable images the inside that uses flash, the extendability that has solved existing flash partition table file generated technology is strong not, maintenance workload is large, the problem that product development efficiency is low, make the partition table file getting there is stronger extendability, compared with lowland maintenance workload, higher product development efficiency etc.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, all any modifications of doing within the spirit and principles in the present invention, be equal to and replace and improvement etc., within all should being included in protection scope of the present invention.