CN112732318A - Singlechip firmware upgrading method - Google Patents

Singlechip firmware upgrading method Download PDF

Info

Publication number
CN112732318A
CN112732318A CN202110038134.2A CN202110038134A CN112732318A CN 112732318 A CN112732318 A CN 112732318A CN 202110038134 A CN202110038134 A CN 202110038134A CN 112732318 A CN112732318 A CN 112732318A
Authority
CN
China
Prior art keywords
files
file
chip microcomputer
single chip
upgrading
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.)
Pending
Application number
CN202110038134.2A
Other languages
Chinese (zh)
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.)
Wuhan Kotei Informatics Co Ltd
Original Assignee
Wuhan Kotei Informatics 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 Wuhan Kotei Informatics Co Ltd filed Critical Wuhan Kotei Informatics Co Ltd
Priority to CN202110038134.2A priority Critical patent/CN112732318A/en
Publication of CN112732318A publication Critical patent/CN112732318A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/658Incremental updates; Differential updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1004Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's to protect a block of data words, e.g. CRC or checksum
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/654Updates using techniques specially adapted for alterable solid state memories, e.g. for EEPROM or flash memories

Abstract

The invention provides a method for upgrading firmware of a single chip microcomputer, which comprises the following steps: splitting a source file into a plurality of independent files according to a program function in the source file; carrying out differential comparison on the split new and old version source files, extracting differential files and packaging the differential files into upgrade files; and sequentially carrying out differential upgrading on the parts of the single chip microcomputer with the difference files according to the upgrading file information. By the scheme, the upgrading time of the firmware of the single chip microcomputer can be shortened, the upgrading efficiency is improved, and reliable and efficient upgrading of the software of the single chip microcomputer is realized.

Description

