WO2023203768A1 - 電子制御装置及び書込制御方法 - Google Patents

電子制御装置及び書込制御方法 Download PDF

Info

Publication number
WO2023203768A1
WO2023203768A1 PCT/JP2022/018588 JP2022018588W WO2023203768A1 WO 2023203768 A1 WO2023203768 A1 WO 2023203768A1 JP 2022018588 W JP2022018588 W JP 2022018588W WO 2023203768 A1 WO2023203768 A1 WO 2023203768A1
Authority
WO
WIPO (PCT)
Prior art keywords
nonvolatile memory
external
data
internal
processing
Prior art date
Application number
PCT/JP2022/018588
Other languages
English (en)
French (fr)
Inventor
保徳 磯崎
雄介 阿部
隆博 飯田
Original Assignee
日立Astemo株式会社
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 日立Astemo株式会社 filed Critical 日立Astemo株式会社
Priority to PCT/JP2022/018588 priority Critical patent/WO2023203768A1/ja
Publication of WO2023203768A1 publication Critical patent/WO2023203768A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/654Updates using techniques specially adapted for alterable solid state memories, e.g. for EEPROM or flash memories

Definitions

  • the present invention relates to a vehicle-mounted electronic control device.
  • An electronic control device such as an ECU (Electrical Control Unit) is controlled by a microcomputer (hereinafter referred to as a microcomputer).
  • the microcontroller installed in the electronic control unit realizes various functions, and is also equipped with external circuits that correspond to those functions. Control software connected to the device as an external circuit.
  • the ECU has a function of rewriting control software stored in internal nonvolatile memory using external signals.
  • diagnostic tools were connected to the ECU by wire via an OBD (On-board Diagnostic) connector, and communication methods such as CAN (Controller Area Network) were used to perform UDS (Unified Diagnostic Services) or XCP (Universal measurement and Calibration).
  • the control software to be updated is transferred in accordance with a predetermined protocol such as ⁇ Protocol'', and the internal non-volatile memory is rewritten accordingly.
  • OTA Over-the-air
  • the control software is rewritten by OTA, for example, using the following procedure. While the vehicle is in use, an in-vehicle receiver receives update data wirelessly transferred from a data server, and the transferred update data is sent to the ECU to be updated via the gateway and the transmission path of the in-vehicle network. After receiving the update data, a notification is sent to the user on the in-vehicle monitor that the control software can now be updated, and the system waits for an operation from the user. Thereafter, the control software is updated with the received update data in accordance with a control software update request made by a user's operation.
  • the rewriting method that transfers the control software via wire can rewrite the ECU's control software at high speed, so it can be used in EOLP (End of Line Programming), where the control software is written to the ECU during the manufacturing process at the factory, or at the repair shop.
  • EOLP End of Line Programming
  • the design should be such that each method is consistent and any method can be selected, so that even if the control software is rewritten using a wired method, the OTA specifications will not be deviated from (and vice versa). is necessary.
  • Double Bank method In order to support rewriting using both methods, a configuration called the Double Bank method is sometimes adopted for the ECU hardware.
  • Double Bank method the internal non-volatile memory in the microcontroller is divided into two areas, one area stores the currently running control program, and the other area writes the transferred update data. . Note that the former is referred to as the front surface, and the latter is referred to as the back surface.
  • Update data wirelessly transferred from a data server while the vehicle is in use is written on the back side of the nonvolatile memory.
  • the updated data to be transferred may be compressed or encrypted in order to speed up communication processing and ensure security. In that case, the data is decompressed and decrypted before being written to the back side of non-volatile memory.
  • the control software After receiving all the update data and writing to the back side, the control software is updated according to the user's request. Specifically, by changing the setting value of the internal register, the next time the ECU is started up, the side on which the control software is activated will be the opposite side (back side) from the current side. Although the vehicle cannot be started during this update process, with this Double Bank method, switching the starting surface is sufficient, so the time during which the vehicle cannot be started can be shortened. Therefore, the Double Bank method is easy to use and has been widely adopted.
  • an external bank method is sometimes adopted in which a flash memory (hereinafter referred to as external nonvolatile memory) is provided outside the microcomputer without dividing the internal nonvolatile memory of the microcomputer.
  • the microcomputer and external nonvolatile memory are connected to a communication section inside the microcomputer, and the external nonvolatile memory can be erased or written according to the communication content from the microcomputer.
  • Update data wirelessly transferred from a data server while the vehicle is in use is written into an external nonvolatile memory.
  • the updated data to be transferred may be compressed or encrypted in order to speed up communication processing and ensure security. In that case, it is better to write the file directly to the external non-volatile memory without decompressing or decoding it.
  • the control software After receiving all the update data and writing to the external non-volatile memory, the control software is updated in response to a user's request, similar to the Double Bank method. Specifically, the data stored in the external non-volatile memory is read out, necessary processing such as decoding and decompression is performed, the internal non-volatile memory is rewritten, and the control software is updated.
  • the required capacity of the internal nonvolatile memory can be suppressed to the same level as the required capacity of the control software.
  • it is necessary to provide a separate external nonvolatile memory, mass-produced, general-purpose chips can be used, so the cost of the ECU is lower than that of the Double Bank method. Therefore, it is considered to be an effective method for dealing with OTA even though the size of software is expected to increase in the future.
  • the External Bank method also has issues to be solved. As described above, in any case, it is necessary to make it possible to rewrite the control software using either OTA or wired methods. In the case of the External Bank method, there is a problem from this point of view.
  • Rollback means, when rewriting the control software fails, to return the control software to the state before the update using pre-saved data of the control software before the update. If updating of control software using OTA fails, the vehicle may become unable to run, so a rollback function is essential for an ECU that uses OTA.
  • Patent Document 1 Publication No. 2016-37157
  • MCU multi-core arithmetic processing unit
  • ROM control program
  • the core 22 executes a reception process of receiving rewriting data and storing it in a cache memory (CAM), and a process of writing data stored in the CAM to a ROM.
  • a vehicle control device is described that suspends the operations of the cores 21 and 23 when the core 22 is executing the process of writing rewriting data into the ROM.
  • control software data before update is the software itself running on the surface.
  • control software data before update is stored in an external non-volatile memory. Therefore, if the control software is updated only by OTA, no particular problem will occur.
  • One way to avoid this problem is to transfer the current internal non-volatile memory contents to the external non-volatile memory after the update data is stored in the external non-volatile memory by OTA and before updating the internal non-volatile memory.
  • One possible method is to back up (copy) to.
  • this method has the following problems from the viewpoint that it is desirable to reduce the processing load of OTA as much as possible, considering that OTA mainly performs processing while the vehicle is in use.
  • the update data be compressed.
  • the data stored in the external nonvolatile memory requires processing to compress the data stored in the internal nonvolatile memory.
  • compression processing consumes a large amount of CPU and memory resources, so it has a large impact on processing load. If copies are made only with encryption without compression, a large capacity of external non-volatile memory is required, which increases hardware costs.
  • backup using this method has the effect of increasing processing load and hardware cost.
  • Another way to solve this problem is to write backup data not only to the internal non-volatile memory but also to the external non-volatile memory when using wires.
  • the overall processing time increases due to the addition of processing to the external nonvolatile memory.
  • the time required is the sum of the processing times for writing to each nonvolatile memory. Note that the processing time required to rewrite the same amount of data is generally longer in external nonvolatile memory than in internal nonvolatile memory, so the increase in time is large.
  • Patent Document 1 Although the technology described in Patent Document 1 can execute the rewrite process at high speed while suppressing the power consumption required for the rewrite process, the rewrite target is only the (internal) nonvolatile memory corresponding to the core. It is not possible to simultaneously write a backup program to another memory under control from an external device.
  • the present invention aims to perform high-speed rewriting of internal nonvolatile memory and backup to external nonvolatile memory.
  • the electronic control device includes a microcomputer including a processor that executes a predetermined program, and an external nonvolatile memory connected to the microcomputer, and the microcomputer has internal nonvolatile memory and external nonvolatile memory. and a second communication unit that communicates with an external device, the microcomputer transmits data received from the external device for rewriting the internal nonvolatile memory to the internal nonvolatile memory. and writing to the external non-volatile memory.
  • FIG. 1 is a diagram showing the configuration of a system according to an embodiment of the present invention.
  • FIG. 3 is a diagram showing an example of the arrangement of a control program according to the first embodiment.
  • FIG. 3 is a diagram showing an example of the arrangement of a control program according to the first embodiment.
  • FIG. 3 is a diagram showing an example of a file used for updating a control program according to the first embodiment.
  • 5 is a flowchart of processing executed by the processor of the first embodiment on external nonvolatile memory.
  • 5 is a diagram illustrating a procedure for rewriting the internal nonvolatile memory and writing backup data to the external nonvolatile memory in the first embodiment.
  • FIG. FIG. 7 is a diagram illustrating an example of the arrangement of a control program according to a second embodiment.
  • FIG. 7 is a diagram illustrating an example of the arrangement of a control program according to a second embodiment.
  • FIG. 3 is a diagram showing the configuration of a received data storage unit according to a second embodiment.
  • 7 is a flowchart of control processing executed by the processor of the second embodiment on external nonvolatile memory.
  • 7 is a diagram illustrating a procedure for rewriting the internal nonvolatile memory and writing backup data to the external nonvolatile memory according to the second embodiment.
  • FIG. 7 is a diagram showing the correspondence between processes and tasks in Example 3.
  • FIG. FIG. 7 is a diagram illustrating an example of the arrangement of a control program according to a third embodiment.
  • FIG. 7 is a diagram illustrating an example of the arrangement of a control program according to a third embodiment.
  • 12 is a flowchart showing control of task execution according to the third embodiment.
  • FIG. 7 is a diagram showing a procedure for rewriting the internal nonvolatile memory and writing backup data to the external nonvolatile memory
  • FIG. 1 is a diagram showing the configuration of a system according to an embodiment of the present invention.
  • the system of this embodiment includes an ECU 1 and an external device 10 connected via a communication line 11.
  • the external device 10 is installed in a device whose main part is a microcomputer, for example, a personal computer, has a function of communicating with the ECU 1, and has software that realizes the functions necessary for the operation of this embodiment.
  • the external device 10 is connected to the ECU 1 via an interface such as an external connector provided on the ECU 1 or a vehicle connector connected to the external connector.
  • the ECU 1 is equipped with a microcomputer 2.
  • the microcomputer 2 includes at least one processor 3a that executes software (if multiple processors are installed, the processors 3a, 3b, etc.), at least one volatile RAM 5, and an external device.
  • at least one communication section 6 for communicating, an internal non-volatile memory 7 for holding a program, at least one communication section 8 for communicating with the external non-volatile memory 9, and a bus 4 for connecting the respective elements. has.
  • the microcomputer 2 is connected to an external nonvolatile memory 9 via a communication section 8 .
  • the external non-volatile memory 9 stores backup data of the control program executed in the internal non-volatile memory 7, and this backup data is used for rollback when updating of the control program fails. used.
  • the ECU 1 is capable of communicating with a connected external device 10 via at least one communication unit 6 .
  • Example 1 In the first embodiment, a method will be described in which speeding up is achieved by using commands from the external device 10 for a purpose other than the original purpose.
  • processors other than the processor 3a the processing of those processors is stopped or appropriate processing such as running on RAM (see FIG. 2) is performed so as not to interfere with the series of processing. It is assumed that there is
  • FIG. 2A and 2B are diagrams showing an example of the configuration of the control program of this embodiment.
  • FIG. 2A shows the arrangement in the RAM 5
  • FIG. 2B shows the arrangement in the internal nonvolatile memory 7.
  • the main programs executed by the processor 3a are a communication/data processing unit 23 that controls communication with the external device 10, decompresses and decodes received write data, and a program stored in the internal nonvolatile memory 7.
  • the internal nonvolatile memory rewriting unit 21 is arranged in the RAM 5.
  • the RAM 5 stores a program 22 that is referenced by other processors that are not involved in the operation of the processor 3a.
  • the reason why the program is arranged in this way is that when rewriting the internal nonvolatile memory 7, it is necessary to transition the internal nonvolatile memory 7 from the normal state to the rewritable state. This is because the stored program cannot be executed. Therefore, immediately before rewriting, control of the processor 3a is transferred to the internal nonvolatile memory rewriting unit 21 on the RAM 5, and after the transition to the rewritable state, the data in the internal nonvolatile memory 7 is rewritten, and after the rewriting is completed, the state is returned to the normal state. After that, control of the processor 3a is returned to the communication/data processing section 23 on the internal nonvolatile memory 7.
  • the program placed in the RAM 5 is stored as a part of the other data 25 in the internal non-volatile memory 7, and before executing a series of rewriting processes for the internal non-volatile memory 7, the program is stored in the other data 25.
  • the program is copied from RAM5. Thereafter, processors other than the processor 3a read the program from a predetermined address on the RAM 5 and execute the process.
  • FIG. 3 is a diagram showing an example of a file used for updating the control program.
  • the files used to update the control program are broadly divided into the update control software itself and rewrite control information.
  • the rewrite control information includes the address to be written, the program size to be written, the format of the data to be written, and a value for verifying whether writing has been performed correctly after rewriting.
  • FIG. 4 is a flowchart of the processing that the processor 3a executes on the external nonvolatile memory 9.
  • the processor 3a starts processing upon receiving write data from the external device 10 (S01).
  • the processor 3a determines whether erasing processing of the external nonvolatile memory 9 is necessary based on the current write target address and the size of data received from the external device 10 (S02), and determines that erasing processing is necessary. If so, the data stored in the external nonvolatile memory 9 is erased in predetermined erase units (S03).
  • the processor 3a writes the received write data to the external nonvolatile memory 9 in fixed units (S04). Thereafter, the processor 3a determines whether there is any more write data (S05), and repeats the process of step S04 until the write process for all write data is completed. Then, when all the write data has been written, the process has ended normally, so a normal response is returned to the external device and the next write data is requested (S06).
  • a file containing updated control software to be written into the ECU 1 and control information regarding the software is prepared, and the file is designated by the external device 10, as shown in FIG. Thereafter, the process is started in response to a start operation instruction from the user (S11).
  • the external device 10 reads and stores the specified file (S12).
  • the external device 10 transmits an initialization command for writing to the ECU 1 (S13).
  • This initialization command transmits information such as the rewriting target, size, and data type of the file read in step S12 to the ECU 1. Based on this information, the ECU 1 makes preparations necessary for rewriting control.
  • the external device 10 transmits the write data of the update software in multiple parts (S14 to S16).
  • the processor 3a executes the process shown in FIG. 4, and executes the write process to the external nonvolatile memory 9 by appropriately controlling the communication unit 8.
  • the ECU 1 requests the external device 10 for the next write data.
  • the external device 10 notifies the user of a response to the effect that the process has ended abnormally, and ends the process midway. The above process is repeated until all write data is written.
  • a completion notification is received from the external device 10 (S17).
  • the end notification in step S17 is sent to notify the ECU 1 that the rewriting process has ended, but in the first embodiment, the data written in the external non-volatile memory 9 is sent to the ECU 1 at the timing when the ECU 1 receives the end notification.
  • a rewrite process is executed to read and write to the internal nonvolatile memory 7. Specifically, a predetermined amount of data written in the external non-volatile memory 9 is read from the beginning, appropriate processing such as decoding processing and decompression processing is executed, and the process of rewriting the internal non-volatile memory 7 is repeated.
  • the control by the processor 3a is transferred from the communication and data processing unit 23 to the internal nonvolatile memory rewriting unit 21, and after the state of the internal nonvolatile memory 7 is changed to a rewritable state. , rewrites the internal non-volatile memory 7. After the rewriting is completed, the internal nonvolatile memory 7 is returned to its normal state, and then control by the processor 3a is returned to the communication and data processing section 23.
  • Example 1 The effects of speeding up by the method of Example 1 are as follows. At first glance, data is written to two nonvolatile memories (external nonvolatile memory 9, internal nonvolatile memory 7) in sequence, so when writing data to each of the two nonvolatile memories (when writing twice) ) and the processing time appears to be the same. However, the update data only needs to be transferred once from the external device 10. In particular, when the first embodiment is applied to the currently mainstream CAN, most of the processing time is the time for transferring update data to the ECU 1. Since the speed of reading write data from the external non-volatile memory 9 is faster than the data transfer time to the ECU 1 via the CAN, rewriting of the internal non-volatile memory 7 can be made faster by that difference.
  • writing to the internal non-volatile memory 7 is controlled by each processor using the data written to the internal non-volatile memory 7, so it is necessary to write raw data before conversion.
  • the data written to the secondary memory 9 is for backup purposes. Focusing on this point, in FIG. 5, the data written to the external non-volatile memory 9 is the received write data itself, but data converted by some method may be written to the external non-volatile memory 9.
  • compressed or encrypted write data can be decrypted before writing, decompressed before writing, or decrypted and decompressed before writing (the same data as in the internal non-volatile memory 7). good.
  • the data written to the external non-volatile memory 9 only needs to undergo some kind of conversion through processing by the processor so that it becomes the same as the data before conversion. Note that, as described above, in practice, it is essential that the data written to the external nonvolatile memory 9 be encrypted.
  • the procedure is to rewrite the internal nonvolatile memory 7 after writing data to the external nonvolatile memory 9, but the procedure is reversed, that is, after rewriting the internal nonvolatile memory 7, the external nonvolatile memory 9 is rewritten. You can also write data to.
  • write data transferred from the external device 10 is encrypted or compressed.
  • the transferred data is decoded and decompressed to return to the original data before writing. That is, when writing to the external nonvolatile memory 9, decompressed data is written, so the amount of data to be written increases. Otherwise, encryption and compression will be performed twice, making it a hassle. Considering this point, processing efficiency decreases in the order in which data is written to the external nonvolatile memory 9 after rewriting the internal nonvolatile memory 7.
  • Embodiment 2 shows an example of a procedure for achieving high speed by performing write processing in parallel using two processors 3a and 3b.
  • a description will be given with reference to the attached drawings.
  • the system configuration of the second embodiment requires at least two processors (CPUs) 3a and 3b that execute software. Other than this point, it is the same as FIG. 1.
  • Each of the processors 3a and 3b executes processing on the internal nonvolatile memory 7 and the external nonvolatile memory 9.
  • Other processors may stop processing so as not to disturb the series of processing, or may execute programs stored in a memory different from internal nonvolatile memory 7 (for example, RAM 5) (see FIG. 6A).
  • FIG. 6A and 6B are diagrams showing an example of the configuration of the control program of this embodiment.
  • FIG. 6A shows the arrangement in the RAM 5
  • FIG. 6B shows the arrangement in the internal nonvolatile memory 7.
  • the main programs executed by the processor 3a are the internal nonvolatile memory rewriting section 31 and the communication/data processing section 35.
  • the internal nonvolatile memory rewriting section 31 and the communication/data processing section 35 are the same as the internal nonvolatile memory rewriting section 21 and the communication/data processing section 23 of the first embodiment. Furthermore, the internal nonvolatile memory rewriting unit 31 is arranged in the RAM 5 for the same reason as in the first embodiment.
  • the RAM 5 stores a program 34 that is referenced by processors that are not involved in the operations of the processors 3a and 3b.
  • the reason for arranging the program 34 in the RAM 5 is also the same as in the first embodiment.
  • Example 2 differs from Example 1 in the following two points.
  • One is a receive data buffer in which the processor 3a stores the write data received from the external device 10, and the processor 3b reads the stored data and executes the process of writing it to the external non-volatile memory 9.
  • the point is that a storage section 32 is provided.
  • the external nonvolatile memory control unit 33 which is the main program executed by the processor 3b, is stored in the RAM 5.
  • the reason why the external nonvolatile memory control unit 33 is stored in the RAM 5 is that, as in the first embodiment, the program stored in the internal nonvolatile memory 7 cannot be executed when the internal nonvolatile memory 7 is in a rewritable state.
  • the external non-volatile memory control unit 33 is arranged in the RAM 5 in order to freely control the external non-volatile memory 9 while the internal non-volatile memory 7 is being processed.
  • the program placed in the RAM 5 is stored as a part of the other data 36 in the internal non-volatile memory 7, and before executing a series of rewriting processes for the internal non-volatile memory 7, the program is stored as a part of the other data 36 in the internal non-volatile memory 7.
  • the program is copied from RAM5. Thereafter, processors other than the processor 3a read the program from a predetermined address on the RAM 5 and execute the process.
  • FIG. 7 is a diagram showing the configuration of the received data storage section 32.
  • a reception completion pointer 41 indicating the end of the write data received from the external device 10 has been written to the received data storage unit 32, and a write pointer 41 indicating the end of the data that has been written to the external non-volatile memory 9.
  • Two pointers are provided: a completion pointer 42.
  • the area between the reception completion pointer 41 and the write completion pointer 42 is unprocessed data in which write data received from the external device 10 has not been written to the external nonvolatile memory 9.
  • the values of these pointers increase or decrease in a fixed direction (increase or decrease in a fixed direction with respect to the address of the RAM 5), and there is an upper limit determined by the size of the received data storage section 32. In other words, this upper limit value indicates the end of the received data storage section 32.
  • both pointers 41 and 42 are the same, but in a series of processes, the following operations occur.
  • the processor 3a uses the communication and data processing section 35 to execute a process of writing the write data received from the external device 10 into the received data storage section 32 in a fixed direction. After the write process is completed, the value of the reception completion pointer 41 is changed by the amount of data written. Thereafter, after completing the processing on the internal non-volatile memory 7 handled by the processor 3a, the processing result is returned to the external device 10.
  • the processor 3b executes the process as follows. If there is a difference between the reception completion pointer 41 and the write completion pointer 42, there is unprocessed data that has not been written to the external nonvolatile memory 9. Therefore, the processor 3b reads a predetermined amount of data from the location indicated by the write completion pointer 42 and writes it into the external nonvolatile memory 9. Thereafter, the value of the write completion pointer 42 changes in the same direction as the reception completion pointer 41 by the amount of data written. If the reception completion pointer 41 and the write completion pointer 42 match, there is no unprocessed data, so the processor 3b waits without performing the write process. Thereafter, when the reception completion pointer 41 is advanced by the processor 3a, a difference occurs between the reception completion pointer 41 and the write completion pointer 42, so the processor 3b resumes writing data to the external nonvolatile memory 9.
  • each of the processors 3a and 3b independently executes the above-described processing, in the following two cases, the processors 3a and 3b execute the processing synchronously.
  • One is that when the value of the reception completion pointer 41 reaches the upper limit value, even if the processing of the processor 3a is completed, the response to the external device 10 is not sent until the value of the write completion pointer 42 reaches the upper limit value. wait.
  • the processor 3a responds to the external device 10, and then returns the reception completion pointer 41 and the write completion pointer 42 to their initial values. Thereafter, the above-mentioned processing is executed.
  • the processor 3a waits until the reception completion pointer 41 and the write completion pointer 42 match before responding. Note that whether the write data is the last one depends on, for example, the size information of the program sent in advance from the external device 10, the amount of data received from the external device 10 measured inside the ECU 1, and the write data received this time. Can be determined based on size.
  • FIG. 8 is a flowchart of the control process that the processor 3b executes on the external nonvolatile memory.
  • the processor 3b When the processor 3b starts processing according to the user's operation, it waits for instructions from the processor 3a (S21). Thereafter, when the processor 3b receives the first write data from the external device 10, the process proceeds to step S22 by the operation of the processor 3a, and starts processing.
  • step S22 it is determined whether erasure processing of the external non-volatile memory 9 in the area where the write data is to be written is necessary, and if necessary, the data is erased in erasure units of the external non-volatile memory 9 (S23).
  • step S24 it is determined whether there is writable data using the procedure described in FIG. 7 (S24). If there is no unwritten data, the process waits in S24. If there is data to be written, the write data is read from the received data storage section 32 and written to the external nonvolatile memory 9 (S25, S26). After writing, verify is performed to verify the written data (S27). For example, data in the same range as the location written in step S26 is read from the external nonvolatile memory 9, and a match with the written data is confirmed. If they match, it is assumed that the writing was completed correctly and the write completion pointer 42 is advanced. Thereafter, it is determined whether either the write completion pointer 42 has reached the upper limit value or the written data is the final data (S28). If the conditions are met, the process returns to step S21; if neither condition is met, the process returns to step S24.
  • step S21 when the process moves to step S21 because the write completion pointer 42 has reached the upper limit value, after the reception completion pointer 41 and the write completion pointer 42 are cleared by the processor 3a, the process moves to step S22 by an operation from the processor 3a. to determine whether erasing is necessary.
  • step S22 if the size of the received data storage section 32 and the erase unit of the external nonvolatile memory 9 match, the determination is always YES. Therefore, the process may be simplified by setting the size of the received data storage section 32 and executing step S23 without making the determination in step S22.
  • Steps S31 to S33 are the same as S11 to S13 in the first embodiment.
  • step S34 the first write data is transferred from the external device 10.
  • the processor 3a advances the reception completion pointer 41.
  • the processor 3b is instructed to proceed to step S22, and the processing of the processor 3b is started. Thereafter, the process of rewriting the internal nonvolatile memory 7 is executed if possible.
  • the required amount of data has not been reached, so it is not executed. After the rewrite process to the internal nonvolatile memory 7 is completed, the process result is returned to the external device 10.
  • the internal nonvolatile memory 7 is rewritten.
  • the internal non-volatile memory rewriting unit 31 moves once to the internal non-volatile memory 7 to a rewritable state, and then rewrites the data.
  • the internal non-volatile memory 7 is returned to its normal state, and then control of the processor 3a is returned to the communication/data processing section 35, after which the processing result is sent back to the external device 10.
  • steps S34 and S35 the processor 3b executes the process shown in FIG. 8, regardless of the movement of the processor 3a. Since a difference occurs between the reception completion pointer 41 and the write completion pointer 42 in step S34, data is written to the external non-volatile memory 9 through appropriate control via the communication unit 8. After data writing is completed, the write completion pointer 42 is advanced by the amount written. In FIG. 9, before the processor 3a receives the write data in step S36, the reception completion pointer 41 and the write completion pointer 42 match, and the processor 3a enters a standby state. In step S36, when the processor 3a receives new write data and the reception completion pointer 41 advances, the write process is restarted.
  • step S37 when the reception completion pointer 41 reaches the upper limit value, the processor 3a waits for a response to the external device 10 until the write completion pointer 42 reaches the upper limit value, as explained in FIG. Then, after waiting for the write completion pointer 42 to reach the upper limit value (S38), the processor 3a returns the processing result to the external device 10.
  • the processor 3a sets the reception completion pointer 41 and the write completion pointer 42 to initial values, and repeats the processing from S34.
  • the external device 10 After receiving all the write data and completing the processing of the ECU 1, the external device 10 transmits a termination command (S42). When the external device 10 receives a normal response from the ECU 1, it notifies the user of the completion of the process (S43), and ends the series of processes.
  • each of the processors 3a and 3b executes processing independently, but if any error occurs in the process of processing the external nonvolatile memory 9, the processor 3b notifies the processor 3a of the error, and the processor Even if 3a has completed its own processing normally, it returns an error to the external device 10 and ends the processing.
  • the effects of speeding up by the method of Example 2 are as follows.
  • the internal non-volatile memory 7 side, which the processor 3a is in charge of, is almost the same as the conventional wired method, although there are some differences such as writing to the received data storage section 32 and synchronization with the external non-volatile memory 9 side. Can be processed. If the processor 3b can perform the backup process to the external non-volatile memory 9 using the processing time, the process can be performed in approximately the same time as rewriting the internal non-volatile memory 7.
  • the speed can be increased by reducing the data transfer time.
  • the fastest processing time is the same as before, and the slowest processing time is faster than the processing time required to write to the external non-volatile memory 9 alone.
  • Embodiment 3 shows an example of a procedure for simultaneously executing processing on two nonvolatile memories by multitasking using one processor.
  • a description will be given with reference to the attached drawings.
  • the system configuration in the third embodiment is the same as that in the first embodiment. As in the first embodiment, if there are processors other than the processor 3a, the processing of those processors is stopped or executed on the RAM 5 (see FIG. 11), or other appropriate processing is performed so as not to interfere with the series of processing.
  • the contents processed by the processor are broken down into three parts, as shown in FIG. 10: communication and data processing task 55, internal non-volatile memory rewriting task 51, and external non-volatile memory control task 53. do.
  • the communication/data processing task 55 includes transmission/reception processing with the external device 10, reception processing using a predetermined protocol, storage processing in the received data storage section 52, decoding of written data, and decompression processing of written data. Execute one of the processes depending on the internal state of the The internal non-volatile memory rewriting task 51 includes erasing the internal non-volatile memory 7, writing to the internal non-volatile memory 7, and confirming the completion of erasing and writing, and performs any of these processes depending on the current internal state. Execute.
  • the external non-volatile memory control task 53 includes erasing the external non-volatile memory 9, writing to the external non-volatile memory 9, reading the external non-volatile memory 9, and confirming the completion of erasing/writing processing, and the current internal Execute one of the processes depending on the status.
  • erasing and writing to non-volatile memory takes time from the time a command is sent until the command is completed. During this time, if the processor is in a standby state in which it does not perform other processing, the overall processing efficiency will decrease. Therefore, processing efficiency can be improved by separating command processing for erase/write processing and processing for checking whether the processing is completed.
  • FIG. 11A and 11B are diagrams showing an example of the configuration of the control program of this embodiment.
  • FIG. 11A shows the arrangement in the RAM 5
  • FIG. 11B shows the arrangement in the internal nonvolatile memory 7.
  • the processing program included in the communication/data processing task 55 is placed in the internal nonvolatile memory 7, and the processing program included in the internal nonvolatile memory rewriting task 51 and the processing program included in the external nonvolatile memory control task 53 are placed in the RAM 5. will be placed in
  • the internal non-volatile memory rewriting task 51, external non-volatile memory control task 53, and communication/data processing task 55 of the third embodiment are the internal non-volatile memory rewriting section 31, external non-volatile memory control section 33 of the first embodiment. , is the same as the communication and data processing section 35. Further, other data 56, received data storage section 52, etc. are also the same as in the first embodiment.
  • the tasks are divided and the processing is repeated in accordance with the sequence shown in FIG. 12 using one processor, thereby eliminating the waiting time of the processor as much as possible and executing the processing at high speed.
  • the communication and data processing task 55 is executed (S52), and then the external nonvolatile memory control task 53 (S54) is executed.
  • the internal nonvolatile memory rewriting task 51 (S53) is executed instead of the communication and data processing task 55.
  • switching between the communication/data processing task 55 and the internal nonvolatile memory rewriting task 51 can be performed, for example, by the following method.
  • the communication/data processing task 55 completes processing such as decoding and decompressing the received write data, and the next time the internal nonvolatile memory 7 is rewritten, the communication/data processing task 55 completes the process when the external nonvolatile memory control task 53 ends.
  • a flag indicating that the internal nonvolatile memory rewriting task 51 is to be executed instead of 55 is set. Then, after the external nonvolatile memory control task 53 ends, the internal nonvolatile memory rewriting task 51 is activated.
  • this state continues while the internal non-volatile memory 7 is being rewritten, and after the internal non-volatile memory 7 is rewritten, the internal non-volatile memory rewriting task 51 initializes the flag, and the next external non-volatile memory control task 53 After execution of , the state returns to the state where the communication and data processing task 55 is executed.
  • the structure of the received data storage section 52 can be the same as that in FIG. 7 of the second embodiment.
  • the processing procedure using the reception completion pointer 41 and the write completion pointer 42 may also be the same as in the second embodiment (FIG. 7).
  • the processing procedure for the external non-volatile memory 9 may be the same as in the second embodiment (FIG. 8).
  • the erase/write command processing and the completion confirmation processing are provided separately, so S23 and S26 are the two stages of "erase/write command" and "confirmation". It can be divided into
  • Example 3 differs from Example 2 in the following points.
  • the processing of each task is executed alternately.
  • the rewriting process of the internal nonvolatile memory 7 and the rewriting process of the external nonvolatile memory 9 are executed independently and simultaneously in parallel, so that processing can be performed without depending on each other's status and without waiting time.
  • the next process cannot proceed until the process of other tasks is finished and the task itself waits. From this point of view, the speedup of processing according to the third embodiment is somewhat limited compared to the second embodiment.
  • this embodiment is similar to the second embodiment in that processing on the external nonvolatile memory 9 can be executed during communication control with the external device 10 and processing on the internal nonvolatile memory 7, processing speed can be increased. Further, if the processing performance of the processor is high, the difference between the second embodiment and the third embodiment will be small.
  • FIG. 13 takes the time axis into consideration.
  • the processor 3a alternately executes either the communication/data processing task 55 or the internal nonvolatile memory rewriting task 51 and the external nonvolatile memory control task 53 as shown in FIG.
  • FIG. 13 shows that rewriting processing of the internal nonvolatile memory 7 by the internal nonvolatile memory rewriting task 51 and writing processing of the external nonvolatile memory 9 by the external nonvolatile memory control task 53 are performed alternately. Note that the intervals between the arrows indicating each process are not related to the actual length of processing time.
  • the communication and data processing task 55 stores it in the received data storage section 52.
  • the next external nonvolatile memory control task 53 since the write data has been stored in the received data storage section 52, processing for the external nonvolatile memory 9 is started. Specifically, the external nonvolatile memory control task 53 executes the process in step S22 (determining the necessity of erasing), and if necessary, sends the process in step S23 (erase command) to the external nonvolatile memory via the communication unit 8. Issue to memory 9.
  • step S64 processing for the internal nonvolatile memory 7 is not executed, but response processing for the external device 10 is executed. .
  • step S64 processing for the internal nonvolatile memory 7 is not executed, but response processing for the external device 10 is executed.
  • the next external nonvolatile memory control task 53 issues a command to the external nonvolatile memory 9 to confirm whether the erasing process has been completed, and based on the response, it is confirmed whether the erasing process has been completed. Thereafter, the external nonvolatile memory control task 53 repeats this process until it is confirmed that the erasing process is completed. Thereafter, the process shown in FIG. 8 is executed when the external nonvolatile memory control task 53 is executed.
  • the communication and data processing task 55 receives the next write data S65 from the external device 10. After receiving, the process until writing to the received data storage section 52 is the same as step S64. Thereafter, write data processing such as decoding and decompression is executed by the communication and data processing task 55 several times. After the processing of the write data is completed, in order to write the data into the internal non-volatile memory 7, a flag is set to execute the internal non-volatile memory rewriting task 51 instead of the communication/data processing task 55 next time.
  • the internal non-volatile memory rewrite task 51 is executed, and thereafter, similarly to the external non-volatile memory 9, erasure, confirmation, write, and confirmation processes are executed.
  • the flag is initialized so that the communication/data processing task 55 is executed.
  • the communication line 11 is configured as a wired communication line, and the rewritten data is transferred via wired communication, but the communication line 11 may be configured as a wireless communication line. , the rewrite data may be transferred via wireless communication.
  • the electronic control device includes a microcomputer 2 including a processor that executes a predetermined program, and an external nonvolatile memory 9 connected to the microcomputer 2. , an internal nonvolatile memory 7, a communication unit 8 that communicates with an external nonvolatile memory 9, and a communication unit 6 that communicates with an external device 10. Since the data received from the device 10 is written to the internal nonvolatile memory 7 and the external nonvolatile memory 9, in a configuration where the microcontroller can access the internal nonvolatile memory 7 and the external nonvolatile memory 9, the data received from the device 10 is written based on the control from the external device 10.
  • the internal nonvolatile memory 7 can be rewritten and the backup data can be written to the external nonvolatile memory 9 at high speed.
  • processing speed can be increased.
  • the microcomputer 2 also has a received data storage section 32 that stores data received from the external device 10, and stores the same data stored in the received data storage section 32 in the internal nonvolatile memory 7 and the external nonvolatile memory. 9, internal processing is simple and the program can be made faster.
  • It also has a first processor 3a that performs writing processing on the internal nonvolatile memory, and a second processor 3b that performs writing processing on the external nonvolatile memory, and the first processor 3a writes data received from the external device 10.
  • the second processor 3b writes the data stored in the received data storage section 32 and the internal nonvolatile memory 7 to the external nonvolatile memory 9, so processing can be distributed among the processors and the processing speed can be increased. can be improved.
  • the microcomputer 2 decrypts the data received from the external device 10 and writes it to the internal nonvolatile memory 7, without decrypting the data received from the external device 10. Since the rollback data is written to the external nonvolatile memory 9 at the same time, rollback data can be stored in the external nonvolatile memory 9 while maintaining security.
  • the present invention is not limited to the embodiments described above, and includes various modifications and equivalent configurations within the scope of the appended claims.
  • the embodiments described above have been described in detail to explain the present invention in an easy-to-understand manner, and the present invention is not necessarily limited to having all the configurations described.
  • a part of the configuration of one embodiment may be replaced with the configuration of another embodiment.
  • the configuration of one embodiment may be added to the configuration of another embodiment.
  • other configurations may be added, deleted, or replaced with a part of the configuration of each embodiment.
  • each of the above-mentioned configurations, functions, processing units, processing means, etc. may be realized in part or in whole by hardware, for example by designing an integrated circuit, and a processor realizes each function. It may also be realized by software by interpreting and executing a program.
  • Information such as programs, tables, files, etc. that realize each function can be stored in a storage device such as a memory, hard disk, or SSD (Solid State Drive), or in a recording medium such as an IC card, SD card, or DVD.
  • a storage device such as a memory, hard disk, or SSD (Solid State Drive)
  • a recording medium such as an IC card, SD card, or DVD.
  • control lines and information lines shown are those considered necessary for explanation, and do not necessarily show all control lines and information lines necessary for implementation. In reality, almost all configurations can be considered interconnected.

