Method for operating a storage medium and computing unit having a storage medium

By introducing dynamic mapping between virtual and physical addresses and sequence counter management in non-volatile memory, the problems of uneven wear of storage media and data loss caused by hardware defects are solved, improving storage efficiency and device lifespan, and is particularly suitable for vehicle control equipment.

CN113741804BActive Publication Date: 2026-01-02ROBERT BOSCH GMBH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110577493.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2020-05-27
Filing Date
2021-05-26
Publication Date
2026-01-02
Estimated Expiration
2041-05-26

AI Technical Summary

Technical Problem

Existing technologies in non-volatile memory suffer from problems such as uneven wear, data loss due to hardware defects, and low write efficiency. These problems are particularly prevalent in vehicle control equipment, where traditional storage media management methods cannot effectively address them.

Method used

By dynamically mapping data between the virtual address space and the physical address space, using a sequence counter to manage physical sub-regions, data copying and rotation are achieved, avoiding the use of hardware defective areas, and optimizing the lifespan of the storage medium through a wear leveling mechanism.

Benefits of technology

It improves the write efficiency of storage media, reduces data loss caused by hardware defects, extends the lifespan of storage media, and reduces wear and tear on control equipment, making it particularly suitable for storage management in vehicle control equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113741804B_ABST
    Figure CN113741804B_ABST
Patent Text Reader

Abstract

Method for operating a storage medium and computing unit having a storage medium. The invention relates to a method for operating a storage medium which provides a non-volatile memory which can be written to without prior deletion and in which data can be deposited in a physical address space, wherein data are written to and / or read from the memory in such a way that a virtual address space is addressed, the virtual address space being mapped into the physical address space in a changeable allocation, wherein physical sub-areas are provided on the storage medium, virtual sub-areas are allocated to the physical sub-areas in a changeable allocation, the virtual sub-areas being addressed by means of the virtual address space, and wherein the allocation is repeatedly changed and in which the data are transferred to other physical sub-areas while maintaining their position in the virtual sub-areas; and to a computing unit having such a storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The invention relates to a method for operating a storage medium which provides a non-volatile memory, to a computing unit having such a storage medium and to a computer program for carrying out the method. BACKGROUND

[0002] Computing units such as control devices in vehicles, i.e. in the automotive sector, often have to store not only program code non-volatile but also data non-volatile while the software implemented thereon is running. For this purpose, EEPROMs or flash memories are traditionally used as hardware. The functionality of the software concerned is standardized by the so-called AUTOSAR alliance. However, these standards only specify the functional scope of the software but not the way and method of organizing data on the storage medium. SUMMARY

[0003] According to the invention, a method for operating a storage medium, a computing unit for carrying out the method and a computer program for carrying out the method are proposed which have the features of the independent patent claims. Advantageous design proposals are the subject matter of the dependent claims and the subsequent description.

[0004] The invention relates to a method for operating a storage medium which provides a non-volatile memory on which data can be deposited in a physical address space. This method can be implemented in particular on a computing unit such as a control device in a vehicle, which then utilizes corresponding software. In this respect, the invention also relates to a corresponding computing unit having such a storage medium.

[0005] When writing to such a storage medium, several points have to be observed in general. Each deletion or programming process is a physical load on the storage cell(s). Thus, the number of deletions or programming processes allowed for each storage cell of the storage technology used is limited. If the load limit is exceeded, robust operation cannot be guaranteed any more due to wear.

[0006] Non-volatile data are distinguished not only in terms of content but in particular also by the frequency with which they are stored. The storage frequency of individual data often exceeds the number of deletions or programming processes allowed. In order to reduce the resulting load on the storage medium, these deletions or programming processes have to be distributed over the medium (so-called "wear-leveling").

[0007] Individual memory cells or also larger contiguous memory areas can fail due to hardware defects. Storing data in such memory cells or memory areas is not allowed. Flash memories (and also other storage media with non-volatile memory) cannot be overwritten arbitrarily, but have to be deleted before a larger area (in so-called flash banks) can be programmed.