Singlechip firmware upgrading method
Technical Field
The invention relates to the field of single-chip microcomputers, in particular to a method for upgrading firmware of a single-chip microcomputer.
Background
With the development of the technology, electronic products such as single chip microcomputers and the like have more variability and expansibility. In order to meet the upgrading and updating requirements of products such as a single chip microcomputer, software upgrading needs to be carried out on firmware of the single chip microcomputer. The traditional upgrading method is to rewrite the source file into the firmware to realize the upgrading of the singlechip, however, the upgrading time of the singlechip firmware is longer, and the upgrading method is particularly obvious for the upgrading of complex software or a large batch of singlechips.
Disclosure of Invention
In view of this, the embodiment of the present invention provides a method for upgrading a firmware of a single chip microcomputer, so as to solve the problem that the upgrading time of the existing single chip microcomputer is long.
In a first aspect of the embodiments of the present invention, a method for upgrading a firmware of a single chip microcomputer is provided, including:
splitting a source file into a plurality of independent files according to a program function in the source file;
the size of the file is determined according to the minimum erasing size of the F l ash supported by the single chip microcomputer and the planned sizes of the code segments and the data segments, and the number of split files is determined according to the number of the software function modules;
carrying out differential comparison on the split new and old version source files, extracting differential files and packaging the differential files into upgrade files;
and sequentially carrying out differential upgrading on the parts of the single chip microcomputer with the difference files according to the upgrading file information.
In one embodiment, the program is divided into one or more segments according to the program function in the source file, and each segment is an integral multiple of the minimum erase size of the F l ash supported by the single chip microcomputer.
In one embodiment, a CRC CODE region is reserved in the last segment or each segment of the off-chip ROM whole for checking data in the off-chip ROM whole or each segment.
In one embodiment, obtaining upgrade file information, where the upgrade file information at least includes the quantity of BLOCK, the starting address of each BLOCK, the size of each BLOCK space, and whether data is encrypted;
judging whether the upgrade file is effective or not according to the initial address and the space size of each BLOCK and whether the source file is an empty file or not;
erasing the storage area corresponding to each BLOCK and requesting to write the difference file;
the single chip microcomputer writes the received difference file data into a corresponding ROM address, exits the data transmission process and informs the single chip microcomputer of the completion of the transmission;
checking whether the transmitted difference file has errors, if not, writing the CRC CODE into a reserved CRC CODE area, and if so, retrying or executing an abnormal flow;
and judging whether the upgrade of all the difference files is finished, and if not, continuing to perform erasing and writing of the storage areas corresponding to the difference files and checking the written files.
In the embodiment of the invention, the source file is divided into a plurality of independent files according to functions, the differential files are extracted and packaged into the upgrading files, and differential upgrading is sequentially carried out on the differential file parts on the single chip according to the upgrading file information. Therefore, the problem that the upgrading time of the traditional singlechip firmware upgrading method is long is solved, the upgrading time of the singlechip firmware can be effectively shortened, and the upgrading efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings described below are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for upgrading firmware of a single chip microcomputer according to an embodiment of the present invention;
FIG. 2 is a diagram of an off-chip ROM data plan provided by an embodiment of the present invention;
FIG. 3 is a schematic diagram of differential source file extraction provided by one embodiment of the present invention;
fig. 4 is a schematic diagram of a differential upgrade process of a source file of a single chip microcomputer according to an embodiment of the present invention.
Detailed Description
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the embodiments described below are only a part of the embodiments of the present invention, and not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons skilled in the art without any inventive work shall fall within the protection scope of the present invention, and the principle and features of the present invention shall be described below with reference to the accompanying drawings.
The terms "comprises" and "comprising," when used in this specification and claims, and in the accompanying drawings and figures, are intended to cover non-exclusive inclusions, such that a process, method or system, or apparatus that comprises a list of steps or elements is not limited to the listed steps or elements.
Referring to fig. 1, fig. 1 is a schematic flow chart of a method for upgrading a firmware of a single chip microcomputer according to an embodiment of the present invention, including:
s101, splitting a source file into a plurality of independent files according to a program function in the source file;
specifically, code segments, data segments and the like of the program are planned, the program is divided according to the functions of the program, and different functions are divided into different segments, so that the change of source file data obtained by compiling is limited in a certain segment or a certain plurality of segments after a certain function of the program is changed, and the change of data of the whole segment cannot be caused.
The file size is determined according to the minimum erasing size of the F l ash supported by the single chip microcomputer and the planned size of the code segment and the data segment, and the number of split files is determined according to the number of the software function modules.
It should be noted that the size of the segment allocation space is determined by the complexity of the program function, the more complex the function is, the larger the segment space is, that is, the program is divided into one or more segments according to the program function in the source file, and each segment is an integer multiple of the minimum erase (write) size of F l ash supported by the single chip microcomputer.
Preferably, a certain amount of margin (i.e. free storage space) is reserved for each segment space or a specific segment space, so as to facilitate later function expansion of the software.
Preferably, a CRC CODE region is reserved in the last segment or in each segment of the off-chip ROM whole for checking data in the off-chip ROM whole or in each segment. The CRC is used to check data in a block of physical storage. In fig. 2, the CRC CODE of the whole off-chip ROM is stored in the last segment, and it can be designed that each segment reserves a separate CRC CODE space.
In one embodiment, as shown in fig. 2, a schematic diagram of the off-chip ROM is provided, and when the size of the off-chip ROM space is 128MB, the off-chip ROM space is divided into several segments as shown in fig. 2 according to different functions of the program, where the SOFT _ VER _ AREA segment is used to store special information such as CRC CODE, software version, and the like.
S102, carrying out differential comparison on the split new and old version source files, extracting differential files and packaging the differential files into upgrade files;
and performing differential confirmation (a differential tool can be used) on the split new and old versions of the source files, extracting the source files with the differences and packaging the source files into upgrade files. The packaging method used may be the same or different for different upgrade platforms.
Summarizing in one embodiment, for extracting and packaging difference files in source files, as shown in fig. 3, difference files (i.e., BLOCKs) with changes are confirmed by comparing differences of new and old versions of source files, and the difference file packages are extracted. And obtaining an upgrade file to upgrade the firmware of the single chip microcomputer.
And S103, differential upgrading is sequentially carried out on the parts of the single chip microcomputer with the differential files according to the upgrading file information.
Specifically, in one embodiment, as shown in fig. 4, the differential upgrade process is as follows:
and S1031, obtaining the information of the upgrade file, wherein the information comprises the number of BLOCKs in the upgrade file, the initial address of each BLOCK, the space size of each BLOCK, whether the data is encrypted and the like.
S1032, judging whether the information of the upgrade file is valid, specifically judging whether the ending address is in a proper range according to whether the starting address of the BLOCK is in a proper range or not, judging whether the starting address and the size are integral multiples of the minimum erasing (writing) size supported by the single chip microcomputer or not, judging whether the source file is an empty file or not and the like.
S1033, erasing the space corresponding to the BLOCK, and erasing the area after judging that the starting address and the size of the BLOCK meet the conditions in S1032.
And S1034, requesting to start data transmission, and after the normal completion of S1033, informing the single chip microcomputer of preparing to start data transmission, and transmitting information such as the initial address and size of transmission, whether data is encrypted and the like to the single chip microcomputer.
And S1035, data transmission/writing, wherein the single chip microcomputer writes the received data into a corresponding ROM address. If the data is transmitted in an encrypted manner, the received data is decrypted and then written.
And S1036, requesting to quit data transmission and informing the singlechip that the data transmission is finished.
S1037, checking whether the transmitted data has an error based on the CRC Check, writing the CRC CODE to the reserved CRC CODE area if there is no error, and performing a retry or an abnormal flow if there is an error. If the ROM region only designs an integral CRC CODE region, and the current BLOCK is not the BLOCK side where the CRC CODE is located, only CRC Check judgment can be carried out, and CRC CODE writing is not carried out.
S1038, confirming whether the BLOCKs of the source file are completely upgraded or not, and if other BLOCKs need to be upgraded, repeating the steps S1033 to S1037. And if all the BLOCKs are upgraded, exiting the upgrading process.
It should be noted that the differential upgrade method of the firmware of the single chip microcomputer is to control the upgrade of different blocks by planning the upgrade source file in blocks, and does not need to upgrade all source files, thereby achieving the purpose of reducing the upgrade time of the firmware of the single chip microcomputer. The method is not limited to upgrading the ROM in the single chip microcomputer chip, but also is suitable for upgrading the expanded ROM outside the chip.
It CAN be understood that, taking the upgrading through the CAN bus in the automobile electronics as an example: assuming that the CAN rate is calculated at 500kbps (62.5KB/s) at 25% bandwidth utilization, the rate is 15.625KB/s, and if the overall source file upgrade packet size is 128MB, the time required to use a conventional upgrade approach is: 128MB/15.625KB/s 8389 sec 2.33 h. If the source file with difference is 40MB, adopting the mode of differential upgrade, the time needed is: 40MB/15.625KB/s 2621 sec 0.73 hours.
In the embodiment, the upgrading time can be shortened and the upgrading efficiency can be improved by differentially upgrading the firmware of the single chip microcomputer.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
It can be understood by those skilled in the art that, in one embodiment, the electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement part or all of steps S101 to S103 to implement differential upgrade of the firmware of the single chip microcomputer.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (4)

