CN106990983B - Singlechip programming method, device and system and singlechip - Google Patents

Singlechip programming method, device and system and singlechip Download PDF

Info

Publication number
CN106990983B
CN106990983B CN201710170442.4A CN201710170442A CN106990983B CN 106990983 B CN106990983 B CN 106990983B CN 201710170442 A CN201710170442 A CN 201710170442A CN 106990983 B CN106990983 B CN 106990983B
Authority
CN
China
Prior art keywords
address
chip microcomputer
file
programming
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710170442.4A
Other languages
Chinese (zh)
Other versions
CN106990983A (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.)
Beijing Electric Vehicle Co Ltd
Original Assignee
Beijing Electric Vehicle 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 Beijing Electric Vehicle Co Ltd filed Critical Beijing Electric Vehicle Co Ltd
Priority to CN201710170442.4A priority Critical patent/CN106990983B/en
Publication of CN106990983A publication Critical patent/CN106990983A/en
Application granted granted Critical
Publication of CN106990983B publication Critical patent/CN106990983B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a singlechip programming method, a device and a system and a singlechip, wherein the method comprises the following steps: the method comprises the steps of obtaining a file compiled by an upper computer, carrying out address conversion on a first address related in the file according to an address conversion strategy corresponding to a single-chip microcomputer to obtain a second address of the single-chip microcomputer, and carrying out programming on data corresponding to the first address in the file at the position of the second address obtained by the first address conversion according to the single programming data volume of the single-chip microcomputer. Compared with the mode of performing address conversion by the upper computer in the prior art, the method and the device have the advantages that the upper computer has higher universality because the single chip microcomputer performs address conversion according to the corresponding address conversion strategy in the embodiment of the invention, can be suitable for the single chip microcomputers with different chip types, and solve the technical problem of poor universality of the upper computer in the prior art.

Description