[0008] The possibilities for handling this to date have partial disadvantages in the case of such storage media, in particular in the case of flash memories, which should be briefly set out.

[0009] The associated data is combined and managed in blocks. If a data block has been changed and there is a write task for this data block, the block can be appended at the end of the occupied area, that is to say at the next free physical address. Due to multiple write tasks, the storage media will fill up over time. As a result, the time to find a block is prolonged. Before this state is reached, the flash bank with the oldest data should be deleted in order to provide space for new write tasks. If necessary, data also has to be migrated from this bank to the end of the occupied area in order not to be lost. Not only the deletion of the bank, but also the search for data and the migration are time-consuming and slow down or prevent the handling of write or read tasks.

[0010] If a memory cell or memory area can no longer be deleted and / or programmed due to a hardware defect, data can be placed behind the defective area, that is to say at the next non-defective physical address. In particular in the case of larger defective areas (for example defective word lines), unsuccessful programming attempts will take a lot of time.

[0011] In this context, it is now proposed that data is written into and / or read from the memory in such a way that a virtual address space is addressed, which is mapped into the physical address space according to an alterable allocation ("mapping").

[0012] The storage medium in a computing unit, such as a control device, is addressed by a microcontroller or processor (as part of the computing unit) usually by a physical address space. Within the scope of the present invention, this physical memory or address space is abstracted into a virtual (or logical) memory or address space. If data is written into the physical memory (or its address space) or read anew from the physical memory, this is now achieved with an intermediate connection of the virtual or logical address space. There is a mapping (allocation) between the physical address space and the logical address space, which is changeable at software runtime, i.e. dynamic, whereby a physical subregion of the storage medium is allocated a virtual subregion, which is addressed by the virtual address space. This allocation is stored, inter alia, redundantly, for example, also in the physical subregion, i.e. at the allocated physical address also the virtual address or a characterizing value of the virtual address, such as an ID, is stored. With the continuation of the invention, the data is now repeatedly transferred to other (free) physical subregions while keeping the location of the data in the virtual subregion and the mapping is adapted accordingly. In other words, the data is copied back here while the virtual address to be addressed remains unchanged.

[0013] This brings various advantages. Defective regions in the physical memory can be mapped in this way very simply onto other regions or allocated to other regions, that is to say the real defective regions are not continued to be allocated to the virtual regions; rather, such virtual regions are then allocated to (previously, inter alia, free or reserved as a reserve) physical regions. The time-consuming search for the end of the defective region is dispensed with.

[0014] Since the data is fixedly retained at the same virtual address and the mapping to the physical address is known, the laborious search in the storage medium is dispensed with. Also dispensed with is the necessity of always attaching the data (block) to the end of the occupied region or migrating it to other banks.

[0015] The repeated, inter alia. periodic, copying back of the data (with the change in the allocation) also prevents the drifting away of rarely programmed cells (physical subregions) and thus the loss of data. All data is periodically reprogrammed by the mechanism of copying back or transfer. Charge losses, which naturally lead to data loss after many years, are thus counteracted.

[0016] Even though the application can preferably be used in the case of EEPROMs, PCM (Phase-change Random Access Memory) or MRAM (Magnetoresistive Random Access Memory), the application in principle also functions in the case of other non-volatile memories. The application exhibits particular advantages in the case of memories which can be written without prior deletion, since the physical sub-areas can then be transferred purposefully. In the case of memories having areas which can only be overwritten after prior deletion, such as conventional flash memories, individual cells can only be programmed after the entire area (for example a so-called flash bank or sector) has been deleted. Thus, generally much larger areas are deleted than subsequently programmed, which for the application cases relevant in the present case, such as vehicle control devices, means too much wear.

[0017] The mentioned advantages can be achieved in particular if the mapping or the allocation is changed each time at least one criterion is fulfilled, for example at each start-up of the computing unit and / or after a predetermined amount of data has been written into the memory and / or sub-area and / or a predetermined number of write processes of the memory and / or the sub-area.

[0018] In addition to the mapping, a sequence counter is preferably also stored in the physical sub-areas as management information. With the sequence counter, the age of a sub-area can be identified. Each time data is written into a hitherto unused sub-area, the hitherto unused sub-area is newly compiled and allocated (mapped) accordingly. Each new sub-area can obtain, for example, an incremented sequence counter as further part of the management information, that is to say the greater the value, the newer the sub-area.

[0019] However, preferably, a physical sub-area is allocated to a virtual sub-area only when data is also stored in the virtual sub-area. A virtual sub-area which has not yet been used is thus not allocated a physical sub-area. In this way, a reserve of physical sub-areas can be provided, in order to be able to rotate the oldest physical sub-areas to other locations on the one hand and to be able to transfer map (that is to say reallocate) defective physical sub-areas on the other hand. The greater the reserve, the greater the leeway in the event of defects. The physical sub-areas are in particular stored consecutively (generally ordered according to the sequence counter), since this significantly simplifies and thus accelerates the search for the oldest and newest physical sub-areas. This also ensures that write and read accesses do not have to be arbitrarily scattered over the memory, but rather relate to consecutive storage areas.

[0020] The computing unit, for example the control device of a vehicle, according to the application is in particular set up in a program-technical manner to carry out the method according to the application.

[0021] The implementation of the method according to the application in the form of a computer program or computer program product with program code for carrying out all the method steps is also advantageous, in particular when the control device being implemented is also used for other tasks and is thus always present, because this leads to particularly low costs. In particular, data carriers suitable for providing the computer program are magnetic, optical and electronic memories, such as in particular PCM or MRAM, but also for example hard disks, flash memories, EEPROMs, DVDs and others. It is also possible to download the program via a computer network (Internet, Intranet, etc.).

[0022] Further advantages and embodiments of the application result from the description and the accompanying drawings.

[0023] The application is illustrated schematically in the drawings according to embodiments and is described below with reference to the drawings. BRIEF DESCRIPTION OF DRAWINGS

[0024] Figure 1 A computing unit according to the application in one preferred embodiment is illustrated schematically.

[0025] Figure 2 and 3 Different partial processes of a method according to the application in one preferred embodiment are illustrated. DETAILED DESCRIPTION

[0026] A computing unit 100 according to the application in one preferred embodiment, for example a control device of a vehicle, is illustrated schematically in Figure 1 The computing unit has a storage medium 120 with a non-volatile memory, for example a PCM memory, and a microcontroller 110. The working principle of the computing unit and thereby also of the method according to the application should be explained subsequently, wherein data 115 are read from the memory or written to the memory.

[0027] The physical address space 121 of the storage medium 120 is, for example, uniformly divided into physical sub-areas 122, which are also referred to as physical rows ("Rows") in the following. The data 115 (or data blocks) that have to be managed (that is to say read and written) by the control device are placed into a virtual memory 140 having a virtual address space 141, which is likewise uniformly divided into virtual or logical rows 142. The allocation 130 (also referred to as "Mapping") between the virtual rows 142 and the physical rows 122 is stored as management information in the physical rows 122 and there, inter alia, in the header area 123 ("Header") and / or the footer area 124 ("Footer") or redundantly in both here. Furthermore, the allocation can also be present in the executing software. The first few bytes of a row can be referred to as the header area of the row, and the last few bytes of a row can be referred to as the footer area of the row. A row then consists of an effective data area and a header area and / or a footer area. As mentioned, the data in the header area and the footer area can be identical.

[0028] Physical rows 122 having cells that can no longer be written due to hardware defects are marked as defective in the management information and are thus mapped out, as is the last (from above, that is to say the lowermost) row 122 in the example shown.

[0029] In general, the storage medium 120 is not completely filled. Free sub-areas, that is to say physical rows 122 that are not used, are marked as reserves in the management information and can thus be permitted for a change (for example a rotation of rows) or an extension in terms of mapping (storage of new data), as are the fifth and sixth (from above) rows 122 in the example shown, which are not allocated to a virtual row.