1. A method for upgrading firmware of a single chip microcomputer is characterized by comprising the following steps:
splitting a source file into a plurality of independent files according to a program function in the source file;
the size of the file is determined according to the minimum Flash erasing size supported by the single chip microcomputer and the planned size of the code segment and the data segment, and the number of split files is determined according to the number of the software function modules;
carrying out differential comparison on the split new and old version source files, extracting differential files and packaging the differential files into upgrade files;
and sequentially carrying out differential upgrading on the parts of the single chip microcomputer with the difference files according to the upgrading file information.
2. The method of claim 1, wherein splitting the source file into a plurality of separate files by a program function in the source file comprises:
and dividing the program into one or more sections according to the program function in the source file, wherein each section is an integral multiple of the minimum erasure size of the Flash supported by the singlechip.
3. The method of claim 2, wherein partitioning a program into one or more segments by program function in a source file further comprises:
and reserving a CRC CODE area in the last section or each section of the whole off-chip ROM for checking the data in the whole off-chip ROM or each section.
4. The method according to claim 1, wherein the differential upgrade sequentially performed on the parts of the single chip microcomputer where the differential files exist according to the upgrade file information specifically comprises:
obtaining upgrade file information, wherein the upgrade file information at least comprises the number of BlOCKs in the upgrade file, the initial address of each BLOCK, the space size of each BLOCK and whether data is encrypted;
judging whether the upgrade file is effective or not according to the initial address and the space size of each BLOCK and whether the source file is an empty file or not;
erasing the storage area corresponding to each BLOCK and requesting to write the difference file;
the single chip microcomputer writes the received difference file data into a corresponding ROM address, exits the data transmission process and informs the single chip microcomputer of the completion of the transmission;
checking whether the transmitted difference file has errors, if not, writing the CRC CODE into a reserved CRC CODE area, and if so, retrying or executing an abnormal flow;
and judging whether the upgrade of all the difference files is finished, and if not, continuing to perform erasing and writing of the storage areas corresponding to the difference files and checking the written files.
CN202110038134.2A 2021-01-12 2021-01-12 Singlechip firmware upgrading method Pending CN112732318A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110038134.2A CN112732318A (en) 2021-01-12 2021-01-12 Singlechip firmware upgrading method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110038134.2A CN112732318A (en) 2021-01-12 2021-01-12 Singlechip firmware upgrading method