Landscapes

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

Abstract

電子制御装置であって、所定のプログラムを実行するプロセッサを含むマイコンと、前記マイコンに接続される外部不揮発性メモリとを備え、前記マイコンは、内部不揮発性メモリと、前記外部不揮発性メモリと通信する第1通信部と、外部装置と通信する第2通信部とを有し、前記マイコンは、前記内部不揮発性メモリを書き換えるための前記外部装置から受信したデータを、前記内部不揮発性メモリ及び前記外部不揮発性メモリに書き込む。

Description

電子制御装置及び書込制御方法
 本発明は、車載用電子制御装置に関する。
 ECU(Electrical Control Unit)などの電子制御装置は、マイクロコンピュータ(以下、マイコン)により制御される。電子制御装置に搭載されるマイコンは様々な機能を実現し、さらに、それらの機能に対応した外部回路が設けられており、マイコンの内部の不揮発性メモリ(以下、内部不揮発性メモリ)に記憶されている制御用ソフトウェアによって外部回路として接続された装置を制御する。
 ECUは、外部からの信号よって内部不揮発性メモリに格納された制御用ソフトウェアを書き換える機能を有する。従来は例えば、OBD(On-board Diagnostic)コネクタを介して有線で診断ツールをECUへ接続し、CAN(Controller Area Network)などの通信手段で、UDS(Unified Diagnostic Services)やXCP(Universal measurement and Calibration Protocol)等の所定のプロトコルに従って、更新すべき制御用ソフトウェアを転送し、それによって内部不揮発性メモリの書き換えを行っていた。しかし、近年ではOTA(Over-the-air)という無線通信によって制御用ソフトウェアを転送する方式もある。
 OTAによる制御用ソフトウェアの書き換えは、例えば、以下の手順で行われる。車両使用中にデータサーバから無線で転送された更新用データを車載の受信機で受信し、転送された更新用データはゲートウェイ及び車載ネットワークの伝送路を介して更新対象のECUに送られる。更新用データの受信が終了した後、車内モニタ等に、ユーザへ制御用ソフトウェアのアップデートが可能となった通知を出し、ユーザからの操作を待つ。その後、ユーザからの操作よる制御用ソフトウェアの更新リクエストに従って、受信した更新用データで制御用ソフトウェアを更新する。
 OTAによる制御用ソフトウェア書換方法がなかった時、ECUの制御用ソフトウェアの更新が必要な際、修理工場への入庫が必要でありユーザへの手間がかかる。しかし、OTAでは普段の車両の使用中に制御用ソフトウェアが更新可能であり、修理工場への入庫が必要ない。また、車両メーカにとっても、制御用ソフトウェアの書換対応のための手間やコストを削減でき、ECUを最適な状態にアップデートしやすい。このようにOTAは、車両メーカ、及びユーザの双方にメリットがある。このため、ECUの制御用ソフトウェアをOTA方式によって更新するケースは、増加すると予想される。
 しかしながら、有線で制御用ソフトウェアを転送する書換方法は、ECUの制御用ソフトウェアを高速で書き換えできるため、工場での製造工程においてECUへ制御用ソフトウェアを書き込むEOLP(End of Line Programming)や修理工場での制御用ソフトウェアの書き換えの場面で必要である。すなわち、今後はECUの制御用ソフトウェアの書換方法として、従来の有線による方法とOTAによる方法のいずれも対応可能なものが増えると予想される。この場合、例えば有線による方法で制御用ソフトウェアの書き換えを実施しても、OTAに関する仕様を逸脱しない(その逆も同様)よう、各々の方法を整合させ、いずれの方法も選択できるような設計が必要である。
 両者の方法による書き換えに対応するために、ECUのハードウェアに主にDouble Bank方式と呼ばれる構成が採用されることがある。Double Bank方式では、マイコン内の内部不揮発性メモリが2分割されており、一方の領域には現在実行中の制御プログラムが格納されており、他方の領域には、転送された更新用データを書き込む。なお、前者を表面、後者を裏面と称する。
 Double Bank方式を用いたOTAによる制御用ソフトウェアの書き換えは、例えば、以下の手順で行われる。車両使用中にデータサーバから無線で転送される更新用データを不揮発性メモリの裏面に書き込む。なお、転送される更新用データは通信処理の高速化やセキュリティの確保のため圧縮や暗号化などがされている場合がある。その場合は、解凍や復号を行ってから不揮発性メモリの裏面に書き込む。
 全ての更新用データの受信が完了し、裏面への書き込みが終了した後、ユーザからの要求によって制御用ソフトウェアを更新する。具体的には、内部レジスタの設定値を変更して、次回ECU立ち上げ時に、制御用ソフトウェアの起動する面を現在と反対側(裏面)にする。この更新の処理の間は車両を起動できないが、このDouble Bank方式では起動面の切り替えで済むため、車両を起動できない時間が短くて済む。そのため、Double Bank方式は使い勝手がよく、広く採用されている。
 しかしながら、Double Bank方式の場合、制御用ソフトウェアのデータサイズの2倍の容量を持つ内部不揮発性メモリが必要になる。今後、自動運転などの処理の高度化、車両の集中制御化などの観点からソフトウェアが大容量化すると予想される。そのため、ソフトウェアの必要容量が大きくになるにつれ、その2倍の内部不揮発性メモリの容量を持つマイコン製品が市場に存在しない可能性がある。このようなマイコン製品が存在しても、マイコンの価格が内部不揮発性メモリの容量に依存するため、コストが高くなる。特に、車載用製品は、大量生産品という観点から、製造コストが大きく増加する。現状では、必要な容量が比較的小さいため、必要な容量の2倍も大きな値ではなく、このデメリットが小さいが、将来的には大きなデメリットになるケースが予想される。
 この欠点に対応するECUのハードウェア構成として、マイコンの内部不揮発性メモリを分割せずに、マイコン外部にフラッシュメモリ(以降、外部不揮発性メモリ)を設けるExternal Bank方式が採用されることがある。マイコンと外部不揮発性メモリはマイコン内部の通信部と接続し、マイコンからの通信内容によって、外部不揮発性メモリの消去や書込を行うことができる。
 External Bank方式を用いたOTAによる制御用ソフトウェアの書き換えは、例えば、以下の手順で行われる。車両使用中にデータサーバから無線で転送される更新用データを外部不揮発性メモリに書き込む。なお、転送される更新用データは通信処理の高速化やセキュリティの確保のため圧縮や暗号化などがされている場合がある。その場合は、解凍や復号を行わずにそのまま外部不揮発性メモリ面に書き込むとよい。
 全ての更新用データの受信が完了し、外部不揮発性メモリへの書き込みが終了した後、Double Bank方式と同様に、ユーザからのリクエストによって制御用ソフトウェアを更新する。具体的には、外部不揮発性メモリに格納されたデータを読み出し、復号・解凍などの必要な処理を行って、内部不揮発性メモリを書き換え、制御用ソフトウェアを更新する。
 External Bank方式では、必要な内部不揮発性メモリの容量は制御用ソフトウェアの必要容量と同等に抑えられる。外部不揮発性メモリを別に設ける必要があるが、大量生産品で汎用品のチップを使用できるため、ECUのコストは、Double Bank方式より抑えられる。そのため、今後のソフトウェアのサイズの増加が予想される中でもOTAに対応するための有効な方式と考えられる。
 しかしながら、External Bank方式にも解決すべき課題がある。前述したように、制御用ソフトウェアの書き換えは、いかなる場合でも、OTA及び有線による方法を、どちらでも実施できる状態にする必要がある。External Bank方式の場合、この観点から問題がある。
 OTAによる更新にはロールバックと呼ばれる機能が設けられる。ロールバックとは、制御用ソフトウェアの書き換えを失敗した場合に、予め保存された更新前の制御用ソフトウェアのデータを用いて、制御用ソフトウェアを更新前に戻すことである。OTAによる制御用ソフトウェアの更新に失敗した場合、車両が走行不可能になる可能性があるため、OTAを採用するECUにはロールバック機能は必須の機能である。
 本技術分野の背景技術として、以下の先行技術がある。特許文献1(特表2016-37157号公報)には、マルチコア型演算処理ユニット(MCU)のコア21が、外部装置からコア22の制御プログラム(ROM)の書き換え要求を受信したときは、コア22が書き換え処理を実行する。コア22は書き換え用データを受信してキャッシュメモリ(CAM)に格納する受信処理、及びCAMに格納したデータをROMへ書き込む処理を実行する。コア22が書き換え用データをROMに書き込む処理を実行しているときは、コア21及び23の作動を休止させる車両用制御装置が記載されている。
