DE102020209136A1 - Method for secure storage of a data element to be stored by a computer program in an external memory - Google Patents

Method for secure storage of a data element to be stored by a computer program in an external memory Download PDF

Info

Publication number
DE102020209136A1
DE102020209136A1 DE102020209136.6A DE102020209136A DE102020209136A1 DE 102020209136 A1 DE102020209136 A1 DE 102020209136A1 DE 102020209136 A DE102020209136 A DE 102020209136A DE 102020209136 A1 DE102020209136 A1 DE 102020209136A1
Authority
DE
Germany
Prior art keywords
error correction
memory
data element
interface module
data item
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
DE102020209136.6A
Other languages
German (de)
Inventor
Martin Assel
Axel Aue
Matthias Schreiber
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Robert Bosch GmbH
Original Assignee
Robert Bosch GmbH
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 Robert Bosch GmbH filed Critical Robert Bosch GmbH
Priority to DE102020209136.6A priority Critical patent/DE102020209136A1/en
Priority to CN202110818778.3A priority patent/CN113961381A/en
Publication of DE102020209136A1 publication Critical patent/DE102020209136A1/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1008Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices
    • G06F11/1048Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices using arrangements adapted for a specific error detection or correction feature
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1008Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices
    • G06F11/1044Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices with specific ECC/EDC distribution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0706Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
    • G06F11/0736Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in functional embedded systems, i.e. in a data processing system designed as a combination of hardware and software dedicated to performing a certain function

Abstract

Die Erfindung betrifft ein Verfahren zur abgesicherten Speicherung eines von einem Computerprogramm zu speichernden Datenelements in einem externen Speicher (64), der an einen Mikrocontroller (50) angebunden ist, wobei der Mikrocontroller ein Schnittstellenmodul (58) umfasst, das dazu eingerichtet ist, Fehlerkorrekturwerte für Datenelemente zu berechnen, umfassend bei Erstellung des Computerprogramms, während einer Bestimmung von Speicheradressen des Computerprogramms ein Bestimmen (10) einer Speicheradresse in dem externen Speicher für das Datenelement, wobei ein gemeinsamer Speichplatzbedarf von Datenelement und einem zugehörigen Fehlerkorrekturwert berücksichtigt wird; und bei Ausführung des Computerprogramms ein Empfangen (12) des Datenelements durch das Schnittstellenmodul; ein Berechnen (14) eines Fehlerkorrekturwerts für das Datenelement durch das Schnittstellenmodul; und ein Schreiben (16), beginnend an der Speicheradresse, des Datenelements und unmittelbar darauffolgend des berechneten Fehlerkorrekturwerts innerhalb einer Adressierungsphase durch das Schnittstellenmodul. Weiter werden ein entsprechender Mikrocontroller und eine Recheneinheit bereitgestellt.The invention relates to a method for the secure storage of a data element to be stored by a computer program in an external memory (64) which is connected to a microcontroller (50), the microcontroller comprising an interface module (58) which is set up to output error correction values for to calculate data elements, comprising when creating the computer program, during a determination of memory addresses of the computer program, determining (10) a memory address in the external memory for the data element, taking into account a common memory space requirement of data element and an associated error correction value; and upon execution of the computer program, receiving (12) the data item by the interface module; calculating (14), by the interface module, an error correction value for the data item; and writing (16) by the interface module, starting at the memory address, the data element and immediately thereafter the calculated error correction value. A corresponding microcontroller and a computing unit are also provided.

Description

Die vorliegende Erfindung betrifft ein Verfahren zur abgesicherten Speicherung eines von einem Computerprogramm zu speichernden Datenelements in einem externen Speicher sowie einen Mikrocontroller und eine Recheneinheit zu dessen Durchführung.The present invention relates to a method for secure storage of a data element to be stored by a computer program in an external memory, as well as a microcontroller and a processing unit for carrying it out.

Stand der TechnikState of the art

In Arbeitsspeichern wie SRAM, Flash, PCM oder DRAM können, um den Dateninhalt abzusichern, zusätzlich zu den Datenbits weitere, als „Error Correction Code“ (ECC) bezeichnete Bits zur Fehlerkorrektur bzw. Fehlererkennung gespeichert werden. Einzel- oder Mehrbitfehler innerhalb eines Datenelementes können damit erkannt und abhängig von der Anzahl der Bitfehler innerhalb des Datenelements korrigiert werden.In working memories such as SRAM, Flash, PCM or DRAM, in order to secure the data content, additional bits known as "Error Correction Code" (ECC) for error correction or error detection can be stored in addition to the data bits. Single or multiple bit errors within a data element can thus be detected and corrected depending on the number of bit errors within the data element.

In eingebetteten Systemen, etwa Steuergeräten von Maschinen oder Fahrzeugen, kommen sogenannte Mikrocontroller zum Einsatz, die neben einem oder mehreren Prozessorkernen über eine bestimmte, beschränkte Menge an internem Arbeitsspeicher verfügen, in dem Programme und Daten während der Ausführung gespeichert werden. Für diesen Arbeitsspeicher kann, insbesondere für sicherheitskritische Anwendungen, etwa in Kraftfahrzeugen, ein Fehlerkorrekturverfahren mittels ECC im Mikrocontroller implementiert sein.So-called microcontrollers are used in embedded systems, such as control units of machines or vehicles. In addition to one or more processor cores, they have a certain, limited amount of internal memory in which programs and data are stored during execution. An error correction method using ECC can be implemented in the microcontroller for this main memory, in particular for safety-critical applications, for example in motor vehicles.

Typische in Mikrocontrollern als Arbeitsspeicher verwendete SRAM-Speicherzellen umfassen 6 Transistoren und sind entsprechend relativ teuer und aufwendig in der Herstellung, daher ist der im Mikrocontroller integrierte Arbeitsspeicher oftmals nur so groß bemessen, dass er für grundlegende Anwendungen ausreichend ist. Eine interne Erweiterbarkeit des Arbeitsspeichers ist bei Mikrocontrollern aus Kostengründen üblicherweise nicht vorgesehen bzw. nicht möglich, da der Arbeitsspeicher mit den Prozessorkernen in einem Chip integriert ist.Typical SRAM memory cells used as main memory in microcontrollers have 6 transistors and are therefore relatively expensive and complex to manufacture, which is why the main memory integrated in the microcontroller is often only large enough for basic applications. Internal expandability of the main memory is usually not provided or not possible in microcontrollers for cost reasons, since the main memory is integrated with the processor cores in one chip.

Um auch die Ausführung von Anwendungen zu ermöglichen, die auf einen größeren Arbeitsspeicher als auf dem Mikrocontroller vorgesehen zugreifen, kann ein externer Arbeitsspeicher über eine Kommunikationsschnittstelle, z.B. eine SPI-Schnittstelle (Serial Peripheral Interface), angebunden werden. Dieser externe Arbeitsspeicher kann kostengünstig in Form von DRAM-Speicherzellen, die nur einen Transistor benötigen, ausgeführt werden. Allerdings ist in verfügbaren extern anbindbaren Arbeitsspeichern keine Fehlerkorrekturfunktion implementiert.To enable the execution of applications that access a larger main memory than provided on the microcontroller, an external main memory can be connected via a communication interface, e.g. an SPI interface (Serial Peripheral Interface). This external working memory can be implemented inexpensively in the form of DRAM memory cells that only require one transistor. However, no error correction function is implemented in available externally connectable main memories.

Offenbarung der ErfindungDisclosure of Invention

Erfindungsgemäß werden ein Verfahren zur abgesicherten Speicherung eines von einem Computerprogramm zu speichernden Datenelements in einem externen Speicher sowie einen Mikrocontroller und eine Recheneinheit zu dessen Durchführung mit den Merkmalen der unabhängigen Patentansprüche vorgeschlagen. Vorteilhafte Ausgestaltungen sind Gegenstand der Unteransprüche sowie der nachfolgenden Beschreibung.According to the invention, a method for secure storage of a data element to be stored by a computer program in an external memory as well as a microcontroller and a processing unit for carrying it out are proposed with the features of the independent patent claims. Advantageous configurations are the subject of the dependent claims and the following description.

