CN103605552B - MCU upgrading method and device - Google Patents

MCU upgrading method and device Download PDF

Info

Publication number
CN103605552B
CN103605552B CN201310626254.XA CN201310626254A CN103605552B CN 103605552 B CN103605552 B CN 103605552B CN 201310626254 A CN201310626254 A CN 201310626254A CN 103605552 B CN103605552 B CN 103605552B
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.)
Active
Application number
CN201310626254.XA
Other languages
Chinese (zh)
Other versions
CN103605552A (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

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

MCU upgrade method and device
Technical field
The present invention relates to software technology field, more particularly to a kind of MCU upgrade methods and device.
Background technology
To configuring MCU(Micro Control Unit, microprocessor)Electronic product for, software upgrading function is normal Function is advised, when the defects of MCU softwares occurs in product, user can be by solving its technological deficiency to software upgrading.It is existing In technology, the technical scheme upgraded to MCU softwares is usually:The legacy version stored in the flash memory of erasing storage MCU softwares Software, and new version software is write in flash memory, and because the read-write number of flash memory has number limitation, read-write operation number Whether whether frequent, the time length read and write every time to be, is all the principal element for directly affecting flash memory service life, therefore, if Upgrading every time, the service life of flash memory obviously will can be all significantly reduced in new version software data all write-in flash memory, meanwhile, rise Stage efficiency is low.
The content of the invention
The main object of the present invention is to provide a kind of MCU upgrade method and device, it is intended to improves the same of MCU upgrading efficiency When, the service life of the flash memory of extension storage MCU softwares.
The present invention proposes a kind of MCU upgrade method, including:
When receiving the upgrade request of MCU transmissions, software to be upgraded in the MCU is obtained according to the upgrade request received Version number;
According to the syntagmatic of each software version to prestore, and difference section corresponding to each syntagmatic is numbered, The syntagmatic and corresponding difference section numbering of the software to be upgraded and new version software are determined, wherein, the difference piece Area's numbering is two different editions softwares under a syntagmatic, and the section data to be prestored in the section of identical numbering are different Section corresponding to number;
Numbered according to the really difference section, extract section corresponding to the numbering of the difference section in the new version software Section data;
The section data of extraction and difference section numbering are sent to the MCU, so that the MCU is by the section number According to being updated in flash memory in the section of the software to be upgraded corresponding with difference section numbering.
Preferably, when receiving the upgrade request of MCU transmissions, obtained in the MCU and treated according to the upgrade request received Before the step of upgrading the version number of software, this method also includes:
When receiving new version software, the new version software is split as section number according to default section quantity According to, and the section data after fractionation are stored in corresponding section;
Each section of new version software is compared with the data of each corresponding section of legacy version software to prestore, really Determining new version software, difference section corresponding with the section that each legacy version data between software has differences is numbered;
Establish new software version number version syntagmatic corresponding with each Geju City software version number, and the combination of each version The mapping relations of difference section numbering and preservation corresponding to relation.
Preferably, the data of each section by new version software section corresponding with each legacy version software to prestore It is compared, determines that new version software difference section corresponding with the section that each legacy version data between software has differences is compiled Number the step of include:
A, according to the number order of section, successively by each section of new version software section corresponding with legacy version software In each data be compared successively according to data bit order;
B, when there is the data difference in the data bit in the section corresponding with legacy version software of the new version software section, The section numbering for determining the section that data are different in the data bit is difference section numbering, and jumps to the new version software Next section carries out comparing;
C, above-mentioned steps A and B are repeated, until the section of the new version software has all compared and finished.
Preferably, the section data are updated in flash memory and corresponding with difference section numbering described wait to rise by the MCU Level software section in step be specially:
The MCU numbers software to be upgraded in locking MCU according to the difference section needs the section updated;
Whether section data corresponding to the numbering of difference section are empty in the data that the MCU judges to receive;
When in the data received difference section numbering corresponding to section data be space-time, while judge lock section Whether middle section data are empty, if so, then the MCU is directly by section data corresponding to the difference section numbering received Write in the section of the locking, if it is not, then the MCU deletes the data in the section of the locking, while received described Section data corresponding to the numbering of difference section are write in the section of the locking.
The present invention also proposes a kind of MCU update device, including:
Acquisition module, during upgrade request for receiving MCU transmissions, according to obtaining the upgrade request that receives The version number of software to be upgraded in MCU;
Determining module, for the syntagmatic according to each software version to prestore, and corresponding to each syntagmatic Difference section is numbered, and determines the syntagmatic and corresponding difference section numbering of the software to be upgraded and new version software, its In, the difference section numbering is two different editions softwares under a syntagmatic, is prestored in the section of identical numbering The different section of section data corresponding to number;
Extraction module, for according to the really difference section numbering, extracting the difference section in the new version software and compiling The section data of section corresponding to number;
Sending module, for the section data of extraction and difference section numbering to be sent into the MCU, for described The section data are updated in flash memory in the section of the software to be upgraded corresponding with difference section numbering by MCU.
Preferably, the device also includes splitting module and memory module, and the fractionation module is used to receive redaction During software, the existing version software is split as section data according to default section quantity;The memory module is used to tear open Section data after point are stored in corresponding section;The determining module is additionally operable to, by each section of new version software with The data that each legacy version software to prestore corresponds to section are compared, and determine between new version software and each legacy version software Number difference section corresponding to the section that data have differences;The memory module be additionally operable to establish new software version number with it is old soft Version syntagmatic corresponding to part version number, and the mapping relations that difference section corresponding to each version syntagmatic is numbered are simultaneously Preserve.
Preferably, the determining module includes:
Comparing unit, according to the number order of section, successively by each section of the new version software and legacy version software Each data in corresponding section are compared successively according to data bit order;
Determining unit, there is the new version software section different from the data in the corresponding section of legacy version software for working as When, the section numbering for determining the section that data are different in the data bit is difference section numbering;
After the comparing unit is additionally operable to determine that the section numbering of the different section of data bit is difference section numbering, and The next section for jumping to the new version software carries out comparing.
Preferably, the section data are updated in flash memory and corresponding with difference section numbering described wait to rise by the MCU Realize that upgraded module specifically includes by upgraded module in MCU in the section of level software:
Lock cell, needed more for numbering software to be upgraded in locking MCU according to the difference section according to the MCU New section;
Judging unit, whether section data corresponding to the numbering of difference section in the data received for judging the MCU Whether it is empty for section data in sky, and the section for judging to lock;
Unit is deleted, the data in section for deleting locking;
Writing unit, for section data corresponding to the difference section numbering received to be write to the piece of the locking Qu Zhong.
The present invention proposes a kind of MCU upgrade method and device, when receiving the upgrade request of MCU transmissions, according to reception To upgrade request obtain the version number of software to be upgraded in the MCU, and closed according to the combination of each software version to prestore System, and difference section corresponding to each syntagmatic are numbered, and determine that the combination of the software to be upgraded and new version software is closed System and corresponding difference section numbering, and then extract the section of section corresponding to the numbering of the difference section in the new version software Data, and the section data are sent to the MCU, it is corresponding described to be upgraded with difference section numbering to be updated in flash memory In the section of software, so as to realize software upgrading.Number in the section only updated when upgrading in this programme to MCU to needs According to operation is written and read, without by new version software data all write-in flash memory, upgrading efficiency high, and significantly improve The service life of flash memory.
Brief description of the drawings
Fig. 1 is the idiographic flow schematic diagram of MCU of the present invention upgrade method first embodiment;
Fig. 2 is the schematic flow sheet of MCU of the present invention upgrade method second embodiment;
Fig. 3 is the idiographic flow schematic diagram of step S60 in Fig. 2;
Fig. 4 is to be upgraded to be updated to section data in the MCU of the present invention embodiment step S40 of upgrade method first and second Schematic flow sheet in the section of software;
Fig. 5 is the high-level schematic functional block diagram of MCU of the present invention update device preferred embodiment;
Fig. 6 is the concrete structure schematic diagram of determining module in Fig. 5;
Fig. 7 is the concrete structure schematic diagram of the preferred embodiment for the upgraded module that MCU is upgraded;
Fig. 8 is the syntagmatic and each syntagmatic of each software version to prestore in each embodiment of the present invention The schematic diagram of corresponding difference section numbering;
Fig. 9 is open in each embodiment of the present invention, two different editions softwares under a syntagmatic is torn by identical numbering Burst area data and the corresponding schematic diagram stored.
The realization, functional characteristics and advantage of the object of the invention will be described further referring to the drawings in conjunction with the embodiments.
Embodiment
Below in conjunction with the accompanying drawings and specific embodiment is described further with regard to technical scheme.It should be appreciated that this The specific embodiment of place description is not intended to limit the present invention only to explain the present invention.
Reference picture 1, Fig. 1 are the idiographic flow schematic diagram of MCU of the present invention upgrade method first embodiment.
The present embodiment proposes a kind of MCU upgrade method, including:
Step S10, when receiving the upgrade request of MCU transmissions, obtained in the MCU and treated according to the upgrade request received Upgrade the version number of software.
The executive agent of the present embodiment is by taking server as an example.The version number of its software to be upgraded can be encapsulated in MCU's by MCU In upgrade request, for server when receiving the upgrade request of MCU transmissions, the upgrade request is decoded please to obtain upgrading The version number of software to be upgraded in the MCU asked.
The running software that MCU is carried in the present embodiment in a flash memory, is configured with MCU electronic product in start, or Person can obtain the latest edition of the software of MCU installations when user triggers upgrade request by button or other devices to server This information(Such as version number), the version information of software of the version information got with being preserved in flash memory is compared, with true Whether the software for determining currently to preserve in flash memory is latest edition, if the software currently preserved in flash memory is not latest edition, is carried Show whether user is upgraded, when receiving the confirmation of user, MCU sends upgrade request to server, in the upgrading In request, the version number of MCU softwares is included.
Step S20, according to the syntagmatic of each software version to prestore, and difference piece corresponding to each syntagmatic Area numbers, and determines the syntagmatic and corresponding difference section numbering of the software to be upgraded and new version software;
The difference section numbering is two different editions softwares under a syntagmatic, in the section of identical numbering The section data that prestore are numbered corresponding to different sections.
In the present embodiment, the storage region of MCU flash memory is divided into the section of predetermined number, and section is entered in order Line number, and by MCU software data be divided into section quantity identical section data, by section data and section numbering map Preserving, the size of each section may be the same or different in the present embodiment, and the size of preferably each section is identical, such as often The size of individual section is 1kb.As shown in figure 9, piece of the server by the software data of each version according to MCU storage region Area's quantity is split as multiple section data, and each section data are stored in corresponding section, while according in MCU flash memory The order of section is numbered to the section divided in server, and section data and section numbering mapping are preserved.
Server is split as piece when receiving new version software data, by new version software according to default section quantity Area's data, and the section data after fractionation are stored in corresponding section, and new version software and legacy version software are carried out Compare, determine the section numbering that section data have differences between redaction and legacy version, and record, to establish new software version The syntagmatic of number version corresponding with old software version number(Such as software version 1 and software version 5 can form a combination and close System, the syntagmatic correspond to the variance data of software version 5 and software version 1), and corresponding to each version syntagmatic it is poor Different section numbering, the mapping relations that difference section corresponding to each version syntagmatic is numbered can be by mapping tables come real It is existing.
As shown in figure 9, two different editions softwares under a syntagmatic(It is defined as new version software and legacy version is soft Part), it is section 1 to section 13 that its section stored, which is numbered, when comparison, new version software is identical with legacy version software The section of numbering is compared respectively, for example, the number by the data of the section 1 of new version software and the section 1 of legacy version software According to being compared, by the data of the section 2 of new version software compared with the data of the section 2 of legacy version software,,, with This analogizes, until finding data has discrepant section, the numbering of the section is that difference section is numbered, such as new version software Section 4 data it is different from the data of the section 4 of legacy version software, then the difference section numbering be section 4.Between each version Syntagmatic and with difference section numbering mapping table it is as shown in Figure 8.The stringer of the left side first represents current rise in form All version numbers deposited in level server, wherein assuming that current newest version number is V6.0;The row of top first, which represents, works as Preceding user uses the version number of machine(Assuming that the machine current version of user is V4.0);Due to the characteristics of upgrading be can only be from Lowest version is upgraded to highest version, and can not upgrade between identical version, therefore upper right half is invalid data in form, Labeled as NA, bottom left section is then effective variance data, then the content of MCU upgradings is located at V4.0 and V6.0 intersection, The data of the intersection are V4.0 and the difference section of V6.0 version software data is numbered, and server is getting MCU softwares After version number, the difference between the software on latest edition software and MCU can be easily got according to MCU software version numbers Number section.
Step S30, numbered, extracted in the new version software corresponding to the numbering of the difference section according to the difference section The section data of section;
In the present embodiment, server can preserve the software data burst area of each version, while preserve each version Software section numbering and the mapping relations of section data, then the difference can be obtained according to new software version number, difference section numbering Section data corresponding to different section numbering.
Step S40, the section data of extraction and difference section numbering are sent to the MCU, so that the MCU is by institute Section data are stated to be updated in flash memory in the section of the software to be upgraded corresponding with difference section numbering.
In other variant embodiments, when the software currently preserved in flash memory is not latest edition, and currently preserve When the version number of software and the non-conterminous version number of latest edition software, prompt message can be pushed to user, to prompt user to select Select and which version upgraded to, when receiving the selection information of user, determine the software version number of user's selection, now MCU is to clothes The upgrade request that business device is sent includes the version number for the software that MCU is currently carried and the software version number of MCU request upgradings, Server is now according to the syntagmatic of the new software version number version corresponding with old software version number to prestore, and each group Difference section corresponding to conjunction relation is numbered, and determines the version number for the software that MCU is currently carried and the software version of MCU request upgradings Difference section numbering corresponding to the syntagmatic of this number, and the software version number and difference for asking to upgrade according to the MCU of determination Section is numbered, and prestore section data corresponding to the numbering of extraction difference section, by prestore section data and the difference section volume of extraction Number the MCU is sent to, is dodged so that the section data that prestore of extraction are updated to corresponding to the difference section numbering by the MCU Deposit section.This scheme has selectivity, when MCU has compatibling problem, does not force customer upgrade to the software of latest edition, with Reduce produced problem after upgrading.
The upgrade method for the MCU that the present embodiment proposes, when receiving the upgrade request of MCU transmissions, according to the liter received The version number of software to be upgraded in MCU described in level acquisition request, and according to the syntagmatic of each software version to prestore, and Difference section corresponding to each syntagmatic is numbered, and determines the syntagmatic of the software to be upgraded and new version software and corresponding Difference section numbering, and then extract the section data of section corresponding to the numbering of the difference section in the new version software, and The section data are sent to the MCU, to be updated to the software to be upgraded corresponding with difference section numbering in flash memory In section, so as to realize software upgrading.Data in the section only updated when this programme upgrades to MCU to needs are written and read Operation, without by new version software data all write-in flash memory, upgrading efficiency high, significantly improve flash memory uses the longevity Life.
Reference picture 2, Fig. 2 are the schematic flow sheet of MCU of the present invention upgrade method second embodiment.
MCU of the present invention upgrade method second embodiment, in the present embodiment, step S10 are proposed based on first embodiment Include before:
Step S50, when receiving new version software, new version software is split as section according to default section quantity Data, and the section data after fractionation are stored in corresponding section;
Step S60, the data of each section of new version software section corresponding with each legacy version software to prestore are entered Row compares, and determines that new version software difference section corresponding with the section that each legacy version data between software has differences is compiled Number;
Step S70, new software version number version syntagmatic corresponding with each Geju City software version number is established, and it is each The mapping relations of difference section numbering and preservation corresponding to version syntagmatic.
In the present embodiment, server is when receiving new version software, by the new version software received and prestores Each legacy version software is compared successively.When new version software and each legacy version software to prestore compare, by redaction Each section of software is compared one by one with the data of the corresponding section of legacy version software to prestore, in new version software and old edition During the data difference having in section of this software, it is difference section to determine the section, and continues to compare other sections, in redaction Software and the legacy version software compare when finishing, the syntagmatic established between the new version software and legacy version software(The group Conjunction relation includes new version software number and legacy version kit mumber), while establish the syntagmatic and number it with difference section Between mapping relations(As shown in Figure 8), and continue new version software being compared with other legacy version softwares, until completing new The comparison process of version software and all legacy version softwares.
Reference picture 3, Fig. 3 are the idiographic flow schematic diagram of step S60 in Fig. 2.
In MCU of the present invention upgrade method second embodiment, step S60 includes:
Step S61, according to the number order of section, successively by each section of the new version software and legacy version software pair Each data in section are answered to be compared successively according to data bit order;
Step S62, when there is the data in the data bit in the section corresponding with legacy version software of the new version software section When different, the section numbering for determining the section that data are different in the data bit is difference section numbering, and jumps to the new edition Next section of this software carries out comparing;
Step S63, above-mentioned steps S61 and step S62 are repeated, until the section of the new version software has all compared Finish.
When comparing, new version software and the first data bit of the first section of legacy version software are compared first, first When data bit is identical, continue to compare other data bit of the first section of new version software and legacy version software in order, the When there is data bit difference one section, it is difference section to determine the first section, and jumps to next section and be compared, other sections Alignments it is identical with the alignments of the first section, until after having compared all sections, establish the new version software and Syntagmatic between legacy version software, while the mapping relations established between the syntagmatic and difference section, and continue by New version software is compared with other legacy version softwares;Be provided with a counter in the present embodiment, when new version software with First data bits of the section of legacy version software first according to it is identical when, counter adds 1, and compare in order new version software with it is old Other data bit of first section of version software, and when data bits is according to being identical, counter adds 1, until there is data bit Data are different, jump to next section and are compared, or next section is jumped to when the numerical value of counter reaches preset value It is compared(The preset value is relevant with the size of section), the alignments of other sections and the alignments phase of the first section Together, will not be repeated here.
Reference picture 4, Fig. 4 are to update section data in the MCU of the present invention embodiment step S40 of upgrade method first and second Schematic flow sheet into the section of software to be upgraded.
In the present embodiment, the section data are updated in flash memory described treat corresponding with difference section numbering by MCU Upgrade software section in step be specially::
Step S80, the MCU number software to be upgraded in locking MCU according to the difference section needs the section updated;
Step S90, whether section data corresponding to the numbering of difference section are empty in the data that the MCU judges to receive;
Step S100, when in the data received difference section numbering corresponding to section data be not space-time, judge simultaneously Whether section data are empty in the section of locking, if so, then the MCU is directly corresponding by the difference section numbering received Section data write in the section of the locking, if it is not, then the MCU deletes the data in the section of the locking, while by institute Section data corresponding to stating the difference section numbering received are write in the section of the locking.
When being that legacy version software is compared due to new version software, the difference between new version software and legacy version software Different section there may be sky data, and now MCU is in the data stored in updating flash memory, it is understood that there may be 3 kinds of situations, i.e., directly deletes Write direct in the data of difference section and delete in difference section except the data in difference section, by the data received The data received are write into difference section while data, then MCU is receiving section data of server transmission and correspondingly Difference section numbering when, when server only sends difference section numbering and corresponding section data every time, specifically Operating process is as follows:Difference section is locked first numbers section corresponding with the software run in MCU, and in data are received Only numbered comprising difference section, and data are not space-time in the section locked, illustrate new version software and the software run in MCU Data should be sky in the updated for difference section in this, now delete the data in the section of locking;Or receiving Comprising difference section numbering and section data in data, and lock section Zhong You sections data when, then with the section got Data in the section of data renewal locking;Difference section numbering and section data are being included in data are received, and are being locked When there is no section data in fixed section, by the section of the section data write lock-out got.Wherein, because server is every It is secondary only to send a difference section numbering and corresponding section data, then it can be sent out after server data is sent to MCU End of identification is sent, when receiving end of identification, stopping is upgraded MCU, and jumps to application layer.
Or server is reduction transmission times, the mapping relations that can be established between difference section numbering and section data, And the mapping relations between the data of section are numbered into difference section, and section data are sent to MCU, MCU will can be obtained successively Section data are taken to be updated to flash memory section corresponding to corresponding difference section numbering, specific renewal process is specific as previously discussed not Repeat again.
Reference picture 5, Fig. 5 are the high-level schematic functional block diagram of MCU of the present invention update device preferred embodiment.
The present embodiment proposes a kind of MCU update device, including:
Acquisition module 10, when receiving the upgrade request of MCU transmissions, the MCU is obtained according to the upgrade request received In software to be upgraded version number;
The executive agent of the present embodiment is equally by taking server as an example.MCU version number can be encapsulated in MCU upgrading by MCU In request, server is decoded to obtain in upgrade request when receiving the upgrade request of MCU transmissions to the upgrade request MCU software version numbers.
In a flash memory, the electronic product for being configured with MCU is being started shooting for the preferred operation of software that MCU is carried in the present embodiment When, or when user triggers upgrade request by button or other devices, the software of MCU installations can be obtained to server most Redaction information(Such as version number), the version information of software of the version information got with being preserved in flash memory is compared, Whether it is latest edition with the software for determining currently to preserve in flash memory, if the software currently preserved in flash memory is not latest edition, Then prompt the user whether to be upgraded, when receiving the confirmation of user, upgrade request is sent to server, in the upgrading In request, the version number of MCU softwares is included.
Determining module 20, it is corresponding for the syntagmatic according to each software version to prestore, and each syntagmatic Difference section numbering, determine the software to be upgraded and new version software syntagmatic and corresponding difference section numbering; Difference section numbering is two different editions softwares under a syntagmatic, the piece to be prestored in the section of identical numbering Numbered corresponding to the different section of area's data;
In the present embodiment, the storage region of MCU flash memory is divided into the section of predetermined number, and section is entered in order Line number, and by MCU software data be divided into section quantity identical section data, by section data and section numbering map Preserving, the size of each section may be the same or different in the present embodiment, and the size of preferably each section is identical, such as often The size of individual section is 1kb.As shown in figure 9, section of the server by each version software data according to MCU storage region Quantity is split as multiple section data, and each section data are stored in corresponding section, while according to the piece in MCU flash memory The order in area is numbered to the section divided in server, and section data and section numbering mapping are preserved.
Server is compared when receiving new version software data, by new version software with legacy version software, it is determined that Section data have differences between redaction and legacy version section numbering, and recording, with establish new software version number with it is old soft The syntagmatic of version corresponding to part version number, and difference section corresponding to each syntagmatic are numbered, each version combination The mapping relations that difference section corresponding to relation is numbered can be realized by mapping table, such as software version 1 and software version Originally 5 a version syntagmatic can be formed, the syntagmatic corresponds to the variance data of software version 5 and software version 1, version group Conjunction relation and the mapping table that difference section is numbered are as shown in Figure 8.The stringer of the left side first represents current upgrade service in form All version numbers deposited in device, wherein assuming that current newest version number is V6.0;The row of top first represents active user The version number of used machine(Assuming that the machine current version of user is V4.0);Due to upgrading the characteristics of be can only be from lowest version Highest version is upgraded to, and can not be upgraded between identical version, therefore upper right half is invalid data in form, is labeled as NA, bottom left section are then effective variance data, then the content of MCU upgradings is located at V4.0 and V6.0 intersection, the intersection Data at point are numbered for V4.0 and the difference section of V6.0 version software data, and server is getting MCU software versions After number, the difference section between the software on latest edition software and MCU can be easily got according to MCU software version numbers Numbering.
Extraction module 30, for according to the really difference section numbering, extracting the difference section in the new version software The section data of section corresponding to numbering;
In the present embodiment, server can preserve the mapping relations of the software section numbering and section data of each version, Then the section data that prestored corresponding to the numbering of the difference section can be obtained according to new software version number, difference section numbering;Or clothes The data of business device only legacy version software, and the mapping relations of the section numbering and section data of old edition are preserved, it is soft in redaction After the completion of part compares with legacy version software, only corresponding to preservation difference section numbering and new version software difference section numbering Section data, and the mapping relations of difference section numbering and section data, the data of other unchanged sections are deleted, with section Save the memory space of server.
Sending module 40, for the section data of extraction and difference section numbering to be sent into the MCU, for described The section data are updated in flash memory in the section of the software to be upgraded corresponding with difference section numbering by MCU.
In other variant embodiments, when the software currently preserved in flash memory is not latest edition, and currently preserve When the version number of software and the non-conterminous version number of latest edition software, prompt message can be pushed to user, to prompt user to select Select and which version upgraded to, when receiving the selection information of user, determine the software version number of user's selection, now MCU is to clothes The upgrade request that business device is sent includes the version number for the software that MCU is currently carried and the software version number of MCU request upgradings, Server is now according to the syntagmatic of the new software version number version corresponding with old software version number to prestore, and each group The mapping relations that difference section corresponding to conjunction relation is numbered, the version number and MCU requests for determining the software that MCU is currently carried rise Difference section numbering corresponding to the syntagmatic of the software version number of level, and the software version for asking to upgrade according to the MCU of determination This number and difference section numbering, prestore corresponding to the numbering of extraction difference section section data, by extraction prestore section data and Difference section numbering is sent to the MCU, is compiled so that the section data that prestore of extraction are updated to the difference section by the MCU Flash memory section corresponding to number.This scheme has selectivity, when MCU has compatibling problem, does not force customer upgrade to latest edition This software, to reduce produced problem after upgrading.
The update device for the MCU that the present embodiment proposes, when receiving the upgrade request of MCU transmissions, according to the liter received The version number of software to be upgraded in MCU described in level acquisition request, and according to the syntagmatic of each software version to prestore, and Difference section corresponding to each syntagmatic is numbered, and determines the syntagmatic of the software to be upgraded and new version software and corresponding Difference section numbering, and then extract the section data of section corresponding to the numbering of the difference section in the new version software, and The section data are sent to the MCU, to be updated to the software to be upgraded corresponding with difference section numbering in flash memory In section, so as to realize software upgrading.Data in the section only updated when upgrading in this programme to MCU to needs are carried out Read-write operation, without by new version software data all write-in flash memory, upgrading efficiency high, and significantly improve flash memory Service life.
In MCU of the present invention update device preferred embodiment, the device also includes splitting module 50 and memory module 60, The fractionation module 50 is used for when receiving new version software, will be split as section number according to the default section quantity property entered According to;The memory module 60 is used to the section data after fractionation being stored in corresponding section;The determining module 20 is also used In each section of new version software being compared with the data of each corresponding section of legacy version software to prestore, it is determined that newly Version software difference section numbering corresponding with the section that each legacy version data between software has differences;The memory module 60 are additionally operable to establish new software version number version syntagmatic corresponding with old software version number, and each version syntagmatic The mapping relations of corresponding difference section numbering and preservation.
In the present embodiment, server is when receiving new version software, by the new version software received and prestores Each legacy version software is compared successively.When new version software and each legacy version software to prestore compare, by redaction Each section of software is compared one by one with the data of the corresponding section of legacy version software to prestore, in new version software and old edition During the data difference having in section of this software, it is difference section to determine the section, and continues to compare other sections, in redaction Software and the legacy version software compare when finishing, the syntagmatic established between the new version software and legacy version software(The group Conjunction relation includes new version software number and legacy version kit mumber), while establish between the syntagmatic and difference section Mapping relations(As shown in Figure 8), and continue new version software being compared with other legacy version softwares, until completing redaction The comparison process of software and all legacy version softwares.
Reference picture 6, Fig. 6 are the concrete structure schematic diagram of determining module in Fig. 5.
In MCU of the present invention update device preferred embodiment, the determining module 20 includes:
Comparing unit 21 is soft by each section of the new version software and legacy version successively according to the number order of section Each data that part is corresponded in section are compared successively according to data bit order;
Determining unit 22, there is the new version software section different from the data in the corresponding section of legacy version software for working as When, the section numbering for determining the section that data are different in the data bit is difference section numbering;
After the comparing unit 21 is additionally operable to determine that the section numbering of the different section of data bit is difference section numbering, And the next section for jumping to the new version software carries out comparing
When comparing, new version software and the first data bit of the first section of legacy version software are compared first, first When data are identical in data bit, continue to compare new version software and other data bit of the first section of legacy version software in order Upper data, when having data difference in the first section, it is difference section to determine the first section, and jumps to next section and compared Right, the alignments of other sections are identical with the alignments of the first section, until after having compared all sections, it is new to establish this Syntagmatic between version software and legacy version software, while establish the pass of the mapping between the syntagmatic and difference section System, and continue new version software being compared by section with the data in other legacy version softwares;Set in the present embodiment There is a counter, when new version software is identical with the first data bit of the section of legacy version software first, counter adds 1, and presses Order compares new version software and other data bit of the first section of legacy version software, and when data bit is identical, counts Device adds 1, until there is data bit different, jumps to next section and is compared, or when the numerical value of counter reaches preset value Next section is jumped to be compared(The preset value is relevant with the size of section), the alignments of other sections and the first section Alignments it is identical, will not be repeated here.
Reference picture 7, Fig. 7 are the concrete structure schematic diagram of the preferred embodiment for the upgraded module that MCU is upgraded.
In MCU of the present invention update device preferred embodiment, the MCU by the section data be updated in flash memory with Realize that upgraded module is specific by upgraded module in MCU 70 in the section of the software to be upgraded corresponding to the numbering of difference section Including:
Lock cell 71, for numbering software needs to be upgraded in locking MCU according to the difference section according to the MCU The section of renewal;
Judging unit 72, section data corresponding to the numbering of difference section are in the data received for judging the MCU No is sky, and judges whether section data are empty in the section of locking;
Unit 73 is deleted, the data in section for deleting locking;
Writing unit 74, for section data corresponding to the difference section numbering received to be write into the locking In section.
When being that legacy version software is compared due to new version software, the difference between new version software and legacy version software Different section there may be sky data, and now MCU is in the data stored in updating flash memory, it is understood that there may be 3 kinds of situations, i.e., directly deletes Write direct in the data of difference section and delete in difference section except the data in difference section, by the data received The data received are write into difference section while data, then MCU is receiving section data of server transmission and correspondingly Difference section numbering when, when server only sends difference section numbering and corresponding section data every time, specifically Operating process is as follows:Difference section is locked first numbers section corresponding with the software run in MCU, and in data are received Only numbered comprising difference section, and data are not space-time in the section locked, illustrate new version software and the software run in MCU Data should be sky in the updated for difference section in this, now delete the data in the section of locking;Or receiving Comprising difference section numbering and section data in data, and lock section Zhong You sections data when, then with the section got Data in the section of data renewal locking;Comprising difference section numbering and section data in data are received, and lock When there is no section data in section, by the section of the section data write lock-out got.Wherein, because server is each only A difference section numbering and corresponding section data are sent, then can send and tie to MCU after server data is sent Beam identification, when receiving end of identification, stopping is upgraded MCU, and jumps to application layer.
Or server is reduction transmission times, the mapping relations that can be established between difference section numbering and section data, And the mapping relations between the data of section are numbered into difference section, and section data are sent to MCU, MCU will can be obtained successively Section data are taken to be updated to flash memory section corresponding to corresponding difference section numbering, specific renewal process is specific as previously discussed not Repeat again.
The preferred embodiments of the present invention are the foregoing is only, are not intended to limit the scope of the invention, every utilization The equivalent structure transformation that description of the invention and accompanying drawing content are made, or directly or indirectly it is used in other related technology necks Domain, it is included within the scope of the present invention.

Claims (8)

  1. A kind of 1. MCU upgrade method, it is characterised in that including:
    When receiving the upgrade request of MCU transmissions, the version of software to be upgraded in the MCU is obtained according to the upgrade request received This number;
    According to the syntagmatic of each software version to prestore, and difference section corresponding to each syntagmatic is numbered, it is determined that The software to be upgraded is numbered with the syntagmatic of new version software and corresponding difference section, wherein, the difference section is compiled Number for two different editions softwares under syntagmatic, the different piece of the section data that are prestored in the section of identical numbering Numbered corresponding to area;
    Numbered according to the difference section, extract the section number of section corresponding to the numbering of the difference section in the new version software According to, wherein, storage section numbering of the difference section numbering with the section data in the MCU is identical;
    By the section data of extraction and the difference section numbering be sent to the MCU, for the MCU by the section data more Newly into flash memory in the section of the software to be upgraded corresponding with difference section numbering.
  2. 2. according to the method for claim 1, it is characterised in that it is described receive MCU transmissions upgrade request when, according to connecing Before the upgrade request received obtains the step of version number of software to be upgraded in the MCU, this method also includes:
    When receiving new version software, the new version software is split as section data according to default section quantity, and Section data after fractionation are stored in corresponding section;
    Each section of new version software is compared with the data of each corresponding section of legacy version software to prestore, it is determined that newly Version software difference section numbering corresponding with the section that each legacy version data between software has differences;
    Establish new software version number version syntagmatic corresponding with each Geju City software version number, and each version syntagmatic The mapping relations of corresponding difference section numbering and preservation.
  3. 3. according to the method for claim 2, it is characterised in that each section by new version software is each with prestoring The data that Geju City version software corresponds to section are compared, and determine that new version software exists with each legacy version data between software Include corresponding to the section of difference the step of the numbering of difference section:
    A, according to the number order of section, successively by the section corresponding with legacy version software of each section of the new version software Each data are compared successively according to data bit order;
    B, when there is the data difference in the data bit in the section corresponding with legacy version software of the new version software section, it is determined that The section numbering of the different section of data is difference section numbering in the data bit, and jumps to the next of the new version software Section carries out comparing;
    C, above-mentioned steps A and B are repeated, until the section of the new version software has all compared and finished.
  4. 4. according to the method for claim 1, it is characterised in that the MCU by the section data be updated in flash memory with Difference section numbering corresponding to the software to be upgraded section in step be specially:
    The MCU numbers software to be upgraded in locking MCU according to the difference section needs the section updated;
    Whether section data corresponding to the numbering of difference section are empty in the data that the MCU judges to receive;
    When in the data received difference section numbering corresponding to section data be space-time, while judge lock section in piece Whether area's data are empty, if so, then the MCU is directly by section data write-in corresponding to the difference section numbering received In the section of the locking, if it is not, then the MCU deletes the data in the section of the locking, while by the difference received Section data corresponding to the numbering of section are write in the section of the locking.
  5. A kind of 5. MCU update device, it is characterised in that including:
    Acquisition module, during upgrade request for receiving MCU transmissions, obtained according to the upgrade request that receives in the MCU The version number of software to be upgraded;
    Determining module, for the syntagmatic according to each software version to prestore, and difference corresponding to each syntagmatic Section is numbered, and determines the syntagmatic and corresponding difference section numbering of the software to be upgraded and new version software, wherein, institute It is two different editions softwares under a syntagmatic to state difference section numbering, the section to be prestored in the section of identical numbering Numbered corresponding to the different section of data;
    Extraction module, for according to the really difference section numbering, extracting difference section numbering pair in the new version software The section data for the section answered;
    Sending module, for the section data of extraction and difference section numbering to be sent into the MCU, so that the MCU will The section data are updated in flash memory in the section of the software to be upgraded corresponding with difference section numbering.
  6. 6. device according to claim 5, it is characterised in that the device also includes splitting module and memory module, described Split module to be used for when receiving new version software, the new version software is split as section according to default section quantity Data;The memory module is used to the section data after fractionation being stored in corresponding section;The determining module is additionally operable to, Each section of new version software is compared with the data of each corresponding section of legacy version software to prestore, determines redaction Software difference section numbering corresponding with the section that each legacy version data between software has differences;The memory module is also used In establishing new software version number version syntagmatic corresponding with old software version number, and corresponding to each version syntagmatic The mapping relations of difference section numbering and preservation.
  7. 7. device according to claim 6, it is characterised in that the determining module includes:
    Comparing unit, it is successively that each section of the new version software is corresponding with legacy version software according to the number order of section Each data in section are compared successively according to data bit order;
    Determining unit, for when there is the data difference in the section corresponding with legacy version software of the new version software section, really The section numbering of the different section of data is difference section numbering in the fixed data bit;
    After the comparing unit is additionally operable to determine that the section numbering of the different section of data bit is difference section numbering, and redirect Comparing is carried out to next section of the new version software.
  8. 8. device according to claim 5, it is characterised in that the MCU by the section data be updated in flash memory with Realize that upgraded module specifically wraps by upgraded module in MCU in the section of the software to be upgraded corresponding to the numbering of difference section Include:
    Lock cell, need what is updated for numbering software to be upgraded in locking MCU according to the difference section according to the MCU Section;
    Judging unit, in the data received for judging the MCU section data corresponding to the numbering of difference section whether be it is empty, And judge whether section data are empty in the section of locking;
    Unit is deleted, the data in section for deleting locking;
    Writing unit, for section data corresponding to the difference section numbering received to be write to the section of the locking In.
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 CN103605552A (en) 2014-02-26
CN103605552B true 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)