[0030] Examples of such an allocation or such a mapping should be set out subsequently, and the following assumptions are made:

[0031] Physical address space: 0x1C80000 - 0x1C87FFFF

[0032] Size of the physical memory: 512 kB

[0033] Selected size of the physical rows: 1024 B (multiple of bits on a word line)

[0034] Size of the management information (header, footer) per row: 2 * 16 B = 32 B.

[0035] For this purpose, it should be noted that, in terms of the size of the physical rows, a multiple of bits on a word line is important to the extent that errors on individual word lines can be handled appropriately thereby.

[0036] From this it follows that:

[0037] Number of rows: 512 kB / 1 kB = 512

[0038] Size of a logical (virtual) row (effective data): 1024 B - 32 B = 992 B

[0039] Total management information: 512 * 32 B = 16 kB

[0040] Total size of virtual memory: 512 kB - 16 kB = 496 kB = 992 B * 512

[0041] Address space of virtual memory: 0x00000 - 0x7BFFF.

[0042] As explained in the Figure 2 Now each 128 B data is written to the free storage medium in the mentioned order to the following addresses:

[0043] 1. Virtual address 0x00000: 0x00000 / 992 = 0, remainder 0

[0044] Data 210 is put into logical row ID 000 with offset 0.

[0045] 2. Virtual address 0x3DF80: 0x3DF80 / 992 = 255, remainder 864

[0046] Data 210 is put into logical row ID 255 with offset 864.

[0047] 3. Virtual address 0x3E000: 0x3E000 / 992 = 256, remainder 0

[0048] Data 210 is put into logical row ID 256 with offset 0.

[0049] 4. Virtual address 0x7BF80: 0x7BF80 / 992 = 511, remainder 864

[0050] Data 210 is put into logical row ID 511 with offset 0.

[0051] Since at the beginning no rows are stored in the storage medium, the new rows are physically put at the next free addresses, respectively. In correspondence with this, there is no fixed assignment between the physical and the logical addresses, but the assignment is derived from the ID. Here, the ID is part of the management information.