Die Erfindung basiert auf der Maßnahme, dass bei der Erstellung des Computerprogramms, d.h. insbesondere beim Bestimmen bzw. Zuweisen der (physikalischen) Speicheradresse für das zu speichernde Datenelement z.B. im sog. Linker oder Locator, ein gemeinsamer Speichplatzbedarf von Datenelement und einem zugehörigen Fehlerkorrekturwert berücksichtigt wird, also mit anderen worten entsprechender Platz zwischen aufeinanderfolgenden Datenelementen freigelassen wird. Somit ist der physikalisch „reservierte“ Speicherplatz zwischen zwei aufeinanderfolgenden Speicheradressen für Datenelemente so groß, dass er sowohl ein Datenelement als auch einen Fehlerkorrekturwert aufnehmen kann, obwohl im Programmcode selbst nur das Datenelement gespeichert wird. The invention is based on the measure that when creating the computer program, ie in particular when determining or assigning the (physical) memory address for the data element to be stored, e.g. in the so-called linker or locator, a common memory space requirement for the data element and an associated error correction value is taken into account , in other words corresponding space is left free between consecutive data elements. Thus, the physically "reserved" memory space between two consecutive memory addresses for data items is so large that it can accommodate both a data item and an error correction value, although only the data item is stored in the program code itself.

Der Fehlerkorrekturwert wird dann im Betrieb von einem Schnittstellenmodul des Mikrocontrollers hinzugefügt.The error correction value is then added on the fly by an interface module of the microcontroller.

Entsprechend werden gemäß dem vorgeschlagenen Verfahren durch das Schnittstellenmodul das Datenelement und der zugehörige Fehlerkorrekturwert (im Folgenden auch ECC-Wert) innerhalb einer einzigen Adressierungsphase des Speichers geschrieben, eine eigenständige Adressberechnung zur Bestimmung einer Speicheradresse für den ECC-Wert oder ein weiterer langer Adresszugriff während einer eigenen Adressierungsphase für den ECC-Wert entfallen. Dies ist vorteilhaft, da dadurch Speicherzugriffszeiten gegenüber einer voneinander unabhängigen Handhabung von Datenelementen und ECC-Werten verringert werden.According to the proposed method, the data element and the associated error correction value (hereinafter also ECC value) are written by the interface module within a single addressing phase of the memory, an independent address calculation to determine a memory address for the ECC value or another long address access during a separate addressing phase for the ECC value. This is advantageous because it reduces memory access times compared to handling data elements and ECC values independently of one another.

Wie erläutert, wird die Berechnung des ECC-Werts während der Ausführung des Computerprogramms durch das Schnittstellenmodul durchgeführt. Dieses ist als Hardwaremodul des Mikrocontrollers ausgeführt. Eine entsprechende Funktionalität, die im Prozessorkern oder als Software implementiert ist, erübrigt sich. Entsprechend ist eine Abänderung existierender Prozessorkerne oder Software nicht notwendig.As explained, the calculation of the ECC value is performed by the interface module during the execution of the computer program. This is designed as a hardware module of the microcontroller. A corresponding functionality, which is implemented in the processor core or as software, is not required. Accordingly, no modification of existing processor cores or software is necessary.

Das Bestimmen der Speicheradresse in dem externen Speicher bzw. die Bestimmung der Speicheradressen des Computerprogramms erfolgt bei Erstellung des Computerprogramms, wobei bevorzugt ist, dass das Bestimmen der Speicheradresse bzw. die Bestimmung der Speicheradressen des Computerprogramms durch ein Programmierwerkzeug erfolgt, insbesondere durch einen Linker oder einen Locator, das in einem Computerprogrammcode des Computerprogramms oder in einem kompilierten oder assemblierten Binärcode bzw. Objektcode des Computerprogrammcodes enthaltene logische Speicheradressen in Speicheradressen des externen Speichers abbildet.The memory address in the external memory or the memory addresses of the computer program are determined at Creation of the computer program, it being preferable for the memory address or the memory addresses of the computer program to be determined by a programming tool, in particular by a linker or a locator, which is in a computer program code of the computer program or in a compiled or assembled binary code or object code maps logical memory addresses contained in the computer program code into memory addresses in the external memory.

Als Computerprogrammcode bzw. Software wird hier ein von dem Programmierer in einer Programmiersprache (z.B. in C oder Assembler) geschriebener Code, der die Funktion des Computerprogramms implementiert, verstanden. Der aus diesem Computerprogrammcode durch Kompilierung und/oder Assemblierung erhaltene Objektcode wird bei Erstellung des Computerprogramms zusammengefügt, wobei insbesondere Symbolen in dem Objektcode, die z.B. auf Datenelemente verweisen, Speicheradressen zugewiesen werden. Es werden also Speicheradressen des Computerprogramms bestimmt. Dies erfolgt durch einen sogenannten Linker. Bei Mikrocontrollern, die auf dem Gebiet eingebetteter Anwendungen verwendet werden, werden Computerprogramme und Datenelemente typischerweise an absoluten - bezogen auf den Adressraum des Mikrocontrollers - Adressen gespeichert. Wenn der Linker nur relative Adressen erzeugt, wird zusätzlich ein sogenannter Locator verwendet, der die relativen Adressen in absolute Adressen umwandelt.Computer program code or software is understood here as a code written by the programmer in a programming language (e.g. in C or assembler) that implements the function of the computer program. The object code obtained from this computer program code by compiling and/or assembling is combined when the computer program is created, with memory addresses being assigned in particular to symbols in the object code, which refer to data elements, for example. Memory addresses of the computer program are thus determined. This is done by a so-called linker. In microcontrollers used in the field of embedded applications, computer programs and data items are typically stored at absolute addresses relative to the microcontroller's address space. If the linker only generates relative addresses, a so-called locator is also used, which converts the relative addresses into absolute addresses.

Als Fehlerkorrekturverfahren bzw. Fehlererkennungsverfahren zur Berechnung des ECC-Werts kann ein beliebiges geeignetes Fehlerkorrekturverfahren, etwa ein Hamming-Code, verwendet werden. Solche Verfahren sind dem Fachmann an sich bekannt.Any suitable error correction method, such as a Hamming code, can be used as the error correction method or error detection method for calculating the ECC value. Such methods are known per se to those skilled in the art.

Der über das Schnittstellenmodul angebundene externe Speicher kann insbesondere ein flüchtiger Speicher sein, der vom Mikrocontroller als Arbeitsspeicher verwendet wird, d.h. ein DRAM-Speicher (DRAM, Dynamic Random Access Memory). Es ist allerdings auch die Anwendung des Verfahrens bei einem nichtflüchtigen Speicher möglich.The external memory connected via the interface module can, in particular, be a volatile memory that is used by the microcontroller as working memory, i.e. a DRAM memory (DRAM, Dynamic Random Access Memory). However, it is also possible to use the method with a non-volatile memory.

Als „Adressierungsphase“ wird hier ein Speicherzugriff (schreibend oder lesend) verstanden, bei dem beginnend bei einer Startadresse eine bestimmte Anzahl aufeinanderfolgender (d.h. an aufeinanderfolgenden Adressen zu speichernde bzw. gespeicherte) Bits (oder Bytes) geschrieben bzw. gelesen wird. Die Startadresse wird als Speicheradresse der entsprechenden Daten bezeichnet.The "addressing phase" is understood here as a memory access (writing or reading) in which, starting with a start address, a certain number of consecutive bits (or bytes) (i.e. to be saved or stored at consecutive addresses) are written or read. The starting address is referred to as the storage address of the corresponding data.

Im Rahmen dieser Anmeldung wird auf ein zu speicherndes Datenelement Bezug genommen, es ist jedoch klar, dass das erfindungsgemäße Verfahren auch auf mehrere zu speichernde Datenelemente angewandt werden kann (wobei die während der Ausführung des Computerprogramms auszuführenden Schritte aufeinanderfolgend jeweils auf verschiedene Datenelemente angewandt werden), ein Datenelement kann also im Sinne von wenigstens ein Datenelement verstanden werden.In the context of this application, reference is made to a data item to be stored, but it is clear that the method according to the invention can also be applied to several data items to be stored (whereby the steps to be carried out during the execution of the computer program are successively applied to different data items in each case), a data element can thus be understood in the sense of at least one data element.