Publications (1)

Publication Number Publication Date
CN112732318A true CN112732318A (en) 2021-04-30

Family

ID=75590610

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110038134.2A Pending CN112732318A (en) 2021-01-12 2021-01-12 Singlechip firmware upgrading method

Country Status (1)

Country Link
CN (1) CN112732318A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113221149A (en) * 2021-05-27 2021-08-06 深圳市共进电子股份有限公司 Firmware encryption method and device, firmware decryption method and computer equipment
CN113721966A (en) * 2021-08-27 2021-11-30 杭州华橙软件技术有限公司 Node upgrading method and device, storage medium and electronic device
CN113867210A (en) * 2021-09-29 2021-12-31 中国科学院长春光学精密机械与物理研究所 Multipath satellite-borne embedded system software on-orbit reconstruction control system and control method

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102622250A (en) * 2012-03-07 2012-08-01 四川长虹电器股份有限公司 Software upgrading method for set top box supporting multi-flash equipment
CN105589725A (en) * 2016-01-11 2016-05-18 武汉虹信通信技术有限责任公司 Upgrade patch manufacture method of electronic equipment, upgrade method and upgrade patch
CN105930197A (en) * 2016-06-28 2016-09-07 乐视控股(北京)有限公司 Software upgrading method and electronic equipment
CN107861764A (en) * 2016-09-21 2018-03-30 佛山市顺德区美的电热电器制造有限公司 For the program upgrade system of cooking appliance, method and cooking appliance
CN110716727A (en) * 2019-09-02 2020-01-21 领翌技术(横琴)有限公司 Software upgrading method and system
CN111045713A (en) * 2019-12-19 2020-04-21 浪潮(北京)电子信息产业有限公司 Method, system and device for upgrading computer system
CN111258620A (en) * 2018-11-30 2020-06-09 中兴通讯股份有限公司 Method, device and equipment for generating differential upgrade package
CN111782246A (en) * 2020-07-03 2020-10-16 常州东晟合众节能科技有限公司 Embedded program upgrading method of multi-node equipment based on bus
CN111796856A (en) * 2020-08-26 2020-10-20 北京紫光展锐通信技术有限公司 Differential upgrading method and device, storage medium and computer equipment
CN111831297A (en) * 2019-04-17 2020-10-27 中兴通讯股份有限公司 Zero-difference upgrading method and device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102622250A (en) * 2012-03-07 2012-08-01 四川长虹电器股份有限公司 Software upgrading method for set top box supporting multi-flash equipment
CN105589725A (en) * 2016-01-11 2016-05-18 武汉虹信通信技术有限责任公司 Upgrade patch manufacture method of electronic equipment, upgrade method and upgrade patch
CN105930197A (en) * 2016-06-28 2016-09-07 乐视控股(北京)有限公司 Software upgrading method and electronic equipment
CN107861764A (en) * 2016-09-21 2018-03-30 佛山市顺德区美的电热电器制造有限公司 For the program upgrade system of cooking appliance, method and cooking appliance
CN111258620A (en) * 2018-11-30 2020-06-09 中兴通讯股份有限公司 Method, device and equipment for generating differential upgrade package
CN111831297A (en) * 2019-04-17 2020-10-27 中兴通讯股份有限公司 Zero-difference upgrading method and device
CN110716727A (en) * 2019-09-02 2020-01-21 领翌技术(横琴)有限公司 Software upgrading method and system
CN111045713A (en) * 2019-12-19 2020-04-21 浪潮(北京)电子信息产业有限公司 Method, system and device for upgrading computer system
CN111782246A (en) * 2020-07-03 2020-10-16 常州东晟合众节能科技有限公司 Embedded program upgrading method of multi-node equipment based on bus
CN111796856A (en) * 2020-08-26 2020-10-20 北京紫光展锐通信技术有限公司 Differential upgrading method and device, storage medium and computer equipment

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113221149A (en) * 2021-05-27 2021-08-06 深圳市共进电子股份有限公司 Firmware encryption method and device, firmware decryption method and computer equipment
CN113221149B (en) * 2021-05-27 2024-02-09 深圳市共进电子股份有限公司 Firmware encryption method, device, firmware decryption method and computer equipment
CN113721966A (en) * 2021-08-27 2021-11-30 杭州华橙软件技术有限公司 Node upgrading method and device, storage medium and electronic device
CN113721966B (en) * 2021-08-27 2024-03-29 杭州华橙软件技术有限公司 Node upgrading method and device, storage medium and electronic device
CN113867210A (en) * 2021-09-29 2021-12-31 中国科学院长春光学精密机械与物理研究所 Multipath satellite-borne embedded system software on-orbit reconstruction control system and control method
CN113867210B (en) * 2021-09-29 2024-04-05 中国科学院长春光学精密机械与物理研究所 On-orbit reconstruction control method for multichannel satellite-borne embedded system software

