CN108008976B - Software identifier generation method, computer readable storage medium and single chip microcomputer - Google Patents
Software identifier generation method, computer readable storage medium and single chip microcomputer Download PDFInfo
- Publication number
- CN108008976B CN108008976B CN201711446366.1A CN201711446366A CN108008976B CN 108008976 B CN108008976 B CN 108008976B CN 201711446366 A CN201711446366 A CN 201711446366A CN 108008976 B CN108008976 B CN 108008976B
- Authority
- CN
- China
- Prior art keywords
- software
- storage medium
- storage unit
- generation method
- codes
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
Abstract
The invention discloses a software identifier generation method, a computer readable storage medium and a single chip microcomputer. The software identification generation method is used for generating software identification for software codes stored in a storage medium; the software identification generation method comprises the following steps: s1Calculating the software code to generate a check code; s2Generating a software identifier according to the check code; different software codes generate different check codes. The invention generates different check codes according to different software codes, and further generates different software identifiers, namely the software identifiers are different as long as the software codes are different. When the application software of the singlechip in the device is changed and updated, the corresponding software identification is also changed, so that whether the application software of the singlechip meets the user requirement can be quickly identified, and the safety management of the singlechip software version is realized.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a software identifier generation method, a computer readable storage medium and a single chip microcomputer.
Background
At present, corresponding application software is generally required to be installed when devices such as electronic equipment and intelligent instruments realize certain functions. In order to facilitate management, software identification needs to be carried out on application software, particularly, related standards issued by legal metering mechanisms need to be executed on meters such as electric energy meters, and software identification needs to be carried out on software installed in the meters so as to achieve effective management.
In the prior art, the software identifier is generally generated by microprocessor software, and a user can change the software identifier, that is, the software identifier is not changed when the software is changed or updated, which is not favorable for device management and has a risk of data leakage.
Disclosure of Invention
The invention provides a software identifier generation method, a computer readable storage medium and a single chip microcomputer, aiming at overcoming the defects that in the prior art, software identifiers of software installed in a device are generated by microprocessor software, the software identifiers are not changed when the software is changed or updated, and the management of the device is not facilitated.
The invention solves the technical problems through the following technical scheme:
a software identification generation method, the software identification generation method is used for generating software identification for software codes stored in a storage medium;
the software identification generation method comprises the following steps:
S1calculating the software code to generate a check code;
S2generating a software identifier according to the check code;
different software codes generate different check codes.
Preferably, the storage medium includes at least a first storage unit, and the software code is stored in the first storage unit;
the storage medium further comprises at least one second storage unit, and the second storage unit stores a polynomial;
step S1Before, the software identifier generating method further includes:
setting a corresponding relation between the second storage unit and the first storage unit;
step S1The method specifically comprises the following steps:
acquiring a software code from the first storage unit, and acquiring a polynomial from the corresponding second storage unit;
and calculating the software code according to the polynomial to generate a check code.
Preferably, each second storage unit stores a different polynomial.
Preferably, the storage medium further includes a third storage unit;
step S2Then, the software identification generation method further comprises:
and storing the check code and/or the software identification in the third storage unit.
The present invention also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the software identification generation method described above.
Preferably, the computer readable storage medium is a FLASH memory.
The invention also provides a single chip microcomputer which comprises the computer readable storage medium.
Preferably, the single chip microcomputer further comprises: a control unit and a TR interface;
the control unit is electrically connected with the computer readable storage medium and the TR interface respectively;
the control unit is used for acquiring the software identifier from the computer-readable storage medium when receiving a reading instruction, and outputting the software identifier outwards through the TR interface.
Preferably, the single chip microcomputer further comprises: a parallel-to-serial conversion circuit;
the control unit is electrically connected with the TR interface through the parallel-serial conversion circuit;
and the parallel-serial conversion circuit is used for converting the software identifier into a serial bit data stream.
The positive progress effects of the invention are as follows: the invention generates different check codes according to different software codes, and further generates different software identifiers, namely the software identifiers are different as long as the software codes are different. When the application software of the singlechip in the device is changed and updated, the corresponding software identification is also changed, so that whether the application software of the singlechip meets the user requirement can be quickly identified, and the safety management of the software version is realized.
Drawings
Fig. 1 is a flowchart of a software identifier generation method according to embodiment 1 of the present invention.
Fig. 2 is a schematic block diagram of a single chip microcomputer according to embodiment 3 of the present invention.
Detailed Description
The invention is further illustrated by the following examples, which are not intended to limit the scope of the invention.
Example 1
The software identifier generation method of the present embodiment generates a software identifier for a software code stored in a storage medium. The storage medium comprises at least one first storage unit, at least one second storage unit and a third storage unit. The first storage unit is used for storing software codes, and the second storage unit is used for storing polynomials. Wherein the polynomial stored in each second storage unit is different.
As shown in fig. 1, the software identifier generation method includes the following steps:
and 101, setting a corresponding relation between the second storage unit and the first storage unit.
Wherein different software codes generate different check codes.
In this embodiment, step 102 includes:
step 102-1, the software code is obtained from the first storage unit, and the polynomial is obtained from the corresponding second storage unit.
And 102-2, calculating the software code according to the polynomial to generate a check code.
Specifically, when the software code is downloaded, the software code is sequentially written into the first storage unit, and meanwhile, division and remainder operation (without borrow) is performed on the software code obtained from the first storage unit according to the polynomial obtained from the corresponding second storage unit.
The following describes, by way of a specific example, the process of computing software code according to a polynomial:
for example, a first storage unit stores software codes of: 1010. the polynomial stored in the second storage unit corresponding to the first storage unit is: h (x) x3+x+1。
First, according to the index of the variable, h (x) x3+ x +1 into the corresponding binary number 1011; since the polynomial has 4 bits, the software code is shifted left by 3(4-1) bits to get 1010000.
Secondly, performing modulo 2 division on the software code which is shifted to the left by 3 bits by using a binary number of a polynomial to obtain residual bits 011, namely the check code.
Because each first storage unit generates a check code, the software code is stored in several first storage units, and several check codes can be obtained. It should be noted that the number of bits of the check code depends on the highest power of the polynomial h (x).
And 103, generating a software identifier according to the check code.
If a segment of software code has i 16BIT check codes, the specific step of generating the software identifier may be: and (3) respectively carrying out non-borrow division operation on the 32 th-power polynomials in the 2 groups of second storage units by using the data streams obtained by removing 0XFFF from the check codes to obtain 2 groups of 32BIT remainders which are respectively used as the high 32BIT data and the low 32BIT data in the software identifier.
Wherein, the software identification of 64BIT is stored in the software identification storage area.
In this embodiment, different check codes are generated according to different software codes, so as to generate different software identifiers, that is, as long as the software codes are different, the software identifiers are necessarily different. When the application software of the singlechip in the device is changed and updated, the corresponding software identification is also changed, so that whether the application software of the singlechip meets the user requirement can be quickly identified, and the safety management of the software version is realized.
Example 2
The present embodiment provides a computer-readable storage medium on which a computer program is stored, the computer program, when executed by a processor, implementing the software identification generation method provided in embodiment 1.
In this embodiment, the computer-readable storage medium is a FLASH memory.
The program storage area of the FLASH memory generally consists of M storage blocks (i.e., the first storage unit), and each storage block is divided into a plurality of pages. The program memory area supports only slice erase and does not support block erase and page erase. The NVR1 (i.e. the second storage unit) in the NVR area of the FLASH memory stores data codes K (binary numbers of polynomials) with a certain length, the nth 16BIT data Kn in the data codes K corresponds to the nth block Mn in the M data blocks, and when writing each storage block of the FLASH memory, the FLASH controller selects the corresponding polynomial to calculate the check code according to the corresponding relationship. Wherein NVR1 does not support read and write functions for the user. After writing a storage block, a 16BIT check code Cn is calculated and stored in NVR2 (i.e., the third storage unit) in the NVR area. NVR2 has read-only functionality for users.
After all the memory blocks needed in downloading the program are written, the total number of M16 BIT check codes is obtained. And (3) respectively carrying out non-borrow division operation on the 32 th-power polynomials in the 2 groups of second storage units by using the data streams with 0XFFFF removed from the check codes to obtain 2 groups of 32BIT remainders which are respectively used as high 32BIT data and low 32BIT data in the software identifier, and storing 64BIT data of the software identifier to a fixed position in NVR 2.
The computer readable storage medium of the embodiment is used for storing the application program, so that the corresponding software identifier can be changed as long as the application software in the FLASH memory is changed and updated, thereby quickly identifying whether the application software of the FLASH memory meets the requirements of users or not and realizing the safety management of the software version.
Example 3
This embodiment provides a singlechip, as shown in fig. 2, the singlechip includes: a computer-readable storage medium 1, a control unit 2 and a TR interface 3. The computer-readable storage medium is the computer-readable storage medium provided in embodiment 2.
The control unit 2 is electrically connected to the computer-readable storage medium 1 and the TR interface 3, respectively. The control unit is used for acquiring the software identifier from the computer readable storage medium when receiving the reading instruction and outputting the software identifier outwards through the TR interface. The reading instruction is generated by the peripheral equipment and is sent to the singlechip. In the embodiment, the software identifier can be read by the peripheral equipment without the intervention of the single chip microcomputer, so that the possibility of processing the software identifier by the single chip microcomputer is avoided, and the management of a law supervision organization is facilitated.
In this embodiment, according to actual requirements, a parallel-serial conversion circuit 4 may be further disposed in the single chip. The control unit 2 is electrically connected to the TR connection 3 via a parallel-serial conversion circuit 4. And the parallel-serial conversion circuit is used for converting the software identifier into a serial bit data stream. Therefore, the software identifier after parallel-serial conversion can be output to peripheral equipment through an infrared or RS485 communication interface.
While specific embodiments of the invention have been described above, it will be appreciated by those skilled in the art that this is by way of example only, and that the scope of the invention is defined by the appended claims. Various changes and modifications to these embodiments may be made by those skilled in the art without departing from the spirit and scope of the invention, and these changes and modifications are within the scope of the invention.
Claims (7)
1. A software identification generation method is characterized in that the software identification generation method generates a software identification for a software code stored in a storage medium;
the software identification generation method comprises the following steps:
S1calculating the software code to generate a check code;
S2generating a software identifier according to the check code;
different software codes generate different check codes;
the storage medium comprises at least one first storage unit, and the software codes are stored in the first storage unit;
the storage medium further comprises at least one second storage unit, and the second storage unit stores a polynomial;
step S1Before, the software identifier generating method further includes:
setting a corresponding relation between the second storage unit and the first storage unit;
step S1The method specifically comprises the following steps:
acquiring a software code from the first storage unit, and acquiring a polynomial from the corresponding second storage unit;
calculating the software code according to the polynomial to generate a check code;
wherein each of the first storage units generates one of the check codes, and each of the second storage units stores a different polynomial.
2. The software identification generation method of claim 1, wherein the storage medium further comprises a third storage unit;
step S2Then, the software identification generation method further comprises:
and storing the check code and/or the software identification in the third storage unit.
3. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the software identification generation method of any one of claims 1 to 2.
4. The computer-readable storage medium of claim 3, wherein the computer-readable storage medium is a FLASH memory.
5. A single chip microcomputer, characterized in that it comprises a computer-readable storage medium according to claim 3 or 4.
6. The single-chip microcomputer according to claim 5, wherein said single-chip microcomputer further comprises: a control unit and a TR interface;
the control unit is electrically connected with the computer readable storage medium and the TR interface respectively;
the control unit is used for acquiring the software identifier from the computer-readable storage medium when receiving a reading instruction, and outputting the software identifier outwards through the TR interface.
7. The single-chip microcomputer according to claim 6, wherein said single-chip microcomputer further comprises: a parallel-to-serial conversion circuit;
the control unit is electrically connected with the TR interface through the parallel-serial conversion circuit;
and the parallel-serial conversion circuit is used for converting the software identifier into a serial bit data stream.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711446366.1A CN108008976B (en) | 2017-12-27 | 2017-12-27 | Software identifier generation method, computer readable storage medium and single chip microcomputer |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711446366.1A CN108008976B (en) | 2017-12-27 | 2017-12-27 | Software identifier generation method, computer readable storage medium and single chip microcomputer |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108008976A CN108008976A (en) | 2018-05-08 |
CN108008976B true CN108008976B (en) | 2021-08-27 |
Family
ID=62061890
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711446366.1A Active CN108008976B (en) | 2017-12-27 | 2017-12-27 | Software identifier generation method, computer readable storage medium and single chip microcomputer |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108008976B (en) |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7496912B2 (en) * | 2004-02-27 | 2009-02-24 | International Business Machines Corporation | Methods and arrangements for ordering changes in computing systems |
US20090119657A1 (en) * | 2007-10-24 | 2009-05-07 | Link Ii Charles M | Methods and systems for software upgrades |
CN104991865A (en) * | 2015-07-27 | 2015-10-21 | 广东美的厨房电器制造有限公司 | Software management system, software management method and household appliance |
CN105653932B (en) * | 2015-12-30 | 2018-11-06 | 北京金山安全管理系统技术有限公司 | The method and apparatus of software upgrading verification |
CN106096381A (en) * | 2016-06-06 | 2016-11-09 | 北京壹人壹本信息科技有限公司 | The method and system of application file checking |
CN107092236B (en) * | 2017-06-23 | 2019-05-03 | 东莞市中泰模具股份有限公司 | The CNC grooving machine tool of computer readable storage medium and the application medium |
-
2017
- 2017-12-27 CN CN201711446366.1A patent/CN108008976B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN108008976A (en) | 2018-05-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR20100039647A (en) | Data storage device and data storage system having the same | |
US9208021B2 (en) | Data writing method, memory storage device, and memory controller | |
KR20160090054A (en) | Flash memory system and operating method thereof | |
KR20230093481A (en) | Communication data processing method and device, equipment and storage medium | |
CN113300883B (en) | Protocol information generation method, device and terminal equipment | |
US20170302299A1 (en) | Data processing method, memory storage device and memory control circuit unit | |
CN105528183A (en) | Data storage method and storage equipment | |
CN114741231A (en) | Data read-write method, device and equipment based on memory and storage medium | |
US20200233743A1 (en) | Error correction code memory device and codeword accessing method thereof | |
CN104572994A (en) | Method and device for searching data | |
CN108008976B (en) | Software identifier generation method, computer readable storage medium and single chip microcomputer | |
CN113223601A (en) | Circuit, system and method for error correction code management of write-once memory codes | |
US20040088497A1 (en) | Methods and apparatus for exchanging data using cyclic redundancy check codes | |
US20180143785A1 (en) | Server system and reading method | |
US9460782B2 (en) | Method of operating memory controller and devices including memory controller | |
US20170003885A1 (en) | Method and apparatus for downloading data | |
CN105354107A (en) | Data transmission method and system for NOR Flash | |
CN111143240A (en) | Image storage method, system and terminal equipment | |
US11928077B2 (en) | Data processing circuit, data storage device including the same, and operating method thereof | |
US8943385B2 (en) | NAND memory management | |
CN111966523B (en) | Method, system, equipment and medium for managing electric appliance parameters | |
CN109683813B (en) | NVME SSD automatic formatting method, device, terminal and storage medium | |
CN109857340B (en) | Method and device for storing and reading files in NOR FLASH and storage medium | |
CN108964884B (en) | Method for generating dynamic password of mobile terminal, storage medium, electronic equipment and system | |
CN106155916A (en) | Data storage device and data reading method |
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 |