Bevorzugt umfasst das Verfahren einen Lesevorgang des Datenelements, der ein Lesen des Datenelements und des ECC-Werts beginnend an der Speicheradresse, ein Berechnen eines Fehlerkorrektur-Vergleichswerts (im Folgenden auch ECC-Vergleichswert) für das gelesene Datenelement durch das Schnittstellenmodul und ein Vergleichen des ECC-Vergleichswerts mit dem gelesenen ECC-Wert, um festzustellen, ob diese gleich sind oder nicht gleich sind, durch das Schnittstellenmodul umfasst. Weiter bevorzugt umfasst der Lesevorgang, durch das Schnittstellenmodul, wenn der ECC-Vergleichswert und der gelesene ECC-Wert gleich sind, ein Senden des gelesenen Datenelements; und wenn der ECC-Vergleichswert und der gelesene ECC-Wert nicht gleich sind, ein Senden eines auf Grundlage des gelesenen Datenelements und des gelesenen ECC-Werts korrigierten Datenelements. Durch diese Verfahrensschritte können aufgetretene Speicherfehler beim Lesen erkannt und gegebenenfalls korrigiert werden.The method preferably includes a reading process of the data element, which reads the data element and the ECC value starting at the memory address, calculates an error correction comparison value (hereinafter also ECC comparison value) for the read data element by the interface module and compares the ECC - Comparing value with the read ECC value to determine whether they are equal or not equal, by the interface module. More preferably, the reading process comprises, by the interface module if the ECC comparison value and the read ECC value are the same, sending the read data element; and if the ECC comparison value and the read ECC value are not equal, sending a corrected data item based on the read data item and the read ECC value. By means of these method steps, memory errors that have occurred during reading can be recognized and, if necessary, corrected.

Bevorzugt umfasst der Lesevorgang des Datenelements, durch das Schnittstellenmodul, ein Empfangen eines geänderten Teil-Datenelements des gelesenen Datenelements, ein Bilden eines geänderten Datenelements aus dem geänderten Teil-Datenelement und den nicht geänderten Teilen des gelesenen Datenelements, ein Berechnen eines geänderten Fehlerkorrekturwerts basierend auf dem geänderten Datenelement, und ein Schreiben, beginnend an der Speicheradresse, des geänderten Datenelements und unmittelbar darauffolgend des berechneten geänderten Fehlerkorrekturwerts innerhalb einer Adressierungsphase. Hierdurch wird ein Lese-Schreib-Vorgang realisiert, mittels dem z.B. sogenannte „read-modify-write“-Befehle implementiert werden können. Der modifizierte bzw. geänderte Teil des gelesenen Datenworts wird durch das Schnittstellenmodul in das gelesene Datenwort eingefügt und ebenso wird durch das Schnittstellenmodul eine Neuberechnung des Fehlerkorrekturwerts vorgenommen. Diese Schritte sind aus Sicht der Software nicht sichtbar bzw. transparent, so dass diese nicht angepasst werden muss.The read operation of the data element by the interface module preferably includes receiving a changed partial data element of the read data element, forming a changed data element from the changed partial data element and the unchanged parts of the read data element, calculating a changed error correction value based on the changed data element, and writing, starting at the memory address, the changed data element and immediately following the calculated changed error correction value within an addressing phase. This implements a read-write process that can be used, for example, to implement so-called "read-modify-write" commands. The modified or changed part of the read data word is inserted into the read data word by the interface module and the error correction value is also recalculated by the interface module. From the point of view of the software, these steps are not visible or transparent, so that they do not have to be adjusted.

Ein erfindungsgemäßer Mikrocontroller umfasst ein Schnittstellenmodul, das dazu eingerichtet ist, ein Datenelement und eine Speicheradresse für das Datenelement zu empfangen, einen ECC-Wert für das empfangene Datenelement zu berechnen, und das Datenelement und den zugehörigen ECC-Wert an die empfangene Speicheradresse in einem externen Speicher innerhalb einer Adressierungsphase zu schreiben. Der Mikrocontroller ist also dazu eingerichtet, einen Schreibvorgang entsprechend dem Verfahren, der während der Ausführung des Computerprogramms erfolgt, durchzuführen. Der Mikrocontroller ist weiter bevorzugt dazu eingerichtet, einen Lesevorgang gemäß dem erfindungsgemäßen Verfahren durchzuführen.A microcontroller according to the invention comprises an interface module which is set up for this purpose, a data element and a memory address for receiving the data item, calculating an ECC value for the received data item, and writing the data item and the associated ECC value to the received memory address in an external memory within an addressing phase. The microcontroller is therefore set up to carry out a write operation in accordance with the method that takes place during the execution of the computer program. The microcontroller is further preferably set up to carry out a reading process according to the method according to the invention.

Eine erfindungsgemäße Recheneinheit, z.B. ein Steuergerät eines Kraftfahrzeugs, umfasst einen erfindungsgemäßen Mikrocontroller, wobei die Recheneinheit bevorzugt einen externen Speicher, der über das Schnittstellenmodul mit dem Mikrocontroller verbunden ist, umfasst.A computing unit according to the invention, e.g. a control unit of a motor vehicle, comprises a microcontroller according to the invention, the computing unit preferably comprising an external memory which is connected to the microcontroller via the interface module.

Die Erfindung eignet sich insbesondere für sog. „Embedded Systems“ bzw. eingebettete Systeme. Darunter werden elektronische Rechner oder Computer verstanden, die in einen technischen Kontext eingebunden (eingebettet) ist. Dabei übernimmt der Rechner entweder Überwachungs-, Steuerungs- oder Regelfunktionen oder ist für eine Form der Daten- bzw. Signalverarbeitung zuständig, beispielsweise beim Ver- bzw. Entschlüsseln, Codieren bzw. Decodieren oder Filtern. Eine typische Anforderung an eingebettete Systeme ist die Realzeit-Fähigkeit (Echtzeit-Fähigkeit). Eine Verarbeitung mit nicht vorhersagbarer Verarbeitungsgeschwindigkeit kann nicht toleriert werden. Viele Applikationen (insbesondere Steuerungen in sicherheitsrelevante Systemen - also Systeme, durch die ein Mensch gefährdet, verletzt oder sogar getötet werden könnte) setzen eine vorhersagbare Reaktionszeit des Systems voraus.The invention is particularly suitable for so-called embedded systems. This includes electronic calculators or computers that are integrated (embedded) in a technical context. The computer either assumes monitoring, control or regulation functions or is responsible for a form of data or signal processing, for example when encrypting or decrypting, coding or decoding or filtering. A typical requirement for embedded systems is real-time capability. Processing at unpredictable processing speeds cannot be tolerated. Many applications (especially controllers in safety-relevant systems - i.e. systems that could endanger, injure or even kill a person) require a predictable system response time.

Weitere Vorteile und Ausgestaltungen der Erfindung ergeben sich aus der Beschreibung und der beiliegenden Zeichnung.Further advantages and refinements of the invention result from the description and the attached drawing.

Die Erfindung ist anhand von Ausführungsbeispielen in der Zeichnung schematisch dargestellt und wird im Folgenden unter Bezugnahme auf die Zeichnung beschrieben.The invention is shown schematically in the drawing using exemplary embodiments and is described below with reference to the drawing.

Figurenlistecharacter list

  • 1A zeigt ein Ablaufdiagramm eines Schreibvorgangs gemäß einer bevorzugten Ausführungsform des Verfahrens zur abgesicherten Speicherung; 1A Figure 12 shows a flow chart of a write operation according to a preferred embodiment of the secure storage method;
  • 1B zeigt ein Ablaufdiagramm eines Lesevorgangs gemäß einer bevorzugten Ausführungsform des Verfahrens zur abgesicherten Speicherung; 1B Figure 12 shows a flow chart of a read operation according to a preferred embodiment of the secure storage method;
  • 2 zeigt einen Mikrocontroller, der zur Implementierung des erfindungsgemäßen Verfahrens bevorzugt verwendet werden kann; und 2 shows a microcontroller that can preferably be used to implement the method according to the invention; and
  • 3A und 3b zeigen beispielhaft die physikalische Anordnung bzw. die Anordnung aus Sicht des Computerprogramms mehrerer Datenelemente samt zugehörigen EEC-Werten, wie sie durch die vorliegende Erfindung erreicht wird. 3A and 3b Fig. 12 shows, by way of example, the physical arrangement or the arrangement from the computer program's point of view of a plurality of data elements together with associated EEC values, as is achieved by the present invention.

Ausführungsform(en) der Erfindungembodiment(s) of the invention