特開2016-37157号公報
 Double Bank方式の場合、更新前の制御用ソフトウェアのデータは、表面で起動しているソフトウェアそのものである。External Bank方式の場合、更新前の制御用ソフトウェアのデータは、外部不揮発性メモリに格納される。そのため、OTAのみで制御用ソフトウェアの更新を行う場合は特段これに関する問題は起こらない。
 しかし、従来の有線による方法は、内部不揮発性メモリのみを書き換えるため、外部不揮発性メモリに更新前の制御用ソフトウェアが格納されない。すなわち、仮に有線による方法で制御用ソフトウェアを更新後に、OTAによる更新が実施され、それが失敗した場合、外部不揮発性メモリに更新前のプログラムが格納されていないため、ロールバックが実施できず、車両が起動不可能となる。
 有線による更新後、OTAによる更新のケースは、External Bank方式を採用するすべての工場出荷後のECUに当てはまる。すなわち、External Bank方式を採用する場合は、OTAによる更新時のロールバックを可能とする対策が必要である。
 この問題を回避する一つの案として、OTAによって外部不揮発性メモリへの更新用データが格納された後、内部不揮発性メモリの更新前に、現在の内部不揮発性メモリの内容を、外部不揮発性メモリへバックアップ(コピー)する方法が考えられる。
 しかし、この方法にはOTAが主に車両使用中に処理する点を考慮した場合、OTAの処理負荷はなるべく低くすることが望ましいという観点から以下の問題がある。
 セキュリティ上の観点から、外部不揮発性メモリに格納される制御用ソフトウェアのデータの暗号化が実用上は必須である。内部不揮発性メモリに格納されるデータはプレーンなソフトウェアのデータ(生データ)なので、内部不揮発性メモリから外部不揮発性メモリへのバックアップの過程で暗号化処理が必要となり、暗号化による処理負荷が増加する。
 また、OTAによる更新用データの転送時間の短縮のため、更新用データは圧縮されているとよい。その場合、外部不揮発性メモリへ格納されるデータは、内部不揮発性メモリに格納されたデータを圧縮する処理が必要となる。一般的に圧縮処理はCPUとメモリのリソースを大きく消費するため、処理負荷への影響は大きい。もし、圧縮せずに暗号化のみでコピーをすると、外部不揮発性メモリの大きな容量が必要となるため、ハードウェアのコストが増加する。
 以上の観点から、この方法によるバックアップは、処理負荷やハードウェアコストの増加の影響が生じる。
 この問題を解決する別の方法として、有線による場合、内部不揮発性メモリの書き換えだけでなく、外部不揮発性メモリにもバックアップデータを書き込む方法が考えられる。このようにすることで、OTAによる内部不揮発性メモリの更新実施前には、内部不揮発性メモリに格納されたデータが既に外部不揮発性メモリにバックアップされている状態なので、前述のコピー処理は不要となる。そのため、前述の方法における問題を解消できる。
 しかしながら、この方法では、外部不揮発性メモリに対する処理の追加によって全体の処理時間が増加する。単純に計算すると、各不揮発性メモリに書き込む処理時間の和の時間が必要となる。なお、一般的に同量のデータの書き換えにかかる処理時間は、外部不揮発性メモリは内部不揮発性メモリより長いため、時間の増加分は大きい。
 この処理時間の増加が特に問題となるのは、工場内で出荷時に初期プログラムを書き込む(EOLP)ケースである。車両は大量生産品のため、製造工程は厳密に管理されている。特に、処理時間の増加によって生産性が低下する。また、このために生産設備を強化すると対策コストが必要となる。すなわち、ソフトウェア上の処理による高速化が現実的である。処理時間の高速化は、今後のExternal Bank方式の利便性を左右する非常に重要な課題である。
 特許文献1に記載された技術では、書き換え処理にかかる消費電力を抑えつつ高速で書換処理を実行できるものの、書き換え対象はそのコアに対応する(内部)不揮発性メモリのみである。外部装置からの制御によって、別のメモリにバックアップとしてのプログラムを同時に書き込むことはできない。
 本発明では、内部不揮発性メモリの書き換えと外部不揮発性メモリへのバックアップを高速で実行することを目的とする。
 本願において開示される発明の代表的な一例を示せば以下の通りである。すなわち、電子制御装置であって、所定のプログラムを実行するプロセッサを含むマイコンと、前記マイコンに接続される外部不揮発性メモリとを備え、前記マイコンは、内部不揮発性メモリと、前記外部不揮発性メモリと通信する第1通信部と、外部装置と通信する第2通信部とを有し、前記マイコンは、前記内部不揮発性メモリを書き換えるための前記外部装置から受信したデータを、前記内部不揮発性メモリ及び前記外部不揮発性メモリに書き込むことを特徴とする。
 本発明の代表的な実施の形態によれば、内部不揮発性メモリの書き換えと外部不揮発性メモリへのバックアップを高速で実行できる。前述した以外の課題、構成及び効果は、以下の実施例の説明により明らかにされる。
