[go: up one dir, main page]

DE102023213338A1 - Managing a ring buffer-like memory - Google Patents

Managing a ring buffer-like memory Download PDF

Info

Publication number
DE102023213338A1
DE102023213338A1 DE102023213338.5A DE102023213338A DE102023213338A1 DE 102023213338 A1 DE102023213338 A1 DE 102023213338A1 DE 102023213338 A DE102023213338 A DE 102023213338A DE 102023213338 A1 DE102023213338 A1 DE 102023213338A1
Authority
DE
Germany
Prior art keywords
data structure
header
block
section
storage medium
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
DE102023213338.5A
Other languages
German (de)
Inventor
Andreas Markus Brodt
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 DE102023213338.5A priority Critical patent/DE102023213338A1/en
Publication of DE102023213338A1 publication Critical patent/DE102023213338A1/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/72Details relating to flash memory management
    • G06F2212/7207Details relating to flash memory management management of metadata or control data

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Datenstruktur zur Verwaltung mindestens eines Ringspeichers für ein physikalisches Speichermedium, insbesondere für ein Flash-Memory-Speichermedium, wobei die Datenstruktur einen Header und mindestens eine Sektion zur Speicherung von Verwaltungsdaten aufweist, dadurch gekennzeichnet, dass der Header mindestens ein Feld für eine Steuergröße und mindestens je ein Feld je Sektion aufweist. Data structure for managing at least one ring buffer for a physical storage medium, in particular for a flash memory storage medium, wherein the data structure has a header and at least one section for storing management data, characterized in that the header has at least one field for a control variable and at least one field per section.

Description

Die vorliegende Erfindung betrifft eine Datenstruktur zur Verwaltung eines ringspeicherartigen Speichers, entsprechende Verfahren zur Verwaltung sowie Computerprogramme, maschinenlesbare Speichermedien und Vorrichtungen.The present invention relates to a data structure for managing a ring buffer-type memory, corresponding methods for managing it, as well as computer programs, machine-readable storage media and devices.

Stand der TechnikState of the art

Moderne Fahrzeugsteuergeräte sind komplexe, miteinander verbundene Systeme. Zu Analyse- und Verbesserungszwecken können Steuergeräte mit einem System zur Ereignisdatenerfassung (engl. Event Data Recording) ausgestattet sein. Teilweise sind solche Systeme zur Ereignisdatenerfassung gesetzlich oder durch Normen vorgeschrieben.Modern vehicle control units are complex, interconnected systems. For analysis and improvement purposes, control units can be equipped with an event data recording system. In some cases, such event data recording systems are required by law or standards.

Systeme zur Ereignisdatenerfassung für Fahrzeuge weisen typischerweise die folgenden Rahmenbedingungen auf:

  • Log-strukturiertes Schreibmuster: Ereignisdatenerfassungssysteme fügen typischerweise neue Ereignisdatensätze an, behalten eine Reihe älterer Datensätze und überschreiben oder löschen ältere bzw. veraltete Datensätze. Dies führt zu einem „ringspeicherartigen“ Schreibmuster. In-Place-Updates, d. h. Änderungen von bereits geschriebenen Datensätzen, sind dagegen kein typisches Datenänderungsszenario.
Vehicle event data acquisition systems typically have the following framework conditions:
  • Log-structured write pattern: Event data acquisition systems typically append new event records, retain a set of older records, and overwrite or delete older or obsolete records. This results in a "circular buffer" write pattern. In-place updates, i.e., changes to previously written records, are not a typical data change scenario.

Kleine Schreibvorgänge: Im Rahmen der vorliegenden Erfindung wird davon ausgegangen, dass die Größe der auf einmal zu schreibenden Daten in der Größenordnung von bis zu höchstens ein paar hundert Bytes liegt. Dies ist nicht der Fall für alle automobilen Datenerfassungssysteme.Small write operations: For the purposes of the present invention, it is assumed that the size of the data to be written at once is on the order of a few hundred bytes at most. This is not the case for all automotive data acquisition systems.

Die Steuergeräte-Hardware, auf der das Ereignisdatenerfassungssystem implementiert ist, kann zu jedem Zeitpunkt ohne Vorwarnung einen Stromausfall erleiden, bspw. aufgrund eines Unfalls verbunden mit einem Abriss der Stromversorgung. Zwar verfügen einige Steuergeräte über eine Energiereserve (z. B. durch Kondensatoren im Steuergerät), um im Falle eines Verlustes der Stromversorgung, bspw. aufgrund eines Unfalls, zumindest für eine begrenzte Zeit und zumindest mit einem begrenzten Funktionsumfang einsatzfähig zu bleiben. Allerdings kann das Steuergerät im Falle eines Unfalls mit Aufgaben beschäftigt sein, die eine höhere Priorität haben (z. B. Zündung der Airbags) als die Datenaufzeichnung.The ECU hardware on which the event data acquisition system is implemented can experience a power failure at any time without warning, for example, due to an accident involving a power interruption. While some ECUs have a power reserve (e.g., through capacitors in the ECU) to remain operational for at least a limited period of time and with at least a limited range of functions in the event of a power loss, e.g., due to an accident, the ECU may be busy with tasks that have a higher priority (e.g., airbag deployment) than data recording.

Unter diesen Rahmenbedingungen besteht nun die Herausforderung darin, den Zustand des Speichers des Systems zur Ereignisdatenerfassung zu bewahren bzw. wiederherzustellen, insbesondere im Falle eines „ringspeicherartigen“ Speicherverhaltens die Position des logischen Starts und Endes des Ringspeichers.Under these conditions, the challenge now is to preserve or restore the state of the memory of the event data acquisition system, especially in the case of a "ring buffer-like" memory behavior, the position of the logical start and end of the ring buffer.

Ein klassisches Vorgehen, um den Zustand des Speichers zu bewahren bzw. wiederherzustellen, ist das Anlegen einer redundanten Speicherung bspw. auf einem zweiten SpeichermediumA classic approach to preserve or restore the state of the memory is to create redundant storage, for example on a second storage medium

Offenbarung der ErfindungDisclosure of the invention

Aufgabe der vorliegenden Erfindung ist es daher eine Datenstruktur zu schaffen, mittels der eine Bewahrung bzw. Wiederherstellbarkeit des Zustands eines Speichers eines Systems zur Ereignisdatenerfassung ermöglicht wird, ohne dass ein zweites Speichermedium eingesetzt werden muss. Dies kann dazu genutzt werden, um ein entsprechend ausgestattetes Fahrzeugsteuergerät kostengünstig herzustellen.The object of the present invention is therefore to create a data structure that enables the preservation or recovery of the state of a memory of an event data acquisition system without the need for a second storage medium. This can be used to cost-effectively manufacture a correspondingly equipped vehicle control unit.

Die Herausforderungen bestehen daher in den folgenden Punkten.The challenges therefore lie in the following points.

Bewahrung der Information darüber, welche Blöcke erfolgreich gelöscht wurden und dies über Zündzyklen und Stromausfälle hinweg.Maintaining information about which blocks were successfully erased across firing cycles and power outages.

Insbesondere beim Einsatz von Speichermedien, deren Technologie ein mehrfaches überschreiben nicht zulässt, wie bspw. NOR-Flash-Speichermedien, Bewahrung der Information darüber, auf welchen Bytes in welchen Blöcken ein Schreibvorgang gestartet wurde und dies über Zündzyklen und Stromausfälle hinweg. Dies muss nicht unbedingt bedeuten, dass die Bytes erfolgreich geschrieben wurden, sondern nur dass der Versuch unternommen wurde, in ein Byte zu schreiben. Allein die Information über den Versuch ist ausreichend, um zu wissen, dass für dieses Byte kein zweiter Schreibversuch unternommen werden darf, ohne dass Byte vorher zu löschen.Particularly when using storage media whose technology does not allow multiple overwriting, such as NOR flash storage media, it is important to retain information about which bytes in which blocks a write operation was initiated on, even across firing cycles and power outages. This does not necessarily mean that the bytes were successfully written, but only that an attempt was made to write to a byte. The information about the attempt alone is sufficient to know that a second write attempt cannot be made for that byte without first erasing the byte.