1A stellt ein Ablaufdiagramm eines Schreibvorgangs zur abgesicherten Speicherung eines Datenelements in einem an einen Mikrocontroller angebundenen externen Speicher gemäß einer bevorzugten Ausführungsform der Erfindung dar. In der weiteren Beschreibung (auch bei den weiteren Figuren) wird insbesondere auf ein Datenelement und einen ECC-Wert Bezug genommen, dies dient der sprachlichen Vereinfachung und ist im Sinne von wenigstens ein Datenelement und wenigstens ein ECC-Wert zu lesen. Die Erfindung ist also nicht auf ein einzelnes Datenelement eingeschränkt. 1A shows a flowchart of a write process for secure storage of a data element in an external memory connected to a microcontroller according to a preferred embodiment of the invention. In the further description (also in the further figures), reference is made in particular to a data element and an ECC value, this serves to simplify the language and is to be read in the sense of at least one data element and at least one ECC value. The invention is therefore not restricted to a single data element.

Bei dem Datenelement kann es sich sowohl um Programmdaten, d.h. Programmanweisungen, als auch um Daten, die vom Computerprogramm verwendet und gegebenenfalls verändert werden, handeln. Im Verfahren wird ein Schnittstellenmodul verwendet, über das der externe Speicher mit dem Mikrocontroller verbunden ist. Das Schnittstellenmodul ist eingerichtet, Fehlerkorrekturberechnungen durchzuführen.The data element can be both program data, i.e. program instructions, and data that is used and possibly changed by the computer program. An interface module is used in the method, via which the external memory is connected to the microcontroller. The interface module is set up to carry out error correction calculations.

In Schritt 10 findet eine Adressbestimmung statt, in der eine Speicheradresse für das zu speichernde Datenelement bestimmt wird. In dieser Adressbestimmung wird neben dem notwendigen Speicherplatz für das Datenelement auch ein notwendiger Speicherplatz für einen Fehlerkorrekturwert (ECC-Wert) berücksichtigt, wobei die Adressbestimmung so durchgeführt wird, dass der ECC-Wert direkt auf das Datenelement folgend angeordnet wird. Für das Datenelement und den zughörigen ECC-Wert wird also in der Adressbestimmung entsprechender Speicherplatz reserviert. Die Adressbestimmung wird während der Erstellung des Computerprogramms durchgeführt, genauer während einer Bestimmung von Speicheradressen des Computerprogramms, bevorzugt durch einen dabei verwendeten Linker und/oder Locator. Aus Sicht des Computerprogrammcodes (z.B. eines in C oder Assembler geschriebenen Programmcodes), d.h. aus Sicht des Programmierers, oder des kompilierten oder assemblierten Computerprogrammcodes, ist der ECC-Wert nicht sichtbar.In step 10 an address determination takes place, in which a storage address for the data element to be stored is determined. In addition to the storage space required for the data element, this address determination also takes into account a storage space required for an error correction value (ECC value), the address determination being carried out in such a way that the ECC value is arranged directly after the data element. Appropriate storage space is therefore reserved in the address specification for the data element and the associated ECC value. The address determination is carried out during the creation of the computer program, more precisely during a determination of memory addresses of the computer program, preferably by a linker and/or locator used in the process. From the point of view of the computer program code (e.g. a program code written in C or assembler), i.e. from the programmer's point of view, or the compiled or assembled computer program code, the ECC value is not visible.

Während der Ausführung des Computerprogramms wird in Schritt 12 das zu speichernde Datenelement und die zugehörige Speicheradresse vom Schnittstellenmodul empfangen und in Schritt 14 wird der zum Datenelement gehörige ECC-Wert berechnet. Beide Schritte 12, 14 werden durch das Schnittstellenmodul durchgeführt.During execution of the computer program, in step 12, the data to be stored element and the associated memory address are received from the interface module and in step 14 the ECC value associated with the data element is calculated. Both steps 12, 14 are performed by the interface module.

In Schritt 16, der ebenfalls vom Schnittstellenmodul durchgeführt wird, werden das Datenelement und der ECC-Wert während einer einzelnen Adressierungsphase an die empfangene Speicheradresse in den Speicher geschrieben, d.h. das Datenelement wird beginnend an der empfangenen Speicheradresse geschrieben und der ECC-Wert wird unmittelbar auf das Datenelement folgend geschrieben. Eine Berechnung einer eigenen Speicheradresse für den ECC-Wert ist somit nicht notwendig.In step 16, also performed by the interface module, the data element and the ECC value are written to the received memory address in the memory during a single addressing phase, i.e. the data element is written starting at the received memory address and the ECC value is immediately set to the data item is written below. It is therefore not necessary to calculate a separate memory address for the ECC value.

1B stellt ein Ablaufdiagramm eines Lesevorgangs gemäß einer bevorzugten Ausführungsform der Erfindung dar. 1B Figure 12 illustrates a flowchart of a read operation in accordance with a preferred embodiment of the invention.

Nach Empfang einer Leseanforderung enthaltend eine Speicheradresse durch das Schnittstellenmodul werden in Schritt 24 werden, beginnend an der empfangenen Speicheradresse, das Datenelement und der unmittelbar nachfolgend gespeicherte ECC-Wert aus dem Speicher gelesen. Dies erfolgt wieder innerhalb einer einzigen Adressierungsphase, eine gesonderte Adressierungsphase zum Auslesen des ECC-Werts ist nicht notwendig.After receipt of a read request containing a memory address by the interface module, in step 24, starting at the received memory address, the data element and the immediately subsequently stored ECC value are read from the memory. This takes place again within a single addressing phase, a separate addressing phase for reading out the ECC value is not necessary.

In Schritt 26 wird ein Fehlerkorrektur-Vergleichswert (ECC-Vergleichswert) aus dem gelesenen Datenelement durch das Schnittstellenmodul berechnet. Dieser ECC-Vergleichswert wird in Schritt 28 mit dem gelesenen ECC-Wert, d.h. dem beim Schreiben des Datenelements gültigen ECC-Wert, verglichen. Beim Vergleich wird festgestellt, ob das Datenelement verändert wurde, ob also ein Speicherfehler aufgetreten ist.In step 26, an error correction (ECC) comparison value is calculated from the read data element by the interface module. This ECC comparison value is compared in step 28 with the read ECC value, i.e. the ECC value valid when the data element was written. The comparison determines whether the data element has been changed, ie whether a memory error has occurred.

Wenn der ECC-Vergleichswert gleich dem ECC-Wert ist, d.h. wenn (im Sinne des verwendeten Fehlerkorrekturverfahrens) kein Speicherfehler aufgetreten ist, wird das gelesene Datenelement gesendet, insbesondere an den mindestens einen Prozessorkern des Mikrocontrollers, Schritt 30.If the ECC comparison value is equal to the ECC value, i.e. if (in terms of the error correction method used) no memory error has occurred, the read data element is sent, in particular to the at least one processor core of the microcontroller, step 30.

Wenn der ECC-Vergleichswert nicht gleich dem ECC-Wert ist, d.h. wenn ein Speicherfehler aufgetreten ist, wird in Schritt 32 zunächst geprüft, ob der Fehler korrigiert werden kann. Ob dies möglich ist, hängt vom verwendeten Fehlerkorrekturverfahren, mit dem der ECC-Wert berechnet wird, ab. Wird beispielsweise für ein 64 Bit langes Datenelement ein 8 Bit langer ECC-Wert verwendet, können typischerweise 1-Bit-Fehler erkannt und korrigiert werden und 2-Bit-Fehler erkannt aber nicht korrigiert werden.If the ECC comparison value is not equal to the ECC value, i.e. if a memory error has occurred, it is first checked in step 32 whether the error can be corrected. Whether this is possible depends on the error correction method used to calculate the ECC value. For example, if an 8-bit ECC value is used for a 64-bit data element, typically 1-bit errors can be detected and corrected, and 2-bit errors can be detected but not corrected.

Wenn festgestellt wird, dass der Fehler korrigiert werden kann, wird in Schritt 34 der Fehler korrigiert, d.h. ein korrigiertes Datenelement bestimmt. Das korrigierte Datenelement wird in Schritt 36 an den mindestens einen Prozessorkern des Mikrocontrollers übertragen. Wenn andererseits festgestellt wird, dass der Fehler nicht korrigiert werden kann, wird in Schritt 38 eine entsprechende Fehlermeldung an den mindestens einen Prozessorkern des Mikrocontrollers übermittelt. If it is determined that the error can be corrected, in step 34 the error is corrected, i.e. a corrected data element is determined. In step 36, the corrected data element is transmitted to the at least one processor core of the microcontroller. If, on the other hand, it is determined that the error cannot be corrected, in step 38 a corresponding error message is transmitted to the at least one processor core of the microcontroller.