本発明の実施例のシステムの構成を示す図である。 実施例1の制御プログラムの配置の一例を示す図である。 実施例1の制御プログラムの配置の一例を示す図である。 実施例1の制御用プログラムの更新のために使用されるファイルの一例を示す図である。 実施例1のプロセッサが外部不揮発性メモリに対して実行する処理のフローチャートである。 実施例1の内部不揮発性メモリの書き換えと共に外部不揮発性メモリへのバックアップデータを書き込む手順を示す図である。 実施例2の制御プログラムの配置の一例を示す図である。 実施例2の制御プログラムの配置の一例を示す図である。 実施例2の受信データ格納部の構成を示す図である。 実施例2のプロセッサが外部不揮発性メモリに対して実行する制御処理のフローチャートである。 実施例2の内部不揮発性メモリの書き換えと共に外部不揮発性メモリへのバックアップデータを書き込む手順を示す図である。 実施例3の処理とタスクとの対応を示す図である。 実施例3の制御プログラムの配置の一例を示す図である。 実施例3の制御プログラムの配置の一例を示す図である。 本実施例3のタスク実行の制御を表すフローチャートである。 実施例3の内部不揮発性メモリの書き換えと共に外部不揮発性メモリへのバックアップデータを書き込む手順を示す図である。
 以下、本発明の実施例を、添付された図面を参照しつつ説明する。
 図1は、本発明の実施例のシステムの構成を示す図である。
 本実施例のシステムはECU1と通信線11を介して接続される外部装置10とを有する。
 外部装置10は、マイクロコンピュータを主要部とした装置、例えばパーソナルコンピュータに搭載され、ECU1と通信できる機能を有し、かつ本実施例の動作に必要な機能を実現するソフトウェアを有する。外部装置10は、ECU1に設けられた外部コネクタ又は当該外部コネクタに繋がる車両のコネクタなどのインターフェースを介してECU1に接続される。
 ECU1には、マイコン2が搭載されている。マイコン2は、ソフトウェアを実行する少なくとも一つ以上のプロセッサ3aと(複数のプロセッサが搭載される場合は、プロセッサ3a、プロセッサ3b・・・とする)、少なくとも一つの揮発性RAM5と、外部装置と通信するための少なくとも一つの通信部6と、プログラムを保持する内部不揮発性メモリ7と、外部不揮発性メモリ9と通信するための少なくとも一つの通信部8と、それぞれの要素を接続するバス4とを有する。マイコン2は、通信部8を介して外部不揮発性メモリ9と接続される。外部不揮発性メモリ9には、後述するように、内部不揮発性メモリ7で実行される制御用プログラムのバックアップデータが格納され、このバックアップデータは制御用プログラムの更新に失敗した場合のロールバック用に使用される。ECU1は、少なくとも一つの通信部6を介して、接続される外部装置10と通信可能である。
 [実施例1]
 実施例1では、外部装置10からの指令を本来とは別の目的に使用することで、高速化を達成する方法について説明する。
 実施例1では、プロセッサ3a以外のプロセッサがある場合、一連の処理を妨げないように、それらのプロセッサの処理を停止する、又はRAM上で動作(図2参照)など適切な処理を行われているものとする。
 図2A、図2Bは、本実施例の制御プログラムの構成の一例を示す図であり、図2AはRAM5内の配置を示し、図2Bは内部不揮発性メモリ7内の配置を示す。
 プロセッサ3aが実行する主なプログラムは、外部装置10との通信制御や、受信した書込データの解凍処理及び復号処理などを実行する通信兼データ処理部23、内部不揮発性メモリ7に格納されたデータに対する処理を実行する内部不揮発性メモリ書換部21、及び外部不揮発性メモリ9に対する処理を実行する外部不揮発性メモリ制御部24がある。
 内部不揮発性メモリ書換部21は、RAM5に配置される。RAM5には、内部不揮発性メモリ書換部21の他に、プロセッサ3aの動作に関与しない他のプロセッサが参照するプログラム22が格納される。
 このようにプログラムが配置される理由は、内部不揮発性メモリ7を書き換える際、内部不揮発性メモリ7を通常状態から書換可能状態に移行する必要があるが、書換可能状態では内部不揮発性メモリ7に格納されているプログラムを実行できないためである。そのため、書換直前にプロセッサ3aの制御をRAM5上の内部不揮発性メモリ書換部21に移してから、書換可能状態に移行後に内部不揮発性メモリ7のデータを書き換え、書き換えが終了して通常状態に戻した後に、プロセッサ3aの制御を内部不揮発性メモリ7上の通信兼データ処理部23に戻す制御を行う。
 なお、他のプロセッサについても、内部不揮発性メモリ7が書換可能状態では、内部不揮発性メモリ7に格納されるプログラムを実行できない。すなわち、内部不揮発性メモリ7が書換可能状態では、他のプロセッサのプログラムもRAM5上で実行される必要がある。各プロセッサは各々独立して動くことを考慮し、前述の配置によって、この条件を満たすようにしている。
 なお、RAM5は、その特性上、電源を遮断すると書き込まれたデータは保持されずに、消失する。このため、RAM5に配置されるプログラムは、内部不揮発性メモリ7のその他のデータ25の一部として格納されており、一連の内部不揮発性メモリ7の書換処理を実行する前に、その他のデータ25からRAM5にプログラムがコピーされる。その後、プロセッサ3a以外のプロセッサは、RAM5上の所定のアドレスからプログラムを読み出して処理を実行する。
 図3は、制御用プログラムの更新のために使用されるファイルの一例を示す図である。
 制御用プログラムを更新するために使用されるファイルは、更新用の制御用ソフトウェア本体と、書換制御用情報に大別される。書換制御用情報は、書き込み対象のアドレス、書き込み対象のプログラムサイズ、書き込まれるデータのフォーマット、書き換え後に正しく書き込めたか検証するための値などである。このファイルを外部装置10に対して指定することによって、このファイルを外部装置10に付与する。その後、適切なタイミングで、それらの情報をECU1に対して送付することで、プログラムの書き換えを適切に制御できる。
 図4は、プロセッサ3aが外部不揮発性メモリ9に対して実行する処理のフローチャートである。
 プロセッサ3aは、外部装置10から書込データの受信を契機に処理を開始する(S01)。
 次に、プロセッサ3aは、現在の書き込み対象アドレスと外部装置10から受信したデータのサイズから、外部不揮発性メモリ9の消去処理の必要性を判定し(S02)、消去処理が必要であると判定された場合、外部不揮発性メモリ9に格納されたデータを所定の消去単位で消去する(S03)。
 その後、プロセッサ3aは、受信した書込データを一定の単位で、外部不揮発性メモリ9に書き込む(S04)。その後、プロセッサ3aは、書込データがまだあるか判定し(S05)、全ての書込データの書込処理が終了するまで、ステップS04の処理を繰り返す。そして、全ての書込データの書き込みが完了すると、正常に処理が終了したので、外部装置へ正常応答を返信して、次の書込データを要求する(S06)。
 なお、消去処理(S03)又は書込処理(S04)が正常終了しなかった場合は、処理を終了し、外部装置へ異常応答を返信する(S07)。外部装置は、適切なエラーメッセージをユーザに報知する。
 次に、図5を参照して、実施例1のシステムによる、内部不揮発性メモリ7の書き換えと共に外部不揮発性メモリ9へのバックアップデータを書き込む手順を説明する。
 まず、図3に一例を示すような、ECU1に書き込まれる更新後の制御用ソフトウェアと、当該ソフトウェアに関する制御用情報を含むファイルを用意し、そのファイルを外部装置10にて指定する。その後、ユーザからの開始操作の指示によって処理を開始する(S11)。外部装置10は、指定されたファイルを読み込み、格納する(S12)。
 その後、外部装置10は、ECU1に対する書き込みのための初期化命令を送信する(S13)。この初期化命令によって、ステップS12で読み込まれたファイルの書き換え対象、サイズ、データの種別などの情報をECU1に伝達する。ECU1は、この情報に基づいて、書換制御に必要な準備を行う。
 その後、外部装置10は、更新用ソフトウェアの書込用データを複数回に分けて送信する(S14~S16)。プロセッサ3aは、図4に示す処理を実行し、通信部8を適切に制御することで外部不揮発性メモリ9に対する書き込み処理を実行する。図4で示す一連の処理が正常に終了したら(S06)、ECU1は次の書込データを外部装置10に要求する。処理が異常終了したら(S07)、外部装置10は異常終了した旨の応答をユーザ報知し、処理を途中で終了する。以上の処理を全ての書込データが書き込まれるまで繰り返す。
 最後の書込データを受領(S16)し、受領した最後の書込データの処理が完了して、外部装置10へ正常応答を送信すると、外部装置10から終了通知を受領する(S17)。本来、ステップS17の終了通知は、ECU1に書換処理の終了する通知するために送信されるが、実施例1では、ECU1が終了通知を受領したタイミングで、外部不揮発性メモリ9に書き込んだデータを読み出して内部不揮発性メモリ7に書き込む、書換処理を実行する。具体的には、外部不揮発性メモリ9に書き込んだデータを先頭から所定量を読み出し、復号処理、解凍処理などの適切な処理を実行して、内部不揮発性メモリ7を書き換える処理を繰り返す。
 なお、内部不揮発性メモリ7の書き換え直前には、プロセッサ3aによる制御を通信兼データ処理部23から内部不揮発性メモリ書換部21に移し、内部不揮発性メモリ7の状態を書換可能状態に移行した後に、内部不揮発性メモリ7を書き換える。書き換え終了後は、内部不揮発性メモリ7を通常の状態に戻した後、プロセッサ3aによる制御を通信兼データ処理部23に戻す。
 以上の処理が実行され、内部不揮発性メモリ7の書き換えが正常に完了した場合、終了通知(S17)に対して正常応答を外部装置10に返信する。外部装置10は、この正常応答を受信すると、ユーザに一連の処理が正常完了した旨を報知する(S18)。一方、内部不揮発性メモリ7の書き換えが途中で失敗した場合、終了通知(S17)に対して異常終了を外部装置10に応答し、ユーザに異常終了した旨を報知する。
 実施例1の方法による高速化の効果は以下の通りである。一見、二つの不揮発性メモリ(外部不揮発性メモリ9、内部不揮発性メモリ7)に順にデータを書き込んでいるため、二つの不揮発性メモリの各々へデータを書き込む場合(2回の書き込みを実施する場合)と処理時間は変わらないように見える。しかし、更新用データは外部装置10から1回転送すればよい。特に、現在主流のCANに実施例1を適用する場合、処理時間の多くがECU1への更新用データの転送時間である。CANを介したECU1へのデータ転送時間と比較し、外部不揮発性メモリ9から書込データを読み出す速度の方が速いため、その差だけ、内部不揮発性メモリ7の書き換えを高速化できる。
 以上、図5を用いて不揮発性メモリの書き換えの一例を説明したが、プログラムの本来の動作に影響を与えない範囲で、他の処理を前後に実行してもよい。実際の運用に基づいた一例をあげると、書換前にECU1の固有情報を読み出すための指令や、初期化(S13)の前に書換後に意図したソフトウェアに更新できたか検証するための値を送信し、終了通知(S17)による処理完了後に、外部装置10からの指令に基づいて、ECU1が所定の方法によって書込後のメモリのデータを用いて演算を行って、事前に送信された値と照合してもよい。
 また、内部不揮発性メモリ7への書き込みは、内部不揮発性メモリ7へ書き込まれたデータを用いて各プロセッサが制御するものであることから、変換前の生データを書き込む必要があるが、外部不揮発性メモリ9に書き込むデータはバックアップ目的である。その点に着目すると、図5において、外部不揮発性メモリ9へ書き込まれるデータは、受信した書込データそのものであるが、何らかの方法によって変換されたデータを外部不揮発性メモリ9に書き込んでもよい。具体的には、圧縮や暗号化された書込データを、復号してから書き込み、解凍してから書き込み、復号及び解凍してから(内部不揮発性メモリ7と同一のデータを)書き込みのいずれでもよい。すなわち、外部不揮発性メモリ9に書き込まれるデータは、プロセッサの処理によって何らかの変換を行って変換前のデータと同一になればよい。なお、前述したとおり、実用上は外部不揮発性メモリ9に書き込むデータは暗号化されていることは必須である。
 また、図5では、外部不揮発性メモリ9にデータを書き込んだ後、内部不揮発性メモリ7を書き換える手順としたが、逆の手順、すなわち内部不揮発性メモリ7を書き換えた後、外部不揮発性メモリ9にデータを書き込んでもよい。
 一般的には、外部装置10から転送される書込データは暗号化や圧縮されている。内部不揮発性メモリ7を書き換える際には、転送されたデータを復号・解凍によって元のデータに戻してから書き込む。すなわち、外部不揮発性メモリ9に書き込む際は、解凍済データを書き込むため、書き込むデータ量が増える。もしくは、暗号化や圧縮が行われて2度手間になる。この点を考慮すると、内部不揮発性メモリ7を書き換えた後に外部不揮発性メモリ9にデータを書き込む順では、処理効率が低下する。
 [実施例2]
 実施例2では、二つのプロセッサ3a、3bを用いて、並列に書込処理を行うことで高速化を達成する手順の一例を示す。以下、添付された図面を参照しつつ説明する。
 実施例2のシステムの構成については、ソフトウェアを実行する少なくとも二つのプロセッサ(CPU)3a、3bが必要となる。この点以外は図1と同じである。
 プロセッサ3aとプロセッサ3bのそれぞれは、内部不揮発性メモリ7、外部不揮発性メモリ9に対する処理を実行する。これ以外のプロセッサは、一連の処理を妨げないように処理を停止する、又は、内部不揮発性メモリ7と異なるメモリ(例えばRAM5)に格納されたプログラムを実行してもよい(図6A参照)。
 図6A、図6Bは、本実施例の制御プログラムの構成の一例を示す図であり、図6AはRAM5内の配置を示し、図6Bは内部不揮発性メモリ7内の配置を示す。
 プロセッサ3aが実行する主なプログラムは、内部不揮発性メモリ書換部31及び通信兼データ処理部35である。内部不揮発性メモリ書換部31及び通信兼データ処理部35は、実施例1の内部不揮発性メモリ書換部21及び通信兼データ処理部23と同じである。また、内部不揮発性メモリ書換部31がRAM5に配置されるのも実施例1と同様の理由である。
 RAM5には、内部不揮発性メモリ書換部31の他に、プロセッサ3a、3bの動作に関与しないプロセッサが参照するプログラム34が格納される。プログラム34をRAM5に配置する理由も実施例1と同じである。
 実施例2は、実施例1と以下の2点で相違する。一つは、プロセッサ3aが外部装置10から受信した書込データを格納し、かつ、プロセッサ3bが格納されたデータを読み取り、外部不揮発性メモリ9に書き込む処理を実行するためのバッファである受信データ格納部32が設けられる点である。もう一つは、プロセッサ3bが実行する主なプログラムである外部不揮発性メモリ制御部33がRAM5に格納される点である。外部不揮発性メモリ制御部33をRAM5に格納する理由は実施例1と同様に、内部不揮発性メモリ7の書換可能状態において、内部不揮発性メモリ7に格納されるプログラムを実行できないためである。本実施例では、内部不揮発性メモリ7に対する処理の実行中に、外部不揮発性メモリ9への自由な制御を行うために、外部不揮発性メモリ制御部33はRAM5に配置する。
 なお、RAM5は、その特性上、電源を遮断すると書き込まれたデータは保持されずに、消失する。このため、RAM5に配置されるプログラムは、内部不揮発性メモリ7のその他のデータ36の一部として格納されており、一連の内部不揮発性メモリ7の書換処理を実行する前に、その他のデータ36からRAM5にプログラムがコピーされる。その後、プロセッサ3a以外のプロセッサは、RAM5上の所定のアドレスからプログラムを読み出して処理を実行する。
 図7は、受信データ格納部32の構成を示す図である。
 受信データ格納部32に対し、外部装置10から受信した書込データが書き込まれている末端を示す受信完了ポインタ41と、外部不揮発性メモリ9に対する書込処理が完了したデータの末端を示す書込完了ポインタ42の二つのポインタが設けられている。受信完了ポインタ41と書込完了ポインタ42の間が、外部装置10から受信した書込データが外部不揮発性メモリ9に書き込まれていない未処理データである。これらポインタの値は一定方向に増加又は減少し(RAM5のアドレスに関して一定の方向で増減し)、受信データ格納部32のサイズによって定まる上限値が存在する。言い換えると、この上限値は受信データ格納部32の末端を示す。
 初期状態は両ポインタ41、42の値(両ポインタが示すアドレス)が同じであるが、一連の処理の中で、下記のように動作する。プロセッサ3aは、通信兼データ処理部35によって、外部装置10から受信した書込データを受信データ格納部32へ一定の方向に書き込む処理を実行する。書込処理終了後、データを書き込んだ分だけ受信完了ポインタ41の値を変化する。その後、プロセッサ3aが担当する内部不揮発性メモリ7に対する処理の終了後、外部装置10へ処理の結果を応答する。
 一方、プロセッサ3bは以下のように処理を実行する。受信完了ポインタ41と書込完了ポインタ42に差がある場合、外部不揮発性メモリ9に書き込まれていない未処理データが存在する。そのため、プロセッサ3bは、書込完了ポインタ42が示す場所から所定量のデータを読み出して、外部不揮発性メモリ9に書き込む。その後、データを書き込んだ分だけ書込完了ポインタ42の値を受信完了ポインタ41と同じ方向に変化する。受信完了ポインタ41と書込完了ポインタ42が一致している場合、未処理データが存在しないため、プロセッサ3bは書き込み処理を行わずに待つ。その後、プロセッサ3aにより受信完了ポインタ41が進んだ場合、受信完了ポインタ41と書込完了ポインタ42に差が生じるので、プロセッサ3bは外部不揮発性メモリ9へのデータ書き込みを再開する。
 プロセッサ3a、3bの各々は前述した処理を独立して実行するが、以下の2点に該当する場合には、プロセッサ3a、3bは同期して処理を実行する。一つは、受信完了ポインタ41の値が上限値に達した場合に、プロセッサ3aの処理が完了しても、書込完了ポインタ42の値が上限値に達するまで、外部装置10への応答を待つ。受信完了ポインタ41及び書込完了ポインタ42が上限値に達した後、プロセッサ3aは外部装置10へ応答した後、受信完了ポインタ41及び書込完了ポインタ42を初期値に戻す。以後、前述の処理を実行する。
 もう一つは、外部装置10から受信した書込データが最後のデータである場合、受信完了ポインタ41及び書込完了ポインタ42が一致するまで待ってからプロセッサ3aは応答を行う。なお、書込データが最後かは、例えば、外部装置10から予め送られたプログラムのサイズ情報と、ECU1内部で計測している外部装置10から受信したデータ量と、今回受信した書込データのサイズに基づいて判定できる。
 図8は、プロセッサ3bが外部不揮発性メモリに対して実行する制御処理のフローチャートである。
 プロセッサ3bは、ユーザの操作に従って処理を開始すると、プロセッサ3aからの指令を待ち受ける(S21)。その後、プロセッサ3bは、外部装置10から初回の書込データを受信すると、プロセッサ3aの操作によってステップS22に移行し、処理を開始する。
 ステップS22では、書込データを書き込むべき領域の外部不揮発性メモリ9の消去処理が必要かを判定し、必要があれば外部不揮発性メモリ9の消去単位でデータを消去する(S23)。
 その後、図7で説明した手順で、書込可能なデータがあるかを判定する(S24)。未書込のデータがない場合はS24で待機する。書き込むべきデータがある場合は受信データ格納部32から書込データを読み出し、外部不揮発性メモリ9に書き込む(S25、S26)。書込後は、書き込まれたデータを検証するベリファイを実施する(S27)。例えば、ステップS26によって書き込んだ場所と同じ範囲のデータを外部不揮発性メモリ9から読み出し、書き込んだデータとの一致を確認する。一致した場合、正しく書き込めたとして書込完了ポインタ42を進める。その後、書込完了ポインタ42が上限値に達している、又は書き込んだデータが最終データであるの、いずれかの条件に該当するかを判定する(S28)。条件に該当する場合はステップS21に戻り、どちらの条件にも該当しない場合はステップS24に戻る。
 なお、書込完了ポインタ42が上限値に達したことよってステップS21に移行した場合、プロセッサ3aによって受信完了ポインタ41及び書込完了ポインタ42がクリアされた後で、プロセッサ3aからの操作によってステップS22に移行して、消去の要否を判定する。
 書き込むデータがなくなるまで以上の処理を繰り返す。
 なお、ステップS22に関して、受信データ格納部32のサイズと外部不揮発性メモリ9の消去単位が一致している場合、必ずYESと判定される。このため、受信データ格納部32のサイズを設定し、ステップS22の判定を行わずに、ステップS23を実行するように、処理を簡略化してもよい。
 次に、図9を参照して、実施例2による、内部不揮発性メモリ7の書き換えと外部不揮発性メモリ9への書き込みを並列に行う手順を説明する。
 ステップS31~S33は、実施例1のS11~S13と同じである。
 ステップS34で外部装置10から初回の書込データが転送される。プロセッサ3aは受信した書込データを、受信データ格納部32に保存した後、受信完了ポインタ41を進める。同時にプロセッサ3bに対しステップS22への移行を指令し、プロセッサ3bの処理を開始する。その後、内部不揮発性メモリ7への書換処理ができれば実行する。S34では必要なデータ量に達していないため実行していない。内部不揮発性メモリ7への書換処理の終了後、外部装置10に処理結果を返信する。
 外部装置10から次の書込データを受領すると(S35)、同様に受信データ格納部32に保存する。その後、内部不揮発性メモリ7を書き換える。書換直前に一度内部不揮発性メモリ書換部31に移行して、内部不揮発性メモリ7を書換可能状態に移行した後にデータを書き換える。書換終了後、内部不揮発性メモリ7を通常状態に戻した後、プロセッサ3aの制御を通信兼データ処理部35に戻し、その後に外部装置10に処理結果を返信する。
 一方、ステップS34、S35において、プロセッサ3bはプロセッサ3aの動きとは関係なく、図8に示す処理を実行する。ステップS34によって受信完了ポインタ41と書込完了ポインタ42に差分が生じるため、通信部8を介して外部不揮発性メモリ9に適切に制御して、データを書き込む。データ書込終了後は、書き込んだ分だけ書込完了ポインタ42を進める。図9では、プロセッサ3aが、ステップS36で書込データを受信する前に、受信完了ポインタ41と書込完了ポインタ42が一致し待機状態となる。ステップS36によって、プロセッサ3aが、新たな書込データを受信し、受信完了ポインタ41が進めば書き込み処理が再開される。
 この後、受信完了ポインタ41が上限値に達するまで、前述した処理を繰り返す。そして、ステップS37で、受信完了ポインタ41が上限値に達した場合、図7で説明した通り、書込完了ポインタ42が上限値に達するまで、プロセッサ3aは外部装置10への応答を待つ。そして、書込完了ポインタ42が上限値に達するのを待って(S38)、プロセッサ3aが外部装置10へ処理結果を返信する。次の書込データの受信では(S39)、プロセッサ3aが受信完了ポインタ41と書込完了ポインタ42を初期値に設定して、S34からの処理を繰り返す。
 そして、最後の書込データを受信した場合(S40)、現在のポインタの位置にかかわらず、ステップS37及びS38と同じ処理を実行する(S41)。
 全ての書込データを受信し、ECU1の処理が終わった後、外部装置10が終了命令を送信する(S42)。外部装置10は、ECU1から正常応答を受信した場合、処理完了をユーザへ通知し(S43)、一連の処理を終了する。
 以上の処理を順に行うが、途中で何らかの要因で処理が失敗した場合、外部装置10は処理の異常終了をユーザに通知する。なお、プロセッサ3aとプロセッサ3bの各々は独立して処理を実行するが、外部不揮発性メモリ9の処理の過程において何らかのエラーが生じた場合、その旨をプロセッサ3bからプロセッサ3aに通知して、プロセッサ3aが自身の処理が正常終了していても、外部装置10に対してエラーを返信し処理を終了する。
 実施例2の方法による高速化の効果は以下の通りである。プロセッサ3aが担当する内部不揮発性メモリ7側は、受信データ格納部32への書き込みや、外部不揮発性メモリ9側との同期など異なる点はあるが、今までの有線による方法とほぼ同じように処理できる。その処理時間を利用して、プロセッサ3bが外部不揮発性メモリ9へのバックアップ処理を行うことができれば、内部不揮発性メモリ7の書き換えとほぼ同じ時間で処理できる。内部不揮発性メモリ7に比べ、外部不揮発性メモリ9の書換性能が著しく悪い場合は、それが達成できないが、その場合でも外部装置10から外部不揮発性メモリ9への書き込み処理と比較し、データ転送が不要(内部不揮発性メモリ7側で処理される)ため、データ転送時間の減少分で高速化できる。以上をまとめると、最速で今までと同等、最遅でも外部不揮発性メモリ9に単独で書き込むための処理時間より高速化ができる。
 以上、図9を用いて不揮発性メモリの書き換えの一例を説明したが、プログラムの本来の動作に影響を与えない範囲で、実施例1で説明した他の処理を前後に実行してもよい。
 [実施例3]
 実施例3では一つのプロセッサを用いて、マルチタスク処理によって、二つの不揮発性メモリに対して同時に処理を実行する手順の一例を示す。以下、添付された図面を参照しつつ説明する。
 実施例3におけるシステムの構成は実施例1と同様である。実施例1と同様、プロセッサ3a以外のプロセッサがある場合、一連の処理を妨げないように、それらのプロセッサの処理を停止する、又はRAM5上で動作(図11参照)など適切に処理する。
 一連の書き換え手順において、プロセッサが処理する内容を、図10に示すように細かく分解し、通信兼データ処理タスク55、内部不揮発性メモリ書換タスク51、外部不揮発性メモリ制御タスク53の三つに分類する。
 通信兼データ処理タスク55は、外部装置10との送受信処理、既定のプロトコルによる受信処理、受信データ格納部52への格納処理、書込データの復号、及び書込データの解凍処理を含み、現在の内部状態に応じていずれかの処理を実行する。内部不揮発性メモリ書換タスク51は、内部不揮発性メモリ7の消去、内部不揮発性メモリ7の書込、及び消去・書込の終了確認処理を含み、現在の内部状態に応じていずれかの処理を実行する。外部不揮発性メモリ制御タスク53は、外部不揮発性メモリ9の消去、外部不揮発性メモリ9の書込、外部不揮発性メモリ9の読込、及び消去・書込処理の終了確認処理を含み、現在の内部状態に応じていずれかの処理を実行する。
 一般的に不揮発性メモリの消去・書込は、命令を送信してからその命令を完了するまで時間がかかる。その間、プロセッサが他の処理を実行しない待機状態にすると全体の処理効率が低下する。そのため、消去・書込処理のための命令処理と、その処理が完了したかを確認する処理を分けることで、処理効率を高めることができる。
 図11A、図11Bは、本実施例の制御プログラムの構成の一例を示す図であり、図11AはRAM5内の配置を示し、図11Bは内部不揮発性メモリ7内の配置を示す。
 通信兼データ処理タスク55に含まれる処理プログラムは内部不揮発性メモリ7に配置され、内部不揮発性メモリ書換タスク51に含まれる処理プログラムと、外部不揮発性メモリ制御タスク53に含まれる処理プログラムはRAM5上に配置される。
 ここで、実施例3の内部不揮発性メモリ書換タスク51、外部不揮発性メモリ制御タスク53、通信兼データ処理タスク55は、実施例1の内部不揮発性メモリ書換部31、外部不揮発性メモリ制御部33、通信兼データ処理部35と同じである。また、その他のデータ56や受信データ格納部52なども実施例1と同じである。
 前述のようにタスクを分けて、一つのプロセッサで図12に示すシーケンスに従って処理を繰り返し、プロセッサの待機時間を可能な限りなくして、高速で処理を実行する。図12に示す通り、通常時は、通信兼データ処理タスク55を実行し(S52)、その後、外部不揮発性メモリ制御タスク53(S54)を実行する。但し、内部不揮発性メモリ7を書き換えるときは、通信兼データ処理タスク55の代わりに内部不揮発性メモリ書換タスク51(S53)を実行する。
 なお、通信兼データ処理タスク55と内部不揮発性メモリ書換タスク51の切り替えは、例えば以下の方法で実施できる。通信兼データ処理タスク55によって、受信した書込データの復号・解凍などの処理が終わり、次回に内部不揮発性メモリ7を書き換える際は、外部不揮発性メモリ制御タスク53の終了時に通信兼データ処理タスク55ではなく内部不揮発性メモリ書換タスク51を実施することを示すフラグを設定する。そして、外部不揮発性メモリ制御タスク53の終了後、内部不揮発性メモリ書換タスク51が起動する。以後、内部不揮発性メモリ7の書換中はこの状態が続き、内部不揮発性メモリ7の書換終了後に内部不揮発性メモリ書換タスク51がフラグを初期化することで、次の外部不揮発性メモリ制御タスク53の実行後に、通信兼データ処理タスク55が実行される状態に戻る。
 実施例3は、以上のような設計をするので、実施例2と同様の設計が可能である。例えば、受信データ格納部52の構造は実施例2の図7と同じものを使用できる。受信完了ポインタ41と書込完了ポインタ42を用いた処理手順も実施例2(図7)と同じでよい。また、外部不揮発性メモリ9への処理手順も実施例2(図8)と同じでよい。詳細には、前述の通り、処理効率の観点から、消去・書込の命令処理と完了確認処理は別に設けられるため、S23とS26は「消去/書込の命令」、「確認」の2段階に分けられる。
 但し、実施例3は以下の点で実施例2と相違する。図12からも分かるように、各タスクの処理を交互に実行する点である。実施例2では、内部不揮発性メモリ7の書換処理と外部不揮発性メモリ9の書換処理を独立して同時に並行で実行するため、お互いの状況に依存せず、待ち時間がなく処理できる。しかし、実施例3の場合、他のタスクの処理が終わり、自身のタスクまで待たないと次の処理が進まない。このような観点から、実施例3による処理の高速化は、実施例2と比べるとやや限定的である。しかし、外部装置10との通信制御や内部不揮発性メモリ7の処理の間に、外部不揮発性メモリ9への処理を実行できる点は実施例2と同様であるため、処理を高速化できる。また、プロセッサの処理性能が高速であれば、実施例2と実施例3の差は小さくなる。
 図13を参照して実施例3の具体的な処理について説明する。全体の制御のフローは図9と同じため、ステップS64とS65(図13のS34とS35に対応)での内部動作に焦点をあてて説明する。
 なお、図13は図9と違い時間軸を考慮に入れて表している。前述した通り、プロセッサ3aは、図12のように通信兼データ処理タスク55又は内部不揮発性メモリ書換タスク51のいずれかと、外部不揮発性メモリ制御タスク53を交互に実行する。図13では、内部不揮発性メモリ書換タスク51による内部不揮発性メモリ7の書換処理と、外部不揮発性メモリ制御タスク53による外部不揮発性メモリ9の書込処理とを交互に行っていることを示す。なお、各処理を示す矢印の間隔は実際の処理時間の長さとは関連していない。
 S64では、外部装置10から書込データを受け取った後、通信兼データ処理タスク55により、受信データ格納部52に格納する。その次の外部不揮発性メモリ制御タスク53では、受信データ格納部52に書き込みデータが格納されたので、外部不揮発性メモリ9に対する処理を開始する。具体的には、外部不揮発性メモリ制御タスク53はステップS22の処理(消去の必要性の判定)を実行し、必要があればステップS23の処理(消去コマンド)を通信部8介して外部不揮発性メモリ9に発行する。
 外部不揮発性メモリ制御タスク53の終了後、プロセッサの処理が通信兼データ処理タスク55に移るが、ステップS64では内部不揮発性メモリ7に対する処理を実行せず、外部装置10への応答処理を実行する。そして、次の外部不揮発性メモリ制御タスク53では、消去処理が終了したかを確認するコマンドを外部不揮発性メモリ9に発行し、その応答により消去処理が終わったか確認する。以後、外部不揮発性メモリ制御タスク53では消去処理の終了が確認できるまでこれを繰り返す。その後、外部不揮発性メモリ制御タスク53の実行時に図8に示す処理を実行する。
 外部装置10に対する応答処理実行後は、通信兼データ処理タスク55で、外部装置10から次の書込データS65を受信する。受信後、受信データ格納部52に書き込むまではステップS64と同じである。その後、数回の通信兼データ処理タスク55によって、復号・解凍などの書込データ処理を実行する。書込データの処理の終了後は、それを内部不揮発性メモリ7に書き込むため、次回は通信兼データ処理タスク55の代わりに、内部不揮発性メモリ書換タスク51を実行するようにフラグを設定する。外部不揮発性メモリ制御タスク53の終了後、内部不揮発性メモリ書換タスク51を実行し、以後、外部不揮発性メモリ9と同様に、消去、確認、書き込み、確認の処理を実行する。書き換えが終了し、次の外部不揮発性メモリ制御タスク53の終了後、通信兼データ処理タスク55を実行するようにフラグを初期化する。
 以後、実施例2と同様の流れで処理を実行する。いずれかのタスクおいて何らかのエラーが生じた場合、外部装置10に対してエラー通知を送信して、処理を中断する。
 また、プログラムの本来の動作に影響を与えない範囲で、実施例1で説明した他の処理を前後に実行してもよい。
 [変形例]
 以上に説明した実施例は、それぞれ実用上の観点から通信線11が有線で構成され、有線通信を介して書換データが転送されるものであるが、通信線11が無線で構成されてもよく、無線通信を介して書換データが転送されるものでもよい。
 以上に説明したように、本発明の実施例の電子制御装置は、所定のプログラムを実行するプロセッサを含むマイコン2と、マイコン2に接続される外部不揮発性メモリ9とを備え、前記マイコン2は、内部不揮発性メモリ7と、外部不揮発性メモリ9と通信する通信部8と、外部装置10と通信する通信部6とを有し、マイコン2は、内部不揮発性メモリ7を書き換えるために、外部装置10から受信したデータを、内部不揮発性メモリ7及び外部不揮発性メモリ9に書き込むので、マイコンが内部不揮発性メモリ7と外部不揮発性メモリ9にアクセスできる構成において、外部装置10からの制御に基づいてマイコン2の内部不揮発性メモリ7に格納されたECU1の制御用ソフトウェアを書き換える際に、内部不揮発性メモリ7の書き換えと外部不揮発性メモリ9へのバックアップデータの書き込みを高速に実行できる。特に、外部装置10から1回のデータ転送で、内部不揮発性メモリ7及び外部不揮発性メモリ9の両方にデータを書き込むので、処理を高速化できる。
 また、マイコン2は、外部装置10から受信したデータを格納する受信データ格納部32を有し、受信データ格納部32に格納されるデータと同じデータを、内部不揮発性メモリ7及び外部不揮発性メモリ9に書き込むので、内部処理が簡単でプログラムを高速化できる。
 また、前記内部不揮発性メモリに書き込み処理を行う第1プロセッサ3aと、外部不揮発性メモリに書き込み処理を行う第2プロセッサ3bとを有し、第1プロセッサ3aは、外部装置10から受信したデータを受信データ格納部32及び内部不揮発性メモリ7に書き込み、第2プロセッサ3bは、受信データ格納部32に格納されたデータを外部不揮発性メモリ9に書き込むので、プロセッサ間で処理を分散でき、処理速度を向上できる。
 また、前記インターフェースが受信したデータが暗号化されている場合、マイコン2は、外部装置10から受信したデータを復号して内部不揮発性メモリ7に書き込み、外部装置10から受信したデータを復号せずに外部不揮発性メモリ9に書き込むので、セキュリティ維持しつつ、ロールバック用のデータを外部不揮発性メモリ9に格納できる。
 なお、本発明は前述した実施例に限定されるものではなく、添付した特許請求の範囲の趣旨内における様々な変形例及び同等の構成が含まれる。例えば、前述した実施例は本発明を分かりやすく説明するために詳細に説明したものであり、必ずしも説明した全ての構成を備えるものに本発明は限定されない。また、ある実施例の構成の一部を他の実施例の構成に置き換えてもよい。また、ある実施例の構成に他の実施例の構成を加えてもよい。また、各実施例の構成の一部について、他の構成の追加・削除・置換をしてもよい。
 また、前述した各構成、機能、処理部、処理手段等は、それらの一部又は全部を、例えば集積回路で設計する等により、ハードウェアで実現してもよく、プロセッサがそれぞれの機能を実現するプログラムを解釈し実行することにより、ソフトウェアで実現してもよい。
 各機能を実現するプログラム、テーブル、ファイル等の情報は、メモリ、ハードディスク、SSD(Solid State Drive)等の記憶装置、又は、ICカード、SDカード、DVD等の記録媒体に格納することができる。
 また、制御線や情報線は説明上必要と考えられるものを示しており、実装上必要な全ての制御線や情報線を示しているとは限らない。実際には、ほとんど全ての構成が相互に接続されていると考えてよい。