Erkennen von Blöcken, die nicht ordnungsgemäß gelöscht sind. Solche Blöcke dürfen unter keinen Umständen gelesen oder geschrieben werden, ohne den Block vorher zu löschen.Detecting blocks that have not been properly erased. Such blocks must not be read or written under any circumstances without first erasing the block.

Vor diesem Hintergrund schafft die vorliegende Erfindung eine Datenstruktur (Block) zur Verwaltung eines Ringspeichers für ein physikalisches Speichermedium. Ferner weist die Datenstruktur einen Header und mindestens eine Sektion (Vielfaches von 6 Byte) zur Speicherung von Verwaltungsdaten auf.Against this background, the present invention provides a data structure (block) for managing a ring buffer for a physical storage medium. Furthermore, the data structure comprises a header and at least one section (a multiple of 6 bytes) for storing management data.

Die Datenstruktur gemäß der vorliegenden Erfindung zeichnet sich dadurch aus, dass der Header mindestens ein Feld für eine Steuergröße (Erase Timestamp) und mindestens je ein Feld je Sektion aufweist.The data structure according to the present invention is characterized in that the header has at least one field for a control variable (Erase Timestamp) and at least one field per section.

Bei dem physikalischen Speichermedium kann es sich um ein Flash-Memory-Speichermedium, wie bspw. einem NAND oder NOR-Flash-Speichermedium handeln.The physical storage medium can be a flash memory storage medium, such as a NAND or NOR flash storage medium.

Der Vorteil der Datenstruktur gemäß der vorliegenden Erfindung ist, dass aufgrund der Felder im Header der Datenstruktur auf einfache Art und Weise die Gültigkeit, der Füllstand sowie die Beschreibbarkeit der Datenstruktur ermittelt werden kann.The advantage of the data structure according to the present invention is that the validity, fill level and writable nature of the data structure can be easily determined based on the fields in the header of the data structure.

Nach einer Ausführungsform der Datenstruktur gemäß der vorliegenden Erfindung kann das mindestens eine Feld nur zwei gültige Werte annehmen; darunter entweder einen den Zustand „gelöscht“ repräsentierenden Wert oder einen die Steuergröße des Headers repräsentierenden Wert.According to an embodiment of the data structure according to the present invention, the at least one field can assume only two valid values; including either a value representing the "deleted" state or a value representing the control variable of the header.

Der Vorteil dieser Ausführungsform ist, dass auf einfache Art und Weise die Gültigkeit der Datenstruktur ermittelt werden kann.The advantage of this embodiment is that the validity of the data structure can be determined in a simple way.

Nach einer Ausführungsform der Datenstruktur gemäß der vorliegenden Erfindung weist der Header mindestens ein Feld für eine Statusangabe (Full State Flag) auf.According to one embodiment of the data structure according to the present invention, the header has at least one field for a status indication (Full State Flag).

Das mindestens eine Feld kann dabei anzeigen, ob die Datenstruktur einen Datensatz aufweist, der dazu geeignet ist, den verwalteten Ringspeicher wiederherzustellen.The at least one field can indicate whether the data structure contains a data record that is suitable for restoring the managed ring buffer.

Der Vorteil dieser Ausführungsform ist, dass auf einfache Art und Weise die Verwendbarkeit der Datenstruktur zur Wiederherstellung des verwalteten Ringspeichers ermittelt werden kann.The advantage of this embodiment is that the usability of the data structure for restoring the managed ring buffer can be determined in a simple manner.

Nach einer Ausführungsform der Datenstruktur gemäß der vorliegenden Erfindung hat der Header eine fest vorgegebene Größe.According to one embodiment of the data structure according to the present invention, the header has a fixed size.

Nach einer Ausführungsform der Datenstruktur gemäß der vorliegenden Erfindung hat die Datenstruktur eine fest vorgegebene Größe.According to one embodiment of the data structure according to the present invention, the data structure has a fixed size.

Feste vorgegebene Größen weisen den Vorteil auf, dass keine dynamischen, d.h. keine sich zur Laufzeit des Systems umfassend die Datenstruktur ändernde Informationen vorliegen und demnach auch nicht bewahrt und wiederhergestellt werden müssen. Dies führt zu einer Vereinfachung der Datenstruktur.Fixed, predefined values have the advantage that there is no dynamic information, i.e., no information that changes the data structure extensively during the system's runtime, and therefore no need to be stored and restored. This leads to a simplification of the data structure.

Nach einer Ausführungsform der Datenstruktur gemäß der vorliegenden Erfindung ist die erste der mindestens einen Sektion zur Aufnahme einer vollständigen Repräsentation der verwalteten Ringspeicher ausgestaltet.According to one embodiment of the data structure according to the present invention, the first of the at least one section is designed to accommodate a complete representation of the managed ring buffers.

Der Vorteil dieser Ausführungsform ist, der verwaltete Ringspeicher anhand einer einzigen Datenstruktur vollständig wiederhergestellt werden kann. Dies vereinfacht die Wiederherstellung des verwalteten Ringspeichers.The advantage of this implementation is that the managed ring buffer can be completely restored using a single data structure. This simplifies the recovery of the managed ring buffer.

Ein weiterer Aspekt der vorliegenden Erfindung ist ein Verfahren zum Löschen einer Datenstruktur gemäß der vorliegenden Erfindung. Das Verfahren umfasst die nachfolgenden Schritte.Another aspect of the present invention is a method for deleting a data structure according to the present invention. The method comprises the following steps.

Löschen der gesamten Datenstruktur und danachDelete the entire data structure and then

Aktualisieren des Headers der Datenstruktur.Updating the data structure header.

Der Vorteil dieses Aspekts der vorliegenden Erfindung ist, dass auf einfache Art und Weise der Erfolg eines Löschvorgangs auf einem inhärent unzuverlässigen physikalischen Speichermedium nachvollzogen werden kann.The advantage of this aspect of the present invention is that the success of an erasure operation on an inherently unreliable physical storage medium can be easily verified.

Da, im Falle, dass die Aktualisierung des Headers der Datenstruktur zu einem gültigen Datum im Header geführt hat, davon ausgegangen werden kann, dass das Verfahren zum Löschen erfolgreich durchgeführt werden konnte.Since, in case the update of the header of the data structure resulted in a valid date in the header, it can be assumed that the deletion procedure was successful.

Dementsprechend ist dann die Datenstruktur vorbereitet neue Daten aufzunehmen.Accordingly, the data structure is then prepared to receive new data.

Im Falle, dass die Aktualisierung des Headers nicht erfolgt ist, d. h. das Datum im Header ist entweder nicht vorhanden oder inkonsistent, d. h. nicht erwartungsgemäß, wird die Datenstruktur als ungültig angesehen. Dieser Fall deckt auch den Unterfall ab, dass das Löschen der Datenstruktur zwar erfolgreich abgeschlossen werden konnte, aber die Aktualisierung des Headers nicht. Eine ungültige Datenstruktur ist nicht bereit neue Daten aufzunehmen. If the header update has not occurred, i.e., the date in the header is either missing or inconsistent, i.e., not as expected, the data structure is considered invalid. This case also covers the subcase where the deletion of the data structure was completed successfully, but the header update failed. An invalid data structure is not ready to accept new data.

Eine ungültige Datenstruktur kann durch einen erneuten Versuch des Löschens für das erneute Aufnehmen von Daten vorbereitet werden.An invalid data structure can be prepared for re-incorporation of data by attempting to delete it again.

Nach einer Ausführungsform des Verfahrens gemäß der vorliegenden Erfindung wird im Schritt des Aktualisierens der Header mit einem Zeitstempel des Löschens (Erase Timestamp) aktualisiert.According to one embodiment of the method according to the present invention, in the step of updating the header is updated with an erasure timestamp (Erase Timestamp).

Der Vorteil dieser Ausführungsform ist, dass durch die Aktualisierung des Headers mit einem Zeitstempel des Löschens die Gültigkeit der Datenstruktur bzw. der Daten in Datenstruktur auf einfache Art und Weise überprüft werden kann.The advantage of this embodiment is that by updating the header with a timestamp of deletion, the validity of the data structure or the data in the data structure can be easily checked.

Unter einem Zeitstempel des Löschens kann vorliegend ein Zähler verstanden werden, der jedes Mal, wenn ein Block erfolgreich gelöscht wurde inkrementiert wird. Der Wert des aktuellen Zeitstempels des Löschens kann im Arbeitsspeicher des Steuergeräts gehalten werden, d. h. es ist nicht zwingend erforderlich den Wert auf dem physikalischen Speichermedium nichtflüchtig zu speichern.In this case, a deletion timestamp can be understood as a counter that is incremented each time a block is successfully deleted. The value of the current deletion timestamp can be stored in the control unit's RAM, i.e., it is not mandatory to store the value in a non-volatile manner on the physical storage medium.

Der Zeitstempel des Löschens spielt insbesondere dann eine besondere Rolle, wenn die Datenstruktur gemäß der vorliegenden Erfindung in ein Datenstruktursystem eingebunden ist, das bspw. aus einer Mehrzahl von Datenstrukturen gemäß der vorliegenden Erfindung besteht.The timestamp of deletion plays a particular role when the data structure according to the present invention is integrated into a data structure system which, for example, consists of a plurality of data structures according to the present invention.

Für die Zeitstempel des Löschens kann eine feste Speichergröße verwendet werden, z. B. ein Byte. Bei ausreichend langer Laufzeit des Steuergeräts wird der Zähler für die Zeitstempel des Löschens überlaufen. Bezüglich des Überlaufs gibt es folgende Randbedingungen:

  1. 1. Der Überlauf soll lange vor dem Erreichen des maximalen vorzeichenlosen Integer-Wertes für die Länge der Löschzeitstempel (z. B. 255 bzw. 0xFF für ein Byte) erfolgen - ein Zeitstempel des Löschens, der den Wert 0xFF aufweise, wäre von einer gelöschten Datenstruktur ohne Header nicht zu unterscheiden. Der Hamming-Abstand zwischen dem größten gültigen Löschzeitstempel und der maximalen vorzeichenlosen Ganzzahl für die Zählerlänge soll mindestens 1 betragen, kann auch größer sein.
  2. 2. Um eine streng steigende Folge zu simulieren, muss eine „<“-Relation („Echt kleiner“-Relation) auf den Zeitstempeln des Löschens vorliegen, die über Überläufe hinweg funktioniert. Gemäß dieser „<“-Relation kann ein kleinerer Integer-Wert den größeren logischen Wert darstellen, z. B. der Integer-Wert 0 nach einem Überlauf in Relation zu dem Integer-Wert 255. Wenn der größte gültige Zeitstempel des Löschens zu klein ist, kann eine „<“-Relation gemäß der vorliegenden Erfindung nicht funktionieren.
A fixed memory size, e.g., one byte, can be used for the deletion timestamps. If the control unit is running for a sufficiently long time, the deletion timestamp counter will overflow. The following boundary conditions apply to the overflow:
  1. 1. The overflow should occur long before the maximum unsigned integer value for the length of the deletion timestamp is reached (e.g., 255 or 0xFF for a byte). A deletion timestamp with the value 0xFF would be indistinguishable from a deleted data structure without a header. The Hamming distance between the largest valid deletion timestamp and the maximum unsigned integer for the counter length should be at least 1, but can be larger.
  2. 2. To simulate a strictly increasing sequence, a "<" relationship ("truly less" relationship) must exist on the deletion timestamps that works across overflows. According to this "<" relationship, a smaller integer value can represent the larger logical value, e.g., the integer value 0 after an overflow relative to the integer value 255. If the largest valid deletion timestamp is too small, a "<" relationship cannot work according to the present invention.

Es hat sich daher als vorteilhaft herausgestellt, wenn die Anzahl der gültigen Löschzeitstempel mindestens doppelt so groß ist, wie die Anzahl der Datenstrukturen in dem Datenstruktursystem.

  • 3. Die Anzahl der gültigen Zeitstempel des Löschens sollte eine Primzahl sein. Auf diese Weise sind die Bitmuster der Zeitstempel des Löschens, die einer Datenstruktur im Laufe der Zeit zugeordnet werden, sehr unterschiedlich. Dies hilft in Fällen, in denen instabile Bytes falsche Werte liefern, die als gültige Zeitstempel des Löschens erscheinen, weil sie sich nur in wenigen Bits unterscheiden. Die Anzahl der gültigen Zeitstempel des Löschens darf auf keinen Fall ein Vielfaches der Anzahl der Datenstrukturen sein. Die Verwendung einer Primzahl stellt dies sicher.
n 0 1 2 3 ... 97 Block 0 0 32 64 96 ... 0 Block 1 1 33 65 0 ... 1 Block 2 2 34 66 1 ... 2 ... ... ... ... ... ... ... Block 30 30 62 94 31 ... 30 Block 31 31 63 95 32 ... 31 It has therefore proven advantageous if the number of valid deletion timestamps is at least twice as large as the number of data structures in the data structure system.
  • 3. The number of valid erasure timestamps should be a prime number. This ensures that the bit patterns of the erasure timestamps assigned to a data structure over time vary significantly. This helps in cases where unstable bytes yield false values that appear to be valid erasure timestamps because they differ by only a few bits. The number of valid erasure timestamps must never be a multiple of the number of data structures. Using a prime number ensures this.
n 0 1 2 3 ... 97 Block 0 0 32 64 96 ... 0 Block 1 1 33 65 0 ... 1 Block 2 2 34 66 1 ... 2 ... ... ... ... ... ... ... Block 30 30 62 94 31 ... 30 Block 31 31 63 95 32 ... 31

Die vorstehende Tabelle zeigt beispielhaft die Zeitstempel des Löschens am Beispiel von 32 Blöcken, einer Größe für die Zeitstempel des Löschens von einem Byte und 97 Löschzeitstempeln im Bereich 0 bis 96.The table above shows the deletion timestamps using the example of 32 blocks, a deletion timestamp size of one byte and 97 deletion timestamps in the range 0 to 96.

Die Spalten stehen dabei für die Anzahl der Löschungen. In der ersten Spalte nach den Blöcken ist der mögliche initiale Zustand aufgetragen.The columns represent the number of deletions. The first column after the blocks shows the possible initial state.