Beim Schreibvorgang (1A) bzw. beim Lesevorgang (1 B) werden die Berechnung des ECC-Werts (Schritt 14) bzw. des ECC-Vergleichswerts (Schritt 26) durch das Schnittstellenmodul durchgeführt, vgl. 2. Eine Änderung des Designs bzw. der Hardware des Prozessorkerns (oder der Prozessorkerne) ist als nicht notwendig. Auch können Computerprogramme verwendet bzw. programmiert werden, ohne dass dabei Kenntnis über das Schnittstellenmodul und das Fehlerkorrekturverfahren notwendig sind.When writing ( 1A) or during the reading process ( 1 b) the calculation of the ECC value (step 14) or the ECC comparison value (step 26) is carried out by the interface module, cf. 2 . A change in the design or the hardware of the processor core (or processor cores) is not necessary. Computer programs can also be used or programmed without knowledge of the interface module and the error correction method being necessary.

2 stellt einen Mikrocontroller 50 dar, der zur Ausführung des erfindungsgemäßen Verfahrens verwendet werden kann. Der Mikrocontroller 50 ist hier beispielhaft in einem Steuergerät 52, etwa eines Kraftfahrzeugs oder einer Maschinensteuerung, integriert. Der Mikrocontroller 50 umfasst mindestens einen Prozessorkern 54, einen damit verbundenen (internen) flüchtigen Arbeitsspeicher 56 (DRAM, Dynamic Random Access Memory) und eine ebenfalls mit dem Prozessorkern 54 verbundenes Schnittstellenmodul 58. „Verbunden“ ist hier (und, so nicht anders angemerkt, im Rahmen dieser Anmeldung) im Sinne einer Kommunikationsverbindung zum Datenaustausch zu verstehen, hierfür sind typischerweise leitende Verbindung vorgesehen, es sind aber auch drahtlose Verbindungen (z.B. Funk oder Licht) möglich. Die Verbindungen können Punkt-zu-Punkt-Verbindungen sein oder über einen Bus realisiert sein, wobei jeweils serielle oder parallele Kommunikation vorgesehen sein kann. Die drei Funktionselemente (Prozessorkern, Arbeitsspeicher, Schnittstelle) können in einem einzelnen Chip als integrierte Schaltung realisiert sein. 2 FIG. 12 illustrates a microcontroller 50 that can be used to carry out the method according to the invention. The microcontroller 50 is integrated here, for example, in a control device 52, such as a motor vehicle or a machine control. The microcontroller 50 comprises at least one processor core 54, an (internal) volatile working memory 56 (DRAM, dynamic random access memory) connected thereto and an interface module 58 also connected to the processor core 54. "Connected" here (and unless otherwise noted, within the scope of this application) in the sense of a communication connection for data exchange, for this purpose conductive connections are typically provided, but wireless connections (e.g. radio or light) are also possible. The connections can be point-to-point connections or implemented via a bus, in which case serial or parallel communication can be provided in each case. The three functional elements (processor core, main memory, interface) can be implemented in a single chip as an integrated circuit.

Der mindestens eine Prozessorkern 54 ist dazu eingerichtet, Computerprogramme auszuführen. Im Arbeitsspeicher 56 werden die Computerprogramme und während derer Ausführung benötigte und/oder anfallende Daten gespeichert. Das Schnittstellenmodul 58 dient dem Datenaustausch des Mikrocontrollers 50 mit externen Geräten oder Funktionseinheiten. Die Schnittstellenmodul 58 kann eine serielle oder parallele Schnittstelle umfassen, z.B. eine SPI-Schnittstelle (SPI, Serial Peripheral Interface, ursprünglich von Motorola eingeführt) bzw. eine Weiterentwicklung derselben. Das Schnittstellenmodul 58 ist als Hardwaremodul ausgeführt und wird beim Fehlerkorrekturverfahren verwendet, d.h. das Schnittstellenmodul ist eingerichtet, Fehlerkorrekturwerte zu berechnen und gegebenenfalls fehlerhafte gelesene Datenelemente auf Grundlage der Fehlerkorrekturwerte zu korrigieren (bei einem im Sinne des Fehlerkorrekturverfahrens erkannten Speicherfehler).The at least one processor core 54 is set up to run computer programs. The computer programs and the data required and/or occurring during their execution are stored in the main memory 56 . The interface module 58 is used for data exchange between the microcontroller 50 and external devices or functional units. The interface module 58 can comprise a serial or parallel interface, for example an SPI interface (SPI, Serial Peripheral Interface, originally introduced by Motorola) or a further development thereof. The interface module 58 is designed as a hardware module and is used in the error correction method, ie the interface module is set up to calculate error correction values and, if necessary, to correct erroneously read data elements on the basis of the error correction values (in the event of a memory error detected by the error correction method).

Der Mikrocontroller kann weitere mit dem Prozessorkern verbundene Funktionselemente 62 umfassen, etwa einen nichtflüchtigen Speicher (z.B. Flashspeicher) oder weitere Schnittstellen (z.B. eine CAN-Bus-Schnittstelle). Auch können weitere, nicht dargestellte Verbindungen zwischen den einzelnen Funktionselementen vorgesehen sein, beispielsweise eine direkte Verbindung zwischen Arbeitsspeicher 56 und Schnittstellenmodul 58.The microcontroller can include other functional elements 62 connected to the processor core, such as a non-volatile memory (e.g. flash memory) or other interfaces (e.g. a CAN bus interface). Additional connections (not shown) can also be provided between the individual functional elements, for example a direct connection between main memory 56 and interface module 58.

In 2 ist weiterhin ein nicht im Mikrocontroller umfasster externer Arbeitsspeicher 64 dargestellt, der mit dem Schnittstellenmodul 58 verbunden ist. Ebenso können weitere Funktionseinheiten 66 über das Schnittstellenmodul 58 oder weitere Schnittstellen mit dem Mikrocontroller 58 verbunden sein (zusätzlich oder alternativ zu entsprechenden Funktionselementen 62 im Mikrocontroller). Beispiele sind wieder ein nichtflüchtiger Speicher oder weitere Schnittstellen (etwa eine CAN-Bus-Schnittstelle zur Kommunikation des Steuergeräts mit anderen Elementen der Vorrichtung, die vom Steuergerät gesteuert wird).In 2 an external main memory 64 which is not included in the microcontroller and which is connected to the interface module 58 is also shown. Likewise, further functional units 66 can be connected to the microcontroller 58 via the interface module 58 or further interfaces (in addition to or as an alternative to corresponding functional elements 62 in the microcontroller). Examples are again a non-volatile memory or other interfaces (such as a CAN bus interface for communication between the control unit and other elements of the device that is controlled by the control unit).

Durch den externen (flüchtigen) Arbeitsspeicher 64 kann der Arbeitsspeicher, auf den der Mikrocontroller 50 bzw. dessen Prozessorkern 54 zugreifen kann, erweitert werden. Es können also Programme oder deren Daten während der Ausführung zumindest teilweise im externen Arbeitsspeicher gespeichert werden, z.B., wenn diese für den internen Arbeitsspeicher 56 zu groß sind. Zwar ist der Zugriff auf den externen Arbeitsspeicher 64 langsamer als auf den internen Arbeitsspeicher 56, allerdings ist der Zugriff immer noch deutlich schneller als der Zugriff auf einen nichtflüchtigen Speicher, in dem die Programme dauerhaft gespeichert sind.The external (volatile) main memory 64 can be used to expand the main memory which the microcontroller 50 or its processor core 54 can access. Programs or their data can therefore be stored at least partially in the external main memory during execution, e.g. if they are too large for the internal main memory 56. Although access to the external memory 64 is slower than to the internal memory 56, access is still significantly faster than accessing a non-volatile memory in which the programs are permanently stored.