Singlechip programming method, device and system and singlechip
Technical Field
The invention relates to the technical field of computers, in particular to a singlechip programming method, device and system and a singlechip.
Background
The single chip microcomputer is also called a single chip microcontroller and is equivalent to a microcomputer. The operation of the singlechip depends on a program stored in the singlechip, and in order to write the debugged singlechip program into a storage medium of the singlechip, the programming process of the singlechip needs to be executed. Therefore, when the single chip microcomputer is started, the corresponding functions are completed by operating the programs.
During the programming process, the files generated by the compiler need to be preprocessed, such as address conversion and code filling. In the prior art, the steps of address conversion, code filling and other preprocessing are mainly executed by an upper computer, and because single-chip microcomputers belonging to different chip types have certain difference in address conversion mode and filling mode, the upper computer matched with the single-chip microcomputers is required to be used for programming, so that the universality of the upper computer is poor.
Disclosure of Invention
The present invention is directed to solving, at least to some extent, one of the technical problems in the related art.
Therefore, the first purpose of the invention is to provide a singlechip programming method to solve the technical problem of poor universality of an upper computer in the prior art.
The second purpose of the invention is to provide a singlechip programming device.
The third purpose of the invention is to provide a single chip microcomputer.
The fourth purpose of the invention is to provide a singlechip programming system.
In order to achieve the above object, an embodiment of a first aspect of the present invention provides a method for programming a single chip microcomputer, where the method includes the following steps:
acquiring a file compiled by an upper computer; the file comprises a first address and data corresponding to the first address;
according to an address conversion strategy corresponding to the single chip microcomputer, address conversion is carried out on the first address related to the file, and a second address of the single chip microcomputer is obtained;
and according to the single-time programming data volume of the single chip microcomputer, programming data corresponding to the first address in the file at a second address position obtained by converting the first address.
According to the method for programming the single-chip microcomputer, after a file compiled by an upper computer is obtained, address conversion is carried out on a first address related to the file according to an address conversion strategy corresponding to the single-chip microcomputer to obtain a second address of the single-chip microcomputer, and data corresponding to the first address in the file are programmed at a second address position obtained through the first address conversion according to the single programming data volume of the single-chip microcomputer. Compared with the mode of performing address conversion by an upper computer in the prior art, the method and the device have the advantages that the upper computer has higher universality because the address conversion is performed by the single chip microcomputer according to the corresponding address conversion strategy, and the method and the device can be suitable for the single chip microcomputers with different chip types, and solve the technical problem of poor universality of the upper computer in the prior art.
In order to achieve the above object, an embodiment of a second aspect of the present invention provides a device for programming a single chip, where the device includes:
the acquisition module is used for acquiring a file compiled by the upper computer; the file comprises a first address and data corresponding to the first address;
the conversion module is used for carrying out address conversion on the first address related in the file according to an address conversion strategy corresponding to the single chip microcomputer to obtain a second address of the single chip microcomputer;
and the programming module is used for programming the data corresponding to the first address in the file at a second address position obtained by converting the first address according to the single-time programming data volume of the single chip microcomputer.
According to the singlechip programming device, after the file compiled by the upper computer is obtained, address conversion is carried out on the first address related to the file according to the address conversion strategy corresponding to the singlechip, the second address of the singlechip is obtained, and the data corresponding to the first address in the file is programmed at the second address position obtained by the first address conversion according to the single programming data volume of the singlechip. Compared with the mode of performing address conversion by the upper computer in the prior art, the method and the device have the advantages that the upper computer has higher universality because the single chip microcomputer performs address conversion according to the corresponding address conversion strategy in the embodiment of the invention, can be suitable for the single chip microcomputers with different chip types, and solve the technical problem of poor universality of the upper computer in the prior art.
In order to achieve the above object, a third embodiment of the present invention provides a single chip microcomputer, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement:
acquiring a file compiled by a compiler of an upper computer; the file comprises a first address and data corresponding to the first address;
according to an address conversion strategy corresponding to the single chip microcomputer, address conversion is carried out on the first address related to the file, and a second address of the single chip microcomputer is obtained;
and according to the single-time programming data volume of the single chip microcomputer, programming data corresponding to the first address in the file at a second address position obtained by converting the first address.
In order to achieve the above object, an embodiment of a fourth aspect of the present invention provides a system for programming a single chip microcomputer, where the system for programming a single chip microcomputer includes the single chip microcomputer of the third aspect and an upper computer for compiling a program to be programmed.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The foregoing and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
fig. 1 is a schematic flow chart of a method for programming a single chip microcomputer according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of another method for programming a single chip microcomputer according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a monolithic computer programming apparatus according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of another monolithic computer programming apparatus according to an embodiment of the present invention; and
fig. 5 is a schematic structural diagram of a single chip microcomputer according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
The following describes a method and an apparatus for operating a single chip microcomputer according to an embodiment of the present invention with reference to the drawings.
Fig. 1 is a schematic flow chart of a method for programming a single chip microcomputer according to an embodiment of the present invention.
Before the program code is burnt into the single chip microcomputer, a compiler of an upper computer needs to generate a file recorded with the program code and suffixed with 'Hex' or 'S19'. The Hex file and the S19 are both in a format of a file that can be burned into the single chip microcomputer, and are generally called a Hex file and an S19 file.
On one hand, since the binary code address in the Hex file or the S19 file often needs to be converted to be able to be written, for example: converting the logical address into a physical address, converting the address with the cache into the address without the cache, and the like; on the other hand, a storage (Flash) driver of the lower computer generally needs to write data which conforms to a certain data volume once, and if the data in the Hex file or the S19 file has discontinuous addresses or after the Flash driver writes data for many times, the last remaining data cannot reach the data volume which is written once, the data needs to be filled.
In the prior art, an upper computer executes two steps of address conversion and code filling, and in this case, because a certain difference exists between the address conversion mode and the filling mode by adopting single-chip microcomputers with different chip types, the upper computer matched with the single-chip microcomputers needs to be used for programming, so that the universality of the upper computer is poor.
To solve this problem, an embodiment of the present invention provides a monolithic computer programming method, as shown in fig. 1, the monolithic computer programming method includes the following steps:
step 101, obtaining a file compiled by an upper computer.
The file comprises a first address and data corresponding to the first address. The file format is a Hex file and/or an S19 file. The data mentioned here may be specifically program code to be programmed.
And 102, performing address conversion on the first address related in the file according to an address conversion strategy corresponding to the single chip microcomputer to obtain a second address of the single chip microcomputer.
Specifically, according to an address conversion strategy corresponding to the single chip microcomputer, conversion between a logic address of the file and a physical address of the single chip microcomputer is performed on a first address related to the file, and a second address of the single chip microcomputer is obtained.
And/or according to an address conversion strategy corresponding to the single chip microcomputer, converting the first address related to the file between the address without the cache of the file and the address with the cache of the single chip microcomputer to obtain a second address of the single chip microcomputer.
And 103, according to the data volume of single programming of the single-chip microcomputer, programming data corresponding to the first address in the file at a second address position obtained by converting the first address.
Wherein the data amount includes a byte number of the code.
Specifically, according to the data volume of single-time programming of the single-chip microcomputer, data corresponding to the first address in the file are read in a multiple-time mode.
As a possible situation, when the data volume of the read data is smaller than the data volume of the single-time programming of the single-chip microcomputer, the read data is filled, so that the data volume of the filled data is equal to the data volume of the single-time programming of the single-chip microcomputer; and programming the filled data from the second address position.
As another possible situation, when the data volume of the read data is equal to the data volume of the single programming of the single-chip microcomputer, the read data is programmed from the second address position.
It can be seen that in the prior art, the upper computer is required to be operated manually, the operation steps are complicated, and the Hex file and the S19 file are required to be known to a certain extent by an operator to be filled correctly. In addition, based on single-chip microcomputers of different chip types, the address conversion mode is different, the number of code words which can be written once by Flash drive of different chips is also different, and the upper computer is required to adopt different address conversion modes and code filling modes according to different chips. In the embodiment of the invention, the singlechip executes the two steps of address conversion and code filling, and the upper computer only needs to analyze the Hex file or the S19 file, so that the operation steps of the upper computer are reduced, and the universality of the upper computer is improved.
In this embodiment, a file compiled by an upper computer is obtained, address conversion is performed on a first address related in the file according to an address conversion policy corresponding to a single chip microcomputer to obtain a second address of the single chip microcomputer, and data corresponding to the first address in the file is programmed at a position of the second address obtained by the first address conversion according to a single programming data volume of the single chip microcomputer. Compared with the mode of performing address conversion by the upper computer in the prior art, the method and the device have the advantages that the upper computer has higher universality because the single chip microcomputer performs address conversion according to the corresponding address conversion strategy in the embodiment of the invention, can be suitable for the single chip microcomputers with different chip types, and solve the technical problem of poor universality of the upper computer in the prior art.
For clearly explaining the previous embodiment, this embodiment provides another method for programming a single chip microcomputer, and fig. 2 is a schematic flow chart of the another method for programming a single chip microcomputer according to the embodiment of the present invention.
As shown in fig. 2, the method for programming the single chip microcomputer may include the following steps:
step 201, the single chip microcomputer obtains a file compiled by the upper computer.
The file comprises a first address and data corresponding to the first address.
In a possible application scenario, the first address in the file may be multiple, and data needs to be written from different multiple first address locations.
Step 202, the single chip microcomputer performs address conversion on the current first address according to a preset address conversion strategy to obtain a second address of the single chip microcomputer.
Specifically, the preset address conversion policies of the singlechips of different chip types may be different, and each of the singlechips performs conversion between a logical address of the file and a physical address of the singlechip for the first address related to the file according to the respective preset address conversion policies.
For example: in the Hex file, the first address position is 0xC000, and 30 bytes of code in the file need to be written. In the singlechip, the first address is converted into a second address 0x8000 according to a preset address conversion strategy, so that the Flash drive of the singlechip starts from the second address 0x8000 and burns the 30-byte code.
Step 203, the single chip microcomputer reads data corresponding to the first address in the file, and judges whether the data volume of the read data meets the data volume of single programming of the single chip microcomputer, if so, step 204 is executed, otherwise, step 207 is executed.
Specifically, the Flash of the single-chip microcomputer drives the data volume written once to be limited, so that the data corresponding to the first address in the file needs to be written many times, and correspondingly, before each writing, the single-chip microcomputer reads a certain amount of data, specifically, the data volume read each time by the single-chip microcomputer is the data volume written once driven by the Flash, so as to meet the writing requirement.
Of course, when the remaining data is insufficient, if the read data amount is smaller than the data amount written by the Flash drive in a single time, the read data needs to be filled so as to be equal to the data amount written by the Flash drive in a single time.
And 204, when the data volume of the data read this time is equal to the data volume of the single-time programming of the single chip microcomputer, programming the data read this time from the second address position.
Specifically, when the data volume of the read data is equal to the data volume of the single-chip microcomputer in one burning, the data does not need to be filled, and the burning step can be directly executed. When the current programming is performed, the read data needs to be sequentially written from the second address position, and the programming pointer is shifted from the second address position to the end position of the current programming.
Step 205, determining whether the programming is finished, if the programming is finished, ending the process, and if the programming is not finished, executing step 206.
In a possible application scenario, when the single chip microcomputer is programmed, the whole programming process involves a plurality of second addresses of the single chip microcomputer, and the programming can be performed for many times.
In another possible application scenario, starting from a certain second address position, more data needs to be programmed, and the programming may be performed multiple times.
Based on the above two cases, after each programming, it is necessary to determine whether the entire programming process is finished.
Step 206, whether the current first address is updated to the next first address in the file, if yes, step 202 is executed, otherwise step 203 is executed.
Specifically, if the whole programming process is not finished, there are two cases:
in one case, the first address location of the file is programmed, the next first address location in the file needs to be programmed, and the current second address is updated correspondingly, so that the next programming is performed from the next second address location.
In another case, the first address location of the file is not programmed completely, and programming needs to be continued for the current first address, without programming the next first address location in the file.
When the former case occurs, it is necessary to perform address conversion first and then perform the writing step. In the latter case, the programming step can be performed directly.
Step 207, determine whether filling is needed, if yes, go to step 208, otherwise go to step 209.
Specifically, when the data volume of the read data is smaller than the data volume of the single-time programming of the single-chip microcomputer, two situations exist, one situation is that the file compiled by the upper computer is sent, and after multiple times of programming, the data volume needing to be programmed is insufficient; in another case, the file compiled by the upper computer is not sent completely, so that the data volume required to be programmed is insufficient.
For the first case, padding is needed, while for the second case, only waiting is needed.
Step 208, the data read this time is filled, and then step 204 is executed.
Specifically, when the data volume of the read data is smaller than the data volume of the single-time programming of the single-chip microcomputer, the read data is filled, so that the data volume of the filled data is equal to the data volume of the single-time programming of the single-chip microcomputer.
For example: the code with 30 bytes needs to be programmed, the data volume of single programming of the single chip microcomputer is 8 bytes, that is, as the single chip microcomputer of the lower computer, the Flash driver needs to write the code with 8 bytes once, 30% 8 is known to be 6 by calculation, 6 bytes need to be programmed when the programming is performed for the last time, in this case, 2 bytes need to be filled, and the 6 bytes are added to complete 8 bytes for the last programming.
Step 209 waits for the data in the file to be received, and then step 204 is performed.
In this embodiment, a file compiled by an upper computer is obtained, address conversion is performed on a first address related in the file according to an address conversion policy corresponding to a single chip microcomputer to obtain a second address of the single chip microcomputer, and data corresponding to the first address in the file is programmed at a position of the second address obtained by the first address conversion according to a single programming data volume of the single chip microcomputer. Compared with the mode of performing address conversion by the upper computer in the prior art, the method and the device have the advantages that the upper computer has higher universality because the single chip microcomputer performs address conversion according to the corresponding address conversion strategy in the embodiment of the invention, can be suitable for the single chip microcomputers with different chip types, and solve the technical problem of poor universality of the upper computer in the prior art.
As a possible application scenario, the single chip microcomputer related to the single chip microcomputer programming method in the foregoing embodiment may be applied to a vehicle controller of a vehicle and/or an electronic control unit of the vehicle. The vehicle comprises an electric automobile, a fuel automobile and/or a hybrid automobile.
For example: when applied to an electronic control unit of an electric vehicle, the single chip microcomputer can be particularly applied to a motor control electronic control unit, a battery control electronic control unit and the like.
In order to realize the embodiment, the invention further provides a singlechip programming device.
Fig. 3 is a schematic structural diagram of a single chip microcomputer programming device according to an embodiment of the present invention.
As shown in fig. 3, the single chip microcomputer programming device comprises: an acquisition module 31, a conversion module 32 and a programming module 33.
The obtaining module 31 is configured to obtain a file compiled by the upper computer.
The file comprises a first address and data corresponding to the first address.
And the conversion module 32 is used for performing address conversion on the first address related in the file according to an address conversion strategy corresponding to the single chip microcomputer to obtain a second address of the single chip microcomputer.
Specifically, the conversion module 32 is specifically configured to: according to an address conversion strategy corresponding to the single chip microcomputer, converting a logic address of a file and a physical address of the single chip microcomputer for a first address related to the file to obtain a second address of the single chip microcomputer; and/or according to an address conversion strategy corresponding to the single chip microcomputer, converting the first address related to the file between the address without the cache of the file and the address with the cache of the single chip microcomputer to obtain a second address of the single chip microcomputer.
And the programming module 33 is configured to perform programming on data corresponding to the first address in the file at a second address position obtained through the first address conversion according to the data amount of single-time programming of the single-chip microcomputer.
In this embodiment, after a file compiled by an upper computer is obtained, address conversion is performed on a first address related to the file according to an address conversion policy corresponding to a single chip microcomputer to obtain a second address of the single chip microcomputer, and data corresponding to the first address in the file is programmed at a position of the second address obtained by the first address conversion according to a single programming data volume of the single chip microcomputer. Compared with the mode of performing address conversion by an upper computer in the prior art, the method and the device have the advantages that the upper computer has higher universality because the address conversion is performed by the single chip microcomputer according to the corresponding address conversion strategy, and the method and the device can be suitable for the single chip microcomputers with different chip types, and solve the technical problem of poor universality of the upper computer in the prior art.
In order to clearly illustrate the single chip microcomputer programming device provided in the previous embodiment, another single chip microcomputer programming device is further provided in this embodiment, fig. 4 is a schematic structural diagram of another single chip microcomputer programming device provided in the previous embodiment, and on the basis of the previous embodiment, the programming module 33 further includes: a read unit 331, a fill unit 332, and a burn-in unit 333.
The reading unit 331 is configured to read data corresponding to the first address in the file in multiple times according to the data amount written by the single-chip microcomputer in a single time.
And the filling unit 332 is configured to fill the read data when the data amount of the read data is smaller than the data amount written by the single-chip microcomputer in a single time, so that the data amount of the filled data is equal to the data amount written by the single-chip microcomputer in a single time.
And a programming unit 333, configured to perform programming on the filled data starting from the second address position.
Further, the programming unit 333 is further configured to:
and when the data volume of the read data is equal to the data volume of the single programming of the single-chip microcomputer, programming the read data from the second address position.
It should be noted that the foregoing explanation of the method embodiment is also applicable to the apparatus of this embodiment, and is not repeated herein.
In the embodiment of the invention, after a file compiled by an upper computer is obtained, address conversion is carried out on a first address related in the file according to an address conversion strategy corresponding to a single-chip microcomputer to obtain a second address of the single-chip microcomputer, and data corresponding to the first address in the file is programmed at the position of the second address obtained by the first address conversion according to the single programming data volume of the single-chip microcomputer. Compared with the mode of performing address conversion by an upper computer in the prior art, the method and the device have the advantages that the upper computer has higher universality because the address conversion is performed by the single chip microcomputer according to the corresponding address conversion strategy, and the method and the device can be suitable for the single chip microcomputers with different chip types, and solve the technical problem of poor universality of the upper computer in the prior art.
In order to implement the foregoing embodiment, the present invention further provides a single chip microcomputer, and fig. 5 is a schematic structural diagram of the single chip microcomputer provided in the embodiment of the present invention, as shown in fig. 5, the single chip microcomputer includes a memory, a processor, and a computer program stored in the memory and operable on the processor, and the processor executes the computer program to implement:
acquiring a file compiled by a compiler of an upper computer; the file comprises a first address and data corresponding to the first address; according to an address conversion strategy corresponding to the single chip microcomputer, address conversion is carried out on the first address related to the file, and a second address of the single chip microcomputer is obtained; and according to the single-time programming data volume of the single chip microcomputer, programming data corresponding to the first address in the file at a second address position obtained by converting the first address.
As a possible application scenario, the single chip microcomputer of the embodiment may be applied to a vehicle controller of a vehicle and/or an electronic control unit of the vehicle. The vehicle comprises an electric automobile, a fuel automobile and/or a hybrid automobile.
For example: when applied to an electronic control unit of an electric vehicle, the single chip microcomputer can be particularly applied to a motor control electronic control unit, a battery control electronic control unit and the like.
Based on the above, the embodiment of the invention further provides a singlechip programming system, which comprises the singlechip and an upper computer for compiling a program to be programmed.
Wherein, singlechip and host computer pass through the communication cable and are connected. As a possible implementation manner, data communication between the single chip and the upper computer may be specifically implemented through a Controller Area Network (CAN).
In the embodiment of the invention, after a file compiled by an upper computer is obtained, address conversion is carried out on a first address related in the file according to an address conversion strategy corresponding to a single-chip microcomputer to obtain a second address of the single-chip microcomputer, and data corresponding to the first address in the file is programmed at the position of the second address obtained by the first address conversion according to the single programming data volume of the single-chip microcomputer. Compared with the mode of performing address conversion by an upper computer in the prior art, the method and the device have the advantages that the upper computer has higher universality because the address conversion is performed by the single chip microcomputer according to the corresponding address conversion strategy, and the method and the device can be suitable for the single chip microcomputers with different chip types, and solve the technical problem of poor universality of the upper computer in the prior art.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "a plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing steps of a custom logic function or process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc. Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (5)

1. A single chip microcomputer programming method is characterized in that the method is executed by a single chip microcomputer, and the method comprises the following steps:
acquiring a file compiled by an upper computer, wherein the file comprises a first address and data corresponding to the first address;
according to an address conversion strategy corresponding to the single chip microcomputer, address conversion is carried out on the first address related to the file, and a second address of the single chip microcomputer is obtained; according to an address conversion strategy corresponding to the single chip microcomputer, converting a logic address of a file and a physical address of the single chip microcomputer for a first address related to the file to obtain a second address of the single chip microcomputer; and/or according to an address conversion strategy corresponding to the single chip microcomputer, converting a first address related to the file between a cache-free address of the file and a cache-containing address of the single chip microcomputer to obtain a second address of the single chip microcomputer;
when the first addresses are multiple, burning data from different multiple first addresses and judging whether the current first address burning is finished or not;
if the current first address is programmed, programming the next first address and correspondingly updating the current second address position;
if the first address is not programmed, programming the current first address;
according to the data volume which is programmed once by the single chip microcomputer, at the position of a second address obtained by converting the first address, programming the data corresponding to the first address in the file, wherein according to the data volume which is programmed once by the single chip microcomputer, the data corresponding to the first address in the file is read in a plurality of times: when the data volume of the read data is smaller than the data volume of the single-time programming of the single-chip microcomputer, the read data is filled so that the data volume of the filled data is equal to the data volume of the single-time programming of the single-chip microcomputer, and the filled data is programmed from the second address position; or when the data volume of the read data is equal to the data volume of the single-time programming of the single-chip microcomputer, programming the read data from the second address position.
2. The utility model provides a singlechip burns and writes device which characterized in that, the device includes:
the acquisition module is used for acquiring a file compiled by an upper computer, wherein the file comprises a first address and data corresponding to the first address;
the conversion module is used for carrying out address conversion on the first address related in the file according to an address conversion strategy corresponding to the single chip microcomputer to obtain a second address of the single chip microcomputer; wherein
The conversion module is specifically configured to:
according to an address conversion strategy corresponding to the single chip microcomputer, converting a logic address of a file and a physical address of the single chip microcomputer for a first address related to the file to obtain a second address of the single chip microcomputer; and/or according to an address conversion strategy corresponding to the single chip microcomputer, converting a first address related to the file between a cache-free address of the file and a cache-containing address of the single chip microcomputer to obtain a second address of the single chip microcomputer;
when the first addresses are multiple, burning data from different multiple first addresses and judging whether the current first address burning is finished or not; wherein
If the current first address is programmed, programming the next first address and correspondingly updating the current second address position;
if the first address is not programmed, programming the current first address;
the programming module is used for programming data corresponding to the first address in the file at a second address position obtained by converting the first address according to the single-time programming data volume of the single chip microcomputer;
the acquisition module is used for acquiring a file compiled by an upper computer, wherein the file comprises a first address and data corresponding to the first address;
the conversion module is used for carrying out address conversion on the first address related in the file according to an address conversion strategy corresponding to the single chip microcomputer to obtain a second address of the single chip microcomputer;
the programming module is used for programming data corresponding to the first address in the file at a second address position obtained by converting the first address according to the single-time programming data volume of the single chip microcomputer;
the programming module comprises:
the reading unit is used for reading data corresponding to the first address in the file in multiple times according to the data volume of the single-time programming of the single-chip microcomputer;
the filling unit is used for filling the read data when the data volume of the read data is smaller than the data volume of the single-time programming of the single-chip microcomputer, so that the data volume of the filled data is equal to the data volume of the single-time programming of the single-chip microcomputer;
the programming unit is used for programming the filled data from the second address position;
the programming unit is further configured to:
and when the data volume of the read data is equal to the data volume of the single programming of the single-chip microcomputer, programming the read data from the second address position.
3. A single chip microcomputer, comprising a memory, a processor, and a computer program stored in the memory and operable on the processor, wherein the processor executes the computer program to implement:
acquiring a file compiled by a compiler of an upper computer; the file comprises a first address and data corresponding to the first address; according to an address conversion strategy corresponding to the single chip microcomputer, address conversion is carried out on the first address related to the file, and a second address of the single chip microcomputer is obtained; according to an address conversion strategy corresponding to the single chip microcomputer, converting a logic address of a file and a physical address of the single chip microcomputer for a first address related to the file to obtain a second address of the single chip microcomputer; and/or according to an address conversion strategy corresponding to the single chip microcomputer, converting a first address related to the file between a cache-free address of the file and a cache-containing address of the single chip microcomputer to obtain a second address of the single chip microcomputer;
when the first addresses are multiple, burning data from different multiple first addresses and judging whether the current first address burning is finished or not;
if the current first address is programmed, programming the next first address and correspondingly updating the current second address position;
if the first address is not programmed, programming the current first address;
according to the data volume which is programmed once by the single chip microcomputer, data corresponding to the first address in the file is programmed at a second address position obtained by converting the first address; and reading data corresponding to a first address in the file in multiple times according to the data volume of the single-time programming of the single-chip microcomputer: when the data volume of the read data is smaller than the data volume of the single-time programming of the single-chip microcomputer, the read data is filled so that the data volume of the filled data is equal to the data volume of the single-time programming of the single-chip microcomputer, and the filled data is programmed from the second address position; or when the data volume of the read data is equal to the data volume of the single-time programming of the single-chip microcomputer, programming the read data from the second address position.
4. The single chip microcomputer according to claim 3, wherein the single chip microcomputer is applied to a vehicle control unit of a vehicle and/or an electronic control unit of the vehicle.
5. The single-chip microcomputer programming system is characterized by comprising the single-chip microcomputer according to claim 3 or 4 and an upper computer for compiling a program to be programmed.
CN201710170442.4A 2017-03-21 2017-03-21 Singlechip programming method, device and system and singlechip Active CN106990983B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710170442.4A CN106990983B (en) 2017-03-21 2017-03-21 Singlechip programming method, device and system and singlechip

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710170442.4A CN106990983B (en) 2017-03-21 2017-03-21 Singlechip programming method, device and system and singlechip