Claims (7)

  1.  電子制御装置であって、
     所定のプログラムを実行するプロセッサを含むマイコンと、
     前記マイコンに接続される外部不揮発性メモリとを備え、
     前記マイコンは、内部不揮発性メモリと、前記外部不揮発性メモリと通信する第1通信部と、外部装置と通信する第2通信部とを有し、
     前記マイコンは、前記内部不揮発性メモリを書き換えるための前記外部装置から受信したデータを、前記内部不揮発性メモリ及び前記外部不揮発性メモリに書き込むことを特徴とする電子制御装置。
  2.  請求項1に記載の電子制御装置であって、
     前記内部不揮発性メモリを書き換えるためのデータを、前記内部不揮発性メモリ及び前記外部不揮発性メモリの一方に書き込んだ後、当該一方の不揮発性メモリに書き込まれたデータと同じデータを他方の不揮発性メモリに書き込むことを特徴とする電子制御装置。
  3.  請求項2に記載の電子制御装置であって、
     前記内部不揮発性メモリを書き換えるためのデータを、前記外部不揮発性メモリに書き込んだ後、前記外部不揮発性メモリに書き込まれたデータと同じデータを前記内部不揮発性メモリに書き込むことを特徴とする電子制御装置。
  4.  請求項1に記載の電子制御装置であって、
     前記マイコンは、前記外部装置から受信したデータを格納する受信データ格納部を有し、
     前記受信データ格納部に格納されるデータと同じデータを、前記内部不揮発性メモリ及び前記外部不揮発性メモリに書き込むことを特徴とする電子制御装置。
  5.  請求項4に記載の電子制御装置であって、
     前記内部不揮発性メモリへの書き込み処理を行う第1プロセッサと、
     前記外部不揮発性メモリへの書き込み処理を行う第2プロセッサとを有し、
     前記第1プロセッサは、前記外部装置から受信したデータを前記受信データ格納部及び前記内部不揮発性メモリに書き込み、
     前記第2プロセッサは、前記受信データ格納部に格納されたデータを前記外部不揮発性メモリに書き込むことを特徴とする電子制御装置。
  6.  請求項1に記載の電子制御装置であって、
     前記外部装置から受信したデータが圧縮・暗号化されている場合、前記マイコンは、前記外部装置から受信したデータを解凍・復号して前記内部不揮発性メモリに書き込み、
     前記外部装置から受信したデータを解凍・復号せずに前記外部不揮発性メモリに書き込むことを特徴とする電子制御装置。
  7.  電子制御装置が実行する書込制御方法であって、
     前記電子制御装置は、所定のプログラムを実行するプロセッサを含むマイコンと、前記マイコンに接続される外部不揮発性メモリとを有し、
     前記マイコンは、内部不揮発性メモリと、前記外部不揮発性メモリと通信する第1通信部と、外部装置と通信する第2通信部とを有し、
     前記書込制御方法は、
     前記マイコンが、前記内部不揮発性メモリを書き換えるためのデータを前記外部装置から受信し、
     前記マイコンが、前記外部装置から受信したデータを、前記内部不揮発性メモリ及び前記外部不揮発性メモリに書き込むことを特徴とする書込制御方法。