Speicherzugriffe auf den externen Arbeitsspeicher 64 erfolgen über das Schnittstellenmodul 58. Bei einem Schreibzugriff wird durch das Schnittstellenmodul 58 für jedes zu speichernde Datenelement ein zugehöriger Fehlerkorrekturwert (ECC-Wert) berechnet, der ebenfalls im externen Arbeitsspeicher gespeichert werden soll. Die Adressbestimmung, d.h. die Bestimmung der (physikalischen) Speicheradresse im externen Arbeitsspeicher 64, an der das Datenelement gespeichert werden soll, wird vor Ausführung des Computerprogramms, insbesondere bei dessen Erstellung, durchgeführt. Bei dieser Bestimmung werden sowohl die (physikalische) Speicheradresse als auch der Speicherplatzbedarf berechnet, wobei beim Speicherplatzbedarf der Platzbedarf des Datenelements (z.B. 64 Bit) und des zugehörigen ECC-Werts (z.B. 8 Bit) berücksichtigt werden (z.B. insgesamt 72 Bit).Memory accesses to the external main memory 64 take place via the interface module 58. In the case of a write access, the interface module 58 calculates an associated error correction value (ECC value) for each data element to be stored, which is also to be stored in the external main memory. The address determination, i.e. the determination of the (physical) memory address in the external main memory 64 at which the data element is to be stored, is carried out before the computer program is executed, in particular when it is created. In this determination, both the (physical) memory address and the memory space requirement are calculated, with the memory space requirement taking into account the space requirement of the data element (e.g. 64 bits) and the associated ECC value (e.g. 8 bits) (e.g. 72 bits in total).

Beim Schreiben wird das Datenelement an die Speicheradresse geschrieben und unmittelbar nachfolgend wird der ECC-Wert geschrieben, eine eigene Adressberechnung für die ECC-Speicheradresse, d.h. die Speicheradresse an die der ECC-Wert geschrieben wird, ist also nicht notwendig. Im Prinzip kann die ECC-Speicheradresse aus der Speicheradresse und dem Datenelement bzw. dessen Länge bestimmt werden, an die der ECC-Wert geschrieben wird. Neben dem Entfallen einer eigenen Adressberechnung für den ECC-Wert ist auch vorteilhaft, dass das Schreiben und gegebenenfalls das spätere Lesen des Datenelements und des zugehörigen ECC-Werts normalerweise innerhalb eines Burst-Zugriffs des externen Arbeitsspeichers ausgeführt werden können. Ein sogenannter „Burst-Modus“ wird bei üblichen DRAM-Speichern, die als Arbeitsspeicher Verwendung finden, implementiert, dabei werden in einer Speicherzeile gespeicherte Daten in unmittelbarer Aufeinanderfolge geschrieben oder gelesen, so dass die Bereitstellung weiterer in einer Speicherzeile enthaltener Daten sehr wenig Zeit im Gegensatz zur Bereitstellung der ersten in der Speicherzeile enthaltenen Daten in Anspruch nimmt, da die Speicherzeile nicht neu aktiviert werden muss (typische Zeilenlängen sind 512 Byte, 1 kByte, 2 kByte).When writing, the data element is written to the memory address and the ECC value is written immediately afterwards, so a separate address calculation for the ECC memory address, i.e. the memory address to which the ECC value is written, is not necessary. In principle, the ECC memory address can be determined from the memory address and the data element or its length to which the ECC value is written. In addition to eliminating the need for a separate address calculation for the ECC value, it is also advantageous that writing and possibly later reading of the data element and the associated ECC value can normally be carried out within a burst access of the external main memory. A so-called "burst mode" is implemented in conventional DRAM memories that are used as main memory, whereby data stored in a memory row is written or read in immediate succession, so that the provision of further data contained in a memory row takes very little time In contrast to the provision of the first data contained in the memory row, since the memory row does not have to be reactivated (typical row lengths are 512 bytes, 1 kbyte, 2 kbytes).

Da die Adressbestimmung vor Ausführung des Computerprogramms (etwa bei Programmerstellung) stattfindet und die Berechnung des ECC-Werts durch das Schnittstellenmodul ausgeführt wird, kann der Computerprogrammcode bzw. die Software ohne Kenntnis der Fehlerkorrektur programmiert werden, d.h. die Programme müssen nicht angepasst werden.Since the address is determined before the computer program is executed (e.g. when the program is created) and the ECC value is calculated by the interface module, the computer program code or the software can be programmed without knowledge of the error correction, i.e. the programs do not have to be adapted.

Die 3A und 3B stellen beispielhaft die physikalische und die logische Anordnung mehrerer Datenelemente samt zugehörigen EEC-Werten, wie sie durch die vorliegende Erfindung erreicht wird, dar. Hierbei werden beispielhaft 64-Bit Datenelemente und 8-Bit ECC-Werte gezeigt. Abweichend von diesem Beispiel können im Allgemeinen die Datenelemente und die ECC-Werte eine beliebige Länge aufweisen. Beispielsweise können die Datenelemente eine Länge von 8, 16, 32, 64, 128 Bit, um einige typische Werte zu nennen, aufweisen. Ebenso können auch die ECC-Werte andere Längen aufweisen, z.B. 4, 8 oder 16 Bit, dies hängt vom verwendeten ECC-Verfahren ab und kann von der Länge der Datenelemente abhängen (z.B. je 8 Bit Datenelemente-Länge 1 Bit ECC-Wert-Länge) oder kann auch unabhängig davon sein. Es kann auch immer eine Länge des ECC-Werts von beispielsweise 8 Bit (oder einer anderen immer gleichen Länge) vorgesehen sein; typische Kombinationen sind dann 8-Bit Datenelement + 8-Bit ECC-Wert, 16-Bit Datenelement + 8-Bit ECC-Wert, 32-Bit Datenelement + 8-Bit ECC-Wert und 64-Bit Datenelement + 8-Bit ECC-Wert.the 3A and 3B Illustrate the physical and logical arrangement of multiple data elements including associated EEC values as achieved by the present invention by way of example. 64-bit data elements and 8-bit ECC values are shown here by way of example. Deviating from this example, in general the data elements and the ECC values can have any length. For example, the data elements can have a length of 8, 16, 32, 64, 128 bits, to name a few typical values. The ECC values can also have other lengths, e.g. 4, 8 or 16 bits, this depends on the ECC method used and can depend on the length of the data elements (e.g. 1 bit ECC value length for every 8 bit data element length ) or can also be independent of it. A length of the ECC value of, for example, 8 bits (or another length that is always the same) can also always be provided to be typical combinations are then 8-bit data element + 8-bit ECC value, 16-bit data element + 8-bit ECC value, 32-bit data element + 8-bit ECC value and 64-bit data element + 8-bit ECC value Worth.

In 3A ist dabei die tatsächliche, physikalische Anordnung dreier Datenelemente 72a, 72b, 74a, 74b, 76a, 76b und zugehöriger ECC-Werte (Fehlerkorrekturwerte) 73, 75 für die ersten beiden der Datenelemente im externen Speicher dargestellt. Für das dritte Datenelement 76a, 76b ist der zugehörige ECC-Wert im dargestellten Speicherausschnitt nicht mehr enthalten und entsprechend nicht mehr dargestellt. In 3B ist die Anordnung der gleichen Datenelemente 72a, 72b, 74a, 74b, 76a, 76b aus Sicht des Computerprogrammcodes oder des kompilierten oder assemblierten Computerprogrammcodes, auch als logische Anordnung bzw. Speicheradressen bezeichnet, dargestellt. In beiden Figuren sind die Datenelemente mit denselben Bezugszeichen versehen, um eine einfach Zuordnung zu erlauben. Selbstverständlich können im Speicher weitere, nicht dargestellte Datenelemente mit zugehörigen ECC-Werten gespeichert sein.In 3A shows the actual, physical arrangement of three data elements 72a, 72b, 74a, 74b, 76a, 76b and associated ECC values (error correction values) 73, 75 for the first two of the data elements in the external memory. For the third data element 76a, 76b, the associated ECC value is no longer contained in the memory section shown and is accordingly no longer shown. In 3B shows the arrangement of the same data elements 72a, 72b, 74a, 74b, 76a, 76b from the point of view of the computer program code or the compiled or assembled computer program code, also referred to as logical arrangement or memory addresses. In both figures, the data elements are provided with the same reference numbers in order to allow easy assignment. Of course, further data elements (not shown) with associated ECC values can be stored in the memory.

