CN103605552A - MCU upgrading method and device - Google Patents

MCU upgrading method and device Download PDF

Info

Publication number
CN103605552A
CN103605552A CN201310626254.XA CN201310626254A CN103605552A CN 103605552 A CN103605552 A CN 103605552A CN 201310626254 A CN201310626254 A CN 201310626254A CN 103605552 A CN103605552 A CN 103605552A
Authority
CN
China
Prior art keywords
section
software
data
mcu
difference
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201310626254.XA
Other languages
Chinese (zh)
Other versions
CN103605552B (en
Inventor
赵于成
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tonly Electronics Holdings Ltd
Original Assignee
Tonly Electronics Holdings Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tonly Electronics Holdings Ltd filed Critical Tonly Electronics Holdings Ltd
Priority to CN201310626254.XA priority Critical patent/CN103605552B/en
Publication of CN103605552A publication Critical patent/CN103605552A/en
Application granted granted Critical
Publication of CN103605552B publication Critical patent/CN103605552B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention relates to an MCU upgrading method and device, comprising the following steps: when an upgrading request sent by the MCU is received, acquiring the version number of software to be upgraded in the MCU according to the received upgrading request; determining the combination relationship between the software to be upgraded and the new version software and the corresponding difference area number according to the combination relationship of each prestored software version and the difference area number corresponding to each combination relationship; extracting the area data of the area corresponding to the difference area number in the new version software according to the difference area number; the extracted data of the block and the number of the difference block are sent to the MCU, so that the MCU updates the data of the block to the block of the software to be updated corresponding to the number of the difference block in the flash memory to update the MCU software.

Description

The upgrade method of MCU and device
Technical field
The present invention relates to software technology field, relate in particular to a kind of MCU upgrade method and device.
Background technology
To configuration MCU(Micro Control Unit, microprocessor) electronic product, software upgrading function is conventional func, when the defect on MCU software appears in product, user can be by solving its technological deficiency to software upgrading.In prior art, the technical scheme that MCU software is upgraded is generally: wipe the legacy version software of storing in the flash memory of store M CU software, and new version software is write in flash memory, and because the read-write number of times of flash memory has number of times restriction, whether whether frequent, the each time length of reading and writing of read-write operation number of times, all directly to affect the flash memory principal element in serviceable life, therefore, if upgrading at every turn, all new version software data are all write in flash memory and obviously can significantly reduce the serviceable life of flash memory, meanwhile, upgrading inefficiency.
Summary of the invention
Fundamental purpose of the present invention is to provide upgrade method and the device of a kind of MCU, when being intended to improve MCU upgrading efficiency, extends the serviceable life of the flash memory of store M CU software.
The present invention proposes the upgrade method of a kind of MCU, comprising:
While receiving the upgrade request of MCU transmission, according to the upgrade request receiving, obtain the version number of software to be upgraded in described MCU;
According to the syntagmatic of each software version prestoring, and difference section numbering corresponding to each syntagmatic, determine described software to be upgraded and the syntagmatic of new version software and corresponding difference section numbering, wherein, described difference section is numbered two different editions softwares under a syntagmatic, different numbering corresponding to section of section data prestoring in the section of identical numbering;
According to true described difference section numbering, extract the section data that corresponding section is numbered in this difference section in described new version software;
The section data of extraction and this difference section numbering are sent to described MCU, for described MCU, described section Data Update is numbered in the section of corresponding described software to be upgraded with difference section to flash memory.
Preferably, while receiving the upgrade request of MCU transmission, obtain the step of the version number of software to be upgraded in described MCU according to the upgrade request receiving before, the method also comprises:
When receiving new version software, described new version software is split as to section data according to default section quantity, and the section data after splitting are kept in corresponding section;
Compared with the data of each the corresponding section of legacy version software prestoring in each section of new version software, determine difference section numbering corresponding to section that between new version software and each legacy version software, data there are differences;
Set up the new software version number version syntagmatic corresponding with each Geju City software version number, and the mapping relations that number difference section corresponding to each version syntagmatic are also preserved.
Preferably, described compared with the data of each the corresponding section of legacy version software prestoring in each section of new version software, determine that the step of the difference section numbering that section that between new version software and each legacy version software, data there are differences is corresponding comprises:
A, according to the number order of section, compared according to data bit order successively with each data in the corresponding section of legacy version software in each section of described new version software successively;
B, when having described new version software section different from data in data bit in the corresponding section of legacy version software, the section of determining the section that in this data bit, data are different is numbered difference section numbering, and comparing is carried out in next section that jumps to described new version software;
C, repeat above-mentioned steps A and B, until that the section of described new version software has all been compared is complete.
Preferably, described MCU is specially described section Data Update to the step in the section of described software to be upgraded corresponding with difference section numbering in flash memory:
Described MCU locks according to described difference section numbering the section that in MCU, software to be upgraded need to upgrade;
In the data that described MCU judgement receives, whether be empty in difference section if numbering corresponding section data;
When in the data that receive, difference section is numbered corresponding section data not for sky, in the section of judgement locking simultaneously, whether section data are empty, if, described MCU directly numbers corresponding section data by the described difference section receiving and writes in the section of this locking, if not, described MCU deletes the data in the section of this locking, corresponding section data is numbered in the described difference section receiving simultaneously and writes in the section of this locking.
The present invention also proposes the update device of a kind of MCU, comprising:
Acquisition module, when receiving the upgrade request that MCU sends, obtains the version number of software to be upgraded in described MCU according to the upgrade request receiving;
Determination module, the syntagmatic of each software version prestoring for basis, and difference section numbering corresponding to each syntagmatic, determine described software to be upgraded and the syntagmatic of new version software and corresponding difference section numbering, wherein, described difference section is numbered two different editions softwares under a syntagmatic, different numbering corresponding to section of section data prestoring in the section of identical numbering;
Extraction module, for according to true described difference section numbering, extracts the section data that corresponding section is numbered in this difference section in described new version software;
Sending module for the section data of extraction and this difference section numbering are sent to described MCU, is numbered described section Data Update in the section of corresponding described software to be upgraded with difference section for described MCU to flash memory.
Preferably, this device also comprises fractionation module and memory module, and described fractionation module, for when receiving new version software, is split as section data by described existing version software according to default section quantity; Described memory module is for being kept at corresponding section by the section data after splitting; Described determination module also for, compared with the data of each the corresponding section of legacy version software prestoring in each section of new version software, determine difference section numbering corresponding to section that between new version software and each legacy version software, data there are differences; Described memory module is also for setting up the new software version number version syntagmatic corresponding with old software version number, and the mapping relations that number difference section corresponding to each version syntagmatic are also preserved.
Preferably, described determination module comprises:
Comparing unit, according to the number order of section, compares each section of described new version software according to data bit order with each data in the corresponding section of legacy version software successively successively;
Determining unit, for when having the data of described new version software section and the corresponding section of legacy version software different, determines that the section of the section that in this data bit, data are different is numbered difference section numbering;
After described comparing unit is also numbered difference section numbering for the section of different section, specified data position, and comparing is carried out in next section that jumps to described new version software.
Preferably, described MCU realizes described section Data Update to the section of described software to be upgraded corresponding with difference section numbering in flash memory by the module of upgrading in MCU, and the module of upgrading specifically comprises:
Lock cell, for the section that need to upgrade according to described difference section numbering locking MCU software to be upgraded according to described MCU;
Whether judging unit for judging that corresponding section data are numbered in data difference section that described MCU receives, be empty, and in the section of judgement locking, whether section data is empty;
Delete cells, for deleting the data of the section of locking;
Writing unit, for numbering by the described difference section receiving the section that corresponding section data write described locking.
The present invention proposes upgrade method and the device of a kind of MCU, while receiving the upgrade request of MCU transmission, according to the upgrade request receiving, obtain the version number of software to be upgraded in described MCU, and according to the syntagmatic of each software version prestoring, and difference section numbering corresponding to each syntagmatic, determine described software to be upgraded and the syntagmatic of new version software and corresponding difference section numbering, and then extract the section data that corresponding section is numbered in this difference section in described new version software, and these section data are sent to described MCU, to be updated in the section of described software to be upgraded corresponding with difference section numbering in flash memory, thereby realize software upgrading.Data in the section of only needs being upgraded when MCU is upgraded in this programme are carried out read-write operation, and do not need new version software data all to write in flash memory, and upgrading efficiency is high, and have significantly improved the serviceable life of flash memory.
Accompanying drawing explanation
Fig. 1 is the idiographic flow schematic diagram of upgrade method the first embodiment of MCU of the present invention;
Fig. 2 is the schematic flow sheet of upgrade method the second embodiment of MCU of the present invention;
Fig. 3 is the idiographic flow schematic diagram of step S60 in Fig. 2;
Fig. 4 be in first and second embodiment step of upgrade method S40 of MCU of the present invention by section Data Update to the schematic flow sheet in the section of software to be upgraded;
Fig. 5 is the high-level schematic functional block diagram of the update device preferred embodiment of MCU of the present invention;
Fig. 6 is the concrete structure schematic diagram of determination module in Fig. 5;
Fig. 7 is the concrete structure schematic diagram of the preferred embodiment of the MCU upgrading module of upgrading;
Fig. 8 is in each embodiment of the present invention, the schematic diagram of the difference section numbering that the syntagmatic of each software version prestoring and each syntagmatic are corresponding;
Fig. 9 is in each embodiment of the present invention, and two different editions softwares under a syntagmatic split the schematic diagram of section data corresponding stored by identical numbering.
The realization of the object of the invention, functional characteristics and advantage, in connection with embodiment, are described further with reference to accompanying drawing.
Embodiment
Below in conjunction with drawings and the specific embodiments, with regard to technical scheme of the present invention, be described further.Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
With reference to Fig. 1, the idiographic flow schematic diagram of upgrade method the first embodiment that Fig. 1 is MCU of the present invention.
The present embodiment proposes the upgrade method of a kind of MCU, comprising:
Step S10, while receiving the upgrade request of MCU transmission, obtains the version number of software to be upgraded in described MCU according to the upgrade request receiving.
The executive agent of the present embodiment be take server as example.MCU can be encapsulated in the version number of its software to be upgraded in the upgrade request of MCU, and server, when receiving the upgrade request of MCU transmission, is decoded to obtain the version number of software to be upgraded in the MCU in upgrade request to this upgrade request.
The running software that MCU carries is in the present embodiment in flash memory, dispose the electronic product of MCU when start, or when user triggers upgrade request by button or other device, can obtain to server the latest version information (as version number) of the software of MCU installation, the version information of the software of preserving in the version information getting and flash memory is compared, take and determine whether the software of current preservation in flash memory is latest edition, if the software of current preservation is not latest edition in flash memory, point out user whether to upgrade, when receiving user's confirmation, MCU sends upgrade request to server, in this upgrade request, the version number that comprises MCU software.
Step S20, according to the syntagmatic of each software version prestoring, and difference section numbering corresponding to each syntagmatic, determine described software to be upgraded and the syntagmatic of new version software and corresponding difference section numbering;
Described difference section is numbered two different editions softwares under a syntagmatic, different numbering corresponding to section of section data prestoring in the section of identical numbering.
In the present embodiment, the section that the storage area of the flash memory of MCU is divided into predetermined number, and section is numbered in order, and the software data of MCU is divided into the section data identical with section quantity, section data and section numbering mapping are preserved, the large I of each section is identical in the present embodiment also can be different, and the size that is preferably each section is identical, and for example the size of each section is 1kb.As shown in Figure 9, server is split as a plurality of sections data by the software data of each version according to the section quantity of the storage area of MCU, each section data is kept in corresponding section, according to the order of the section in the flash memory of MCU, the section of dividing in server is numbered simultaneously, section data and section numbering mapping are preserved.
Server is when receiving new version software data, new version software is split as to section data according to default section quantity, and the section data after splitting are kept in corresponding section, and new version software and legacy version software are compared, determine the section numbering that between redaction and legacy version, section data there are differences, and record, to set up the syntagmatic of the new software version number version corresponding with old software version number, (for example software version 1 and software version 5 can form a syntagmatic, the variance data of the corresponding software version 5 of this syntagmatic and software version 1), and difference section numbering corresponding to each version syntagmatic, the mapping relations of the difference section numbering that each version syntagmatic is corresponding can realize by mapping relations table.
As shown in Figure 9, two different editions softwares under a syntagmatic (being defined as new version software and legacy version software), the section of its storage is all numbered section 1 to section 13, in the time of relatively, new version software is compared respectively with the section of the identical numbering of legacy version software, for example, the data of the section 1 of the data of the section of new version software 1 and legacy version software are compared, the data of the section 2 of the data of the section of new version software 2 and legacy version software are compared, , , , , , by that analogy, until find the discrepant section of data tool, the numbering of this section is difference section numbering, for example the data of the data of the section 4 of new version software and the section 4 of legacy version software are different, this difference section is numbered section 4.Syntagmatic between each version and with the mapping relations table of difference section numbering as shown in Figure 8.In form, the left side the first stringer represents all version numbers of depositing in current upgrade server, wherein supposes that current up-to-date version number is V6.0; The version number's (the machine current version of supposing user is V4.0) that represents machine that active user uses is walked crosswise in top first; Because the feature of upgrading is to be upgraded to highest version from lowest version, and can not upgrade between identical version, therefore in form, right the first half is invalid data, be labeled as NA, bottom left section is effective variance data, the content of MCU upgrading is positioned at the place, point of crossing of V4.0 and V6.0, the data at this place, point of crossing are the difference section numbering of V4.0 and V6.0 version software data, server, after getting MCU software version number, can get the difference section numbering between the software on latest edition software and MCU easily according to MCU software version number.
Step S30, according to described difference section numbering, extracts the section data that corresponding section is numbered in this difference section in described new version software;
In the present embodiment, server can divide the software data of each version section to preserve, preserve the software section numbering of each version and the mapping relations of section data simultaneously, can be according to new software version number, difference section numbering is obtained this difference section and is numbered corresponding section data.
Step S40, sends to described MCU by the section data of extraction and this difference section numbering, for described MCU, described section Data Update is numbered in the section of corresponding described software to be upgraded with difference section to flash memory.
In other variant embodiment, when in flash memory, the software of current preservation is not latest edition, and when the version number of the version number of the software of current preservation and latest edition software is non-conterminous, can push information to user, with prompting user, select to upgrade to which version, while receiving user's selection information, determine the software version number that user selects, the upgrade request that now MCU sends to server comprises the version number of software and the software version number of MCU request upgrading of the current lift-launch of MCU, server is now according to the syntagmatic of the new software version number the prestoring version corresponding with old software version number, and difference section numbering corresponding to each syntagmatic, determine the version number of software of the current lift-launch of MCU and the corresponding difference of the syntagmatic section numbering of the software version number of MCU request upgrading, and according to software version number and the difference section numbering of definite MCU request upgrading, extract the section data that prestore corresponding to difference section numbering, prestore section data and the difference section numbering extracted are sent to described MCU, for described MCU, corresponding flash memory section is numbered in section Data Update to the described difference section that prestores of extracting.This scheme has selectivity, and when MCU exists compatibling problem, force users is not upgraded to the software of latest edition, to reduce the problem occurring after upgrading.
The upgrade method of the MCU that the present embodiment proposes, while receiving the upgrade request of MCU transmission, according to the upgrade request receiving, obtain the version number of software to be upgraded in described MCU, and according to the syntagmatic of each software version prestoring, and difference section numbering corresponding to each syntagmatic, determine described software to be upgraded and the syntagmatic of new version software and corresponding difference section numbering, and then extract the section data that corresponding section is numbered in this difference section in described new version software, and these section data are sent to described MCU, to be updated in the section of described software to be upgraded corresponding with difference section numbering in flash memory, thereby realize software upgrading.Data in the section of only needs being upgraded when this programme is upgraded to MCU are carried out read-write operation, and do not need new version software data all to write in flash memory, and upgrading efficiency is high, have significantly improved the serviceable life of flash memory.
With reference to Fig. 2, the schematic flow sheet of upgrade method the second embodiment that Fig. 2 is MCU of the present invention.
Based on the first embodiment, propose upgrade method the second embodiment of MCU of the present invention, in the present embodiment, before step S10, comprise:
Step S50, when receiving new version software, is split as section data by new version software according to default section quantity, and the section data after splitting are kept in corresponding section;
Step S60, compares each section of new version software with the data of each the corresponding section of legacy version software prestoring, determine difference section numbering corresponding to section that between new version software and each legacy version software, data there are differences;
Step S70, sets up the new software version number version syntagmatic corresponding with each Geju City software version number, and the mapping relations that number difference section corresponding to each version syntagmatic are also preserved.
In the present embodiment, server, when receiving new version software, is compared the new version software receiving and each legacy version software prestoring successively.When new version software is compared with each legacy version software prestoring, compared one by one with the data of the corresponding section of legacy version software prestoring in each section of new version software, new version software and legacy version software have data in section different time, determine that this section is difference section, and other section of continuation comparison, at new version software and this legacy version software, compare when complete, set up syntagmatic between this new version software and legacy version software (this syntagmatic comprises new version software number and legacy version kit mumber), set up the mapping relations (as shown in Figure 8) between this syntagmatic and difference section numbering simultaneously, and continue new version software and other legacy version software to compare, until complete the comparison process of new version software and all legacy version softwares.
With reference to Fig. 3, Fig. 3 is the idiographic flow schematic diagram of step S60 in Fig. 2.
In upgrade method the second embodiment of MCU of the present invention, step S60 comprises:
Step S61, according to the number order of section, compares each section of described new version software according to data bit order with each data in the corresponding section of legacy version software successively successively;
Step S62, when having described new version software section different from data in data bit in the corresponding section of legacy version software, the section of determining the section that in this data bit, data are different is numbered difference section numbering, and comparing is carried out in next section that jumps to described new version software;
Step S63, repeats above-mentioned steps S61 and step S62, until that the section of described new version software has all been compared is complete.
When comparison, first compare the first data bit of the first section of new version software and legacy version software, in the first data bit when identical, other data bit of the first section of new version software and legacy version software is compared in continuation in order, while having data bit different in the first section, determine that the first section is difference section, and jump to next section and compare, the comparison mode of other section and the first section to compare mode identical, until compared behind all sections, set up the syntagmatic between this new version software and legacy version software, set up the mapping relations between this syntagmatic and difference section simultaneously, and continue new version software and other legacy version software to compare, be provided with in the present embodiment a counter, when the first data bits of new version software and legacy version software the first section is when identical, counter adds 1, and compare in order other data bit of the first section of new version software and legacy version software, and at data bits when being identical, counter adds 1, until have data bits according to difference, jumping to next section compares, or when reaching preset value, the numerical value of counter jumps to next section compare (this preset value is relevant with the size of section), the comparison mode of other section and the first section to compare mode identical, do not repeat them here.
With reference to Fig. 4, in first and second embodiment step of the upgrade method that Fig. 4 is MCU of the present invention S40 by section Data Update to the schematic flow sheet in the section of software to be upgraded.
In the present embodiment, MCU is specially described section Data Update to the step in the section of described software to be upgraded corresponding with difference section numbering in flash memory::
Step S80, described MCU locks according to described difference section numbering the section that in MCU, software to be upgraded need to upgrade;
Step S90, in the data that described MCU judgement receives, whether be empty in difference section if numbering corresponding section data;
Step S100, when in the data that receive, difference section is numbered corresponding section data not for sky, in the section of judgement locking simultaneously, whether section data are empty, if, described MCU directly numbers corresponding section data by the described difference section receiving and writes in the section of this locking, if not, described MCU deletes the data in the section of this locking, corresponding section data is numbered in the described difference section receiving simultaneously and writes in the section of this locking.
While being that due to new version software legacy version software is compared, may there are empty data in the difference section between new version software and legacy version software, during data that now MCU stores in upgrading flash memory, may there are 3 kinds of situations, directly delete the data in difference section, when the data that receive are write direct in the data of difference section and deleted the data in difference section, the data that receive are write to difference section, MCU is when receiving section data that server sends and corresponding difference section numbering, when server only sends difference section numbering and corresponding section data at every turn, specific operation process is as follows: first lock the numbering section corresponding with the software moving in MCU, difference section, and in receiving data, only comprise difference section numbering, and when in the section of locking, data are not empty, illustrate that in the software basis of moving in new version software and MCU, this difference section data after renewal should be sky, now delete the data in the section locking, or in receiving data, comprise difference section numbering and section data, and during Zhong You section, the section data of locking, then the data in the section locking by the section Data Update getting, in receiving data, comprise difference section numbering and section data, and while there is no section data in the section locking, by the section of the section data write lock-out getting.Wherein, because server only sends at every turn, number a difference section and corresponding section data, can after server data be sent, to MCU, send and finish sign, and MCU, when receiving end sign, stops upgrading, and jumps to application layer.
Or, server is for reducing transmission times, can set up the mapping relations between difference section numbering and section data, and by the mapping relations between difference section numbering and section data, and section data send to MCU, MCU can number corresponding flash memory section by obtaining section Data Update to corresponding difference section successively, and concrete renewal process specifically repeats no more as previously discussed.
With reference to Fig. 5, the high-level schematic functional block diagram of the update device preferred embodiment that Fig. 5 is MCU of the present invention.
The present embodiment proposes the update device of a kind of MCU, comprising:
Acquisition module 10, while receiving the upgrade request of MCU transmission, obtains the version number of software to be upgraded in described MCU according to the upgrade request receiving;
The executive agent of the present embodiment be take server equally as example.MCU can be encapsulated in the version number of MCU in the upgrade request of MCU, and server, when receiving the upgrade request of MCU transmission, decodes to obtain the MCU software version number in upgrade request to this upgrade request.
The software that MCU carries in the present embodiment preferably operates in flash memory, dispose the electronic product of MCU when start, or when user triggers upgrade request by button or other device, can obtain to server the latest version information (as version number) of the software of MCU installation, the version information of the software of preserving in the version information getting and flash memory is compared, take and determine whether the software of current preservation in flash memory is latest edition, if the software of current preservation is not latest edition in flash memory, point out user whether to upgrade, when receiving user's confirmation, to server, send upgrade request, in this upgrade request, the version number that comprises MCU software.
Determination module 20, the syntagmatic of each software version prestoring for basis, and difference section numbering corresponding to each syntagmatic, determine the syntagmatic of described software to be upgraded and new version software and corresponding difference section numbering; Described difference section is numbered two different editions softwares under a syntagmatic, different numbering corresponding to section of section data prestoring in the section of identical numbering;
In the present embodiment, the section that the storage area of the flash memory of MCU is divided into predetermined number, and section is numbered in order, and the software data of MCU is divided into the section data identical with section quantity, section data and section numbering mapping are preserved, the large I of each section is identical in the present embodiment also can be different, and the size that is preferably each section is identical, and for example the size of each section is 1kb.As shown in Figure 9, server is split as a plurality of sections data by each version software data according to the section quantity of the storage area of MCU, each section data is kept in corresponding section, according to the order of the section in the flash memory of MCU, the section of dividing in server is numbered simultaneously, section data and section numbering mapping are preserved.
Server is when receiving new version software data, new version software and legacy version software are compared, determine the section numbering that between redaction and legacy version, section data there are differences, and record, to set up the syntagmatic of the new software version number version corresponding with old software version number, and difference section numbering corresponding to each syntagmatic, the mapping relations of the difference section numbering that each version syntagmatic is corresponding can realize by mapping relations table, for example software version 1 and software version 5 can form a version syntagmatic, the variance data of the corresponding software version 5 of this syntagmatic and software version 1, the mapping relations table of version syntagmatic and difference section numbering as shown in Figure 8.In form, the left side the first stringer represents all version numbers of depositing in current upgrade server, wherein supposes that current up-to-date version number is V6.0; The version number's (the machine current version of supposing user is V4.0) that represents machine that active user uses is walked crosswise in top first; Because the feature of upgrading is to be upgraded to highest version from lowest version, and can not upgrade between identical version, therefore in form, right the first half is invalid data, be labeled as NA, bottom left section is effective variance data, the content of MCU upgrading is positioned at the place, point of crossing of V4.0 and V6.0, place, this point of crossing data be that number the difference section of V4.0 and V6.0 version software data, server, after getting MCU software version number, can get the difference section numbering between the software on latest edition software and MCU easily according to MCU software version number.
Extraction module 30, for according to true described difference section numbering, extracts the section data that corresponding section is numbered in this difference section in described new version software;
In the present embodiment, server can be preserved the software section numbering of each version and the mapping relations of section data, can be according to new software version number, and difference section numbering is obtained the section data that prestore corresponding to this difference section numbering; Or server is the data of legacy version software only, and number the section of preserving old edition and the mapping relations of section data, after new version software and legacy version software have been compared, only preserve difference section numbering and new version software difference section and number corresponding section data, and the mapping relations of difference section numbering and section data, delete the data of other unaltered section, to save the storage space of server.
Sending module 40 for the section data of extraction and this difference section numbering are sent to described MCU, is numbered described section Data Update in the section of corresponding described software to be upgraded with difference section for described MCU to flash memory.
In other variant embodiment, when in flash memory, the software of current preservation is not latest edition, and when the version number of the version number of the software of current preservation and latest edition software is non-conterminous, can push information to user, with prompting user, select to upgrade to which version, while receiving user's selection information, determine the software version number that user selects, the upgrade request that now MCU sends to server comprises the version number of software and the software version number of MCU request upgrading of the current lift-launch of MCU, server is now according to the syntagmatic of the new software version number the prestoring version corresponding with old software version number, and the mapping relations of difference section corresponding to each syntagmatic numbering, determine the version number of software of the current lift-launch of MCU and the corresponding difference of the syntagmatic section numbering of the software version number of MCU request upgrading, and according to software version number and the difference section numbering of definite MCU request upgrading, extract the section data that prestore corresponding to difference section numbering, prestore section data and the difference section numbering extracted are sent to described MCU, for described MCU, corresponding flash memory section is numbered in section Data Update to the described difference section that prestores of extracting.This scheme has selectivity, and when MCU exists compatibling problem, force users is not upgraded to the software of latest edition, to reduce the problem occurring after upgrading.
The update device of the MCU that the present embodiment proposes, while receiving the upgrade request of MCU transmission, according to the upgrade request receiving, obtain the version number of software to be upgraded in described MCU, and according to the syntagmatic of each software version prestoring, and difference section numbering corresponding to each syntagmatic, determine described software to be upgraded and the syntagmatic of new version software and corresponding difference section numbering, and then extract the section data that corresponding section is numbered in this difference section in described new version software, and these section data are sent to described MCU, to be updated in the section of described software to be upgraded corresponding with difference section numbering in flash memory, thereby realize software upgrading.Data in the section of only needs being upgraded when MCU is upgraded in this programme are carried out read-write operation, and do not need new version software data all to write in flash memory, and upgrading efficiency is high, and have significantly improved the serviceable life of flash memory.
In the update device preferred embodiment of MCU of the present invention, this device also comprises fractionation module 50 and memory module 60, and described fractionation module 50, for when receiving new version software, is split as section data by the section quantity property entered according to default; Described memory module 60 is for being kept at corresponding section by the section data after splitting; Described determination module 20 also for, compared with the data of each the corresponding section of legacy version software prestoring in each section of new version software, determine difference section numbering corresponding to section that between new version software and each legacy version software, data there are differences; Described memory module 60 is also for setting up the new software version number version syntagmatic corresponding with old software version number, and the mapping relations that number difference section corresponding to each version syntagmatic are also preserved.
In the present embodiment, server, when receiving new version software, is compared the new version software receiving and each legacy version software prestoring successively.When new version software is compared with each legacy version software prestoring, compared one by one with the data of the corresponding section of legacy version software prestoring in each section of new version software, new version software and legacy version software have data in section different time, determine that this section is difference section, and other section of continuation comparison, at new version software and this legacy version software, compare when complete, set up syntagmatic between this new version software and legacy version software (this syntagmatic comprises new version software number and legacy version kit mumber), set up the mapping relations (as shown in Figure 8) between this syntagmatic and difference section simultaneously, and continue new version software and other legacy version software to compare, until complete the comparison process of new version software and all legacy version softwares.
With reference to Fig. 6, Fig. 6 is the concrete structure schematic diagram of determination module in Fig. 5.
In the update device preferred embodiment of MCU of the present invention, described determination module 20 comprises:
Comparing unit 21, according to the number order of section, compares each section of described new version software according to data bit order with each data in the corresponding section of legacy version software successively successively;
Determining unit 22, for when having the data of described new version software section and the corresponding section of legacy version software different, determines that the section of the section that in this data bit, data are different is numbered difference section numbering;
After described comparing unit 21 is also numbered difference section numbering for the section of different section, specified data position, and comparing is carried out in next section that jumps to described new version software.
When comparison, first compare the first data bit of the first section of new version software and legacy version software, when in the first data bit, data are identical, continue to compare in order data in other data bit of the first section of new version software and legacy version software, while having data different in the first section, determine that the first section is difference section, and jump to next section and compare, the comparison mode of other section and the first section to compare mode identical, until compared behind all sections, set up the syntagmatic between this new version software and legacy version software, set up the mapping relations between this syntagmatic and difference section simultaneously, and continue the data in new version software and other legacy version software to compare by section, be provided with in the present embodiment a counter, when the first data bit of new version software and legacy version software the first section is when identical, counter adds 1, and compare in order other data bit of the first section of new version software and legacy version software, and in data bit while being identical, counter adds 1, until there is data bit different, jumping to next section compares, or when reaching preset value, the numerical value of counter jumps to next section compare (this preset value is relevant with the size of section), the comparison mode of other section and the first section to compare mode identical, do not repeat them here.
With reference to Fig. 7, Fig. 7 is the concrete structure schematic diagram of the preferred embodiment of the MCU upgrading module of upgrading.
In the update device preferred embodiment of MCU of the present invention, described MCU realizes described section Data Update to the section of described software to be upgraded corresponding with difference section numbering in flash memory by the module 70 of upgrading in MCU, and the module of upgrading specifically comprises:
Lock cell 71, for the section that need to upgrade according to described difference section numbering locking MCU software to be upgraded according to described MCU;
Whether judging unit 72 for judging that corresponding section data are numbered in data difference section that described MCU receives, be empty, and in the section of judgement locking, whether section data is empty;
Delete cells 73, for deleting the data of the section of locking;
Writing unit 74, for numbering by the described difference section receiving the section that corresponding section data write described locking.
While being that due to new version software legacy version software is compared, may there are empty data in the difference section between new version software and legacy version software, during data that now MCU stores in upgrading flash memory, may there are 3 kinds of situations, directly delete the data in difference section, when the data that receive are write direct in the data of difference section and deleted the data in difference section, the data that receive are write to difference section, MCU is when receiving section data that server sends and corresponding difference section numbering, when server only sends difference section numbering and corresponding section data at every turn, specific operation process is as follows: first lock the numbering section corresponding with the software moving in MCU, difference section, and in receiving data, only comprise difference section numbering, and when in the section of locking, data are not empty, illustrate that in the software basis of moving in new version software and MCU, this difference section data after renewal should be sky, now delete the data in the section locking, or in receiving data, comprise difference section numbering and section data, and during Zhong You section, the section data of locking, then the data in the section locking by the section Data Update getting, in receiving data, comprise difference section numbering and section data, and while there is no section data in the section locking, by the section of the section data write lock-out getting.Wherein, because server only sends at every turn, number a difference section and corresponding section data, can after server data be sent, to MCU, send and finish sign, and MCU, when receiving end sign, stops upgrading, and jumps to application layer.
Or, server is for reducing transmission times, can set up the mapping relations between difference section numbering and section data, and by the mapping relations between difference section numbering and section data, and section data send to MCU, MCU can number corresponding flash memory section by obtaining section Data Update to corresponding difference section successively, and concrete renewal process specifically repeats no more as previously discussed.
The foregoing is only the preferred embodiments of the present invention; not thereby limit the scope of the claims of the present invention; every equivalent structure transformation that utilizes instructions of the present invention and accompanying drawing content to do; or be directly or indirectly used in other relevant technical fields, be all in like manner included in scope of patent protection of the present invention.

Claims (8)

1. a upgrade method of MCU, is characterized in that, comprising:
While receiving the upgrade request of MCU transmission, according to the upgrade request receiving, obtain the version number of software to be upgraded in described MCU;
According to the syntagmatic of each software version prestoring, and difference section numbering corresponding to each syntagmatic, determine described software to be upgraded and the syntagmatic of new version software and corresponding difference section numbering, wherein, described difference section is numbered two different editions softwares under a syntagmatic, different numbering corresponding to section of section data prestoring in the section of identical numbering;
According to described difference section numbering, extract the section data that corresponding section is numbered in this difference section in described new version software;
The section data of extraction and this difference section numbering are sent to described MCU, for described MCU, described section Data Update is numbered in the section of corresponding described software to be upgraded with difference section to flash memory.
2. method according to claim 1, is characterized in that, described in while receiving the upgrade request that MCU sends, obtain the step of the version number of software to be upgraded in described MCU according to the upgrade request receiving before, the method also comprises:
When receiving new version software, described new version software is split as to section data according to default section quantity, and the section data after splitting are kept in corresponding section;
Compared with the data of each the corresponding section of legacy version software prestoring in each section of new version software, determine difference section numbering corresponding to section that between new version software and each legacy version software, data there are differences;
Set up the new software version number version syntagmatic corresponding with each Geju City software version number, and the mapping relations that number difference section corresponding to each version syntagmatic are also preserved.
3. method according to claim 2, it is characterized in that, described compared with the data of each the corresponding section of legacy version software prestoring in each section of new version software, determine that the step of the difference section numbering that section that between new version software and each legacy version software, data there are differences is corresponding comprises:
A, according to the number order of section, compared according to data bit order successively with each data in the corresponding section of legacy version software in each section of described new version software successively;
B, when having described new version software section different from data in data bit in the corresponding section of legacy version software, the section of determining the section that in this data bit, data are different is numbered difference section numbering, and comparing is carried out in next section that jumps to described new version software;
C, repeat above-mentioned steps A and B, until that the section of described new version software has all been compared is complete.
4. method according to claim 1, is characterized in that, described MCU is specially described section Data Update to the step in the section of described software to be upgraded corresponding with difference section numbering in flash memory:
Described MCU locks according to described difference section numbering the section that in MCU, software to be upgraded need to upgrade;
In the data that described MCU judgement receives, whether be empty in difference section if numbering corresponding section data;
When in the data that receive, difference section is numbered corresponding section data not for sky, in the section of judgement locking simultaneously, whether section data are empty, if, described MCU directly numbers corresponding section data by the described difference section receiving and writes in the section of this locking, if not, described MCU deletes the data in the section of this locking, corresponding section data is numbered in the described difference section receiving simultaneously and writes in the section of this locking.
5. a update device of MCU, is characterized in that, comprising:
Acquisition module, when receiving the upgrade request that MCU sends, obtains the version number of software to be upgraded in described MCU according to the upgrade request receiving;
Determination module, the syntagmatic of each software version prestoring for basis, and difference section numbering corresponding to each syntagmatic, determine described software to be upgraded and the syntagmatic of new version software and corresponding difference section numbering, wherein, described difference section is numbered two different editions softwares under a syntagmatic, different numbering corresponding to section of section data prestoring in the section of identical numbering;
Extraction module, for according to true described difference section numbering, extracts the section data that corresponding section is numbered in this difference section in described new version software;
Sending module for the section data of extraction and this difference section numbering are sent to described MCU, is numbered described section Data Update in the section of corresponding described software to be upgraded with difference section for described MCU to flash memory.
6. according to the device shown in claim 5, it is characterized in that, this device also comprises fractionation module and memory module, and described fractionation module, for when receiving new version software, is split as section data by described new version software according to default section quantity; Described memory module is for being kept at corresponding section by the section data after splitting; Described determination module also for, compared with the data of each the corresponding section of legacy version software prestoring in each section of new version software, determine difference section numbering corresponding to section that between new version software and each legacy version software, data there are differences; Described memory module is also for setting up the new software version number version syntagmatic corresponding with old software version number, and the mapping relations that number difference section corresponding to each version syntagmatic are also preserved.
7. device according to claim 6, is characterized in that, described determination module comprises:
Comparing unit, according to the number order of section, compares each section of described new version software according to data bit order with each data in the corresponding section of legacy version software successively successively;
Determining unit, for when having the data of described new version software section and the corresponding section of legacy version software different, determines that the section of the section that in this data bit, data are different is numbered difference section numbering;
After described comparing unit is also numbered difference section numbering for the section of different section, specified data position, and comparing is carried out in next section that jumps to described new version software.
8. device according to claim 5, is characterized in that, described MCU realizes described section Data Update to the section of described software to be upgraded corresponding with difference section numbering in flash memory by the module of upgrading in MCU, and the module of upgrading specifically comprises:
Lock cell, for the section that need to upgrade according to described difference section numbering locking MCU software to be upgraded according to described MCU;
Whether judging unit for judging that corresponding section data are numbered in data difference section that described MCU receives, be empty, and in the section of judgement locking, whether section data is empty;
Delete cells, for deleting the data of the section of locking;
Writing unit, for numbering by the described difference section receiving the section that corresponding section data write described locking.
CN201310626254.XA 2013-11-29 2013-11-29 MCU upgrading method and device Active CN103605552B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310626254.XA CN103605552B (en) 2013-11-29 2013-11-29 MCU upgrading method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310626254.XA CN103605552B (en) 2013-11-29 2013-11-29 MCU upgrading method and device

Publications (2)

Publication Number Publication Date
CN103605552A true CN103605552A (en) 2014-02-26
CN103605552B CN103605552B (en) 2017-12-29

Family

ID=50123782

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310626254.XA Active CN103605552B (en) 2013-11-29 2013-11-29 MCU upgrading method and device

Country Status (1)

Country Link
CN (1) CN103605552B (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105630811A (en) * 2014-10-30 2016-06-01 西安酷派软件科技有限公司 Update method and update system of access control rule
CN105760165A (en) * 2016-02-22 2016-07-13 深圳威迈斯电源有限公司 MCU self-backup loading and refreshing method
CN105786541A (en) * 2014-12-23 2016-07-20 Tcl通力电子(惠州)有限公司 Upgrade method and system based on broadcast signal
CN105912340A (en) * 2016-04-26 2016-08-31 江苏惠通集团有限责任公司 Primary device, remote control and overhead upgrading method of remote control
CN106250195A (en) * 2016-08-10 2016-12-21 青岛海信电器股份有限公司 Update the method for system file, equipment and system
CN107341024A (en) * 2016-04-28 2017-11-10 华为技术有限公司 Method for upgrading system and system upgrade device
CN110784386A (en) * 2019-09-27 2020-02-11 深圳市火乐科技发展有限公司 Firmware updating method and related equipment
CN111651186A (en) * 2020-05-29 2020-09-11 歌尔科技有限公司 Earphone, program upgrading method thereof, control device and readable storage medium
CN114567628A (en) * 2022-02-28 2022-05-31 中汽创智科技有限公司 OTA (over the air) upgrading method and device
CN114968321A (en) * 2021-02-25 2022-08-30 新开普电子股份有限公司 Gas meter terminal and cross-version upgrading method thereof

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080126672A1 (en) * 2004-03-10 2008-05-29 Sony Ericsson Mobile Communications Ab Automatic Backup Store In Firmware Upgrades
CN101334736A (en) * 2007-06-28 2008-12-31 索尼爱立信移动通信日本株式会社 Oftware updating method and portable terminal devic
CN102132259A (en) * 2009-03-30 2011-07-20 日立系统解决方案有限公司 Firmware updating system, firmware delivering server, firmware incorporating device, and program
CN102193803A (en) * 2010-03-03 2011-09-21 上海三旗通信科技有限公司 Method for rapidly updating and downloading mobile phone software
CN102799445A (en) * 2012-05-03 2012-11-28 陈昊 Application upgrading method based on Android platform and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080126672A1 (en) * 2004-03-10 2008-05-29 Sony Ericsson Mobile Communications Ab Automatic Backup Store In Firmware Upgrades
CN101334736A (en) * 2007-06-28 2008-12-31 索尼爱立信移动通信日本株式会社 Oftware updating method and portable terminal devic
CN102132259A (en) * 2009-03-30 2011-07-20 日立系统解决方案有限公司 Firmware updating system, firmware delivering server, firmware incorporating device, and program
CN102193803A (en) * 2010-03-03 2011-09-21 上海三旗通信科技有限公司 Method for rapidly updating and downloading mobile phone software
CN102799445A (en) * 2012-05-03 2012-11-28 陈昊 Application upgrading method based on Android platform and system

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105630811A (en) * 2014-10-30 2016-06-01 西安酷派软件科技有限公司 Update method and update system of access control rule
CN105786541A (en) * 2014-12-23 2016-07-20 Tcl通力电子(惠州)有限公司 Upgrade method and system based on broadcast signal
CN105760165B (en) * 2016-02-22 2019-09-06 深圳威迈斯新能源股份有限公司 A kind of method that self backup load of MCU refreshes
CN105760165A (en) * 2016-02-22 2016-07-13 深圳威迈斯电源有限公司 MCU self-backup loading and refreshing method
CN105912340A (en) * 2016-04-26 2016-08-31 江苏惠通集团有限责任公司 Primary device, remote control and overhead upgrading method of remote control
CN107341024A (en) * 2016-04-28 2017-11-10 华为技术有限公司 Method for upgrading system and system upgrade device
CN107341024B (en) * 2016-04-28 2020-02-14 华为技术有限公司 System upgrading method and system upgrading device
CN106250195A (en) * 2016-08-10 2016-12-21 青岛海信电器股份有限公司 Update the method for system file, equipment and system
CN110784386A (en) * 2019-09-27 2020-02-11 深圳市火乐科技发展有限公司 Firmware updating method and related equipment
CN110784386B (en) * 2019-09-27 2021-12-07 深圳市火乐科技发展有限公司 Firmware updating method and related equipment
CN111651186A (en) * 2020-05-29 2020-09-11 歌尔科技有限公司 Earphone, program upgrading method thereof, control device and readable storage medium
CN111651186B (en) * 2020-05-29 2023-10-03 歌尔科技有限公司 Earphone, program upgrading method thereof, control device and readable storage medium
CN114968321A (en) * 2021-02-25 2022-08-30 新开普电子股份有限公司 Gas meter terminal and cross-version upgrading method thereof
CN114567628A (en) * 2022-02-28 2022-05-31 中汽创智科技有限公司 OTA (over the air) upgrading method and device
CN114567628B (en) * 2022-02-28 2024-03-08 中汽创智科技有限公司 OTA upgrading method and device

Also Published As

Publication number Publication date
CN103605552B (en) 2017-12-29

Similar Documents

Publication Publication Date Title
CN103605552A (en) MCU upgrading method and device
US8571790B2 (en) Method for switching reference map data in navigation device, computer readable medium for the same, and navigation device
CN107391774B (en) The rubbish recovering method of log file system based on data de-duplication
US7165156B1 (en) Read-write snapshots
CN100383720C (en) Multi-volume file support
CN107577436B (en) Data storage method and device
CN102567522B (en) Method and device for managing file system of intelligent card
EP1909068A2 (en) Map data distribution system
CN103186622B (en) The update method of index information and device in a kind of text retrieval system
CN102043656A (en) Software management method and software management server
EP1435576A2 (en) Method and apparatus for block-oriented memory management provided in smart card controllers
CN106462592A (en) Systems and methods to optimize multi-version support in indexes
KR20110117099A (en) Mapping address table maintenance in a memory device
CN101546337A (en) Memory system and data access method
CN101582084B (en) Method and device for data storage
CN104516920A (en) Data inquiry method and data inquiry system
CN102436383A (en) Method and device for processing firmware programs
US9355101B2 (en) Boot in a media player with external memory
CN111309267B (en) Storage space allocation method and device, storage equipment and storage medium
CN106155915A (en) The processing method and processing device of data storage
CN111124464A (en) Method and system for differential upgrade of embedded system and computer readable storage medium
CN103257971B (en) Terminal and file management method
CN104246725A (en) Non-volatile memory device for sequential writing
CN101794261A (en) Mapping table data recovery method and device
CN102253985A (en) File system data management method and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: 516006 community 37, Zhongkai high tech Zone, Huizhou, Guangdong

Patentee after: Tongli Technology Co.,Ltd.

Address before: 516006 Guangdong province Huizhou Zhongkai hi tech Development Zone No. 19 district

Patentee before: TONLY ELECTRONICS HOLDINGS Ltd.

CP03 Change of name, title or address