CN107634859A - A kind of firmware upgrade method and device - Google Patents

A kind of firmware upgrade method and device Download PDF

Info

Publication number
CN107634859A
CN107634859A CN201710915238.0A CN201710915238A CN107634859A CN 107634859 A CN107634859 A CN 107634859A CN 201710915238 A CN201710915238 A CN 201710915238A CN 107634859 A CN107634859 A CN 107634859A
Authority
CN
China
Prior art keywords
firmware
main control
control chip
firmware data
module
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
CN201710915238.0A
Other languages
Chinese (zh)
Other versions
CN107634859B (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.)
Feitian Technologies Co Ltd
Original Assignee
Feitian Technologies Co 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 Feitian Technologies Co Ltd filed Critical Feitian Technologies Co Ltd
Priority to CN201710915238.0A priority Critical patent/CN107634859B/en
Publication of CN107634859A publication Critical patent/CN107634859A/en
Application granted granted Critical
Publication of CN107634859B publication Critical patent/CN107634859B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention discloses a kind of firmware upgrade method and device, it is related to information security field.Methods described includes:Main control chip receives the firmware upgrade instruction that host computer issues, and returns to success response data to host computer;Receive the packet that host computer issues, if not the firmware data that end packet then obtains from the packet is stored to backup memory block, success response data are returned to host computer, if end packet then obtains signed data from the end packet, sign test is carried out to the signed data according to preset signature key and the firmware data being currently received, firmware data is read from the backup memory block if sign test success and be written to application memory area, complete firmware upgrade;Reported an error if sign test failure.

Description