Similar Documents

Publication Publication Date Title
CN112732318A (en) Singlechip firmware upgrading method
CN102132258B (en) Firmware update system, and information apparatus, as well as program
US9678761B2 (en) Technology for selectively updating memory-resident images
CN106095620B (en) A kind of development approach of built-in Linux partition holding
CN108415717B (en) ZYNQ SOC firmware upgrading method and upgrading device
CN106445398B (en) A kind of embedded file system and its implementation based on novel memory devices
US20080195833A1 (en) Systems, methods and computer program products for operating a data processing system in which a file system's unit of memory allocation is coordinated with a storage system's read/write operation unit
CN102043651B (en) NAND flash memory and data updating management method thereof
CN101903866A (en) Method and system for storage of data in non-volatile media
CN103914393A (en) MCU-based (microprogrammed control unit-based) non-loss FLASH storage update method
EP2329366B1 (en) Performing a pre-update on a non volatile memory
EP0990989A2 (en) Microcomputer provided with flash memory and method of storing program into flash memory
CN109032632A (en) A kind of FOTA upgrade method, wireless communication terminal and storage medium
CN110515641A (en) The update method of server firmware, apparatus and system
CN101699476B (en) Data processing method and device of smart cards
CN102163155A (en) Upgrade controlling device and method for upgrading memory device
CN107943710B (en) Memory management method and memory controller using the same
CN104021089A (en) Flash memory control chip, storage device and flash memory control method
CN111966287A (en) Data storage method, electronic device and storage medium
CN109213510A (en) A kind of application program updating method and storage medium for embedded device
CN103430178A (en) Method, apparatus and product of data updating
CN104133743B (en) A kind of by burning file to the method for EMMC chip and device
CN103092659A (en) Digital signal processor (DSP) software upgrading system and upgrading method separated from support environment of emulator
CN107894900B (en) MCU upgrading method and system
CN107479924B (en) Software upgrading verification method based on Android system

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210430