Dargestellt sind beispielhaft zwei aufeinanderfolgende physikalische Speicherabschnitte 70, 71 und zwei aufeinander folgende logische Speicherabschnitte 80, 81, die jeweils bei den hexadezimalen Adressen 0x0000 und 0x0010 beginnen. Diese Speicherabschnitte dienen nur als Beispiel, ebenso sind andere Adressen möglich; auch können die logischen von den physikalischen Adressen verschieden sein. Jede hexadezimale Adresse entspricht einem Byte (8 Bit) und jeweils 4-Byte-Abschnitte, d.h. 32-Bit-Abschnitte, sind durch gestrichelte Linien angezeigt. Gespeichert sind drei 64-Bit-Datenelemente. Das erste Datenelement 72a, 72b ist beginnend bei der physikalischen Adresse (siehe 3A) 0x0000 gespeichert, wobei die 64 Bit des ersten Datenelements als zwei 32-Bit-Elemente 72a, 72b eingezeichnet sind. Unmittelbar auf das erste Datenelement 72a, 72b, d.h. beginnend bei der physikalischen Speicheradresse 0x0008, folgt der zugehörige ECC-Wert 73, der beispielsweise eine Länge von 8 Bit aufweisen kann.Two consecutive physical memory sections 70, 71 and two consecutive logical memory sections 80, 81 are shown by way of example, each beginning at the hexadecimal addresses 0x0000 and 0x0010. These memory sections serve only as an example, other addresses are also possible; the logical addresses can also be different from the physical addresses. Each hexadecimal address corresponds to one byte (8 bits) and each 4-byte section, ie 32-bit section, is indicated by dashed lines. Three 64-bit data items are stored. The first data element 72a, 72b is starting at the physical address (see 3A) 0x0000 with the 64 bits of the first data element plotted as two 32 bit elements 72a, 72b. Immediately following the first data element 72a, 72b, ie starting at the physical memory address 0x0008, is the associated ECC value 73, which can have a length of 8 bits, for example.

Das zweite 64-Bit-Datenelement 74a, 74b beginnt in diesem Beispiel bei der physikalischen Speicheradresse 0x000C und umfasst wieder zwei 32-Bit-Elemente 74a, 74b. Hier ist anzumerken, dass 32-Bit-Elemente in diesem Beispiel an 32-Bit-Abschnitten im Arbeitsspeicher ausgerichtet werden. Wenn der ECC-Wert kürzer als 32-Bit ist, bleibt entsprechend ein Abschnitt im Speicher frei (bei einem 8-Bit-ECC-Wert bleibt beispielsweise der physikalische Speicherabschnitt von 0x0009 bis 0x000B frei). Unmittelbar nach dem zweiten Datenelement 74a, 74b ist der zum zweiten Datenelement gehörige ECC-Wert 75 gespeichert, d.h. an der physikalischen Speicheradresse 0x0014. Das dritte 64-Bit-Datenelement 76a, 76b ist an der physikalischen Speicheradresse 0x0018 (bis 0x001 F) gespeichert. Dessen ECC-Wert ist an der physikalischen Speicheradresse 0x0020 gespeichert, die im in 3A gezeigten Speicherabschnitt nicht mehr dargestellt ist.The second 64-bit data element 74a, 74b in this example starts at the physical memory address 0x000C and again comprises two 32-bit elements 74a, 74b. Note that 32-bit elements in this example are aligned to 32-bit chunks in memory. If the ECC value is shorter than 32-bit, a section in memory remains correspondingly free (e.g. with an 8-bit ECC value, the physical memory section from 0x0009 to 0x000B remains free). The ECC value 75 associated with the second data element is stored immediately after the second data element 74a, 74b, ie at the physical memory address 0x0014. The third 64-bit data item 76a, 76b is stored at physical memory address 0x0018 (through 0x001F). Its ECC value is stored at physical memory address 0x0020, which is in the in 3A memory section shown is no longer shown.

Durch diese Anordnung im externen Speicher können die 64-Bit-Datenelemente und die zugehörigen ECC-Werte jeweils unter Verwendung lediglich der jeweiligen Speicheradresse (0x0000 und 0x000C in Beispiel der 3A) geschrieben bzw. gelesen werden. D.h. Datenelement und zugehöriger ECC-Wert bilden sozusagen ein Verbunddatenelement, das mittels einer einzigen Speicheradresse adressiert werden kann und somit in einer einzigen Adressierungsphase geschrieben bzw. gelesen werden kann. Eine auf das erste Datenelement bezogene Adressierungsphase würde hier beispielsweise bei der Speicheradresse 0x0000 beginnend 9 Byte (72 Bits = 64 Bit Datenelement + 8 Bit ECC-Wert) betreffen, d.h. die Adressen 0x0000 bis einschließlich 0x0008.This arrangement in the external memory allows the 64-bit data elements and the associated ECC values to be stored using only the respective memory address (0x0000 and 0x000C in the example of the 3A) be written or read. That is to say that the data element and associated ECC value form, so to speak, a compound data element which can be addressed using a single memory address and can therefore be written or read in a single addressing phase. An addressing phase relating to the first data element would here, for example, relate to 9 bytes starting at memory address 0x0000 (72 bits=64 bit data element+8 bit ECC value), ie addresses 0x0000 up to and including 0x0008.

3B zeigt die entsprechende logische Anordnung in den Speicherabschnitten 80, 81 der drei 64-Bit-Datenelemente, d.h. die Anordnung aus Sicht des Computerprogrammcodes oder des kompilierten oder assemblierten ausführbaren Computerprogrammcodes. Hier sind die Datenelemente 72a, 72b, 74a, 74b, 76a, 76b unmittelbar aufeinander folgend angeordnet. Das erste Datenelement 72a, 72b ist an der logischen Speicheradresse 0x0000 gespeichert, d.h. es belegt die Adressen 0x0000 bis 0x0007. Das zweite Datenelement 74a, 74b ist an der logischen Speicheradresse 0x0008 gespeichert (0x0008 bis 0x000F). Das dritte Datenelement 76a, 76b ist an der logischen Speicheradresse 0x0010 gespeichert (0x0010 bis 0x0017). Die ECC-Werte und entsprechend die Absicherung der Speicherung von Datenelementen sind aus Sicht des Computerprogrammcodes oder des kompilierten oder assemblierten Computerprogrammcodes nicht sichtbar. eine Anpassung desselben ist also nicht notwendig. 3B Figure 12 shows the corresponding logical arrangement in the memory sections 80, 81 of the three 64-bit data elements, ie the arrangement from the point of view of the computer program code or the compiled or assembled executable computer program code. Here the data elements 72a, 72b, 74a, 74b, 76a, 76b are arranged directly one after the other. The first data element 72a, 72b is stored at the logical memory address 0x0000, ie it occupies the addresses 0x0000 to 0x0007. The second data element 74a, 74b is stored at logical memory address 0x0008 (0x0008 to 0x000F). The third data element 76a, 76b is stored at logical memory address 0x0010 (0x0010 to 0x0017). The ECC values and corresponding protection of the storage of data elements are not visible from the point of view of the computer program code or the compiled or assembled computer program code. an adjustment of the same is therefore not necessary.

Claims (9)