A kind of firmware upgrade method and device
Technical field
The present invention relates to information security field, more particularly to a kind of firmware upgrade method and device.
Background technology
Firmware is exactly the program write in EPROM, EEPROM or Flash chip, popular understanding be exactly " solidification it is soft Part ", it is the program code for being solidificated in IC interior, is responsible for the function of control and cooperation and integration circuit.With technology not Disconnected development, and the extensive use of Bluetooth technology, to adapt to the hardware environment constantly updated, consolidate to the USB firmwares and bluetooth of product Part is upgraded also more and more frequent.In the prior art, to USB firmwares in product upgrade the security means of use, generally It is to be transmitted after USB firmwares are encrypted using USB interface to complete to upgrade, bluetooth firmware in product is upgraded Way be using OTA (Over-the-Air, aerial download) upgrade method, mainly by wireless network (such as WIFI, OTA AKUs, automatic upgrading 3G) are downloaded automatically.On the one hand progress firmware is transmitted based on wireless network or based on USB interface ciphertext It is low to upgrade security, OTA firmware upgrades are on the other hand carried out based on wireless network, transmission effect certainly will be influenceed when firmware is larger Rate, and if transmission time is grown, the dump energy of bluetooth equipment can be also limited to by completing upgrading.
The content of the invention
For solve problems of the prior art, the present invention propose it is a kind of safer and by USB interface come That realizes carries out the method and device of safety upgrade to USB firmwares or bluetooth firmware.
The technical solution adopted by the present invention is as follows:A kind of firmware upgrade method, including:
Step S1, main control chip receives the firmware upgrade instruction that host computer issues, and returns to success response number to host computer According to;
Step S2, described main control chip receives the packet that host computer issues;
Step S3, described main control chip judges whether the packet is end packet, is then to perform step S4, otherwise described Main control chip obtained from the packet firmware data packet sequence number, firmware data length value and with the firmware data length value Corresponding firmware data, by the firmware data of acquisition storage to backup memory block, according to the firmware data packet sequence number and The firmware data length value determines that the main control chip is currently received firmware data total length and recorded, and is returned to host computer Success response data, return to step S2;
Step S4, described main control chip obtains signed data from the end packet, according to preset signature key and currently The firmware data corresponding with the firmware data total length stored in backup memory block carries out sign test to the signed data, if The then described main control chip of sign test success reads firmware number corresponding with the firmware data total length from the backup memory block According to application memory area is written to, firmware upgrade is completed, is terminated;Main control chip reports an error if sign test failure, terminates.
Also include between above-mentioned steps S2 and step S3:Whether the packet that the main control chip judges to receive is starting Bag, it is that then the main control chip obtains firmware data length value and firmware data from the starting bag, from the firmware data Middle acquisition product description information storage, will be surplus in addition to the product description information in the firmware data to the second memory block Remaining data Cun Chudao backs up memory block, the firmware data overall length for determining to be currently received according to the firmware data length value Spend and record, return to success response data to host computer, return and perform step S2;Otherwise the step S3 is performed.
Wherein, whether the packet that above-mentioned main control chip judges to receive is that starting bag is specially:The main control chip obtains The firmware data packet sequence number included in the packet received is taken, judges that the packet is according to the firmware data packet sequence number The no starting bag for firmware data.
Preferably, also include during the success of sign test described in above-mentioned steps S4:
Step S5, described main control chip judges whether the product description information in the second memory block is correct, is then to perform step Main control chip described in rapid S4 reads firmware data corresponding with the firmware data total length from the backup memory block and write Enter to application memory area, complete firmware upgrade, terminate;Otherwise the main control chip reports an error, and terminates.
Preferably, the main control chip judges also to include when the product description information is correct:
Step S6, the firmware that described main control chip judges to store in backup memory block according to the product description information Whether data are bluetooth firmware data, are then to perform step S7, otherwise perform main control chip described in step S4 from the backup Firmware data corresponding with the firmware data total length is read in memory block and is written to application memory area, completes firmware upgrade, Terminate;
Step S7, described main control chip writes the bluetooth firmware data into Bluetooth chip by SWD interfaces, completes solid Part upgrades, and terminates.
Wherein, above-mentioned main control chip judges whether the packet is that end packet is specially:The main control chip judges to connect Whether the 8th byte of the packet received is 0xFF, is, the packet is the end packet of firmware data, otherwise the number It is not the end packet of firmware data according to bag.
Preferably, the above method also includes:
Step 101:Main control chip power-up initializing, run bootstrap loader;
Step 102:The main control chip judges whether to redirect operation application program, is then to perform step 104, otherwise performs Step 103;
Step 103:The main control chip reads firmware data from backup memory block and is written to application memory area, then returns Return step 101;
Step 104:The main control chip receives the instruction that host computer issues;
Step 105:Whether the instruction that the main control chip judges to receive is firmware upgrade instruction, is then to perform step S1 It is described to return to success response data to host computer, otherwise perform step 106;
Step 106:The main control chip performs corresponding operating according to the instruction received, is then back to step 101.
Wherein, the main control chip judges whether that redirecting operation application program is specially:The main control chip is deposited from first Storage area reads flag bit, judges whether the flag bit is equal to the first preset value, is then to perform step 103, otherwise redirects operation Application program, perform the step 104;
It is the first preset value also to include changing the flag bit during success of sign test described in the step S4;The step It is the second preset value also to include changing the flag bit before return to step 101 described in 103.
Whether the instruction that above-mentioned main control chip judges to receive is that firmware upgrade instruction is specially:The main control chip judges Whether the 5th byte of the instruction received is equal to 0xBA, is, the instruction is firmware upgrade instruction, otherwise described solid Part instruction is not firmware upgrade instruction.
Preferably, the main control chip is read corresponding with the firmware data total length solid from the backup memory block Number of packages evidence is written to application memory area specifically, the main control chip first wipes the application memory area, then from the backup Firmware data corresponding with the firmware data total length is read in memory block and is written to application memory area.
Further, the main control chip is read corresponding with the firmware data total length solid from the backup memory block Number of packages evidence also includes after being written to application memory area, and the main control chip wipes the backup memory block.
Preferably, the above method also includes:When the main control chip receives the initialization directive that host computer issues, institute State main control chip and perform initialization operation, and the initialization directive response data for including gap marker is returned to host computer;Work as institute When stating main control chip and receiving the acquisition version number instruction that host computer issues, the main control chip obtains current version of firmware number simultaneously The acquisition version number comprising the current version of firmware number, which is returned, to host computer instructs response.
Preferably, the main control chip obtains firmware number corresponding with the firmware data length value from the packet According to specially:The main control chip packet is decrypted to obtain using the encryption and decryption key to prestore it is described with it is described solid Firmware data corresponding to part data length value;The main control chip obtains signed data from the end packet:It is described The end packet is decrypted to obtain the signed data for the encryption and decryption key to be prestored described in main control chip use.
Present invention also offers a kind of device for upgrading firmware, includes main control chip, backup memory block and application memory area, Wherein, the main control chip includes the first transceiver module, the second transceiver module, the first judge module, the first acquisition module, second Acquisition module, sign test module and writing module;
First transceiver module, the firmware upgrade instruction issued for receiving host computer, and returned successfully to host computer Response data;
Second transceiver module, the packet issued for receiving host computer, and trigger the first judge module;And use When the triggering of the first acquisition module is received success response data are returned to host computer;
First judge module, for judging whether the packet that second transceiver module receives is to terminate Bag, is to trigger the second acquisition module, otherwise triggers the first acquisition module;
First acquisition module, for obtaining firmware data in institute's packet for being received from second transceiver module Bag sequence number, firmware data length value and firmware data corresponding with the firmware data length value, by the firmware number of acquisition The backup memory block is arrived according to storage, the master control is determined according to the firmware data packet sequence number and the firmware data length value Chip is currently received firmware data total length and recorded, and triggers second transceiver module;
Second acquisition module, for judging the institute that second transceiver module receives when first judge module State in the end packet received when packet is end packet from second transceiver module and obtain signed data, deposited from backup Firmware data corresponding to the firmware data total length of the first acquisition module record is obtained in storage area;
The sign test module, for the firmware data according to preset signature key and second acquisition module acquisition Sign test is carried out to the signed data that second acquisition module obtains, writing module is triggered if sign test success, if sign test Failure then reports an error;
Said write module, for will it is described backup memory block in store with first acquisition module record described in Firmware data corresponding to firmware data total length is written to application memory area.
Preferably, above-mentioned main control chip also includes being used for the second memory block for storing product description information;
First judge module, be additionally operable to judge the packet that second transceiver module receives whether be Begin bag;
First acquisition module, it is additionally operable to when first judge module judges what second transceiver module received When the packet is starting bag, firmware data length value is obtained in the starting bag received from second transceiver module The corresponding firmware data with the firmware data length value, the storage of product description information is obtained from the firmware data to institute The second memory block is stated, by the remaining data storage in the firmware data in addition to the product description information to backup storage Area, the firmware data total length being currently received according to firmware data length value determination simultaneously record, and described in triggering Second transceiver module.
Wherein, above-mentioned first judge module, specifically for according to the firmware data packet sequence number obtained from the packet Judge whether the packet is starting bag.
Preferably, the main control chip also includes the second judge module;When the sign test module performs sign test success then Trigger the second judge module;Second judge module, for whether judging the product description information in second memory block Correctly, it is then to trigger said write module, otherwise reports an error.
Preferably, described device also includes Bluetooth chip;
Second judge module, specifically it is additionally operable to when judging that the product description information is correct, according to the product Description information judges to back up whether the firmware data stored in memory block is bluetooth firmware data, if bluetooth firmware number According to then the main control chip writes the bluetooth firmware data by SWD interfaces into the Bluetooth chip;Otherwise described in triggering Writing module.
Preferably, first judge module, the packet received for judging second transceiver module Whether the 8th byte is 0xFF, is, triggers the second acquisition module, otherwise triggers the first acquisition module.
Preferably, above-mentioned main control chip also includes reseting module;
The reseting module, for power-up initializing, and bootstrap loader is run, and for judging whether to redirect fortune Row application program, it is to trigger the first transceiver module, otherwise triggers said write module;
Accordingly, first transceiver module, for receiving instruction that host computer issues and judging whether it is firmware upgrade Instruction, if firmware upgrade instruction then returns to success response data to host computer, if other are instructed, then referred to according to described other Order performs corresponding operating.
Further, the main control chip also includes the first memory block for storage flag;
Accordingly, the reseting module, specifically for power-up initializing, and bootstrap loader is run, and specific use In reading flag bit from first memory block, and judge whether the flag bit is equal to the first preset value, be then trigger described in Writing module, operation application program is otherwise redirected, trigger first transceiver module;
The main control chip also includes modified module, for being stored when sign test module sign test success by described first The flag bit stored in area is revised as the first preset value, is additionally operable to when said write module completes write operation by described in The flag bit stored in first memory block is revised as the second preset value.
Preferably, above-mentioned first transceiver module, the 5th of the instruction issued also particularly useful for the host computer for judging to receive the Whether byte is equal to 0xBA, is that the instruction for determining to receive is firmware upgrade instruction, otherwise determines to receive described Instruction is other instructions.
Preferably, above-mentioned writing module, specifically for wiping the application memory area when receiving triggering, and from described standby The firmware data, which is read, in part memory block is written to application memory area.It is additionally operable to be written to apply by the firmware data of reading to deposit After storage area, the backup memory block is wiped.
Preferably, first transceiver module, also particularly useful for when receiving the initialization directive that host computer issues, hold Row initialization operation, and the initialization directive response data for including gap marker is returned to host computer;Also particularly useful for when reception During the acquisition version number instruction issued to host computer, obtain current version of firmware number and simultaneously returned to host computer comprising described current solid The acquisition version number instruction response of part version number.
Preferably, above-mentioned first acquisition module, specifically for receiving and dispatching mould to described second using the encryption and decryption key to prestore Institute's packet that block receives is decrypted, therefrom obtain firmware data packet sequence number, firmware data length value and with the firmware Firmware data corresponding to data length value, the backup memory block is arrived into the firmware data storage of acquisition, according to described solid Part packet sequence number and the firmware data length value determine that the main control chip is currently received firmware data total length and remembered Record, and trigger second transceiver module;
Above-mentioned second acquisition module, specifically for being received using the encryption and decryption key to prestore to second transceiver module The end packet be decrypted to obtain the signed data, and the first acquisition module note is obtained from backup memory block Firmware data corresponding to the firmware data total length of record.
Beneficial effects of the present invention are as follows:Technical scheme provided by the invention, set form point is employed to firmware data The technologies such as bag, encryption and decryption and signature sign test, the security of firmware data transmission is improved with this, and it is real by hardware interface Network downloading mode is compared in existing bluetooth firmware upgrading, can improve data transmission bauds.
Brief description of the drawings
Fig. 1 is a kind of flow chart for firmware upgrade method that the embodiment of the present invention 1 provides;
Fig. 2 is a kind of process chart for firmware upgrade instruction that the embodiment of the present invention 1 provides;
Fig. 3 is a kind of flow chart for firmware upgrade method that the embodiment of the present invention 2 provides;
Fig. 4 is a kind of composition frame chart for device for upgrading firmware that the embodiment of the present invention 3 provides.
Embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing to embodiment party of the present invention Formula is described in further detail.Device for upgrading firmware in the present invention is preferably dual chip equipment, specifically includes master control core Piece (MCU) and Bluetooth chip, and the main control chip is connected by SWD interfaces (universal serial bus debugging interface) with Bluetooth chip.
Embodiment 1
As shown in figure 1, a kind of firmware upgrade method that the present embodiment provides, comprises the following steps:
Step 101:Main control chip initializes, and runs bootstrap loader;
Specifically, main control chip initializes to system clock, Hardware I/O (including USB interface etc.), timer etc., and Run bootstrap loader (Bootloader programs).
Step 102:Main control chip judges whether to redirect operation application program, is then to perform step 104, otherwise performs step 103;
Preferably, main control chip judges whether to redirect operation application program (APP programs) according to flag bit, for example, master control Chip from the first memory block (address 0x20000) read flag bit, and judgement symbol position whether set, be then execution step 104, Otherwise step 103 is performed.
Step 103:Main control chip reads firmware data from backup memory block and is written to application memory area, then performs step 101;
For example, main control chip reads firmware data from backup memory block (address 0x20410), and it is written to application memory area (address 0x4000).
Preferably, this step is specifically, main control chip first wipes application memory area, then from backup memory block reading firmware Data are written to application memory area, after the completion of to be written, wipe the backup memory block.
Step 104:Main control chip receives the instruction that host computer issues;
Preferably, the instruction that main control chip is issued by USB interface reception host computer.
Step 105:Whether the instruction that main control chip judges to receive is firmware upgrade instruction, is then to perform step 107, no Then perform step 106;
Specifically, main control chip judges whether it is that firmware upgrade instructs according to the 5th byte of the instruction received, if 5th byte is that the instruction that 0xBA is then received is firmware upgrade instruction, is not otherwise firmware upgrade instruction.
Step 106:Main control chip performs corresponding operating according to the instruction received, then performs step 101;
For example, if the instruction that main control chip receives is initialization directive, main control chip perform initialization operation and to Host computer returns to initialization directive response, then performs step 101.Preferably, if preceding four bytes of the instruction are equal to Then the instruction is initialization directive to 0xFFFFFFFF.
In another example if the instruction that main control chip receives is to obtain version number's instruction, main control chip obtains current firmware Version number simultaneously returns to the acquisition version number instruction response comprising the current version of firmware number to host computer, then performs step 101.Preferably, the instruction is to obtain version number's instruction if the 5th byte of the instruction is equal to 0x85.The acquisition The current version of firmware number included in version number's instruction response is made up of firmware major version number and firmware minor version number.
Step 107:Main control chip receives the packet that host computer issues, and firmware data and number of signature are obtained from packet According to, by the firmware data be saved in backup memory block;
Preferably, the packet that main control chip is issued by USB interface reception host computer, main control chip receive upper The form for the packet that machine issues can be:CID(4Bytes)+CMD(1Byte)+Lenth(2Bytes)+Main Serial Number (4Bytes)+firmware data
CID (4Bytes)+00+ firmware datas
CID (4Bytes)+01+ firmware datas
CID (4Bytes)+02+ firmware datas
CID (4Bytes)+03+ firmware datas
Can also be:CID (4Bytes)+CMD (1Byte)+Lenth (2Bytes)+FF+ signed datas
CID (4Bytes)+00+ signed datas
CID (4Bytes)+01+ signed datas
CID (4Bytes)+02+ signed datas
CID (4Bytes)+03+ signed datas
Wherein, CID is gap marker, and CID is preferably 0x0000EB79 in the present embodiment;CMD identifies for command type, this CMD is preferably 0xBA in embodiment;Main Serial number are firmware data packet sequence number, such as 0x00000000, 0x01000000,0x02000000 etc..
Such as:The packet that main control chip receives is as follows:
0000EB79BA010400000000<firmware bytes…>
0000EB7900<firmware bytes…>
0000EB7901<firmware bytes…>
0000EB7902<firmware bytes…>
0000EB7903<firmware bytes…>
0000EB79BA0104FF<signature bytes…>
0000EB7900<signature bytes…>
0000EB7901<signature bytes…>
0000EB7902<signature bytes…>
0000EB7903<signature bytes…>
Then main control chip obtains all firmware bytes and stored as firmware data, obtains all Signature bytes store as signed data.
Step 108:Main control chip carries out sign test to the signed data, is returned if sign test success and performs step 101, if Sign test failure, which then returns, performs step 104;
Preferably, main control chip obtains the public signature key that prestores, according to prestore public signature key, current backup The firmware data stored in memory block, sign test is carried out to the signed data, returned if sign test success and perform step 101, it is no Then perform step 104.
Further, above-mentioned steps 107 can also include, and main control chip obtains product description information from firmware data, And the remaining firmware data in the firmware data in addition to product description information is saved in backup memory block.Preferably, it is main Control chip and obtain preceding 16 byte datas of firmware data and be used as product description information, in step 108 if sign test successfully if enter one Step performs step 109, specific as follows:
Step 109:Main control chip judges whether the product description information is correct, is then to perform step 110, otherwise performs Step 104;
Preferably, main control chip judges whether the product description information matches with the product description information prestored, It is then to perform step 110, otherwise performs step 104.
Step 110:Main control chip judges whether the firmware data is bluetooth firmware number according to the product description information According to, be then execution step 111, otherwise perform step 101;
Preferably, the composition structure of the product description information is as follows:
Product type (1Bytes)+chip model (1Bytes)+USB firmware datas length (4Bytes)+bluetooth firmware number According to length (4Bytes)+version number (4Bytes)+reserve bytes (2Bytes).
This step is specifically, main control chip judges the firmware number according to the value of the 7-10 bytes of product description information According to whether bluetooth firmware data are included, if the value of 7-10 bytes is not 0, the firmware data includes bluetooth firmware number According to otherwise not comprising bluetooth firmware data.
Step 111:Main control chip writes the bluetooth firmware data into Bluetooth chip by SWD interfaces, returns and performs Step 101.
Further, in the present embodiment, reception and handling process that main control chip instructs to firmware upgrade are specific as schemed Shown in 2, including herein below:
Step a1, when main control chip receives the firmware upgrade instruction that host computer issues, return to host computer and successfully ring Data are answered, and the packet for waiting host computer to be received to issue;
Step a2, main control chip receives the packet that host computer issues;
Step a3, main control chip judge the packet that receives whether be firmware data starting bag, be to perform step A4, otherwise perform step a5;
Further, can also include between step a2 and step a3, main control chip judge the packet form whether Correctly, it is then execution step a3, otherwise return to step a2;
Step a4, main control chip decrypts firmware data from the starting bag, and product is obtained from the firmware data Description information storage stores the remaining data in the firmware data in addition to the product description information to the second memory block To backup memory block, success response data, return to step a2 are returned to host computer;
Preferably, main control chip decrypts firmware data using the AES key to prestore from the starting bag.
For example, the success response data returned to host computer are:
0000EB79BA0000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000。
Step a5, main control chip judge the packet that receives whether be firmware data end packet, be to perform step A7, otherwise perform step a6;
Step a6, main control chip decrypts firmware data from the packet and stored to backup memory block, to upper Machine returns to success response data, return to step a2;
For example, the success response data returned to host computer are:
0000EB79BA0000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000。
Step a7, main control chip decrypts signed data from the end packet, is deposited according to preset key and current backup The firmware data stored in storage area carries out sign test to the signed data;
Preferably, preset key is RSA2048 public keys.This step is specifically, main control chip uses RSA2048 public keys to institute State signed data to decrypt to obtain decrypted result, carrying out Hash calculation to the firmware data stored in current backup memory block obtains Cryptographic Hash, the decrypted result is compared with the cryptographic Hash, the sign test success if consistent, otherwise sign test fails.
Step a8, main control chip judges whether sign test success, is then to perform step a9, and otherwise main control chip reports an error, and terminates;
Step a9, main control chip judges whether the product description information in the second memory block is correct, is to perform step A10, otherwise main control chip report an error, terminate;
Step a10, main control chip judges whether the firmware data is bluetooth firmware number according to the product description information According to, be then execution step a11, otherwise terminate;
Step a11, main control chip writes the bluetooth firmware data into Bluetooth chip by SWD interfaces, terminates.
Firmware upgrade method provided by the invention, the firmware data that the host computer that main control chip receives issues use Set form, and encryption and signature technology have been used, the security of firmware data transmission can be effectively improved, and pass through USB interface receives firmware data from host computer, then writes Bluetooth chip by SWD interfaces to realize that bluetooth firmware upgrades, can Effectively improve the speed of bluetooth firmware data upgrading.
Embodiment 2
As shown in figure 3, a kind of firmware upgrade method that the present embodiment provides, comprises the following steps:
Step 201:MCU is initialized;
Step 202:MCU reads flag bit from the first memory block;
Step 203:MCU judges whether the flag bit is the first preset value, is then to perform step 204, otherwise performs step Rapid 206;
Specifically, the first preset value is equal to 0x55AA.
Step 204:MCU reads firmware data from backup memory block and is written to application memory area;
Preferably, MCU first wipes application memory area, and then reading firmware data from backup memory block is written to application memory Area, after the completion of to be written, wipe the backup memory block.
Step 205:Flag bit described in first memory block is revised as the second preset value by MCU, is returned and is performed step 201;
Specifically, the second preset value is equal to 0x0000.
Step 206:MCU receives the instruction that host computer issues, and judges the type of the instruction, if initialization directive is then Step 207 is performed, if firmware upgrade instruction then performs step 209, if other instructions then perform step 208;
Specifically, MCU receives the instruction that issues of host computer, judge the instruction preceding four bytes whether be 0xFFFFFFFF, it is that the instruction is initialization directive, otherwise according to the 5th byte determine instruction type of the instruction, if 5th byte is equal to 0xBA, and then the instruction is firmware upgrade instruction, and otherwise the instruction is other instructions.
For example, initialization directive is:
FFFFFFFF8600081E14DA746C581E5500000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000;
Firmware upgrade instructs:
0000EB79BA0001FE0000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000。
Step 207:MCU performs initialization operation, and returns to the initialization directive comprising gap marker to host computer and respond Data, it is then back to step 206;
Specifically, MCU performs gap marker used in communication before initialization operation includes determining when.It is excellent in the present embodiment Choosing, the gap marker is 0000EB79.
For example, initialization directive response data is:
FFFFFFFF8600111E14DA746C581E550000EB79020100030300000000000000000000000000000 000000000000000000000000000000000000000000000000000。
Step 208:MCU performs corresponding operating according to the instruction received, is then back to step 206;
Step 209:MCU returns to success response data to host computer, and receives the packet that host computer issues;
For example, success response data are:
0000EB79BA0000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000。
Further, the MCU also includes before being returned to host computer into response data, and MCU judges the firmware received Whether the preceding nybble of upgrade command is consistent with the current channel mark that MCU initialization operations determine, is that MCU returns to host computer Success response data are returned, otherwise MCU returns to errored response data to host computer.
Step 210:MCU judge the packet that receives whether be firmware data starting bag, be then execution step 211, Otherwise step 213 is performed;
Specifically, MCU judges whether it is starting bag according to the firmware data packet sequence number included in the packet received, this Preferable in embodiment, MCU judges whether the 8th to 11 bytes of the packet are equal to 0x00000000, is the then number It is starting bag according to bag, performs step 211, otherwise performs step 213.
Further, this step also includes, MCU judge the packet preceding nybble whether with current channel identify phase Symbol, and judge the 5th byte whether with for representing that the command byte that firmware upgrade instructs is consistent, and judging the 6th and the Whether the length value represented by seven bytes is consistent with the data length after the 7th byte, described if being to be if above-mentioned judgement MCU determines whether the 8th to 11 bytes of the packet are equal to 0x00000000, and otherwise the MCU is to host computer Return to errored response data.
Step 211:MCU obtains firmware data from the starting bag, and product description letter is obtained from the firmware data Breath is written to the second memory block, and the remaining firmware data in addition to product description information is written into backup memory block, performs Step 212;
Specifically, data formats of the MCU according to the starting bag, obtains firmware data, and obtain from the starting bag Preceding 16 bytes of the firmware data are written to the second memory block as product description information, by before the removing of the firmware data Remainder bytes outside 16 bytes are written to backup memory block.
Preferably, the data format of the starting bag is as follows:
CID (4Bytes)+CMD (1Byte)+Lenth (2Bytes)+00000000+ firmware datas
CID (4Bytes)+00+ firmware datas
CID (4Bytes)+01+ firmware datas
CID (4Bytes)+02+ firmware datas
CID (4Bytes)+03+ firmware datas
Wherein, CID is gap marker, and CID is preferably 0x0000EB79 in the present embodiment;CMD identifies for command type, this CMD is preferably 0xBA in embodiment.
Further, this step also includes, and MCU obtains firmware data length value from the starting bag, according to the institute State the firmware data total length that the determination of firmware data length value is currently received and record.
Step 212:MCU returns to success response data, return to step 206 to host computer;
For example, success response data are:
0000EB79BA0000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000。
Step 213:MCU judge the packet that receives whether be firmware data end packet, be then execution step 215, Otherwise step 214 is performed;
Specifically, whether the 8th byte of the packet that MCU judges to receive is 0xFF, it is that the packet is to terminate Bag, step 215 is performed, otherwise perform step 214.
For example, the end packet received is as follows:
0000EB79BA0101FF<signature bytes…>
0000EB7900<signature bytes…>
0000EB7901<signature bytes…>
0000EB7902<signature bytes…>
0000EB7903<signature bytes…>
Wherein, signature bytes are signed data.
Step 214:MCU obtains firmware data from the packet and is written to backup memory block, returns and performs step 212;
It is written to backup specifically, MCU according to the form of the packet from the packet obtains firmware data and deposits Storage area.
The form of the packet has been described in embodiment 1, will not be repeated here.
Further, this step can be with specifically, MCU obtains firmware data packet sequence number, firmware from the packet Data length value and firmware data corresponding with the firmware data length value, by the firmware data storage of acquisition to backup Memory block, it is solid to determine that the main control chip is currently received according to the firmware data packet sequence number and the firmware data length value Part total length of data simultaneously records, and returns and performs step 212.
For example, the firmware data packet number that MCU is currently received according to the firmware data packet sequence number, according to described Firmware data packet number obtains the firmware data total length with the result that the firmware data length value is multiplied.
Step 215:MCU obtains signed data from the end packet, and carries out sign test to the signed data, if sign test Successful then execution step 216, step 206 is performed if sign test failure;
Specifically, MCU obtains signed data from the end packet, using the RSA2048 public keys of storage inside to described Signed data is decrypted to obtain decrypted result, to the firmware data total length pair with current record stored in current backup memory block The firmware data answered carries out Hash calculation and obtains cryptographic Hash, the decrypted result is compared with the cryptographic Hash, if unanimously Then sign test success, otherwise sign test failure.
Step 216:MCU judges whether the product description information that is stored in the second memory block is correct, is to perform step 217, otherwise return and perform step 206;
Specifically, MCU gets product type and chip model according to the first two byte of the product description information, MCU judges whether the product type got and chip model match with the product type and chip model prestored, is then Step 217 is performed, otherwise performs step 206.
Step 217:MCU judges the type of the firmware data in backup memory block according to the product description information, if Bluetooth firmware data then perform step 218, if USB firmware datas then perform step 219;
Specifically, the 3rd to the 6th byte of product description information is USB firmware length informations, the of product description information Seven to crossed joint be bluetooth firmware length information.MCU checked the 3rd to the 6th byte of the product description information, If not zero, then firmware data type is USB firmware datas, MCU enters to the 7th of the product description information to crossed joint Row inspection, if not zero, then firmware data type is bluetooth firmware data.
Step 218:The firmware data stored in backup memory block is written in Bluetooth chip by MCU using SWD interfaces, so Step 219 is performed afterwards;
Step 219:Flag bit described in first memory block is revised as the first preset value by MCU, is then back to step 201.
For example, the first preset value is equal to 0x55AA.
Embodiment 3
A kind of device for upgrading firmware that the present embodiment provides, as shown in figure 4, including main control chip 300, backup memory block 400 and application memory area 500, the main control chip 300 includes the first transceiver module 301, the second transceiver module 302, first sentenced Disconnected module 303, the first acquisition module 304, the second acquisition module 305, sign test module 306 and writing module 307;
First transceiver module 301, for receiving the firmware upgrade instruction that host computer issues, and to host computer return into Work(response data;
Second transceiver module 302, the packet issued for receiving host computer, and trigger the first judge module 303; And return to success response data to host computer during triggering for receiving the first acquisition module 304;
First judge module 303, for judging whether is the packet that second transceiver module 302 receives It is end packet, is, trigger the second acquisition module 305, otherwise triggers the first acquisition module 304;
First acquisition module 304, it is solid for being obtained in institute's packet for being received from second transceiver module 302 Part packet sequence number, firmware data length value and firmware data corresponding with the firmware data length value, by described in acquisition Firmware data storage is true according to the firmware data packet sequence number and the firmware data length value to the backup memory block 400 The fixed main control chip 300 is currently received firmware data total length and recorded, and triggers second transceiver module 302;
Second acquisition module 305, for judging second transceiver module 302 when first judge module 303 Signature is obtained in the end packet received when the packet received is end packet from second transceiver module 302 Data, obtained from backup memory block 400 solid corresponding to the firmware data total length that first acquisition module 304 records Number of packages evidence;
Sign test module 306, for the firmware number according to preset signature key and second acquisition module 305 acquisition Sign test is carried out according to the signed data obtained to second acquisition module 305, writing module is triggered if sign test success 307, reported an error if sign test failure;
Said write module 307, for will be storing with first acquisition module 304 in the backup memory block 400 Firmware data corresponding to the firmware data total length of record is written to application memory area 500.
The instruction that is referred in the present embodiment, the form of packet are with the data format referred in embodiment 1 or 2, herein not Repeat again.
Embodiment 4
A kind of device for upgrading firmware that the present embodiment provides, include main control chip, backup memory block and application memory area, The main control chip includes the first transceiver module, the second transceiver module, the first judge module, the first acquisition module, the second acquisition Module, sign test module and writing module;
The main control chip also includes being used for the second memory block for storing product description information;
First transceiver module, the firmware upgrade instruction issued for receiving host computer, and returned successfully to host computer Response data;
Second transceiver module, the packet issued for receiving host computer, and trigger the first judge module;And use When the triggering of the first acquisition module is received success response data are returned to host computer;
First judge module, for judging whether the packet that second transceiver module receives is to terminate Bag, is to trigger the second acquisition module, otherwise triggers the first acquisition module;It is additionally operable to judge that second transceiver module receives The packet whether be starting bag.
Preferable in the present embodiment, first judge module is according to the firmware data packet sequence obtained from the packet Number judge whether the packet is starting bag;First judge module is specifically used for judging that second transceiver module receives To the 8th byte of the packet whether be 0xFF, be to trigger the second acquisition module, otherwise trigger the first acquisition module;
First acquisition module, for judging the institute that second transceiver module receives when first judge module It is when originating bag to state packet, and firmware data packet sequence number is obtained in the institute's packet received from second transceiver module, is consolidated Part data length value and firmware data corresponding with the firmware data length value;Institute is arrived into the firmware data storage of acquisition Backup memory block is stated, determines that the main control chip currently connects according to the firmware data packet sequence number and the firmware data length value Receive firmware data total length and record, and trigger second transceiver module;
Specifically, first acquisition module is additionally operable to when the first judge module judged result is yes in the present embodiment When, firmware data length value is obtained in the starting bag received from second transceiver module and is grown with the firmware data Firmware data corresponding to angle value, the storage of product description information is obtained from the firmware data to second memory block, by institute The remaining data storage in firmware data in addition to the product description information is stated to backup memory block, according to the firmware Data length value determines the firmware data total length being currently received and recorded, and triggers second transceiver module.
Second acquisition module, for obtaining number of signature in the end packet that is received from second transceiver module According to obtaining firmware data corresponding to the firmware data total length of first acquisition module record from backup memory block;
The sign test module, for the firmware data according to preset signature key and second acquisition module acquisition Sign test is carried out to the signed data that second acquisition module obtains, the second judge module is triggered if sign test success, if Sign test failure then reports an error;
The main control chip also includes the second judge module, and second judge module is used to judge second memory block In product description information it is whether correct, be then triggering said write module, otherwise report an error, terminate.
Said write module, for will it is described backup memory block in store with first acquisition module record described in Firmware data corresponding to firmware data total length is written to application memory area;
Further, device described in the present embodiment also includes Bluetooth chip;
Second judge module, specifically it is additionally operable to when judging that the product description information is correct, according to the product Description information judges to back up whether the firmware data stored in memory block is bluetooth firmware data, if bluetooth firmware number According to then the main control chip writes the bluetooth firmware data by SWD interfaces into the Bluetooth chip;Otherwise described in triggering Writing module.
The main control chip also includes reseting module, modified module and the first memory block for storage flag;
The reseting module, for power-up initializing, and bootstrap loader is run, and for judging whether to redirect fortune Row application program, it is to trigger the first transceiver module, otherwise triggers said write module;
Accordingly, first transceiver module, for receiving instruction that host computer issues and judging whether it is firmware upgrade Instruction, if firmware upgrade instruction then returns to success response data to host computer, if other are instructed, then referred to according to described other Order performs corresponding operating.
For example, first transceiver module, specifically for when receiving the initialization directive that host computer issues, performing just Beginningization is operated, and the initialization directive response data for including gap marker is returned to host computer;Received also particularly useful for working as During the acquisition version number instruction that position machine issues, obtain current version of firmware number and include the current firmware version to host computer return The acquisition version number instruction response of this number.
It is preferable in the present embodiment, first transceiver module, issued also particularly useful for the host computer for judging to receive Whether the 5th byte of instruction is equal to 0xBA, is that the instruction for determining to receive is firmware upgrade instruction, otherwise determines to connect The instruction received is other instructions.
Further, the reseting module, specifically for power-up initializing, and bootstrap loader is run, and specifically For reading flag bit from first memory block, and judge whether the flag bit is equal to the first preset value, be to trigger institute Writing module is stated, otherwise redirects operation application program, triggers first transceiver module;
The modified module, for it will be stored when sign test module sign test success in first memory block described in Flag bit is revised as the first preset value, is additionally operable to deposit in first memory block when said write module completes write operation The flag bit of storage is revised as the second preset value.
Preferably, writing module described in the present embodiment, specifically for wiping the application memory area when receiving triggering, And read the firmware data from the backup memory block and be written to application memory area.Said write module, it is additionally operable to read The firmware data taken is written to after application memory area, wipes the backup memory block.
It is preferable in the present embodiment, first acquisition module, specifically for using the encryption and decryption key to prestore to described Institute's packet that second transceiver module receives is decrypted, therefrom obtain firmware data packet sequence number, firmware data length value and Firmware data corresponding with the firmware data length value, the backup memory block is arrived into the firmware data storage of acquisition, Determine that the main control chip is currently received firmware data according to the firmware data packet sequence number and the firmware data length value Total length simultaneously records, and triggers second transceiver module;
Second acquisition module, specifically for being received using the encryption and decryption key to prestore to second transceiver module The end packet be decrypted to obtain the signed data, and the first acquisition module note is obtained from backup memory block Firmware data corresponding to the firmware data total length of record.
The form of the instruction, packet and the product description information that are referred in the present embodiment is the same as the number referred in embodiment 1 or 2 According to form, will not be repeated here.
The foregoing is only a specific embodiment of the invention, but protection scope of the present invention is not limited thereto, any Those familiar with the art the invention discloses technical scope in, the change or replacement that can readily occur in, all should It is included within the scope of the present invention.Therefore, protection scope of the present invention should be defined by scope of the claims.

Claims (26)

  1. A kind of 1. firmware upgrade method, it is characterised in that including:
    Step S1, main control chip receives the firmware upgrade instruction that host computer issues, and returns to success response data to host computer;
    Step S2, described main control chip receives the packet that host computer issues;
    Step S3, described main control chip judges whether the packet is end packet, is then to perform step S4, the otherwise master control Chip obtains firmware data packet sequence number, firmware data length value and corresponding with the firmware data length value from the packet Firmware data, by the firmware data of acquisition storage to backup memory block, according to the firmware data packet sequence number and described Firmware data length value determines that the main control chip is currently received firmware data total length and recorded, and is returned successfully to host computer Response data, return to step S2;
    Step S4, described main control chip obtains signed data from the end packet, according to preset signature key and current backup The firmware data corresponding with the firmware data total length stored in memory block carries out sign test to the signed data, if sign test Successful then described main control chip reads firmware data corresponding with the firmware data total length from the backup memory block and write Enter to application memory area, complete firmware upgrade, terminate;Main control chip reports an error if sign test failure, terminates.
  2. 2. according to the method for claim 1, it is characterised in that also include between the step S2 and step S3:The master Whether the packet that control chip judges to receive is starting bag, is that then the main control chip obtains firmware number from the starting bag According to length value and firmware data, the storage of product description information is obtained from the firmware data to the second memory block, will be described solid Remaining data storage of the number of packages in addition to the product description information is to backup memory block, according to the firmware data Length value determines the firmware data total length being currently received and recorded, and returns to success response data to host computer, returns and perform Step S2;Otherwise the step S3 is performed.
  3. 3. according to the method for claim 2, it is characterised in that the packet that the main control chip judges to receive whether be Originating bag is specially:The main control chip obtains the firmware data packet sequence number included in the packet received, according to described solid Part packet sequence number judge the packet whether be firmware data starting bag.
  4. 4. according to the method for claim 2, it is characterised in that also include during the success of sign test described in step S4:
    Step S5, described main control chip judges whether the product description information in the second memory block is correct, is then to perform step S4 Described in main control chip read corresponding with firmware data total length firmware data from the backup memory block and be written to Application memory area, firmware upgrade is completed, terminated;Otherwise the main control chip reports an error, and terminates.
  5. 5. according to the method for claim 4, it is characterised in that the main control chip judges that the product description information is correct When also include:
    Step S6, the firmware data that described main control chip judges to store in backup memory block according to the product description information Whether it is bluetooth firmware data, is then to perform step S7, otherwise performs main control chip described in step S4 from the backup storage Firmware data corresponding with the firmware data total length is read in area and is written to application memory area, firmware upgrade is completed, terminates;
    Step S7, described main control chip writes the bluetooth firmware data into Bluetooth chip by SWD interfaces, completes firmware liter Level, terminate.
  6. 6. according to the method for claim 1, it is characterised in that the main control chip judges whether the packet is to terminate Bag is specially:Whether the 8th byte of the packet that the main control chip judges to receive is 0xFF, is that the packet is The end packet of firmware data, otherwise the packet is not the end packet of firmware data.
  7. 7. according to the method for claim 1, it is characterised in that methods described also includes:
    Step 101:Main control chip power-up initializing, run bootstrap loader;
    Step 102:The main control chip judges whether to redirect operation application program, is then to perform step 104, otherwise performs step 103;
    Step 103:The main control chip reads firmware data from backup memory block and is written to application memory area, is then back to step Rapid 101;
    Step 104:The main control chip receives the instruction that host computer issues;
    Step 105:Whether the instruction that the main control chip judges to receive is firmware upgrade instruction, is then performed described in step S1 Success response data are returned to host computer, otherwise perform step 106;
    Step 106:The main control chip performs corresponding operating according to the instruction received, is then back to step 101.
  8. 8. according to the method for claim 7, it is characterised in that the main control chip judges whether to redirect operation application program Specially:The main control chip reads flag bit from the first memory block, judges whether the flag bit is equal to the first preset value, is Step 103 is then performed, operation application program is otherwise redirected, performs the step 104;
    It is the first preset value also to include changing the flag bit during success of sign test described in the step S4;In the step 103 It is the second preset value also to include changing the flag bit before the return to step 101.
  9. 9. according to the method for claim 7, it is characterised in that whether the instruction that the main control chip judges to receive is solid Part upgrade command is specially:Whether the 5th byte of the instruction that the main control chip judges to receive is equal to 0xBA, is then The instruction is firmware upgrade instruction, and otherwise the firmware instructions are not firmware upgrade instructions.
  10. 10. according to the method for claim 1, it is characterised in that the main control chip is read from the backup memory block Firmware data corresponding with the firmware data total length is written to application memory area specifically, the main control chip first wipes institute Application memory area is stated, firmware data write-in corresponding with the firmware data total length is then read from the backup memory block To application memory area.
  11. 11. according to the method for claim 10, it is characterised in that the main control chip from it is described backup memory block read with Firmware data corresponding to the firmware data total length also includes after being written to application memory area, and the main control chip wipes institute State backup memory block.
  12. 12. according to the method for claim 1, it is characterised in that methods described also includes:When the main control chip receives During the initialization directive that host computer issues, the main control chip performs initialization operation, and is returned to host computer and include passage mark The initialization directive response data of knowledge;It is described when the main control chip receives the acquisition version number instruction that host computer issues Main control chip, which obtains current version of firmware number and returns to the acquisition version number comprising the current version of firmware number to host computer, to be referred to Order response.
  13. 13. according to the method for claim 1, it is characterised in that the main control chip is obtained from the packet and institute Firmware data corresponding to stating firmware data length value is specially:The main control chip is using the encryption and decryption key to prestore to the number It is decrypted to obtain the firmware data corresponding with the firmware data length value according to bag;The main control chip is from the end Signed data is obtained in bag is specially:The encryption and decryption key to be prestored described in the main control chip use solves to the end packet It is close to obtain the signed data.
  14. 14. a kind of device for upgrading firmware, include main control chip, backup memory block and application memory area, it is characterised in that:It is described Main control chip include the first transceiver module, the second transceiver module, the first judge module, the first acquisition module, the second acquisition module, Sign test module and writing module;
    First transceiver module, the firmware upgrade instruction issued for receiving host computer, and return to success response to host computer Data;
    Second transceiver module, the packet issued for receiving host computer, and trigger the first judge module;And for receiving To the first acquisition module triggering when to host computer return success response data;
    First judge module, for judging whether the packet that second transceiver module receives is end packet, It is to trigger the second acquisition module, otherwise triggers the first acquisition module;
    First acquisition module, for obtaining firmware data packet sequence in institute's packet for being received from second transceiver module Number, firmware data length value and firmware data corresponding with the firmware data length value, the firmware data of acquisition is deposited The backup memory block is stored up, the main control chip is determined according to the firmware data packet sequence number and the firmware data length value It is currently received firmware data total length and records, and triggers second transceiver module;
    Second acquisition module, for judging the number that second transceiver module receives when first judge module Signed data is obtained in the end packet that is received from second transceiver module when according to bag being end packet, from backup memory block Firmware data corresponding to the middle firmware data total length for obtaining the first acquisition module record;
    Sign test module, for according to preset signature key and the firmware data of second acquisition module acquisition to described the The signed data that two acquisition modules obtain carries out sign test, and writing module is triggered if sign test success, is reported if sign test failure It is wrong;
    Said write module, for the firmware with first acquisition module record that will be stored in the backup memory block Firmware data corresponding to total length of data is written to application memory area.
  15. 15. device according to claim 14, it is characterised in that:The main control chip also includes being used to store product description Second memory block of information;
    First judge module, it is additionally operable to judge whether the packet that second transceiver module receives is starting Bag;
    First acquisition module, is additionally operable to that to judge that second transceiver module receives described when first judge module Obtained when packet is starting bag, in the starting bag received from second transceiver module firmware data length value and with Firmware data corresponding to the firmware data length value, the storage of product description information is obtained from the firmware data to described the Two memory blocks, by the remaining data storage in the firmware data in addition to the product description information to backup memory block, root The firmware data total length that is currently received is determined according to the firmware data length value and is recorded, and is triggered described second and received Send out module.
  16. 16. device according to claim 15, it is characterised in that:First judge module, specifically for according to from institute State the firmware data packet sequence number obtained in packet and judge whether the packet is starting bag.
  17. 17. device according to claim 15, it is characterised in that:The main control chip also includes the second judge module;When The sign test module then triggers the second judge module when performing sign test success;
    Second judge module, it is to trigger for judging whether the product description information in second memory block is correct Said write module, otherwise reports an error.
  18. 18. device according to claim 17, it is characterised in that:Described device also includes Bluetooth chip;
    Second judge module, specifically it is additionally operable to when judging that the product description information is correct, according to the product description Whether the firmware data that information judges to store in backup memory block is bluetooth firmware data, if bluetooth firmware data, then The main control chip writes the bluetooth firmware data by SWD interfaces into the Bluetooth chip;Otherwise said write is triggered Module.
  19. 19. device according to claim 14, it is characterised in that:First judge module, for judging described second Whether the 8th byte of the packet that transceiver module receives is 0xFF, is to trigger the second acquisition module, otherwise triggers First acquisition module.
  20. 20. device according to claim 14, it is characterised in that:The main control chip, in addition to reseting module;
    The reseting module, for power-up initializing, and bootstrap loader is run, and for judging whether that redirecting operation answers With program, it is to trigger the first transceiver module, otherwise triggers said write module;
    First transceiver module, for receiving instruction that host computer issues and judging whether it is firmware upgrade instruction, if solid Part upgrade command then returns to success response data to host computer, if other are instructed, is then performed according to other described instructions corresponding Operation.
  21. 21. device according to claim 20, it is characterised in that:The main control chip is also included for storage flag First memory block;
    The reseting module, specifically for power-up initializing, and bootstrap loader is run, and specifically for from described first Flag bit is read in memory block, and judges whether the flag bit is equal to the first preset value, is then to trigger said write module, otherwise Operation application program is redirected, triggers first transceiver module;
    The main control chip also includes modified module, for when the sign test module sign test success when by first memory block The flag bit of storage is revised as the first preset value, is additionally operable to described first when said write module completes write operation The flag bit stored in memory block is revised as the second preset value.
  22. 22. device according to claim 20, it is characterised in that:First transceiver module, connect also particularly useful for judgement Whether the 5th byte of the instruction that the host computer received issues is equal to 0xBA, is that the instruction for determining to receive is firmware liter Level instruction, the instruction for otherwise determining to receive is other instructions.
  23. 23. the device according to claim 14 or 20, it is characterised in that:Said write module, specifically for tactile when receiving The application memory area is wiped during hair, and reads the firmware data from the backup memory block and is written to application memory area.
  24. 24. device according to claim 23, it is characterised in that:Said write module, it is additionally operable to the firmware number of reading After application memory area is written to, the backup memory block is wiped.
  25. 25. device according to claim 14, it is characterised in that:First transceiver module, also particularly useful for when reception During the initialization directive issued to host computer, initialization operation is performed, and the initialization for including gap marker is returned to host computer Instruct response data;Also particularly useful for when receiving the acquisition version number instruction that host computer issues, current version of firmware is obtained Number and to host computer return comprising the current version of firmware number acquisition version number instruct response.
  26. 26. device according to claim 14, it is characterised in that:First acquisition module, prestored specifically for using Encryption and decryption key institute's packet that second transceiver module receives is decrypted, therefrom obtain firmware data packet sequence Number, firmware data length value and firmware data corresponding with the firmware data length value, the firmware data of acquisition is deposited The backup memory block is stored up, the main control chip is determined according to the firmware data packet sequence number and the firmware data length value It is currently received firmware data total length and records, and triggers second transceiver module;
    Second acquisition module, specifically for the institute received using the encryption and decryption key to prestore to second transceiver module State end packet to be decrypted to obtain the signed data, and the first acquisition module record is obtained from backup memory block Firmware data corresponding to the firmware data total length.
CN201710915238.0A 2017-09-30 2017-09-30 Firmware upgrading method and device Active CN107634859B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710915238.0A CN107634859B (en) 2017-09-30 2017-09-30 Firmware upgrading method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710915238.0A CN107634859B (en) 2017-09-30 2017-09-30 Firmware upgrading method and device

Publications (2)

Publication Number Publication Date
CN107634859A true CN107634859A (en) 2018-01-26
CN107634859B CN107634859B (en) 2021-07-02

Family

ID=61103874

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710915238.0A Active CN107634859B (en) 2017-09-30 2017-09-30 Firmware upgrading method and device

Country Status (1)

Country Link
CN (1) CN107634859B (en)

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108196867A (en) * 2018-03-08 2018-06-22 深圳市文鼎创数据科技有限公司 Device for upgrading firmware, equipment and its firmware upgrade method of equipment
CN109358893A (en) * 2018-12-10 2019-02-19 武汉精立电子技术有限公司 A kind of the online upgrading method, apparatus and system of FPGA program
CN109445705A (en) * 2018-10-29 2019-03-08 湖南国科微电子股份有限公司 Firmware authentication method and solid state hard disk
CN109634631A (en) * 2018-11-01 2019-04-16 北京锦鸿希电信息技术股份有限公司 Firmware restoration method, apparatus, electronic equipment and firmware restoration system
CN109767579A (en) * 2018-11-29 2019-05-17 福建新大陆支付技术有限公司 MODEM firmware update, POS system and the storage medium of intelligent POS
CN109977044A (en) * 2019-03-27 2019-07-05 歌尔科技有限公司 USB device enumeration detection method and system and firmware upgrade method and system
CN110187899A (en) * 2019-06-04 2019-08-30 深圳云里物里科技股份有限公司 A kind of firmware programming method, apparatus and its relevant device
CN110366063A (en) * 2019-07-26 2019-10-22 歌尔科技有限公司 A kind of upgrade method of wireless headset, device and charging box
CN111786820A (en) * 2020-06-16 2020-10-16 浙江国利网安科技有限公司 Firmware updating method and device and network equipment
CN111818106A (en) * 2020-09-14 2020-10-23 飞天诚信科技股份有限公司 Data transmission method and equipment
CN112394663A (en) * 2020-11-12 2021-02-23 深圳市泰比特科技有限公司 Method and device for upgrading central control interface line of shared electric bicycle
CN112947978A (en) * 2021-04-01 2021-06-11 深圳市斯尔顿科技有限公司 Method for upgrading firmware based on chip usbhid, terminal device and computer readable storage medium
CN115226094A (en) * 2022-07-08 2022-10-21 深圳市中易腾达科技股份有限公司 OTA (over the air) upgrading method and system capable of automatically identifying Bluetooth chip type
CN116847019A (en) * 2023-07-12 2023-10-03 荣耀终端有限公司 Communication abnormality processing method, electronic device, and computer-readable storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070223521A1 (en) * 2006-03-27 2007-09-27 Sony Corporation Information processing system, information processing apparatus and integrated circuit chip
CN101447012A (en) * 2008-12-22 2009-06-03 深圳华为通信技术有限公司 Method for verifying electronic device and firmware therein
CN101808100A (en) * 2010-01-26 2010-08-18 北京深思洛克软件技术股份有限公司 Method and system for solving replay of remote update of information safety device
CN102035875A (en) * 2009-10-04 2011-04-27 梅兰诺克斯科技有限公司 Processing of block and transaction signatures
CN102981881A (en) * 2012-12-10 2013-03-20 中兴通讯股份有限公司 Method and system for preventing mobile terminal from being updated to illegal firmware version
CN105159707A (en) * 2015-08-14 2015-12-16 飞天诚信科技股份有限公司 Secure financial terminal firmware programming method and financial terminal
CN106899437A (en) * 2017-02-23 2017-06-27 百富计算机技术(深圳)有限公司 A kind of method and apparatus of POS module firmware of upgrading
CN107135074A (en) * 2016-02-29 2017-09-05 中兴通讯股份有限公司 A kind of advanced security method and apparatus

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070223521A1 (en) * 2006-03-27 2007-09-27 Sony Corporation Information processing system, information processing apparatus and integrated circuit chip
CN101447012A (en) * 2008-12-22 2009-06-03 深圳华为通信技术有限公司 Method for verifying electronic device and firmware therein
CN102035875A (en) * 2009-10-04 2011-04-27 梅兰诺克斯科技有限公司 Processing of block and transaction signatures
CN101808100A (en) * 2010-01-26 2010-08-18 北京深思洛克软件技术股份有限公司 Method and system for solving replay of remote update of information safety device
CN102981881A (en) * 2012-12-10 2013-03-20 中兴通讯股份有限公司 Method and system for preventing mobile terminal from being updated to illegal firmware version
CN105159707A (en) * 2015-08-14 2015-12-16 飞天诚信科技股份有限公司 Secure financial terminal firmware programming method and financial terminal
CN107135074A (en) * 2016-02-29 2017-09-05 中兴通讯股份有限公司 A kind of advanced security method and apparatus
CN106899437A (en) * 2017-02-23 2017-06-27 百富计算机技术(深圳)有限公司 A kind of method and apparatus of POS module firmware of upgrading

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108196867A (en) * 2018-03-08 2018-06-22 深圳市文鼎创数据科技有限公司 Device for upgrading firmware, equipment and its firmware upgrade method of equipment
CN109445705B (en) * 2018-10-29 2022-03-22 湖南国科微电子股份有限公司 Firmware authentication method and solid state disk
CN109445705A (en) * 2018-10-29 2019-03-08 湖南国科微电子股份有限公司 Firmware authentication method and solid state hard disk
CN109634631A (en) * 2018-11-01 2019-04-16 北京锦鸿希电信息技术股份有限公司 Firmware restoration method, apparatus, electronic equipment and firmware restoration system
CN109767579A (en) * 2018-11-29 2019-05-17 福建新大陆支付技术有限公司 MODEM firmware update, POS system and the storage medium of intelligent POS
CN109358893A (en) * 2018-12-10 2019-02-19 武汉精立电子技术有限公司 A kind of the online upgrading method, apparatus and system of FPGA program
CN109977044A (en) * 2019-03-27 2019-07-05 歌尔科技有限公司 USB device enumeration detection method and system and firmware upgrade method and system
CN110187899A (en) * 2019-06-04 2019-08-30 深圳云里物里科技股份有限公司 A kind of firmware programming method, apparatus and its relevant device
CN110366063A (en) * 2019-07-26 2019-10-22 歌尔科技有限公司 A kind of upgrade method of wireless headset, device and charging box
CN111786820A (en) * 2020-06-16 2020-10-16 浙江国利网安科技有限公司 Firmware updating method and device and network equipment
CN111818106B (en) * 2020-09-14 2020-12-11 飞天诚信科技股份有限公司 Data transmission method and equipment
CN111818106A (en) * 2020-09-14 2020-10-23 飞天诚信科技股份有限公司 Data transmission method and equipment
CN112394663A (en) * 2020-11-12 2021-02-23 深圳市泰比特科技有限公司 Method and device for upgrading central control interface line of shared electric bicycle
CN112947978A (en) * 2021-04-01 2021-06-11 深圳市斯尔顿科技有限公司 Method for upgrading firmware based on chip usbhid, terminal device and computer readable storage medium
CN115226094A (en) * 2022-07-08 2022-10-21 深圳市中易腾达科技股份有限公司 OTA (over the air) upgrading method and system capable of automatically identifying Bluetooth chip type
CN116847019A (en) * 2023-07-12 2023-10-03 荣耀终端有限公司 Communication abnormality processing method, electronic device, and computer-readable storage medium

Also Published As

Publication number Publication date
CN107634859B (en) 2021-07-02

Similar Documents

Publication Publication Date Title
CN107634859A (en) A kind of firmware upgrade method and device
CN103077058B (en) Method and device for installing application program
CN103745167B (en) The IAP method and device of single-chip microcomputer
CN103197943A (en) Online single-chip microcomputer upgrading method and system
CN105183523A (en) Method for remote upgrade of digital signal processor (DSP) program
CN110333881A (en) A kind of in-orbit reconstructing method of load class device software based on spaceborne FPGA processing
CN109710296A (en) A kind of sky and space plane inertial navigation embedded software on-line updating method
JP2002099441A (en) Communication terminal apparatus and its operating method
CN102004657B (en) A kind of electronic equipment and upgrade method thereof
CN112947977A (en) Software online upgrading method and system
US8943488B2 (en) Video game forward compatibility including software patching
CN110337036A (en) Upgrade method, device and the storage medium of set-top box
CN107844305A (en) The method for upgrading software and embedded device of embedded device
CN102711095A (en) Method for updating nodes of wireless sensor network in wireless mode
CN106020868A (en) Intelligent card firmware updating method and system
KR20090055074A (en) Method of transaction-based firmware upgrade in mobile telephone and firmware upgrade system thereof
CN109358891B (en) DSP software upgrading method and system of embedded controller
CN106952426A (en) Data processing method and device
CN101790029A (en) Method for performing read-write operation on set top box
CN106775904A (en) A kind of program burn writing system and method for microcontroller built-in type system
CN100452907C (en) Data transmission method and device between user identification module and mobile terminal
CN107515757A (en) Software program upgrade method and system, terminal
CN111459468A (en) DSP program on-line upgrading system and method for high-reliability serial port communication
CN112463199A (en) System upgrading method and terminal
CN104349209A (en) Method and device for updating set-top box

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant