CN108228198A - programming method and device - Google Patents
programming method and device Download PDFInfo
- Publication number
- CN108228198A CN108228198A CN201611200202.6A CN201611200202A CN108228198A CN 108228198 A CN108228198 A CN 108228198A CN 201611200202 A CN201611200202 A CN 201611200202A CN 108228198 A CN108228198 A CN 108228198A
- Authority
- CN
- China
- Prior art keywords
- memory
- flash memory
- application
- code
- program
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Landscapes
- Stored Programmes (AREA)
- Read Only Memory (AREA)
Abstract
This disclosure relates to a kind of programming method and device, the program upgrade system applied to vehicle control device.The programming method includes:Application code is carried out by segmentation by host computer and is sent to memory, so that segmentation code is successively stored in the application memory area for being used to store the application code distributed in the memory;Wherein, the length of segmentation code is less than or equal to the application memory area;When the application memory area often receives one section of segmentation code, judge flash memory whether by erasing operation;When the flash memory passes through erasing operation, the flash memory is written in the segmentation code that the application memory area is received.The mode of flash memory is written in this reception application code being segmented every time of the disclosure again, the utilization rate of flash memory space can be greatly improved, it without being limited by memory headroom, solves the problems, such as that flash memory space utilization rate is low in vehicle control chip, improves program upgrading efficiency.
Description
Technical field
A kind of this disclosure relates to electronic technology field, and in particular, to programming method and device.
Background technology
With Freescale master chip it is more be applied to automobile VCU (Vehicle Control Unit, full-vehicle control
Device), TCU (Transmission Control Unit, automatic gear-box control unit) etc., control strategy directly affects
The performance of vehicle upgrades with the modification of control strategy, and corresponding VCU, TCU will be updated the download upgrading of program.One
As in the case of, developer need VCU, TCU for being installed on vehicle are disassembled from housing, then pass through background debugging mode
(Background Debug Mode, BDM) tool is downloaded and is upgraded into line program to VCU, TCU.Doing so can be very cumbersome,
Greatly reduce the efficiency of software upgrading.
Chinese patent application application No. is 201410004767.1 discloses application system and the side of a kind of program upgrading
Method is based on Freescale HCS08 series monolithics CAN (Controller Area Network, controller local area network)
The application system of the program upgrading of bus, including a HCS08 series monolithics system modules of N (N >=1), CAN converters and upper
Machine;Wherein, above-mentioned N number of HCS08 series monolithics system module is connect by CAN bus with CAN converters respectively, the CAN
Converter is connect again with host computer.By the present invention, can not need at the scene conveniently detaching equipment only need to by computer or
Other equipment utilization CAN bus with CAN bus upgrade product into line program.
But the continuous complication of the constantly improve and function with VCU, TCU control strategy, the generation of application program
Code length is increasingly longer, the memory space bigger of demand.And above-mentioned the relevant technologies limit application code length, need by
After all complete deposit ram regions of upgrading data receiver, CRC (cyclic redundancy check, Cyclic Redundancy Check) verifications
Flash (flash memory) is written in application program by property again for success.And in general, the ram space of chip is controlled to be far smaller than
FLASH spaces greatly limit the utilization rate of Flash in this way, reduce program upgrading efficiency.
Invention content
The purpose of the disclosure is to provide a kind of programming method and device, for solving flash memory space profit in vehicle control chip
With rate it is low the problem of.
To achieve these goals, the disclosure provides a kind of programming method, and the program applied to vehicle control device upgrades system
System, described program upgrade-system include host computer and the slave computer of data interaction, the slave computer are carried out with the host computer
Including memory and flash memory;The programming method includes:
Application code is carried out by segmentation by the host computer and is sent to the memory, so that segmentation code is successively deposited
Enter the application memory area for being used to store the application code distributed in the memory;Wherein, the length of segmentation code is small
In or equal to the application memory area;
When the application memory area often receives one section of segmentation code, judge the flash memory whether by erasing behaviour
Make;
When the flash memory passes through erasing operation, described in segmentation code write-in that the application memory area is received
Flash memory.
Optionally, it is described by the host computer by application code carry out segmentation be sent to the memory before, institute
Programming method is stated to further include:
The memory headroom is allocated, so that the memory includes the application memory area and for loading the sudden strain of a muscle
The erasable memory block of erasing program and write-in program in depositing.
Optionally, it is described to judge the flash memory whether by before erasing operation, the programming method further includes:
Judged by the bootstrap in the flash memory described interior described upper there are whether being received in preset time period
The data that machine is sent;Wherein, the data include the segmentation code or upgrade signal;
When it is described it is interior there are data that the host computer is sent are received in preset time period when, will be in the flash memory
The erasing program and said write routine call to the erasable memory block in run;
When it is described it is interior there are data that the host computer is sent are not received in preset time period when, jump to institute
It states in flash memory, and performs the existing application code in the flash memory.
Optionally, it is described to judge whether the flash memory passes through erasing operation, including:
Judge whether the memory receives the segmentation code for the first time;
When it is described to state memory be to receive the segmentation code for the first time when, pass through the erasing program and wipe the flash memory;
When the memory is not to receive the segmentation code for the first time, the institute for receiving the application memory area is performed
State the step of flash memory is written in segmentation code.
Optionally, it is described to judge whether the flash memory passes through erasing operation, including:
Whether the target sector of segmentation code for judging to be used to store the application memory area in the sector of the flash memory passes through
Cross erasing operation;
When erasing operation is not passed through in the target sector, the target sector is wiped by the erasing program;
When erasing operation is passed through in the target sector, the segmentation code for receiving the application memory area is performed
The step of flash memory is written.
Optionally, it further includes:Retain the interrupt vector table of the bootstrap, and reposition in the application program
Disconnected vector table, so that the interrupt vector table address of the bootstrap is different from the interrupt vector table address of the application program.
Optionally, it further includes:Assignment is carried out to the protection register of the flash memory, is used to store in the flash memory to protect
The address of the erasing program and said write program.
The disclosure additionally provides a kind of programming device, applied to the program upgrade system of vehicle control device, described program liter
Grade system includes host computer and the slave computer of data interaction is carried out with the host computer, and the slave computer includes memory and sudden strain of a muscle
It deposits;The programming device includes:
Sending module, for pass through the host computer by application code carry out segmentation be sent to the memory so that
Segmentation code is successively stored in the application memory area for being used to store the application code distributed in the memory;Wherein, divide
The length of section code is less than or equal to the application memory area;
First judgment module, for when the application memory area often receives one section of segmentation code, described in judgement
Whether flash memory passes through erasing operation;
Writing module, for when the flash memory pass through erasing operation when, by the application memory area receive described in point
The flash memory is written in section code.
Optionally, it further includes:Distribution module, for the memory headroom to be allocated, so that the memory includes institute
State application memory area and the erasable memory block for loading erasing program and write-in program in the flash memory.
Optionally, it further includes:
Second judgment module, for judging that described interior there are be in preset time period by the bootstrap in the flash memory
The no data for receiving the host computer and sending;Wherein, the data include the segmentation code or upgrade signal;
Calling module, for working as, described interior there are the data for the host computer is received in preset time period sending
When, it will be run in the erasing program in the flash memory and said write routine call to the erasable memory block;
Jump module, for working as, described interior there are the numbers for the host computer is not received in preset time period sending
According to when, jump in the flash memory, and perform the existing application code in the flash memory.
Optionally, first judgment module includes:
First judging submodule, for judging whether the memory receives the segmentation code for the first time;
First erasing submodule, for when it is described state memory be for the first time receive the segmentation code when, pass through the wiping
Except program wipes the flash memory;
When the memory is not to receive the segmentation code for the first time, said write module is performed the application memory
The step of flash memory is written in the segmentation code that area receives.
Optionally, first judgment module includes:
Second judgment submodule, for judging to be used for the segmentation generation for storing the application memory area in the sector of the flash memory
Whether the target sector of code passes through erasing operation;
Second erasing submodule, for when erasing operation is not passed through in the target sector, passing through the erasing program
Wipe the target sector;
When erasing operation is passed through in the target sector, the execution of said write module receives the application memory area
The step of flash memory is written in the segmentation code.
Optionally, it further includes:Module is repositioned, for retaining the interrupt vector table of the bootstrap, and it is again fixed
The interrupt vector table of the position application program, so that the interrupt vector table address of the bootstrap is different from the application program
Interrupt vector table address.
It further includes:Assignment module for carrying out assignment to the protection register of the flash memory, is used with protecting in the flash memory
In the address for storing the erasing program and said write program.
The technical scheme provided by this disclosed embodiment can include the following benefits:
The memory is sent to by the way that application code is carried out segmentation, when the application memory area often receives one section
During the segmentation code, judge that the flash memory whether by erasing operation, when the flash memory passes through erasing operation, described will be answered
The flash memory is written with the segmentation code that memory block receives, and then, this reception application being segmented every time of the disclosure
The mode of flash memory is written in program code again, can greatly improve the utilization rate of flash memory space, without being limited by memory headroom, solves
The problem of flash memory space utilization rate is low in vehicle control chip improves program upgrading efficiency.
Other feature and advantage of the disclosure will be described in detail in subsequent specific embodiment part.
Description of the drawings
Attached drawing is for providing further understanding of the disclosure, and a part for constitution instruction, with following tool
Body embodiment is used to explain the disclosure, but do not form the limitation to the disclosure together.In the accompanying drawings:
Fig. 1 is the flow chart according to a kind of programming method shown in an exemplary embodiment.
Fig. 2 is another flow chart according to a kind of programming method shown in an exemplary embodiment.
Fig. 3 is another flow chart according to a kind of programming method shown in an exemplary embodiment.
Fig. 4 be the step of being included according to a kind of programming method shown in an exemplary embodiment in judge whether flash memory passes through
The flow chart of erasing operation.
Fig. 5 be the step of being included according to a kind of programming method shown in an exemplary embodiment in judge whether flash memory passes through
Another flow chart of erasing operation.
Fig. 6 is the schematic diagram according to the application program interrupt vector table after the repositioning shown in an exemplary embodiment.
Fig. 7 is the block diagram according to a kind of programming device shown in an exemplary embodiment.
Fig. 8 is another block diagram according to a kind of programming device shown in an exemplary embodiment.
Fig. 9 is the block diagram according to a kind of the first judgment module of programming device shown in an exemplary embodiment.
Figure 10 is another block diagram according to a kind of the first judgment module of programming device shown in an exemplary embodiment.
Figure 11 is another block diagram according to a kind of programming device shown in an exemplary embodiment.
Figure 12 is another block diagram according to a kind of programming device shown in an exemplary embodiment.
Specific embodiment
Here exemplary embodiment will be illustrated in detail, example is illustrated in the accompanying drawings.Following description is related to
During attached drawing, unless otherwise indicated, the same numbers in different attached drawings represent the same or similar element.Following exemplary embodiment
Described in embodiment do not represent all embodiments consistent with the disclosure.On the contrary, they be only with it is such as appended
The example of the consistent device and method of some aspects be described in detail in claims, the disclosure.
The programming method of the disclosure is applied to the program upgrade system of vehicle control device, and described program upgrade-system includes upper
Position machine and the slave computer that data interaction is carried out with the host computer, the slave computer include memory and flash memory.The vehicle control
Device processed can be the controller for having Freescale chip, the host computer and the slave computer can be by CAN module into
Row data interaction.Certainly, in other embodiments, the host computer and the slave computer can also be by other communication parties
Formula carries out the communication mode of data interaction, such as such as RS485 buses and LIN buses, the host computer and the slave computer
It is related to the specific peripheral functionality of the controller chips.
Fig. 1 is the flow chart according to a kind of programming method shown in an exemplary embodiment.As shown in Figure 1, the programming
Method includes the following steps.
In step s 11, application code is carried out by segmentation by the host computer and is sent to the memory, so that point
Section code is successively stored in the application memory area for being used to store the application code distributed in the memory;Wherein, it is segmented
The length of code is less than or equal to the application memory area.
In step s 12, when the application memory area often receives one section of segmentation code, judge that the flash memory is
It is no to pass through erasing operation.
In step s 13, when the flash memory passes through erasing operation, the segmentation that the application memory area is received
The flash memory is written in code.
First, in step S11, operating personnel are sent out application data by way of data-interface or wireless communication
It send to the host computer.The application data is then converted into the application program that slave computer is able to carry out by the host computer
Code, after then the application code is segmented, by communication module in described program upgrade-system (such as
CAN module) it is sent in the memory of slave computer.Wherein, the memory includes the application for storing the application code
Memory block when being segmented to the application code, is segmented into multiple segmentation codes of equal length, can also be divided into
Multiple segmentation codes of length, as long as the length of each segmentation code is less than or equal to the application memory area.
It should be noted that when segmentation code is sent in the memory, a segmentation code can be only sent every time,
Multiple segmentation codes can also be sent every time, as long as the sum of length of multiple segmentation codes sent every time is less than or equal to described
Application memory area.
With S19 document code examples, first in the host computer, the SRecCvt- that is provided using Freescale company
Every record of the S19 document codes of generation is converted into 32 bytes and (carries out waiting at byte lengths herein by GUI.exe softwares
Reason, facilitates the reception of subsequent bootstrap to handle);Then, the S19 document codes are further located by the host computer
Reason (for example, extraction address and valid code);Then, the S19 document codes of segmentation are sent to by bottom by CAN module successively
In the memory of machine.
When application code is carried out segmentation by the host computer is sent to the memory, step S12 is performed, when described
When application memory area often receives one section of segmentation code, judge the flash memory whether by erasing operation.Due to the sudden strain of a muscle
Code can be just written by depositing after needs are wiped, it is therefore desirable to when judging that the flash memory passes through erasing operation, the application be deposited
The flash memory is written in the segmentation code that storage area receives.
The disclosure is sent to the memory by the way that application code is carried out segmentation, when the application memory area often receives
During to one section of segmentation code, judge that the flash memory, will when the flash memory passes through erasing operation whether by erasing operation
The flash memory is written in the segmentation code that the application memory area receives, and then, the disclosure it is this be segmented every time connect
The mode that flash memory is written in application code again is received, the utilization rate of flash memory space can be greatly improved, without being limited by memory headroom
System so that the length of application code can reach to greatest extent distributes to flash memory space, and it is increasingly complicated to have adapted to the functions such as VCU, TCU
The demand of change solves the problems, such as that flash memory space utilization rate is low in vehicle control chip, improves program upgrading efficiency.
Fig. 2 is another flow chart according to a kind of programming method shown in an exemplary embodiment.It is as shown in Fig. 2, described
Programming method includes the following steps.
In the step s 21, the memory headroom is allocated, so that the memory includes storing application program generation
The application program memory block of code and the erasable memory block for loading erasing program and write-in program in the flash memory.
In step S22, the application code is carried out by segmentation by the host computer and is sent to the memory, with
Segmentation code is made successively to be stored in the application memory area;Wherein, the length of segmentation code is less than or equal to the application memory area.
In step S23, when the application memory area often receives one section of segmentation code, judge that the flash memory is
It is no to pass through erasing operation.
In step s 24, when the flash memory passes through erasing operation, the segmentation that the application memory area is received
The flash memory is written in code.
Wherein, the allocation step memory headroom carried out can be in the programming method for performing the disclosure every time
Again the memory headroom is redistributed.It during to the Memory Allocation, is allocated according to demand, institute can be kept for
Application program memory headroom as big as possible is stated, i.e., the space occupied is the bigger the better in memory in described application memory area.By institute
It states memory headroom to be allocated, can not only realize that the segmentation code for sending over the host computer is temporarily stored,
It can realize and the erasing program and said write program are loaded onto in the memory from the flash memory and run.
Fig. 3 is another flow chart according to a kind of programming method shown in an exemplary embodiment.It is as shown in figure 3, described
Programming method includes the following steps.
In step 31, application code is carried out by segmentation by the host computer and is sent to the memory, so that point
Section code is successively stored in the application memory area for being used to store the application code distributed in the memory;Wherein, it is segmented
The length of code is less than or equal to the application memory area.
In the step 32, judge that described interior there are whether receive in preset time period by the bootstrap in the flash memory
The data sent to the host computer;Wherein, the data include the segmentation code or upgrade signal.
In step 33, when it is described it is interior there are data that the host computer is sent are received in preset time period when,
Erasing program in the flash memory and write-in program are called into the erasable memory block and run.
In step 34, when the application memory area often receives one section of segmentation code, judge that the flash memory is
It is no to pass through erasing operation.
In step 35, when the flash memory passes through erasing operation, the segmentation that the application memory area is received
The flash memory is written by said write program in code.
In step 36, interior there are the data for the host computer is not received in preset time period sending when described
When, perform the existing application code in the flash memory.
Wherein, the preset time can section can be 5 seconds, 3 seconds or other time section.The bootstrap is waiting for
Preset time period in, by judge it is described it is interior there are whether received in preset time period the host computer send described in point
Whether section code or upgrade signal, carrying out decision procedure upgrade-system needs whether upgrading or program code are all written the sudden strain of a muscle
It deposits.
When the bootstrap is in the preset time period of waiting, the segmentation code that the host computer is sent is received
Or during upgrade signal, the erasable memory block into the memory is called to transport the erasing program in the flash memory and write-in program
Row.Then step 34 is performed, when the application memory area often receives one section of segmentation code, whether judges the flash memory
By erasing operation.When the flash memory passes through erasing operation, the segmentation code that the application memory area receives is led to
It crosses said write program and the flash memory is written.It is run since said write program is called in memory, accelerates operating rate,
And reduce the probability that flash memory damages caused by unexpected reset.
When the bootstrap is in the preset time period of waiting, the segmentation that the host computer is sent is not received
When code or upgrade signal, then show that program upgrade system does not need to upgrading or the flash memory is all written in program code
In, at this point, jumping in the flash memory, and perform the existing application code in the flash memory.I.e. the disclosure passes through
Timeout mechanism realizes redirecting between bootstrap and application program, instead of the mode that hardware switch is used in the relevant technologies
It realizes redirecting between bootstrap and application program, has saved hardware cost.
Fig. 4 be the step of being included according to a kind of programming method shown in an exemplary embodiment in judge whether flash memory passes through
The flow chart of erasing operation.As shown in figure 4, described judge that the flash memory whether by erasing operation, may comprise steps of.
In step 3411, judge whether the memory receives the segmentation code for the first time.
In step 3412, when the memory is to receive the segmentation code for the first time, wiped by the erasing program
Except the flash memory.
In step 3413, when the memory is not to receive the segmentation code for the first time, performs and deposit the application
The step of flash memory is written in the segmentation code that storage area receives.
Wherein, can include in the flash memory it is multiple for storing the sectors of the segmentation code, when the memory is the
When once receiving the segmentation code, all sectors are disposably wiped by the erasing program.I.e. in the memory first
During the secondary reception segmentation code, the bootstrap calls the erasing program to wipe the flash memory.When the memory is not
When receiving the segmentation code for the first time, with regard to no longer carrying out erasing operation, and passing through to call write-in program by the application memory
The segmentation code that area receives is written in the flash memory.
Fig. 5 be the step of being included according to a kind of programming method shown in an exemplary embodiment in judge whether flash memory passes through
Another flow chart of erasing operation.As shown in figure 5, described judge that the flash memory whether by erasing operation, can include following
Step.
In step 3421, judge to be used for the mesh for storing the segmentation code in the application memory area in the sector of the flash memory
Mark whether sector passes through erasing operation.
In step 3422, when erasing operation is not passed through in the target sector, institute is wiped by the erasing program
State target sector.
In step 3423, when erasing operation is passed through in the target sector, perform and receive the application memory area
The segmentation code be written the flash memory the step of.
Wherein, the flash memory includes multiple sectors, and each sector is used to store the corresponding segmentation code.When described
After application memory area receives a segmentation code, the bootstrap first determines whether this point that the application memory area receives
Whether the target sector corresponding to section code passes through erasing operation.If target sector is not by erasing operation, the guiding
Program is wiped described in routine call and wipes the target sector.When erasing operation is passed through in the target sector, the guiding journey
The target sector is written in the segmentation code that sequence calls write-in program to receive the application memory area.
Optionally, the programming method further includes:Retain the interrupt vector table of the bootstrap, and described in repositioning
The interrupt vector table of application program, so that the interrupt vector table address of the bootstrap is different from the interruption of the application program
Vectorial table address.Since all CPU are usually by fetching on the prearranged address of CPU manufacturer (0xFFFE) from some
It enables, and the bootstrap and the application program be respectively in memory and flash memory, in order to prevent the bootstrap and described
Application program causes the confusion of routine call due to identical address, as shown in fig. 6, in reserved memory bootstrap interruption to
Scale (0xFF10-0xFFFF) resets the interrupt vector table (0xEF10-0xEFFF) of application program.Therefore upgrade in program and be
After the power is turned on, bootstrap will be first carried out in CPU to system;After escape leading, the reset of the application program of programming jump to 0xEFFE to
At amount, start to perform corresponding application program.
Optionally, the programming method further includes:Assignment is carried out to the protection register of the flash memory, to protect the sudden strain of a muscle
It is used to store the address of the erasing program and write-in program in depositing.For example, the erasing program and said write program are placed in
At 0xF000-0xF1FF in flash memory, and FPROT=0x8f is set, to protect the address model of the 0xF000-0xFFFF in flash memory
It encloses.
Optionally, the programming method further includes:The flash memory space is allocated, so that the flash memory includes being used for
The code memory block of memory segment code and the guiding memory block for storing the bootstrap.The flash memory space is carried out
Allocation step, can be every time perform the disclosure programming method when the flash memory space is redistributed again.
Fig. 7 is the block diagram according to a kind of programming device shown in an exemplary embodiment.With reference to Fig. 7, the programming device
700 include sending module 710, sending module 710 and writing module 730.The programming device 700 is applied to vehicle control device
Program upgrade system, described program upgrade-system include host computer and with the host computer carry out data interaction bottom
Machine, the slave computer include memory and flash memory.
The sending module 710 is used to by application code be segmented by the host computer to be sent to the memory,
So that segmentation code is successively stored in the application memory area for being used to store the application code distributed in the memory;Its
In, the length of segmentation code is less than or equal to the application memory area.
First judgment module 720 is used for when the application memory area often receives one section of segmentation code, is judged
Whether the flash memory passes through erasing operation.
The writing module 730 is used for the institute that when the flash memory passes through erasing operation, the application memory area is received
It states segmentation code and the flash memory is written.
Optionally, as shown in figure 8, the programming device 700, which removes, includes sending module 710, sending module 710 and write-in
Outside module 730, distribution module 740 is further included.
The distribution module 740 is for the memory headroom to be allocated, so that the memory includes the application memory
Area and the erasable memory block for loading erasing program and write-in program in the flash memory.
Optionally, as shown in figure 8, the programming device 700, which removes, includes sending module 710, sending module 710, write-in mould
Outside block 730 and distribution module 740, further include:
Second judgment module 750, for judging that described interior there are preset time periods by the bootstrap in the flash memory
Inside whether receive the data that the host computer is sent;Wherein, the data include the segmentation code or upgrade signal;
Calling module 760, for working as, described interior there are the numbers for the host computer is received in preset time period sending
According to when, will be run in the erasing program in the flash memory and said write routine call to the erasable memory block;
Jump module 770, for working as, described interior there are the institutes for the host computer is not received in preset time period sending
It when stating data, jumps in the flash memory, and performs the existing application code in the flash memory.
Optionally, as shown in figure 9, first judgment module 720 includes:
First judging submodule 7211, for judging whether the memory receives the segmentation code for the first time;
First erasing submodule 7212, for when it is described state memory be for the first time receive the segmentation code when, pass through institute
It states erasing program and wipes the flash memory;
When the memory is not to receive the segmentation code for the first time, said write module 730 is performed the application
The step of flash memory is written in the segmentation code that memory block receives.
Optionally, as shown in Figure 10, first judgment module 720 includes:
Second judgment submodule 7221, for judging to be used for point for storing the application memory area in the sector of the flash memory
Whether the target sector of section code passes through erasing operation;
Second erasing submodule 7222, for when erasing operation is not passed through in the target sector, passing through the erasing
Program wipes the target sector;
When erasing operation is passed through in the target sector, said write module 730, which performs, receives the application memory area
The step of flash memory is written in the segmentation code arrived.
Optionally, as shown in figure 11, the programming device 700, which removes, includes sending module 710, sending module 710, write-in mould
Outside block 730 and distribution module 740, further include and reposition module 780.
The repositioning module 780 is used for the interrupt vector table for retaining the bootstrap, and repositions the application
The interrupt vector table of program, so that the interrupt vector table address of the bootstrap is different from the interrupt vector of the application program
Table address.
Optionally, as shown in figure 12, the programming device 700, which removes, includes sending module 710, sending module 710, write-in mould
Outside block 730 and distribution module 740, assignment module 790 is further included.
The assignment module 790 is used to carry out assignment to the protection register of the flash memory, is used for protecting in the flash memory
Store the address of the erasing program and write-in program.
About the device in above-described embodiment, wherein modules perform the concrete mode of operation in related this method
Embodiment in be described in detail, explanation will be not set forth in detail herein.
The preferred embodiment of the disclosure is described in detail above in association with attached drawing, still, the disclosure is not limited to above-mentioned reality
The detail in mode is applied, in the range of the technology design of the disclosure, a variety of letters can be carried out to the technical solution of the disclosure
Monotropic type, these simple variants belong to the protection domain of the disclosure.
It is further to note that specific technical features described in the above specific embodiments, in not lance
In the case of shield, it can be combined by any suitable means.In order to avoid unnecessary repetition, the disclosure to it is various can
The combination of energy no longer separately illustrates.
In addition, arbitrary combination can also be carried out between a variety of different embodiments of the disclosure, as long as it is without prejudice to originally
Disclosed thought should equally be considered as disclosure disclosure of that.
Claims (14)
1. a kind of programming method, applied to the program upgrade system of vehicle control device, described program upgrade-system includes host computer
And the slave computer of data interaction is carried out with the host computer, the slave computer includes memory and flash memory;It is it is characterized in that, described
Programming method includes:
Application code is carried out by segmentation by the host computer and is sent to the memory, so that segmentation code is successively stored in institute
State the application memory area for being used to store the application code distributed in memory;Wherein, the length of segmentation code be less than or
Equal to the application memory area;
When the application memory area often receives one section of segmentation code, judge the flash memory whether by erasing operation;
When the flash memory passes through erasing operation, the sudden strain of a muscle is written in the segmentation code that the application memory area is received
It deposits.
2. programming method according to claim 1, which is characterized in that it is described by the host computer by application code
It carries out segmentation to be sent to before the memory, the programming method further includes:
The memory headroom is allocated, so that the memory includes the application memory area and for loading in the flash memory
Erasing program and write-in program erasable memory block.
3. programming method according to claim 2, which is characterized in that described to judge the flash memory whether by erasing operation
Before, the programming method further includes:
Judge that described interior there are whether receive the host computer in preset time period to send out by the bootstrap in the flash memory
The data sent;Wherein, the data include the segmentation code or upgrade signal;
When it is described it is interior there are data that the host computer is sent are received in preset time period when, by the institute in the flash memory
It states and is run in erasing program and said write routine call to the erasable memory block;
When it is described it is interior there are data that the host computer is sent are not received in preset time period when, jump to the sudden strain of a muscle
In depositing, and perform the existing application code in the flash memory.
4. programming method according to claim 3, which is characterized in that described to judge the flash memory whether by erasing behaviour
Make, including:
Judge whether the memory receives the segmentation code for the first time;
When the memory is to receive the segmentation code for the first time, the flash memory is wiped by the erasing program;
When the memory be not for the first time receive the segmentation code when, perform by the application memory area receive described in point
The step of flash memory is written in section code.
5. programming method according to claim 3, which is characterized in that described to judge the flash memory whether by erasing behaviour
Make, including:
Whether judge to be used for the target sector for storing the segmentation code in the application memory area in the sector of the flash memory by wiping
Division operation;
When erasing operation is not passed through in the target sector, the target sector is wiped by the erasing program;
When erasing operation is passed through in the target sector, perform the segmentation code for receiving the application memory area and be written
The step of flash memory.
6. programming method according to claim 2, which is characterized in that further include:Retain the interruption of the bootstrap to
Scale, and the interrupt vector table of the application program is repositioned, so that the interrupt vector table address of the bootstrap is different
In the interrupt vector table address of the application program.
7. programming method according to claim 2, which is characterized in that further include:To the protection register of the flash memory into
Row assignment, to protect the address for being used for storing the erasing program and said write program in the flash memory.
8. a kind of programming device, applied to the program upgrade system of vehicle control device, described program upgrade-system includes host computer
And the slave computer of data interaction is carried out with the host computer, the slave computer includes memory and flash memory;It is it is characterized in that, described
Programming device includes:
Sending module, for pass through the host computer by application code carry out segmentation be sent to the memory so that segmentation
Code is successively stored in the application memory area for being used to store the application code distributed in the memory;Wherein, it is segmented generation
The length of code is less than or equal to the application memory area;
First judgment module, for when the application memory area often receives one section of segmentation code, judging the flash memory
Whether erasing operation is passed through;
Writing module, for the segmentation generation that when the flash memory passes through erasing operation, the application memory area is received
The flash memory is written in code.
9. programming device according to claim 8, which is characterized in that further include:
Distribution module, for the memory headroom to be allocated, so that the memory includes the application memory area and is used for
Load the erasable memory block of the erasing program and write-in program in the flash memory.
10. programming device according to claim 9, which is characterized in that further include:
Second judgment module, for judging that described interior there are whether connect in preset time period by the bootstrap in the flash memory
The data sent by the host computer;Wherein, the data include the segmentation code or upgrade signal;
Calling module, for when it is described it is interior there are data that the host computer is sent are received in preset time period when, will
It is run in the erasing program and said write routine call to the erasable memory block in the flash memory;
Jump module, for working as, described interior there are the data for the host computer is not received in preset time period sending
When, it jumps in the flash memory, and perform the existing application code in the flash memory.
11. programming device according to claim 10, which is characterized in that first judgment module includes:
First judging submodule, for judging whether the memory receives the segmentation code for the first time;
First erasing submodule, for when the memory is to receive the segmentation code for the first time, passing through the erasing program
Wipe the flash memory;
When the memory is not to receive the segmentation code for the first time, the execution of said write module meets the application memory area
The step of flash memory is written in the segmentation code received.
12. programming device according to claim 10, which is characterized in that first judgment module includes:
Second judgment submodule, for judging to be used for the segmentation code for storing the application memory area in the sector of the flash memory
Whether target sector passes through erasing operation;
Second erasing submodule, for when erasing operation is not passed through in the target sector, being wiped by the erasing program
The target sector;
When erasing operation is passed through in the target sector, described in said write module performs and receives the application memory area
The step of flash memory is written in segmentation code.
13. programming device according to claim 9, which is characterized in that further include:
Module is repositioned, for retaining the interrupt vector table of the bootstrap, and is repositioned in the application program
Disconnected vector table, so that the interrupt vector table address of the bootstrap is different from the interrupt vector table address of the application program.
14. programming device according to claim 9, which is characterized in that further include:
Assignment module, it is described for storing in the flash memory to protect for carrying out assignment to the protection register of the flash memory
Wipe the address of program and said write program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611200202.6A CN108228198B (en) | 2016-12-22 | 2016-12-22 | Programming method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611200202.6A CN108228198B (en) | 2016-12-22 | 2016-12-22 | Programming method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108228198A true CN108228198A (en) | 2018-06-29 |
CN108228198B CN108228198B (en) | 2021-01-01 |
Family
ID=62657101
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611200202.6A Active CN108228198B (en) | 2016-12-22 | 2016-12-22 | Programming method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108228198B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109189405A (en) * | 2018-07-19 | 2019-01-11 | 山东省科学院自动化研究所 | A kind of method and system of proving program Flash data consistency |
CN114816460A (en) * | 2022-06-29 | 2022-07-29 | 上海捷勃特机器人有限公司 | Device and method for remotely upgrading microcontroller of robot system |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE10146609A1 (en) * | 2001-09-21 | 2003-04-10 | Abb Patent Gmbh | Bus component device has a sub-divided integrated flash memory, so that operating system and application programs can be altered, expanded or corrected without disconnection of the device from the bus |
CN101777001A (en) * | 2009-01-08 | 2010-07-14 | 胡科 | DSP (Digital Signal Processor)-based online process curing method |
CN104360877A (en) * | 2014-10-24 | 2015-02-18 | 同济大学 | ECU (electronic control unit) firmware updating method based on Bootloader self update |
CN104765632A (en) * | 2015-04-15 | 2015-07-08 | 南京汽车集团有限公司 | BootLoader management method |
CN105468384A (en) * | 2014-08-25 | 2016-04-06 | 比亚迪股份有限公司 | Vehicle-mounted controller programming system and method, server and programming terminal |
-
2016
- 2016-12-22 CN CN201611200202.6A patent/CN108228198B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE10146609A1 (en) * | 2001-09-21 | 2003-04-10 | Abb Patent Gmbh | Bus component device has a sub-divided integrated flash memory, so that operating system and application programs can be altered, expanded or corrected without disconnection of the device from the bus |
CN101777001A (en) * | 2009-01-08 | 2010-07-14 | 胡科 | DSP (Digital Signal Processor)-based online process curing method |
CN105468384A (en) * | 2014-08-25 | 2016-04-06 | 比亚迪股份有限公司 | Vehicle-mounted controller programming system and method, server and programming terminal |
CN104360877A (en) * | 2014-10-24 | 2015-02-18 | 同济大学 | ECU (electronic control unit) firmware updating method based on Bootloader self update |
CN104765632A (en) * | 2015-04-15 | 2015-07-08 | 南京汽车集团有限公司 | BootLoader management method |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109189405A (en) * | 2018-07-19 | 2019-01-11 | 山东省科学院自动化研究所 | A kind of method and system of proving program Flash data consistency |
CN109189405B (en) * | 2018-07-19 | 2022-03-01 | 山东省科学院自动化研究所 | Method and system for verifying Flash data consistency of program |
CN114816460A (en) * | 2022-06-29 | 2022-07-29 | 上海捷勃特机器人有限公司 | Device and method for remotely upgrading microcontroller of robot system |
Also Published As
Publication number | Publication date |
---|---|
CN108228198B (en) | 2021-01-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR100918162B1 (en) | System and method for field diagnosis of wireless communications device system software | |
EP2657835B1 (en) | Software-defined radio terminal device and method for distributing and installing radio application | |
CN108121594B (en) | Process management method and device | |
US20100012732A1 (en) | Installing a patch in a smart card module | |
EP1973035A1 (en) | System and method for the management of wireless communications device system software downloads in the field | |
EP2230588A1 (en) | Communication terminal and program | |
US20030022663A1 (en) | System and method for field downloading a wireless communications device software code section | |
CN108228198A (en) | programming method and device | |
EP2378413B1 (en) | Methods and systems to implement non-ABI conforming features across unseen interfaces | |
CN105517081B (en) | Method for processing business, device and mobile terminal under a kind of hybrid network standard | |
CN103778009A (en) | Interrupt processing method and device | |
CN109918203A (en) | Access server memory management optimization method, access server and communication system | |
CN110851163A (en) | Software updating method compatible with multi-device platform based on CAN communication | |
CN106020905A (en) | Microcontroller firmware developing and updating method and system | |
US7984432B2 (en) | Method for patching a read-only memory and a data processing system comprising a means of patching the read-only memory based on patch contexts | |
CN106201596A (en) | A kind of method, device and terminal forbidding that third-party application automatically updates | |
CN1309787A (en) | Changing functionality of module terminal in wreless network | |
CN106528206A (en) | Application starting control method and apparatus, and application installation package reinforcement apparatus | |
CN101384063A (en) | Method and system for terminal equipment repairing and updating, system manufacturing method | |
CN102402444A (en) | Remote upgrading method for software | |
CN114035853A (en) | MCU bootstrap system and chip that possess SPI interface | |
CN101556568A (en) | Method for controlling data transmission function of universal serial bus port and terminal equipment | |
CN115934213A (en) | Controller stack calling method, device, equipment and storage medium | |
CN110908706A (en) | Management method of multi-version software | |
US20070016744A1 (en) | Memory management in a portable data carrier |
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 |