PCT/JP2022/018588 2022-04-22 2022-04-22 電子制御装置及び書込制御方法 WO2023203768A1 (ja)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/JP2022/018588 WO2023203768A1 (ja) 2022-04-22 2022-04-22 電子制御装置及び書込制御方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2022/018588 WO2023203768A1 (ja) 2022-04-22 2022-04-22 電子制御装置及び書込制御方法

Publications (1)

Publication Number Publication Date
WO2023203768A1 true WO2023203768A1 (ja) 2023-10-26

Family

ID=88419496

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2022/018588 WO2023203768A1 (ja) 2022-04-22 2022-04-22 電子制御装置及び書込制御方法

Country Status (1)

Country Link
WO (1) WO2023203768A1 (ja)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015121953A (ja) * 2013-12-24 2015-07-02 株式会社デンソー マイクロコンピュータ及び電子制御装置
JP2021024555A (ja) * 2019-08-06 2021-02-22 日本電産エレシス株式会社 電動パワーステアリング制御装置
WO2021075361A1 (ja) * 2019-10-18 2021-04-22 日立Astemo株式会社 冗長系システム及び負荷駆動制御装置
JP2021144635A (ja) * 2020-03-13 2021-09-24 富士通株式会社 プログラム更新システム、並びに情報処理装置及び情報処理プログラム

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015121953A (ja) * 2013-12-24 2015-07-02 株式会社デンソー マイクロコンピュータ及び電子制御装置
JP2021024555A (ja) * 2019-08-06 2021-02-22 日本電産エレシス株式会社 電動パワーステアリング制御装置
WO2021075361A1 (ja) * 2019-10-18 2021-04-22 日立Astemo株式会社 冗長系システム及び負荷駆動制御装置
JP2021144635A (ja) * 2020-03-13 2021-09-24 富士通株式会社 プログラム更新システム、並びに情報処理装置及び情報処理プログラム