Publications (2)

Publication Number Publication Date
CN106990983A CN106990983A (en) 2017-07-28
CN106990983B true CN106990983B (en) 2021-09-24

Family

ID=59412209

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710170442.4A Active CN106990983B (en) 2017-03-21 2017-03-21 Singlechip programming method, device and system and singlechip

Country Status (1)

Country Link
CN (1) CN106990983B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108279910B (en) * 2018-01-17 2021-04-13 珠海市杰理科技股份有限公司 Program code programming method and device, computer equipment and storage medium
CN108491224B (en) * 2018-07-09 2022-02-11 深圳市路畅科技股份有限公司 Vehicle-mounted software updating method and system
CN110007931A (en) * 2019-01-21 2019-07-12 合肥市航嘉电子技术有限公司 Programming module and its programming method
CN113448596A (en) * 2020-03-24 2021-09-28 上海汽车集团股份有限公司 Vehicle controller flashing system and method and related equipment
CN114237647B (en) * 2021-12-20 2022-10-14 深圳市德仪电子科技有限公司 Single-chip microcomputer programming control system and single-chip microcomputer programming control method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103034801A (en) * 2011-08-30 2013-04-10 马克西姆综合产品公司 Safety microcontroller based on mode
CN103324503A (en) * 2013-05-29 2013-09-25 京东方科技集团股份有限公司 Data programming system and method
CN103513997A (en) * 2012-06-21 2014-01-15 比亚迪股份有限公司 Program recording method and system used for bus network
CN104077166A (en) * 2014-07-10 2014-10-01 西北工业大学 EPCS and EPCQ storer online upgrading method based on IP core in FPGA
CN104239916A (en) * 2014-09-04 2014-12-24 深圳市鼎芯无限科技有限公司 Bluetooth pairing tag programming method and programmer

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007233615A (en) * 2006-02-28 2007-09-13 Fujitsu Ltd Address conversion device
JP5914145B2 (en) * 2012-05-01 2016-05-11 ルネサスエレクトロニクス株式会社 Memory protection circuit, processing device, and memory protection method
CN104268095A (en) * 2014-09-24 2015-01-07 上海新储集成电路有限公司 Memory and data reading/ writing operation method based on memory

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103034801A (en) * 2011-08-30 2013-04-10 马克西姆综合产品公司 Safety microcontroller based on mode
CN103513997A (en) * 2012-06-21 2014-01-15 比亚迪股份有限公司 Program recording method and system used for bus network
CN103324503A (en) * 2013-05-29 2013-09-25 京东方科技集团股份有限公司 Data programming system and method
CN104077166A (en) * 2014-07-10 2014-10-01 西北工业大学 EPCS and EPCQ storer online upgrading method based on IP core in FPGA
CN104239916A (en) * 2014-09-04 2014-12-24 深圳市鼎芯无限科技有限公司 Bluetooth pairing tag programming method and programmer