Verfahren zur abgesicherten Speicherung eines von einem Computerprogramm zu speichernden Datenelements in einem externen Speicher (64), der an einen Mikrocontroller (50) angebunden ist, wobei der Mikrocontroller ein Schnittstellenmodul (58) umfasst, das dazu eingerichtet ist, Fehlerkorrekturwerte für Datenelemente zu berechnen, umfassend bei Erstellung des Computerprogramms, während einer Bestimmung von Speicheradressen des Computerprogramms: Bestimmen (10) einer Speicheradresse in dem externen Speicher für das Datenelement, wobei ein gemeinsamer Speichplatzbedarf von Datenelement und einem zugehörigen Fehlerkorrekturwert berücksichtigt wird; und bei Ausführung des Computerprogramms: Empfangen (12) des Datenelements durch das Schnittstellenmodul; Berechnen (14) eines Fehlerkorrekturwerts für das Datenelement durch das Schnittstellenmodul; und Schreiben (16), beginnend an der Speicheradresse, des Datenelements und unmittelbar darauffolgend des berechneten Fehlerkorrekturwerts innerhalb einer Adressierungsphase durch das Schnittstellenmodul.Method for secure storage of a data element to be stored by a computer program in an external memory (64) which is connected to a microcontroller (50), the microcontroller comprising an interface module (58) which is set up to calculate error correction values for data elements, comprising when creating the computer program, during a determination of memory addresses of the computer program: determining (10) a memory address in the external memory for the data element, taking into account a common storage space requirement of data element and an associated error correction value; and upon execution of the computer program: receiving (12) by the interface module the data item; calculating (14) by the interface module an error correction value for the data item; and writing (16) by the interface module, starting at the memory address, the data item and immediately following the calculated error correction value within an addressing phase. Verfahren nach Anspruch 1, umfassend einen Lesevorgang des Datenelements mit den von dem Schnittstellenmodul (58) durchgeführten Schritten: Lesen (24) des Datenelements und des Fehlerkorrekturwerts beginnend an der Speicheradresse; Berechnen (26) eines Fehlerkorrektur-Vergleichswerts für das gelesene Datenelement; und Vergleichen (28) des Fehlerkorrektur-Vergleichswerts mit dem gelesenen Fehlerkorrekturwert.procedure after claim 1 comprising a reading of the data item comprising the steps performed by the interface module (58): reading (24) the data item and the error correction value starting at the memory address; calculating (26) an error correction comparison value for the read data item; and comparing (28) the error correction comparison value with the read error correction value. Verfahren nach Anspruch 2, mit den weiteren von dem Schnittstellenmodul (58) durchgeführten Schritten: wenn der Fehlerkorrektur-Vergleichswert und der gelesene Fehlerkorrekturwert gleich sind, Senden des gelesenen Datenelements (30); und, wenn der Fehlerkorrektur-Vergleichswert und der gelesene Fehlerkorrekturwert nicht gleich sind, Senden eines auf Grundlage des gelesenen Datenelements und des gelesenen Fehlerkorrekturwerts korrigierten Datenelements (36).procedure after claim 2 , with the further steps performed by the interface module (58): if the error correction comparison value and the read error correction value are equal, sending the read data element (30); and if the error correction comparison value and the read error correction value are not equal, sending a data element (36) corrected based on the read data element and the read error correction value. Verfahren nach einem der Ansprüche 2 oder 3, mit den weiteren von dem Schnittstellenmodul (58) durchgeführten Schritten: Empfangen eines geänderten Teil-Datenelements des gelesenen Datenelements; Bilden eines geänderten Datenelements aus dem geänderten Teil-Datenelement und den nicht geänderten Teilen des gelesenen Datenelements; Berechnen eines geänderten Fehlerkorrekturwerts basierend auf dem geänderten Datenelement; und Schreiben, beginnend an der Speicheradresse, des geänderten Datenelements und unmittelbar darauffolgend des berechneten geänderten Fehlerkorrekturwerts innerhalb einer Adressierungsphase.Procedure according to one of claims 2 or 3 , with the further steps performed by the interface module (58): receiving a changed partial data item of the read data item; forming a changed data item from the changed partial data item and the unchanged parts of the read data item; calculating a changed error correction value based on the changed data item; and writing, starting at the memory address, the changed data item and immediately thereafter the calculated changed error correction value within an addressing phase. Verfahren nach einem der vorstehenden Ansprüche, wobei das Bestimmen der Speicheradresse in dem externen Speicher für das Datenelement durch ein Programmierwerkzeug, insbesondere einen Linker oder einen Locator, erfolgt, das in einem Computerprogrammcode des Computerprogramms oder in einem kompilierten oder assemblierten Computerprogrammcode enthaltene logische Speicheradressen in Speicheradressen in dem externen Speicher abbildet.Method according to one of the preceding claims, wherein the determination of the memory address in the external memory for the data element is carried out by a programming tool, in particular a linker or a locator, which converts logical memory addresses contained in a computer program code of the computer program or in a compiled or assembled computer program code into memory addresses mapped to the external memory. Mikrocontroller (50), umfassend ein Schnittstellenmodul (58), das dazu eingerichtet ist, ein Datenelement und eine Speicheradresse für das Datenelement zu empfangen; einen Fehlerkorrekturwert für das empfangene Datenelement zu berechnen; das Datenelement und den zugehörigen Fehlerkorrekturwert an die empfangene Speicheradresse in einem externen Speicher innerhalb einer Adressierungsphase zu schreiben.Microcontroller (50), comprising an interface module (58) which is set up to receive a data item and a memory address for the data item; calculate an error correction value for the received data item; writing the data element and the associated error correction value to the received memory address in an external memory within an addressing phase. Mikrocontroller (50) nach Anspruch 6, wobei das Schnittstellenmodul dazu eingerichtet ist, das Verfahren nach einem der Ansprüche 2 bis 4 durchzuführen.Microcontroller (50) after claim 6 , wherein the interface module is set up to use the method according to one of claims 2 until 4 to perform. Recheneinheit (52), umfassend einen Mikrocontroller (50) nach einem der Ansprüche 6 oder 7.Arithmetic unit (52), comprising a microcontroller (50) according to one of Claims 6 or 7 . Recheneinheit (52) nach Anspruch 8, umfassend einen externen Speicher (64), der über das Schnittstellenmodul mit dem Mikrocontroller verbunden ist.Arithmetic unit (52) after claim 8 , comprising an external memory (64) which is connected to the microcontroller via the interface module.
DE102020209136.6A 2020-07-21 2020-07-21 Method for secure storage of a data element to be stored by a computer program in an external memory Pending DE102020209136A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
DE102020209136.6A DE102020209136A1 (en) 2020-07-21 2020-07-21 Method for secure storage of a data element to be stored by a computer program in an external memory
CN202110818778.3A CN113961381A (en) 2020-07-21 2021-07-20 Method for securely storing data elements to be stored by a computer program in an external memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
DE102020209136.6A DE102020209136A1 (en) 2020-07-21 2020-07-21 Method for secure storage of a data element to be stored by a computer program in an external memory

Publications (1)

Publication Number Publication Date
DE102020209136A1 true DE102020209136A1 (en) 2022-01-27

Family

ID=79179142

Family Applications (1)

Application Number Title Priority Date Filing Date
DE102020209136.6A Pending DE102020209136A1 (en) 2020-07-21 2020-07-21 Method for secure storage of a data element to be stored by a computer program in an external memory

Country Status (2)

Country Link
CN (1) CN113961381A (en)
DE (1) DE102020209136A1 (en)

Also Published As

Publication number Publication date
CN113961381A (en) 2022-01-21

Similar Documents

Publication Publication Date Title
DE19964013B4 (en) Method and device for controlling operations in a vehicle
EP2318920B1 (en) Control appliance for a vehicle, and method for updating data for a control appliance for a vehicle
DE19839680B4 (en) Method and device for modifying the memory contents of control units
DE102018205204A1 (en) Method for providing application data of at least one application executable on a control device of a vehicle, method for calibrating a control device, control device and evaluation device
EP2698678B1 (en) Configuration technique for a control device with applications that communicate with each other
WO2008006737A1 (en) Method for operating a lin bus
EP0500973A1 (en) Bootstrap routine in an EEPROM
EP1588380B1 (en) Method for the recognition and/or correction of memory access errors and electronic circuit arrangement for carrying out said method
DE19931184A1 (en) Altering controller memory contents involves writing new data that is worthy of security into different memory area before transferring to original memory area contg. replaced data
DE102020209133A1 (en) Method for secure storage of a data element in an external memory and interface module
EP1889128B1 (en) Method and device for switching in a memory for a control device
DE102018213618A1 (en) Cryptography module and operating method therefor
EP1611516A2 (en) Program-controlled unit
DE102020209136A1 (en) Method for secure storage of a data element to be stored by a computer program in an external memory
DE10002203B4 (en) Method for protecting a microcomputer system against manipulation of data stored in a memory arrangement of the microcomputer system
DE102016106572A1 (en) METHOD FOR OPERATING A CONTROL DEVICE FOR A VEHICLE, CONTROL UNIT, OPERATING SYSTEM, MOTOR VEHICLE
DE19963475B4 (en) A method and apparatus for controlling operations in a vehicle and providing data therefor
DE102020209132A1 (en) Method for secure storage of a data element to be stored of a specified data type by a computer program in an external memory
DE102005060901A1 (en) A method of detecting a supply interruption in a data store and restoring the data store
DE10315638A1 (en) Program controlled unit
EP0715313B1 (en) Method of programming an electrically erasable read-only memory in an elecronic computer device and control device using the method
DE102009024019A1 (en) Error detection code storage module
DE102018200660B4 (en) ELECTRONIC CONTROL UNIT
EP2461253B1 (en) Micro-process module, in particular chip card microprocessor module
WO2024046863A1 (en) Control device and method for initializing a control device