Similar Documents

Publication Publication Date Title
US6754765B1 (en) Flash memory controller with updateable microcode
US20060075395A1 (en) Flash card system
US20100122017A1 (en) Memory controller, non-volatile memory system, and host device
US8176009B2 (en) Performing a pre-update on a non volatile memory
US20200225869A1 (en) Live Firmware Activation in a Memory System
JP6070360B2 (ja) 情報処理装置およびその処理方法
US20060224821A1 (en) System for parallel updating flash memory and method for the same
TWI722269B (zh) 韌體更新方法及使用此方法的電子裝置
US20100169546A1 (en) Flash memory access circuit
US20070011416A1 (en) Data storage device and medium and related method of storing backup data
CN111026427B (zh) 一种含cpu和fpga的嵌入式系统远程在线升级方法
US7761651B2 (en) Information processing apparatus
WO2023203768A1 (ja) 電子制御装置及び書込制御方法
US20030084232A1 (en) Device and method capable of changing codes of micro-controller
US20080301358A1 (en) Electronic device that Downloads Operational Firmware from an External Host
US8429336B2 (en) Disk drive and method of changing a program therefor
JP2008047155A (ja) 一括消去型不揮発性メモリおよび携帯電話
WO2006101123A1 (ja) 不揮発性記憶装置及び不揮発性記憶装置の制御情報のロード方法
JPH11265283A (ja) 記憶装置におけるファームウェアの修正方法及び記憶装置
US20050265266A1 (en) Optical disc drive that downloads operational firmware from an external host
JP2009223435A (ja) データ記憶方法及び装置、並びにプログラム
US20050268029A1 (en) Optical Disc Drive that Downloads Operational Firmware from an External Host
US20230153096A1 (en) Upgradable electronic device, server for upgrdading electronic device, and method for upgrading electronic device
JP4575112B2 (ja) ファームウェアの書換方法、ディスクドライブ装置、及び情報処理システム
JPH06161842A (ja) 外部記憶装置およびこれを用いたコンピュータ

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22938567

Country of ref document: EP

Kind code of ref document: A1