Also Published As

Publication number Publication date
CN106990983A (en) 2017-07-28

Similar Documents

Publication Publication Date Title
CN106990983B (en) Singlechip programming method, device and system and singlechip
CN108829593B (en) Code coverage rate calculation and analysis method, device, equipment and storage medium
CN108491224B (en) Vehicle-mounted software updating method and system
US7774382B2 (en) Method and apparatus for configuring a control device, and corresponding control device
CN102567018B (en) The application program method for down loading that a kind of Vehicle Controller performs and system
CN108268024A (en) Vehicular diagnostic method, device, terminal and computer readable storage medium
CN111488165B (en) Method and system for upgrading vehicle ECU through script
US9418397B2 (en) Start-up processing task distribution among processing units
US8255108B2 (en) Dynamic file system creation for scan tools
JP5527420B2 (en) Vehicle data acquisition system and vehicle data acquisition method
CN110371022B (en) Battery matching method and device and vehicle-mounted equipment
CN111324362A (en) Vehicle, and method and device for updating vehicle electronic control system program
CN110795304B (en) Method and device for testing performance of distributed storage system
CN107885536A (en) Startup method, embeded processor and the storage device of a kind of embeded processor
KR102085899B1 (en) Operating Monitoring Method For CPU Of Vehicle ECU, And Monitoring Unit
CN116560688A (en) Software updating method for domain controller
GB2526992A (en) Electronic control device and method for rewriting data
US10073675B2 (en) Control unit for a motor vehicle, programming unit, and programming system
CN113805860A (en) Code generation method and device based on C language, electronic equipment and storage medium
CN110781031B (en) Controller data recovery method and device, controller and automobile
CN108920695B (en) A kind of data query method, apparatus, equipment and storage medium
KR101354698B1 (en) Method for operating of electronic control apparatus for vehicle
CN107005552B (en) Method for communication between a production tool and a motor vehicle
JP2010020416A (en) Data transfer method and data transfer unit
CN112181799A (en) Software configuration parameter testing method and device and automobile

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