Unter der Voraussetzung, dass die Anzahl der gültigen Zeitstempel des Löschens mindestens doppelt so groß ist wie die Anzahl der Blöcke, wird eine „<“-Relation zum Vergleich zweier Zeitstempel des Löschens a und b wie folgt verwendet (π bezeichnet die Anzahl der gültigen Löschzeitstempel; z. B. π = 97): a " < " b = { a < b , | a b | < π 2 a b ,   s o n s t

Figure DE102023213338A1_0001
Provided that the number of valid erasure timestamps is at least twice the number of blocks, a “<” relation is used to compare two erasure timestamps a and b as follows (π denotes the number of valid erasure timestamps; e.g., π = 97): a " < " b = { a < b , | a b | < π 2 a b ,   s o n s t
Figure DE102023213338A1_0001

Aus der vorstehenden Tabelle ist deutlich ersichtlich, dass sich die Werte ab dem 98. Eintrag (π = 97) wiederholen. Dadurch wird deutlich, dass es sinnvoll ist für n eine Primzahl zu wählen, da es bei π = 96 bzw. 97 Überläufe braucht, bis ein Block wieder legal den gleichen Erase Timestamp bekommen würde. Das macht es sehr unwahrscheinlich, dass korrupte Bits fälschlicherweise als korrekte Werte interprätiert werden, weil sie zufällig passen.The table above clearly shows that the values repeat starting with the 98th entry (π = 97). This makes it clear that it makes sense to choose a prime number for n, since at π = 96 or 97, it takes several overflows before a block would legally receive the same erase timestamp again. This makes it very unlikely that corrupted bits will be mistakenly interpreted as correct values because they happen to match.

In Verbindung mit der Forderung nach fortlaufenden Werten zwischen Nachbarblöcken ist solche eine Fehlinterprätation dann noch um Potenzen unwahrscheinlicher.In conjunction with the requirement for continuous values between neighboring blocks, such a misinterpretation is even more unlikely.

Bei π = 123 währen es 123 Überläufe. Bei π = 128 (also keine Primzahl und auch noch ein Vielfaches der Blockanzahl von 32) wären es dagegen nur 5 Überläufe.For π = 123, there would be 123 overflows. For π = 128 (i.e., not a prime number and also a multiple of the block number of 32), there would be only 5 overflows.

Die nachstehenden Tabelle listet einige Beispielergebnisse der „<“-Relation für π = 97 auf. Die „<“-Relation vergleicht die Differenz zwischen den Löschzeitstempeln a und b für beiden Szenarien, mit und ohne Überlauf. Die „<“-Relation entsprechend der oben angegeben Relation mit der kleineren Differenz zwischen den Löschzeitstempeln. a b a „<“ b 0 1 wahr 0 47 wahr 0 48 falsch 0 96 falsch 48 96 falsch 49 96 wahr The following table lists some example results of the "<" relation for π = 97. The "<" relation compares the difference between the deletion timestamps a and b for both scenarios, with and without overflow. The "<" relation corresponds to the relation given above with the smaller difference between the deletion timestamps. a b a “<” b 0 1 true 0 47 true 0 48 incorrect 0 96 incorrect 48 96 incorrect 49 96 true

Im Falle eines Überlaufs bei Wert 97 könnte z. B. der Wert 3 identisch mit dem Wert 100 sein. Folglich ist (90 „<“ 3) wahr, weil die Differenz zwischen 90 und 100 (mit Überlauf) kleiner ist als die Differenz zwischen 3 und 90 (ohne Überlauf).For example, in the case of an overflow at value 97, the value 3 could be identical to the value 100. Consequently, (90 "<" 3) is true because the difference between 90 and 100 (with overflow) is smaller than the difference between 3 and 90 (without overflow).

Ein weiterer Aspekt der vorliegenden Erfindung ist ein Verfahren zum Hinzufügen eines Datums zu einer Datenstruktur gemäß der vorliegenden Erfindung. Das Verfahren umfasst die nachfolgenden Schritte.Another aspect of the present invention is a method for adding a datum to a data structure according to the present invention. The method comprises the following steps.

Aktualisieren des Headers der Datenstruktur und danach Anfügen des Datums an die mindestens eine Sektion der Datenstruktur.Updating the header of the data structure and then appending the date to at least one section of the data structure.

Der Vorteil dieses Aspekts der vorliegenden Erfindung ist, auf einfache Art und Weise Versuch des Hinzufügens eines Datums zu der Datenstruktur auf einen inhärent unzuverlässigen physikalischen Speichermedium nachvollzogen werden kann.The advantage of this aspect of the present invention is that it can easily trace any attempt to add a datum to the data structure on an inherently unreliable physical storage medium.

Aus diesem Grunde wird zunächst der Header der Datenstruktur aktualisiert. Durch die Aktualisierung kann nachvollzogen werden, dass ein Versuch des Hinzufügens zumindest begonnen wurde.For this reason, the header of the data structure is first updated. This update indicates that an attempt to add the data has at least begun.

Das Aktualisieren des Headers kann nicht dafür verwendet werden, das erfolgreiche Durchführen des Hinzufügens des Datums anzuzeigen. Dies müsste durch weitere Verfahren ggf. durch höher liegende Softwareschichten sichergestellt werden und ist nicht Umfang der vorliegenden Erfindung.Updating the header cannot be used to indicate the successful addition of the date. This would have to be ensured by additional methods, possibly by higher-level software layers, and is outside the scope of the present invention.

Der entsprechende Bereich der Datenstruktur wird dann - unabhängig davon, ob das Verfahren des Hinzufügens tatsächlich erfolgreich durchgeführt werden konnte - für weitere Versuche des Hinzufügens gesperrt.The corresponding area of the data structure is then locked for further addition attempts, regardless of whether the addition procedure was actually carried out successfully.

Ferner kann durch dieses Aktualisieren des Headers der Datenstruktur die Position des logischen Endes des Speicherbereichs der vorliegenden Datenstruktur durchgeführt werden.Furthermore, by updating the header of the data structure, the position of the logical end of the memory area of the present data structure can be determined.

Um die Versuche zu dokumentieren, Daten in bestimmte Teile der Datenstruktur zu schreiben, kann der Teil des Blocks, der hinter dem Header verbleibt, in eine Anzahl von Sektionen aufgeteilt werden. Die Anzahl der Sektionen kann statisch konfiguriert werden, es muss mindestens eine Sektion vorhanden sein. Die Sektionen können die gleiche Größe aufweisen. Ein Block kann z. B. in 32 gleich große Abschnitte unterteilt werden. Umso mehr Blöcke vorgesehen werden, umso feiner ist die Dokumentation der Schreibversuche und umso kleiner lässt sich ein Ausschuss halten. Im Gegenzug dazu wird der Header größer und die Schreibzeit kann sich erhöhen.To document attempts to write data to specific parts of the data structure, the portion of the block remaining after the header can be divided into a number of sections. The number of sections can be statically configured; at least one section must be present. The sections can be of the same size. For example, a block can be divided into 32 equal sections. The more blocks provided, the more detailed the documentation of write attempts and the smaller the waste can be. Conversely, the header becomes larger, and write time may increase.

Für jede Sektion kann es ein entsprechendes Feld im Header, den sogenannten Sektionsmarker, geben. Das Feld kann die Größe von einem Byte aufweisen. Nachdem die Datenstruktur gelöscht wurde, tragen alle Sektionsmarker eine Wert, der den Zustand „gelöscht“ anzeigt, bspw. den Wert 0xFF. Bevor ein beliebiges Byte in einem Abschnitt geschrieben wird, muss der Abschnitt, der dieses Byte enthält, durch Schreiben des Löschzeitstempels des Blocks in den entsprechenden Sektionsmarker „aktiviert“ werden. Da das logische Speichermodell das Anhängen von Daten nur am Ende des Speicherbereichs der Datenstruktur erlaubt, können die Abschnitte eines Blocks nur in aufsteigender Reihenfolge aktiviert werden.For each section, there may be a corresponding field in the header, the so-called section marker. This field can be one byte in size. After the data structure has been erased, all section markers carry a value indicating the "erased" state, for example, the value 0xFF. Before any byte in a section is written, the section containing that byte must be "activated" by writing the block's erasure timestamp to the corresponding section marker. Since the logical memory model only allows data to be appended to the end of the data structure's memory area, the sections of a block can only be activated in ascending order.

Die Sektionsmarker können für weitere Konsistenzprüfungen verwendet werden:

  1. 1. Ein Sektionsmarker kann nur zwei zulässige Werte haben: Einen Wert, der den Zustand „gelöscht“ anzeigt, bspw. 0xFF und den Zeitstempel des Löschens (Erase Timestamp) der Datenstruktur. Wenn ein anderer Wert in einem Sektionsmarker gefunden wird, wird der entsprechende Sektion als ungültig angesehen.
  2. 2. Es muss unbedingt eine Sequenz von 0 oder mehr Sektionsmarker vorhanden sein, die den Löschzeitstempel des Blocks enthalten, gefolgt von einer Sequenz von 0 oder mehr Abschnittsmarkern die den Wert 0xFF enthalten. Bei jeder anderen Kombination wird der gesamte Block als ungültig angesehen.
The section markers can be used for further consistency checks:
  1. 1. A section marker can have only two valid values: a value indicating the "deleted" state, for example, 0xFF, and the erasure timestamp of the data structure. If any other value is found in a section marker, the corresponding section is considered invalid.
  2. 2. There must be a sequence of 0 or more section markers containing the block's erasure timestamp, followed by a sequence of 0 or more section markers containing the value 0xFF. Any other combination will invalidate the entire block.

Die nachstehende Tabelle enthält einige Beispiel für Header zur Veranschaulichung der Sektionsmarker. Zeitstempel des Löschens Sec. 0 Sec. 1 Sec. 2 Sec. 3 0 0 0 0 0 Alle Sektion aktiviert 11 11 255 255 255 1. Sektion aktiviert 22 255 255 255 255 Kein Sektion aktiviert 33 255 33 33 33 Sektion 0 ist ungültig 44 255 255 199 255 Sektion 2 ist ungültig The table below contains some example headers to illustrate the section markers. Timestamp of deletion Sec. 0 Section 1 Section 2 Section 3 0 0 0 0 0 All sections activated 11 11 255 255 255 1. Section activated 22 255 255 255 255 No section activated 33 255 33 33 33 Section 0 is invalid 44 255 255 199 255 Section 2 is invalid

Die Datenstruktur der vorliegenden Erfindung löst u. a. die Aufgabe des Wiederherstellens der verwalteten Ringspeicher. Im Folgenden werden die erforderlichen Schritte eines solchen Wiederherstellens dargestellt.The data structure of the present invention solves, among other things, the task of restoring the managed ring buffers. The steps required for such a restoration are described below.

Beim Hochfahren des Fahrzeugsteuergeräts (bspw. während des Zünden eines Fahrzeugs) muss zunächst der Zustand der verwalteten Ringspeicher wiederhergestellt werden, bevor die Ringspeicher genutzt werden können. Um den Zustand wiederherzustellen, müssen die Header aller Datenstrukturen des Datenstruktursystem gelesen und interpretiert werden. In diesem Zusammenhang sind die nachstehenden Informationen zu extrahieren.

  • 1. Die Blocknummer des ersten verwendeten Blocks. Dies bezeichnet den einschließenden logischen Anfang des ringspeicherartigen Speichers. Dabei handelt es sich um den Block, der von allen Blöcken, die mindestens eine aktivierte Sektion aufweisen, den kleinsten Zeitstempel des Löschens gemäß der vorstehenden „<“-Relation aufweist.
  • 2. Die Blocknummer und die Sektion, die das logische Ende des ringspeicherartigen Speichers bezeichnen. Von allen Blöcken, die mindestens einen aktiven Abschnitt haben, ist dies der Block mit dem größten Löschzeitstempel, gemäß der „<“-Relation.
  • 3. Der aktuelle Wert des Zeitstempels des Löschens, der im Arbeitsspeicher abgelegt wird, für die Verwendung beim nächsten Löschvorgang.
  • 5. Ferner eine Liste von Blocknummern, die als ungültig betrachtet werden. Diese Blöcke müssen gelöscht werden, bevor sie verwendet werden.
When the vehicle control unit boots up (e.g., during vehicle ignition), the state of the managed ring buffers must first be restored before the ring buffers can be used. To restore the state, the headers of all data structures in the data structure system must be read and interpreted. In this context, the following information must be extracted.
  • 1. The block number of the first block used. This indicates the logical beginning of the circular buffer. This is the block that, of all blocks with at least one activated section, has the smallest erasure timestamp according to the above "<" relation.
  • 2. The block number and section that indicate the logical end of the circular buffer. Of all blocks that have at least one active section, this is the block with the largest erasure timestamp, according to the "<" relation.
  • 3. The current value of the deletion timestamp, which is stored in memory for use in the next deletion operation.
  • 5. A list of block numbers that are considered invalid. These blocks must be erased before they can be used.

Ein weiterer Aspekt der vorliegenden Erfindung ist ein Computerprogramm, welches eingerichtet ist, alle Schritte des Verfahrens gemäß der vorliegenden Erfindung Ansprüche auszuführen.A further aspect of the present invention is a computer program which is arranged to carry out all steps of the method according to the present invention claims.

Ein weiterer Aspekt der vorliegenden Erfindung ist ein maschinenlesbares Speichermedium, auf dem das Computerprogramm gemäß der vorliegenden Erfindung gespeichert ist.Another aspect of the present invention is a machine-readable storage medium on which the computer program according to the present invention is stored.

Ein weiterer Aspekt der vorliegenden Erfindung ist eine elektronische Steuereinheit, die eingerichtet ist, alle Schritte des Verfahrens gemäß der vorliegenden Erfindung auszuführen.A further aspect of the present invention is an electronic control unit configured to carry out all steps of the method according to the present invention.

Nachfolgend werden Ausführungsformen der Erfindung unter Bezugnahme auf die beiliegenden Zeichnungen näher erläutert. In den Zeichnungen zeigen:

  • 1 ein Blockdiagramm eines Fahrzeugsteuergeräts;
  • 2 ein Blockdiagramm eines logischen Speichermodells;
  • 3 ein Blockdiagramm einer Ausführungsform einer Datenstruktur gemäß der vorliegenden Erfindung;
  • 4 ein Ablaufdiagramm einer Ausführungsform des Verfahrens zum Löschen der Datenstruktur gemäß einem Aspekt der vorliegenden Erfindung;
  • 5 ein Ablaufdiagramm einer Ausführungsform des Verfahrens zum Hinzufügens eines Datums zu der Datenstruktur gemäß einem Aspekt der vorliegenden Erfindung;
Embodiments of the invention are explained in more detail below with reference to the accompanying drawings. In the drawings:
  • 1 a block diagram of a vehicle control unit;
  • 2 a block diagram of a logical memory model;
  • 3 a block diagram of an embodiment of a data structure according to the present invention;
  • 4 a flowchart of an embodiment of the method for deleting the data structure according to one aspect of the present invention;
  • 5 a flowchart of an embodiment of the method for adding a date to the data structure according to one aspect of the present invention;

1 zeigt ein Blockdiagramm eines Fahrzeugsteuergerät 10. 1 shows a block diagram of a vehicle control unit 10.

Das Blockdiagramm gibt nur einen Teil der typischen Bausteine eines Fahrzeugsteuergeräts 10 wieder.The block diagram shows only a part of the typical components of a vehicle control unit 10.

Das Diagramm zeigt ein physikalisches Speichermedium 11, auf dem die Datenstruktur gemäß der vorliegenden Erfindung abgelegt sein kann. Bei dem physikalischen Speichermedium 11 kann es sich um ein Speichermedium 11 der Flash-Speichertechnologie handeln, z. B. um ein NOR-Flash-Speichermedium.The diagram shows a physical storage medium 11 on which the data structure according to the present invention can be stored. The physical storage medium 11 can be a storage medium 11 using flash memory technology, e.g., a NOR flash storage medium.

Das Speichermedium 11 ist mit einer Recheneinheit 12 verbunden, die bspw. dazu geeignet ist die Verfahren gemäß der vorliegenden Erfindung auszuführen. The storage medium 11 is connected to a computing unit 12 which is suitable, for example, for carrying out the methods according to the present invention.

Das physikalische Speichermedium 11 kann in Blöcken mit fester Größe organisiert sein. Die Blockgröße kann z. B. 4 KB betragen.The physical storage medium 11 can be organized into fixed-size blocks. The block size can be, for example, 4 KB.

Das physikalische Speichermedium 11 kann derart ausgestaltet sein, dass es nur blockweise gelöscht werden kann. Dabei kann ein blockweises Löschen dazu führen, dass alle Bytes des Blocks mit einem Wert belegt werden, der den Zustand „gelöscht“ repräsentiert. Ein solcher Wert kann der Wert 255 bzw. 0xFF sein.The physical storage medium 11 can be configured such that it can only be erased block by block. Block-by-block erasure can result in all bytes of the block being assigned a value that represents the "erased" state. Such a value can be 255 or 0xFF.

Das physikalische Speichermedium 11 kann byteweise beschrieben werden. Dabei setzt ein Schreibvorgang nur die gewünschten Bits von 1 auf 0. Die 1-Bits in den zu schreibenden Daten sind bereits 1 vom letzten Löschen. Das Zurücksetzen eines Bits von 0 auf 1 ist nur durch Löschen des gesamten Blocks möglich.The physical storage medium 11 can be written to byte by byte. A write operation only sets the desired bits from 1 to 0. The 1 bits in the data to be written are already 1 from the last erasure. Resetting a bit from 0 to 1 is only possible by erasing the entire block.

Die Reihenfolge der Änderungen an einem bestimmten Byte muss strikt Löschen -> Schreiben -> Löschen sein. Das Hinzufügen von weitere 0-Bits zu einem Byte, d. h. zuerst 0xFE zu schreiben und dann 0xFC an dieselbe Stelle zu schreiben, ist nicht erlaubt ohne ein zwischenzeitliches Löschen des gesamten Blocks.The order of changes to a given byte must be strictly delete -> write -> delete. Adding additional 0 bits to a byte, i.e., first writing 0xFE and then writing 0xFC to the same location, is not allowed without first erasing the entire block.

Das physikalische Speichermedium 11 kann byteweise gelesen werden.The physical storage medium 11 can be read byte by byte.

Ein Schreib- oder Löschvorgang kann fehlschlagen. Es kann nicht davon ausgegangen werden, dass nach einem solchen Vorgang der Zustand der betroffenen Bytes bzw. des betroffenen Blocks wirklich wie erwartet ist.A write or delete operation may fail. It cannot be assumed that the state of the affected bytes or block will actually be as expected after such an operation.

Insbesondere kann die Stromversorgung ausfallen und ein Schreib- oder Löschvorgang kann nur teilweise abgeschlossen werden. Außerdem ist nicht vorhersehbar, ob eine bestimmte Operation fehlschlägt oder erfolgreich ist (auch nicht unter bestimmten Bedingungen). Jeder Schreib- oder Löschvorgang muss daher als potentiell fehlschlagend betrachtet werden.In particular, the power supply may fail, and a write or erase operation may only be partially completed. Furthermore, it is unpredictable whether a particular operation will fail or succeed (even under certain conditions). Therefore, every write or erase operation must be considered potentially failing.

Fehlgeschlagene Schreib- oder Löschvorgänge können die Bytes, die Gegenstand des Vorgangs waren, in einem undefinierten und instabilen Zustand hinterlassen. Bytes, die nicht Gegenstand des Vorgangs waren, sind davon nicht betroffen.Failed write or delete operations can leave the bytes that were the subject of the operation in an undefined and unstable state. Bytes that were not the subject of the operation are unaffected.

Die einzige Möglichkeit zu entscheiden, ob eine Schreib- oder Löschoperation auf das physikalische Speichermedium erfolgreich war oder nicht, ist die Überprüfung des Rückgabestatus des physikalischen Speichermediums nach Abschluss der Operation. Schreib- oder Löschvorgänge mit unbekanntem Rückgabestatus müssen als fehlgeschlagen betrachtet werden. Insbesondere ist kein zuverlässiger Weg, um zu entscheiden, ob ein Schreibvorgang erfolgreich war oder nicht, die geschriebenen Bytes zurückzulesen und sie mit der ursprünglichen Quelle zu vergleichen. Ebenso ist es kein zuverlässiger Weg zu entscheiden, ob ein Block erfolgreich gelöscht wurde oder nicht, indem man seinen Inhalt mit 0xFF vergleicht.The only way to determine whether a write or erase operation to the physical storage medium was successful or not is to check the return status of the physical storage medium after the operation is complete. Write or erase operations with an unknown return status must be considered failed. In particular, reading back the written bytes and comparing them with the original source is not a reliable way to determine whether a write operation was successful or not. Likewise, comparing its contents to 0xFF is not a reliable way to determine whether a block was successfully erased or not.

Bei einem wie vorstehend dargestellten Speichermedium 11 sind Löschvorgänge langsam. Ein Löschvorgang kann zum Beispiel 0,2 Sekunden dauern. D. h., es ist wahrscheinlich, dass der Löschvorgang eines Blocks durch einen Stromausfall unterbrochen wird.With a storage medium 11 as shown above, erasure operations are slow. For example, an erasure operation may take 0.2 seconds. This means that the erasure of a block is likely to be interrupted by a power failure.

Die Recheneinheit 12 hat ferner Zugriff auf einen Arbeitsspeicher 13, in dem verfahrensspezifische Daten abgelegt sind. In der Darstellung sind Recheneinheit 11 und Arbeitsspeicher 13 als getrennte Blöcke aufgeführt. Es ist denkbar, dass der Arbeitsspeicher 13 in die Recheneinheit 12 integriert ist. Nicht alle Daten, die im Arbeitsspeicher abgelegt sind, werden auch in der Datenstruktur 11 abgelegt und wären bei einem Ausfall der Stromversorgung des Steuergeräts 10 zunächst verloren. Alle relevanten Daten zur Wiederaufnahme der Verfahren gemäß der vorliegenden Erfindung lassen sich aus den in dem Speichermedium 11 abgelegten Daten wiederherstellen.The computing unit 12 also has access to a working memory 13 in which process-specific data is stored. In the illustration, the computing unit 11 and the working memory 13 are shown as separate blocks. It is conceivable that the working memory 13 is integrated into the computing unit 12. Not all data stored in the working memory is also stored in the data structure 11 and would initially be lost in the event of a power failure of the control unit 10. All relevant data for resuming the processes according to the present invention can be restored from the data stored in the storage medium 11.

2 zeigt ein Blockdiagramm eines logischen Speichermodells eines Datenstruktursystems 20 umfassend eine Datenstruktur 21, 22, 23, 24, 25 bis n gemäß der vorliegenden Erfindung. 2 shows a block diagram of a logical memory model of a data structure system 20 comprising a data structure 21, 22, 23, 24, 25 to n according to the present invention.

Das Datenstruktursystem 20 ist dazu geeignet in einem Softwaresystem den darüber liegenden Schichten ein logisches Speichermodell anzubieten, dass ringspeicherartig verhält.The data structure system 20 is suitable for offering the overlying layers in a software system a logical memory model that behaves like a ring buffer.

Durch die vorliegende Erfindung wird es ermöglich ein robustes und ausfallsicheres Speichermodell auf einem inhärent unzuverlässigen Speichermedium 11 anzubieten.The present invention makes it possible to offer a robust and fail-safe storage model on an inherently unreliable storage medium 11.

Das in 2 dargestellte Speichermodell kann in einer Ausführungsform den darüber liegenden Softwareschichten die nachstehenden Funktionen (Primitiven) anbieten.The 2 The memory model shown can, in one embodiment, offer the following functions (primitives) to the overlying software layers.

InitialisierenInitialize

Stellt den Zustand des verwalteten Ringspeichers wieder her, insbesondere die Position des logischen Starts und Endes des Ringspeichers.Restores the state of the managed ring buffer, specifically the position of the logical start and end of the ring buffer.

Verfügbare Bytes abfragenQuery available bytes

Meldet, wie viele Bytes noch an den Block angehängt werden können.Reports how many bytes can still be appended to the block.

AnhängenAttach

Hängt die Daten an das logische Ende des Ringspeichers an. Die Menge der Daten, darf dabei nicht den verfügbaren Speicherplatz am Ende des Blocks überschreiten.Appends the data to the logical end of the circular buffer. The amount of data must not exceed the available storage space at the end of the block.

Neuen Block beginnenStart new block

Verschiebt das logische Ende des ringspeicherartigen Speichers an den Anfang des nächsten Blocks. Wenn der nächste Block nicht bereit ist, bspw. noch nicht gelöscht ist, wird dieser zunächst vorbereitet, bspw. gelöscht. Befand sich das bisherige logische Ende des Ringspeichers im letzten Block des dem Datenstruktursystem zugeordneten Speicherbereichs des physikalischen Speichermediums 11, so wird das logische Ende („nächster Block“) der erste Block des dem Datenstruktursystem zugeordneten Speicherbereichs des physikalischen Speichermediums.Moves the logical end of the ring buffer to the beginning of the next block. If the next block is not ready, e.g., has not yet been deleted, it is first prepared, e.g., deleted. If the previous logical end of the ring buffer was in the last block of the memory area of the physical storage medium 11 assigned to the data structure system, the logical end ("next block") becomes the first block of the memory area of the physical storage medium assigned to the data structure system.

Nächsten Block löschenDelete next block

Löscht den Block am logischen Anfang des ringspeicherartigen Speichers und setzt den logischen Anfang auf den Anfang des nächsten Blocks. Befand sich der bisherige logische Anfang des ringspeicherartigen Speichers im letzten Block des dem Datenstruktursystem zugeordneten Speicherbereichs des physikalischen Speichermediums 11, so wird der logische Anfang („nächster Block“) der erste Block des dem Datenstruktursystem zugeordneten Speicherbereichs des physikalischen Speichermediums.Deletes the block at the logical beginning of the ring buffer and sets the logical beginning to the beginning of the next block. If the previous logical beginning of the ring buffer was in the last block of the memory area of the physical storage medium 11 assigned to the data structure system, the logical beginning ("next block") becomes the first block of the memory area of the physical storage medium assigned to the data structure system.

LesenTo read

Gibt die gewünschte Anzahl von Bytes zurück, die an einer bestimmten Position zwischen dem logischen Start und dem Ende des ringspeicherartigen Speichers gespeichert sind.Returns the desired number of bytes stored at a specific position between the logical start and end of the circular buffer.

AufräumenClean up

Löscht die als gültig erkannten Blöcke. Wenn es keine solche Blöcke gibt, wird nichts getan. Die Menge von Blöcken, die als ungültig betrachtet werden, ist eine interne Information, die im Arbeitsspeicher gehalten wird und nicht für anderen Software-Schichten sichtbar sein muss.Deletes the blocks identified as valid. If there are no such blocks, nothing is done. The set of blocks considered invalid is internal information stored in memory and may not be visible to other software layers.

Das Datenstruktursystem 20 besteht aus einer Anzahl von n Blöcken 21, 22, 23, 24, 24, 25 bis n, die in einem dem Datenstruktursystem 20 zugewiesen Bereich des physikalischen Speichermediums 11 liegen. Der zugewiesene Bereich kann dabei ein zusammenhängender Bereich im physikalischen Speichermedium sein. Es ist denkbar, dass die Blöcke des Datenstruktursystems 20 in gleichen Reihenfolge Blöcke des physikalischen Speichermediums 11 darstellen. Jeder Block stellt dabei eine Datenstruktur 21, 22, 23, 24, 24, 25 gemäß der vorliegenden Erfindung dar.The data structure system 20 consists of a number of n blocks 21, 22, 23, 24, 24, 25 to n, which are located in an area of the physical storage medium 11 assigned to the data structure system 20. The assigned area can be a contiguous area in the physical storage medium. It is conceivable that the blocks of the data structure system 20 represent blocks of the physical storage medium 11 in the same order. Each block represents a data structure 21, 22, 23, 24, 24, 25 according to the present invention.

Die Blöcke 21 und n sind ohne Füllung dargestellt. Dies soll verdeutlichen, dass diese Blöcke 21, n als gelöscht gekennzeichnet sind. Dies kann bedeuten, dass alle dem jeweiligen Block 21, n zugeordneten Bytes den Wert 0xFF aufweisen. Blocks 21 and n are shown without any padding. This indicates that these blocks 21, n are marked as erased. This may mean that all bytes assigned to the respective block 21, n have the value 0xFF.

Die Blöcke 22, 23, 24 sind mit schraffierter Füllung dargestellt. Dies soll verdeutlichen, dass diese Blöcke als belegt gekennzeichnet sind. Eine Änderung der in diesen Blöcken abgelegten Daten bzw. ein Anhängen von Daten ist nicht möglich.Blocks 22, 23, and 24 are shown with hatched fill. This indicates that these blocks are marked as occupied. Changing the data stored in these blocks or appending data is not possible.

Der Block 25 ist mit einer gepunkteten Füllung dargestellt. Dies soll verdeutlichen, dass sich das aktuell logische Ende des Ringspeichers in diesem Block befindet. Eine Änderung der in diesem Block abgelegten Daten ist nicht möglich. Beim Aufruf der Funktion „Anhängen“ werden die anzuhängenden Daten an diesen Block angehängt - sofern der Block noch ausreichend Speicherplatz aufweist (siehe oben).Block 25 is represented by a dotted line. This indicates that the current logical end of the ring buffer is located in this block. Changing the data stored in this block is not possible. When the "Append" function is called, the data to be appended is appended to this block – provided the block still has sufficient storage space (see above).

Die Blöcken 21, 22, 23, 24, 24, 25 können eine vorgegeben Größe aufweisen. Die Blöcke können auf dem physikalischen Speichermedium 11 aufeinanderfolgende Speicherplätze belegen.Blocks 21, 22, 23, 24, 24, 25 may have a predetermined size. The blocks may occupy 11 consecutive storage locations on the physical storage medium.

3 zeigt ein Blockdiagramm einer Ausführungsform einer Datenstruktur gemäß der vorliegenden Erfindung. 3 shows a block diagram of an embodiment of a data structure according to the present invention.

3 zeigt links ein Datenstruktursystem 20 wie in 2 erläutert. 3 shows on the left a data structure system 20 as in 2 explained.

In der Mitte zeigt 3 eine Detailansicht des Blocks 25; stellvertretend für die andere Datenblöcke 21, 22, 23, 24 bis n des dargestellten Datenstruktursystems 20. Block 25 weist eine Struktur nach der Datenstruktur gemäß der vorliegenden Erfindung auf. Block 25 weist einen Header 251 sowie mindestens eine Sektion 252a, 252b, 252c bis 252n auf.In the middle shows 3 A detailed view of block 25; representative of the other data blocks 21, 22, 23, 24 to n of the illustrated data structure system 20. Block 25 has a structure according to the data structure of the present invention. Block 25 has a header 251 and at least one section 252a, 252b, 252c to 252n.

Rechts zeigt 3 eine Detailansicht des Headers 251 des Blocks 25 des Datenstruktursystems 20. Header 251 umfasst mindestens ein Feld 2511 für eine Steuergröße und mindestens je ein Feld 2513a, 2513b bis 2513n je Sektion 252a, 252b, 252c bis 252n der Datenstruktur 25 gemäß der vorliegenden Erfindung. Ferner umfasst der dargestellte Header mindestens ein Feld 2512 für eine Statusangabe.Right shows 3 A detailed view of header 251 of block 25 of data structure system 20. Header 251 includes at least one field 2511 for a control variable and at least one field 2513a, 2513b to 2513n for each section 252a, 252b, 252c to 252n of data structure 25 according to the present invention. Furthermore, the illustrated header includes at least one field 2512 for a status indication.

4 zeigt ein Ablaufdiagramm einer Ausführungsform des Verfahrens zum Löschen der Datenstruktur gemäß einem Aspekt der vorliegenden Erfindung. 4 shows a flowchart of an embodiment of the method for deleting the data structure according to one aspect of the present invention.

In Schritt 401 wird die gesamte Datenstruktur gelöscht und erst danach wird in Schritt 402 der Header der Datenstruktur aktualisiert.In step 401 the entire data structure is deleted and only then is the header of the data structure updated in step 402.

Das Verfahren kann dabei derart ablaufen, dass die Datenstruktur durch einen Speicherblock des physikalischen Speichermediums repräsentiert wird. Bei einem Flash-Memory-Speichermedium, insbesondere bei einem NOR-Flash-Speichermedium erfolgt das Löschen dadurch, dass alle Bytes des Speicherblocks auf den Wert 0xFF, d. h. mit Einsen („1“) aufgefüllt werden.The method can be implemented in such a way that the data structure is represented by a memory block of the physical storage medium. In the case of a flash memory storage medium, particularly a NOR flash storage medium, erasure occurs by filling all bytes of the memory block to the value 0xFF, i.e., with ones ("1").

Bei einem Flash-Memory Speichermedium kann dieser Vorgang vergleichsweise lange dauern. Bspw. bis zu 0,2 Sekunden.With a flash memory storage medium, this process can take a comparatively long time, for example, up to 0.2 seconds.

Erst wenn das physikalische Speichermedium den Abschluss des Löschvorgangs anzeigt, wird der Schritt 402 ausgeführt, in dem der Header 251 der Datenstruktur 25 aktualisiert wird. Die Aktualisierung des Headers 251 erfolgt dadurch, dass zumindest das mindestens eine Feld für eine Steuergröße mit dem aktuellen Wert eines Zeitstempels für das Löschen belegt wird.Only when the physical storage medium indicates the completion of the deletion process is step 402 executed, in which the header 251 of the data structure 25 is updated. The header 251 is updated by filling at least one field for a control variable with the current value of a timestamp for the deletion.

5 zeigt ein Ablaufdiagramm einer Ausführungsform des Verfahrens zum Hinzufügens eines Datums zu der Datenstruktur gemäß einem Aspekt der vorliegenden Erfindung. 5 shows a flowchart of an embodiment of the method for adding a date to the data structure according to one aspect of the present invention.

In Schritt 501 wird der Header der Datenstruktur aktualisiert und erst danach werden in Schritt 502 anzufügenden Daten an die mindestens eine Sektion der Datenstruktur 25 angefügt.In step 501, the header of the data structure is updated and only then, in step 502, data to be appended is appended to the at least one section of the data structure 25.

Die Aktualisierung des Headers 251 der Datenstruktur 25 ist dabei nur dann erforderlich, wenn für das Anhängen eine neue Sektion „aktiviert“ werden muss. Updating the header 251 of the data structure 25 is only necessary if a new section needs to be “activated” for appending.

Reicht der verbleibende Platz in der aktuellen zu beschreibenden Sektion aus, so können die anzufügenden Daten an der Stelle des logischen Endes des ringspeicherartigen Speichers angehängt werden, ohne dass eine neue Sektion „aktiviert“ werden muss.If the remaining space in the current section to be written is sufficient, the data to be appended can be appended at the position of the logical end of the ring buffer-like memory without having to “activate” a new section.

In beiden Fällen wird das logische Ende des ringspeicherartigen Speichers an das Ende angehängten Daten verschoben.In both cases, the logical end of the ring buffer is moved to the end of the appended data.

Claims (13)

Datenstruktur zur Verwaltung mindestens eines Ringspeichers für ein physikalisches Speichermedium, insbesondere für ein Flash-Memory-Speichermedium, wobei die Datenstruktur einen Header und mindestens eine Sektion zur Speicherung von Verwaltungsdaten aufweist, dadurch gekennzeichnet, dass der Header mindestens ein Feld für eine Steuergröße und mindestens je ein Feld je Sektion aufweist.Data structure for managing at least one ring buffer for a physical storage medium, in particular for a flash memory storage medium, the data structure having a header and at least one section for storing management data, characterized in that the header has at least one field for a control variable and at least one field per section. Datenstruktur nach Anspruch 1, wobei das mindestens eine Feld nur zwei gültige Werte annehmen kann, entweder einen den Wert 0 repräsentierenden Wert oder einen die Steuergröße des Headers repräsentierenden Wert.Data structure according to Claim 1 , where the at least one field can only take two valid values, either a value representing the value 0 or a value representing the control variable of the header. Datenstruktur nach Anspruch 1 oder 2, wobei der Header mindestens ein Feld für eine Statusangabe aufweist.Data structure according to Claim 1 or 2 , where the header has at least one field for a status indication. Datenstruktur nach einem der vorhergehenden Ansprüche, wobei der Header eine fest vorgegebene Größe hat.Data structure according to one of the preceding claims, wherein the header has a fixed size. Datenstruktur nach einem der vorhergehenden Ansprüche, wobei die Datenstruktur eine fest vorgegebene Größe hat.Data structure according to one of the preceding claims, wherein the data structure has a fixed size. Datenstruktur nach einem der vorhergehenden Ansprüche, wobei die erste der mindestens einen Sektion zur Aufnahme einer vollständigen Repräsentation der verwalteten Ringspeicher ausgestaltet ist.Data structure according to one of the preceding claims, wherein the first of the at least one section is designed to accommodate a complete representation of the managed ring buffers. Verfahren zum Löschen einer Datenstruktur nach einem der Ansprüche 1 bis 6 mit den Schritten: a. Löschen der gesamten Datenstruktur und danach b. Aktualisieren des Headers der Datenstruktur.Method for deleting a data structure according to one of the Claims 1 until 6 with the steps: a. Deleting the entire data structure and then b. Updating the header of the data structure. Verfahren nach Anspruch 7, wobei im Schritt des Aktualisierens der Header mit einem Zeitstempel des Löschens aktualisiert wird.Procedure according to Claim 7 , where in the update step the header is updated with a timestamp of deletion. Verfahren zum Hinzufügen eines Datums zu einer Datenstruktur nach einem der Ansprüche 1 bis 6 mit den Schritten: a. Aktualisieren des Headers der Datenstruktur und danach b. Anfügen des Datums an die mindestens eine Sektion der Datenstruktur.Method for adding a date to a data structure according to one of the Claims 1 until 6 with the steps: a. updating the header of the data structure and then b. appending the date to at least one section of the data structure. Verfahren nach Anspruch 9, wobei im Schritt des Aktualisierens der Header in Abhängigkeit von der Steuergröße des Headers aktualisiert wird, insbesondere wobei das zu der Sektion korrespondierende Feld des Headers in Abhängigkeit von der Steuergröße, insbesondere mit der Steuergröße, aktualisiert wird.Procedure according to Claim 9 , wherein in the step of updating the header is updated depending on the control variable of the header, in particular wherein the field of the header corresponding to the section is updated depending on the control variable, in particular with the control variable. Computerprogramm, welches eingerichtet ist, alle Schritte eines Verfahrens nach einem der vorhergehenden Ansprüche auszuführen.Computer program which is arranged to carry out all steps of a method according to one of the preceding claims. Maschinenlesbares Speichermedium, auf dem das Computerprogramm gemäß Anspruch 11 gespeichert ist.Machine-readable storage medium on which the computer program according to Claim 11 is stored. Elektronische Steuereinheit, welche eingerichtet ist, alle Schritt eines Verfahrens gemäß einem der Ansprüche 1 bis 10 auszuführen.Electronic control unit which is arranged to carry out all steps of a method according to one of the Claims 1 until 10 to execute.
DE102023213338.5A 2023-12-28 2023-12-28 Managing a ring buffer-like memory Pending DE102023213338A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
DE102023213338.5A DE102023213338A1 (en) 2023-12-28 2023-12-28 Managing a ring buffer-like memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
DE102023213338.5A DE102023213338A1 (en) 2023-12-28 2023-12-28 Managing a ring buffer-like memory

Publications (1)

Publication Number Publication Date
DE102023213338A1 true DE102023213338A1 (en) 2025-07-03

Family

ID=96021157

Family Applications (1)

Application Number Title Priority Date Filing Date
DE102023213338.5A Pending DE102023213338A1 (en) 2023-12-28 2023-12-28 Managing a ring buffer-like memory

Country Status (1)

Country Link
DE (1) DE102023213338A1 (en)

Similar Documents

Publication Publication Date Title
DE3784190T2 (en) ENTERING A DATA BASE INDEX IN THE JOURNAL FOR IMPROVED RESET.
DE69716233T2 (en) SEMICONDUCTOR MEMORY ARRANGEMENT WITH ERROR DETECTION AND CORRECTION
EP0067364B1 (en) Method and arrangement for a non-volatile storage of the counting state of an electronic counter
DE19839680B4 (en) Method and device for modifying the memory contents of control units
EP1190324B1 (en) Process for the secure writing of a pointer for a circular memory
DE19960258A1 (en) Flash memory unit for storing address information, has data writing unit for writing addresses in black areas of memory cluster, and address updating unit
DE102004014227A1 (en) Control device for a non-volatile memory
DE102006009214B4 (en) Method and apparatus for writing to a destination memory page of a memory
EP1514171B1 (en) Method for restoring administrative data records of a memory that can be erased in blocks
DE102023213338A1 (en) Managing a ring buffer-like memory
DE102012101405B4 (en) Control device for controlling data reading and writing from and to a flash memory
DE69406138T2 (en) METHOD FOR WRITING DATA IN A NON-VOLATILE STORAGE
DE3025044A1 (en) DEVICE FOR PROTECTING ACCESS TO PERMANENT STORAGE IN A DATA PROCESSING SYSTEM
DE10321104B4 (en) Method for filing variable data
DE102016202684B4 (en) DATA MANAGEMENT DEVICE AND DATA MANAGEMENT PROGRAM
DE112015002881B4 (en) Storage device, flash memory controller and program
DE10257861A1 (en) Storage system with a non-volatile storage element that overwrites directly without redundancy, and the associated writing method
DE102023213337A1 (en) Managing a ring buffer-like memory
DE102023213336A1 (en) Event data acquisition system
DE102006013763A1 (en) Memory device e.g. electrically erasable programmable ROM, operating method, for motor vehicle, involves assigning bit pattern after deletion operation separated from writing operation so that block state change is recognized
DE102008010556A1 (en) Method and device for storing information data
DE10148047A1 (en) Securing data in memory component involves storing data and test and validity identifiers multiple times and securing data by bit-wise logically combining data when read out
EP0214390A1 (en) Release method and device for a controlled-access user memory
DE102013214803A1 (en) Tachograph arrangement and method for storing data in a tachograph arrangement
DE102016008046A1 (en) Control file system