Families Citing this family (9)

* 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
CN105912340A (en) * 2016-04-26 2016-08-31 江苏惠通集团有限责任公司 Primary device, remote control and overhead upgrading method of remote control
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
CN110784386B (en) * 2019-09-27 2021-12-07 深圳市火乐科技发展有限公司 Firmware updating method and related equipment
CN111651186B (en) * 2020-05-29 2023-10-03 歌尔科技有限公司 Earphone, program upgrading method thereof, control device and readable storage medium
CN114567628B (en) * 2022-02-28 2024-03-08 中汽创智科技有限公司 OTA upgrading method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1574952B1 (en) * 2004-03-10 2008-04-16 Sony Ericsson Mobile Communications AB Automatic backup store in firmware upgrades

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Also Published As

Publication number Publication date
CN103605552A (en) 2014-02-26

Similar Documents

Publication Publication Date Title
CN103605552B (en) MCU upgrading method and device
CN100468345C (en) Competition solving device
CN110489382B (en) Processing method, system and storage medium for cloud mobile phone game progress data
CN100504769C (en) System and method for implementing a general application program interface
CN103685495B (en) The upgrade method and system of software
EP2437570A1 (en) Method for managing application information implemented by a mobile phone and application manager
CN102043656A (en) Software management method and software management server
CN104007992A (en) Methods and devices for program updating and starting
CN106330561A (en) Dynamic UI setting method and apparatus
CN105959451A (en) MBN loading method and mobile terminal
CN113986543A (en) Memory release method, device, equipment and storage medium
KR101203741B1 (en) System and method for widget service based on smart card, and smart card applied to the same
CN111158788B (en) Desktop starter control method and device and storage medium
CN106708507B (en) Method for optimizing boot application installation time based on Android system
CN102819570B (en) A kind of data access method, Apparatus and system
CN102137122B (en) Method and device for downloading data
US20150112591A1 (en) Apparatus and method for partially updating a navigation data while driving
CN110069505B (en) Offline data processing method and offline data updating device
CN108390916B (en) Picture downloading method and terminal
KR20100010736A (en) Method for managing heterogeneity application in mobile communication terminal and mobile communication terminal using the same
CN103473091B (en) For the software transfer installation method and system of computing device
US7739688B1 (en) Techniques for managing distribution of well-defined objects in a client/server system
CN107491326A (en) A kind of vehicle mounted guidance automatic adaptation method for upgrading software
CN107239469B (en) Routing information query method and device
KR20060015969A (en) Electronic apparatus and program update method of thereof

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