[0052] from which the memory image 200 shown in Figure 2 In this example, there are then also 508 unused lines (denoted with #FREE) as reserve at one's disposal. In contrast, it is always possible to explicitly identify which virtual address these data belong to by means of the ID of the logical line and the offset of the data within this line.

[0053] In addition to this mapping, according to one embodiment, a sequence counter (denoted here by cnt) is also stored as management information. With the help of this sequence counter it is possible to identify the age of a line. With every write of data into a hitherto unused line, this line is newly compiled and is assigned (mapped), respectively, a clear ID matching the virtual address as part of the management information. Every new line obtains an incremented sequence counter as further part of the management information, that is to say the greater the value, the newer the line.

[0054] With every write of data into a line that has already been used, the corresponding area is overwritten, the ID and the sequence counter remain unchanged. Frequent writing into the same (physical) line places a very heavy burden on these lines. In order to avoid this, these lines are also repeatedly rotated on the storage medium, in particular whenever one or more criteria are met. Such criteria are, for example: for every programming task, the amount of data programmed (transiently in RAM) is counted. When a configured limit value is exceeded, a rotation is triggered and the counter is reset to zero. This limit value can be, for example, 30 times the physical line, that is to say 30 kB for a physical line length of 1 kB. In particular in systems in which only very little data is programmed, alternatively or additionally, a rotation can be forced at every first programming task and / or at every first start of the computing unit, independently of the counter. Forcing a rotation at the first write guarantees that a rotation takes place even in the case of low write load. If a rotation always only takes place starting from a minimum number of bytes written, it can happen that in every individual power-on cycle this minimum number is not reached and thus a rotation never takes place. By forcing a rotation at the first write, a rotation reliably takes place and thereby forces an even load.

[0055] In Figure 3In the two examples shown (top and bottom), the rotation is performed, for example, as follows: of the existing eight logical lines, five logical lines are occupied, which have the sequence counter cnt=0 (oldest) up to cnt=4 (newest). Every two lines are rotated. Here, the initial state before the rotation is shown on the left side, while the state after the rotation is shown on the right side. The oldest and the newest line, respectively, are relevant in the rotation and are marked with arrows. The oldest line is migrated behind the newest line. The dashed arrows represent the oldest (top) or the newest (bottom) line after the first rotation; thus, they represent the intermediate state between the left image (initial state) and the right image (state after two rotations). In both cases, the two oldest lines, that is, the lines with the smallest counter value, are rotated. Since a new write to a line always uses the next free line, a continuous free area remains in general (as long as no defective line is picked up in between).

[0056] By rotating the data within a line, for example, not only the logical lines are physically rotated, but additionally the data within a line is rotated, "wear leveling" can be further improved. For example, the logical lines can be regarded as a circular memory and the contained data is moved by a fixed offset at certain (time) intervals or periodically (here the criterion could be, for example, the amount of data programmed into a line), which offset is then deposited as part of the management information. This offset then represents the physical address 0x0 in the line.

Claims

1. Method for operating a storage medium (120), which provides a non-volatile memory on which data (115) can be stored in a physical address space (121), wherein the data (115) is written into the memory and / or read from the memory in such a way that a virtual address space (141) is addressed, which is mapped into the physical address space (121) in accordance with an alterable allocation (130), wherein physical sub-areas (122) are provided on the storage medium (120), which are allocated virtual sub-areas (142) in accordance with the alterable allocation (130), which are addressed by means of the virtual address space (141), and wherein the allocation (130) is repeatedly altered and in doing so the data is transferred to other physical sub-areas (122) while maintaining the location of the data in the virtual sub-areas (142), characterized in that a sequence counter is stored in the physical sub-areas (122) as management information to identify the age of the physical sub-areas, the allocation (130) is altered if at least one criterion is fulfilled, wherein the at least one criterion comprises: a start-up of a computing unit (100), which comprises the storage medium (120); and / or a pre-given amount of data which is written into the memory and / or sub-areas; and / or a pre-given number of write processes of the memory and / or the sub-areas, and one or more oldest, count value-minimal physical sub-areas (122) are identified using the sequence counter and the oldest physical sub-areas are migrated behind the newest physical sub-areas.

2. Method according to claim 1, wherein the allocation (130) is stored in the physical sub-areas (122).

3. Method according to claim 1 or 2, wherein the allocation is altered if there is a defect in a physical sub-area and in doing so the physical sub-area (122) with the defect is not allocated to a virtual sub-area in accordance with the allocation (130).

4. Method according to any one of the preceding claims, wherein a physical sub-area (122) is allocated to a virtual sub-area (142) only when data (115) is stored in the virtual sub-area (142).

5. Method according to any one of the preceding claims, wherein one or more physical sub-areas (122) are not allocated to a corresponding virtual sub-area at least initially in accordance with the allocation (130) and are reserved as a reserve.

6. Method according to any one of the preceding claims, wherein an EEPROM, a phase change memory or a magnetoresistive random access memory is used as storage medium (120).

7. Computing unit (100) with a storage medium (120), which is set up to carry out all method steps of the method according to any one of the preceding claims. ​ ​ ​ ​ ​ ​ ​ 8. The computing unit (100) according to claim 7, configured as a control device, in particular as a control device of a vehicle.

9. Computer program product having a computer program which, when executed on a computing unit (100), causes the computing unit (100) to perform all the method steps of the method according to any one of claims 1 to 6.

10. Machine-readable storage medium having stored thereon a computer program which, when executed on a computing unit (100), causes the computing unit (100) to perform all the method steps of the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Storage device, storage system and method of virtualizing storage device

    CN102810068A

  • Mapping-based wear leveling for non-volatile memory

    US20190310780A1