CN114168370A - Method and device for realizing real-time operating system RAM diagnosis and computer equipment - Google Patents

Method and device for realizing real-time operating system RAM diagnosis and computer equipment Download PDF

Info

Publication number
CN114168370A
CN114168370A CN202010953847.7A CN202010953847A CN114168370A CN 114168370 A CN114168370 A CN 114168370A CN 202010953847 A CN202010953847 A CN 202010953847A CN 114168370 A CN114168370 A CN 114168370A
Authority
CN
China
Prior art keywords
diagnosis
address
ram
memory
interrupt service
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
CN202010953847.7A
Other languages
Chinese (zh)
Inventor
马忠刚
李萌
王晓伟
裴红伟
程康
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.)
China Techenergy Co Ltd
Original Assignee
China Techenergy Co Ltd
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 China Techenergy Co Ltd filed Critical China Techenergy Co Ltd
Priority to CN202010953847.7A priority Critical patent/CN114168370A/en
Publication of CN114168370A publication Critical patent/CN114168370A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0706Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
    • G06F11/073Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in a memory management context, e.g. virtual memory or cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0751Error or fault detection not based on redundancy
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/079Root cause analysis, i.e. error or fault diagnosis
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11CSTATIC STORES
    • G11C29/00Checking stores for correct operation ; Subsequent repair; Testing stores during standby or offline operation
    • G11C29/04Detection or location of defective memory elements, e.g. cell constructio details, timing of test signals
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11CSTATIC STORES
    • G11C29/00Checking stores for correct operation ; Subsequent repair; Testing stores during standby or offline operation
    • G11C29/04Detection or location of defective memory elements, e.g. cell constructio details, timing of test signals
    • G11C29/08Functional testing, e.g. testing during refresh, power-on self testing [POST] or distributed testing
    • G11C29/12Built-in arrangements for testing, e.g. built-in self testing [BIST] or interconnection details
    • G11C29/18Address generation devices; Devices for accessing memories, e.g. details of addressing circuits
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11CSTATIC STORES
    • G11C29/00Checking stores for correct operation ; Subsequent repair; Testing stores during standby or offline operation
    • G11C29/04Detection or location of defective memory elements, e.g. cell constructio details, timing of test signals
    • G11C29/08Functional testing, e.g. testing during refresh, power-on self testing [POST] or distributed testing
    • G11C29/12Built-in arrangements for testing, e.g. built-in self testing [BIST] or interconnection details
    • G11C29/44Indication or identification of errors, e.g. for repair
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11CSTATIC STORES
    • G11C29/00Checking stores for correct operation ; Subsequent repair; Testing stores during standby or offline operation
    • G11C29/04Detection or location of defective memory elements, e.g. cell constructio details, timing of test signals
    • G11C2029/0409Online test

Abstract

The application discloses a method and a device for realizing real-time operating system RAM diagnosis and computer equipment. The method for realizing the RAM diagnosis of the real-time operating system comprises the following steps: starting a RAM diagnosis process and entering an initialization state; receiving a diagnosis instruction for starting the RAM; establishing a RAM diagnosis thread according to the RAM diagnosis instruction, and starting an interrupt service program; calculating a memory diagnosis address by using the RAM diagnosis thread; and according to the memory diagnosis address, performing RAM diagnosis by using an interrupt service program. According to the method, the device and the computer equipment for realizing the RAM diagnosis of the real-time operating system, the RAM diagnosis process is started, the RAM diagnosis state is entered, the RAM diagnosis starting instruction is received, the RAM diagnosis thread is established according to the RAM diagnosis instruction, the interrupt service program is started, the RAM diagnosis address is calculated by using the RAM diagnosis thread, the RAM diagnosis is carried out by using the interrupt service program according to the RAM diagnosis address, the full coverage of the RAM diagnosis can be realized, and the diagnosis efficiency is improved.

Description

Method and device for realizing real-time operating system RAM diagnosis and computer equipment
Technical Field
The application relates to the technical field of nuclear power instrument control systems, in particular to a method and a device for realizing real-time operating system RAM diagnosis and computer equipment.
Background
According to the software requirements of IEC60880 standard class a security functions, self-monitoring of hardware needs to be met. When the system is in an operating state, it is one of effective ways to improve reliability to diagnose a Random Access Memory (RAM). In view of the field of Distributed Control Systems (DCS), which have high requirements on safety and reliability, diagnostic information about a fault needs to be transmitted and reported in time. Therefore, the RAM is periodically diagnosed, and the fault diagnosis time can be shortened, so that the purposes of high safety and high reliability are achieved.
Currently, embedded RAM diagnostic products are mainly classified into two categories: no operating system and an operating system. RAM diagnosis under the condition of no operating system is relatively mature, all functions are executed according to a fixed period sequence, a March C algorithm is adopted to diagnose the RAM, and a fixed-size memory is diagnosed according to requirements in each period. RAM diagnosis under no operating system, and the mapping condition of virtual memory and physical memory is not considered, and the program is in a sequential execution mode without concurrency possibility, so that the method cannot be applied to RAM diagnosis under a real-time operating system. In the case of an operating system, the RAM diagnosis is generally not performed, and at most, partial RAM diagnosis (continuous memory check) is performed in the boot stage, so that the periodic RAM diagnosis in the real-time operating system cannot be satisfied.
Disclosure of Invention
The object of the present application is to solve at least to some extent one of the above mentioned technical problems.
Therefore, a first objective of the present application is to provide a method for implementing real-time operating system RAM diagnosis, which can implement full coverage of memory diagnosis and improve diagnosis efficiency.
The second purpose of the present application is to provide a real-time operating system RAM diagnosis implementation apparatus.
A third object of the present application is to propose a computer device.
A fourth object of the present application is to propose a non-transitory computer-readable storage medium
In order to achieve the above object, an embodiment of a first aspect of the present application provides a real-time operating system RAM diagnosis implementation method, including:
starting a RAM diagnosis process and entering an initialization state;
receiving a diagnosis instruction for starting the RAM;
creating a RAM diagnosis thread according to the RAM diagnosis instruction, and starting an interrupt service program;
calculating a memory diagnosis address by using the RAM diagnosis thread;
and according to the memory diagnosis address, performing RAM diagnosis by using the interrupt service program.
Optionally, the method further comprises:
shutting down all interrupts in an operating system prior to performing RAM diagnostics with the interrupt service routine;
after RAM diagnostics are performed with the interrupt service routine, all interrupts in the operating system are turned on.
Optionally, entering an initialization state includes:
checking memory address range validity, initializing interface information state, memory address mapping, and mapping physical memory to process address space.
Optionally, the memory diagnostic address includes an address line address and a data address, and the calculating the memory diagnostic address by using the RAM diagnostic thread includes:
determining the diagnosis type of the current RAM diagnosis, and determining a memory diagnosis initial address according to the diagnosis type, wherein the diagnosis type comprises address line detection and data detection;
calculating address lines and updating address line detection counts;
calculating a data address;
the data detection percentage is updated.
Optionally, performing RAM diagnosis by using the interrupt service program according to the memory diagnosis address includes:
and utilizing the interrupt service program to perform address line diagnosis and data diagnosis.
Optionally, the address line diagnosis by using the interrupt service routine includes:
backing up base address and test address data, and storing the memory address content to a register;
respectively writing specific mode words in the base address and the test address, and acquiring a first test value;
writing back the memory address content in the register to the test address, and acquiring a second test value;
comparing the first test value with the second test value;
if the two are the same, the diagnosis is passed;
if not, the diagnosis fails.
Optionally, the data diagnosis by using the interrupt service routine includes:
backing up the content of the diagnosed data;
writing a specific mode word in the test address to diagnose the memory address data and acquiring a third test value;
writing back the backup diagnosed data content to the test address, and acquiring a fourth test value;
comparing the third test value with the fourth test value;
if the two are the same, the diagnosis is passed;
if not, the diagnosis fails.
According to the method for realizing the RAM diagnosis of the real-time operating system, the RAM diagnosis process is started, the RAM diagnosis process enters the initialization state, the RAM diagnosis starting instruction is received, the RAM diagnosis thread is established according to the RAM diagnosis instruction, the interrupt service program is started, the RAM diagnosis address is calculated by using the RAM diagnosis thread, the RAM diagnosis is carried out by using the interrupt service program according to the RAM diagnosis address, the full coverage of the RAM diagnosis can be realized, and the diagnosis efficiency is improved.
In order to achieve the above object, a second embodiment of the present application provides a real-time operating system RAM diagnosis implementation apparatus, including:
the starting module is used for starting the RAM diagnosis process and entering an initialization state;
the receiving module is used for receiving a diagnosis instruction of starting the RAM;
the creating module is used for creating a RAM diagnosis thread according to the RAM diagnosis instruction and starting an interrupt service program;
the computing module is used for computing a memory diagnostic address by utilizing the RAM diagnostic thread;
and the diagnosis module is used for diagnosing the RAM by utilizing the interrupt service program according to the memory diagnosis address.
Optionally, the apparatus further comprises:
the interrupt control module is used for closing all interrupts in the operating system before RAM diagnosis is carried out by utilizing the interrupt service program; after RAM diagnostics are performed with the interrupt service routine, all interrupts in the operating system are turned on.
Optionally, the starting module is configured to:
checking memory address range validity, initializing interface information state, memory address mapping, and mapping physical memory to process address space.
Optionally, the memory diagnostic address includes an address line address and a data address, and the calculation module is configured to:
determining the diagnosis type of the current RAM diagnosis, and determining a memory diagnosis initial address according to the diagnosis type, wherein the diagnosis type comprises address line detection and data detection;
calculating address lines and updating address line detection counts;
calculating a data address;
the data detection percentage is updated.
Optionally, the diagnostic module is configured to:
and utilizing the interrupt service program to perform address line diagnosis and data diagnosis.
Optionally, the diagnostic module is specifically configured to:
backing up base address and test address data, and storing the memory address content to a register;
respectively writing specific mode words in the base address and the test address, and acquiring a first test value;
writing back the memory address content in the register to the test address, and acquiring a second test value;
comparing the first test value with the second test value;
if the two are the same, the diagnosis is passed;
if not, the diagnosis fails.
Optionally, the diagnostic module is specifically configured to:
backing up the content of the diagnosed data;
writing a specific mode word in the test address to diagnose the memory address data and acquiring a third test value;
writing back the backup diagnosed data content to the test address, and acquiring a fourth test value;
comparing the third test value with the fourth test value;
if the two are the same, the diagnosis is passed;
if not, the diagnosis fails.
According to the device for realizing the RAM diagnosis of the real-time operating system, the RAM diagnosis process is started, the RAM diagnosis process enters the initialization state, the RAM diagnosis starting instruction is received, the RAM diagnosis thread is established according to the RAM diagnosis instruction, the interrupt service program is started, the RAM diagnosis address is calculated by using the RAM diagnosis thread, the RAM diagnosis is carried out by using the interrupt service program according to the RAM diagnosis address, the full coverage of the RAM diagnosis can be realized, and the diagnosis efficiency is improved.
In order to achieve the above object, an embodiment of a third aspect of the present application provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the computer program to implement the real-time operating system RAM diagnosis implementation method according to the embodiment of the first aspect.
In order to achieve the above object, a non-transitory computer-readable storage medium is further provided in a fourth embodiment of the present application, where a computer program is stored on the non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements the real-time operating system RAM diagnosis implementation method according to the first embodiment.
Additional aspects and advantages of the present application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the present application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate embodiments of the application and, together with the description, serve to explain the application and are not intended to limit the application. In the drawings:
FIG. 1 is a flow diagram of a real-time operating system RAM diagnostic implementation method according to one embodiment of the present application;
FIG. 2 is a flow chart of computing a memory diagnostic address according to one embodiment of the present application;
FIG. 3 is a flow diagram of address line diagnostics for one embodiment of the present application;
FIG. 4 is a flow chart of data diagnostics according to an embodiment of the present application;
FIG. 5 is a flow diagram of a real-time operating system RAM diagnostic implementation method of another embodiment of the present application;
FIG. 6 is a flow diagram of a method for implementing real-time operating system RAM diagnostics according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a diagnostic run module according to an exemplary embodiment of the present application;
FIG. 8 is a schematic structural diagram of a real-time operating system RAM diagnosis implementation apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a real-time operating system RAM diagnosis implementation apparatus according to another embodiment of the present application.
Detailed Description
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
The present application is described in further detail below with reference to specific examples, which should not be construed as limiting the scope of the invention as claimed.
The following describes a real-time operating system RAM diagnostic implementation method, apparatus, and computer device according to embodiments of the present application with reference to the accompanying drawings.
Fig. 1 is a flowchart of a real-time operating system RAM diagnosis implementation method according to an embodiment of the present application, and as shown in fig. 1, the method includes the following steps:
s1, the RAM diagnostic process is started and an initialization state is entered.
Entering an initialization state specifically includes:
checking memory address range validity, initializing interface information state, memory address mapping, and mapping physical memory to process address space.
And S2, receiving a starting RAM diagnosis instruction.
S3, creating a RAM diagnosis thread according to the RAM diagnosis instruction and starting an interrupt service program.
S4, the RAM diagnosis thread is used for calculating the memory diagnosis address.
The memory diagnostic address comprises an address line address and a data address.
As shown in fig. 2, the step of calculating the memory diagnostic address specifically includes the following steps:
and S41, determining the diagnosis type of the current RAM diagnosis, and determining the initial address of the memory diagnosis according to the diagnosis type.
The diagnostic types include address line detection and data detection.
And S42, calculating the address line address and updating the address line detection count.
And S43, calculating the data address.
And S44, updating the data detection percentage.
And S5, according to the memory diagnosis address, using the interrupt service program to diagnose the RAM.
RAM diagnostics using interrupt service routines can be divided into two categories: the first category is address line diagnostics and the second category is data diagnostics.
As shown in fig. 3, the address line diagnosis using the interrupt service routine includes:
and S51, backing up the base address and the test address data, and storing the memory address content in a register.
S52, writing special pattern words in the base address and the test address respectively, and obtaining the first test value.
S53, the memory address content in the register is written back to the test address, and the second test value is obtained.
And S54, comparing the first test value with the second test value.
S55, if the two are the same, the diagnosis is passed.
S56, if not, the diagnosis fails.
As shown in fig. 4, the data diagnosis using the interrupt service routine includes:
and S57, backing up the content of the diagnosed data.
And S58, writing a specific pattern word in the test address to diagnose the memory address data and acquiring a third test value.
And S59, writing back the backup diagnosed data content to the test address and acquiring a fourth test value.
S510, comparing the third test value with the fourth test value.
And S511, if the two are the same, the diagnosis is passed.
S512, if the difference is not the same, the diagnosis is failed.
According to the method for realizing the RAM diagnosis of the real-time operating system, the RAM diagnosis process is started, the RAM diagnosis process enters the initialization state, the RAM diagnosis starting instruction is received, the RAM diagnosis thread is established according to the RAM diagnosis instruction, the interrupt service program is started, the RAM diagnosis address is calculated by using the RAM diagnosis thread, the RAM diagnosis is carried out by using the interrupt service program according to the RAM diagnosis address, the full coverage of the RAM diagnosis can be realized, and the diagnosis efficiency is improved.
In another embodiment of the present application, as shown in fig. 5, the method for implementing real-time operating system RAM diagnosis further includes:
s6, before the RAM diagnosis is carried out by the interrupt service program, all the interrupts in the operating system are closed.
S7, after the RAM diagnostics are performed with the interrupt service routine, all interrupts in the operating system are turned on.
And based on the process mode, an interrupt service program is adopted to acquire the right of diagnosing the RAM with the highest priority, so that the problem of concurrent memory access among processes can be avoided.
The following is a detailed description of a specific embodiment.
In the prior art, RAM diagnostics need to solve several problems:
how to realize RAM diagnosis under a real-time operating system;
2, the real-time operating system generally adopts a virtual memory technology and needs virtual memory and physical memory mapping;
3, during the RAM diagnosis, other processes or interruption are prevented from accessing the same memory address;
4RAM diagnostics cannot affect the operation of the operating system;
how to solve the diagnosis of the memory in the stack area.
In view of the above problems, the present application provides an effective method for implementing continuous cycle RAM diagnostics in a real-time operating system. The method uses assembly language in the interrupt service program, adopts given mode word to diagnose the hardware RAM by bit, including address line diagnosis and data diagnosis. The method can simultaneously carry out stack diagnosis, thereby realizing the diagnosis of all memories.
The specific design is as follows:
the RAM diagnosis function adopts an independent process, the QNX operating system automatically runs the RAM diagnosis process after being started, the priority of the process is set to be the highest, and the priority of the process can be set to be 255 in the current embodiment.
The RAM diagnostic contains the entire memory area used by the operating system and therefore also includes the stack area. When the physical memory is mapped to the address space of the RAM diagnosis process, cache caching operation is forbidden. That is, RAM diagnostics directly access physical memory bypassing cache.
In the RAM diagnostic process, it has a main thread itself, and then includes a diagnostic management thread and an interrupt service routine.
(1) The main thread, responsible for initializing RAM diagnostics, starting the diagnostics management thread, and communicating with the user application using messages.
(2) The diagnosis management thread mainly comprises the following functions: I/O access permissions, thread priority, address line diagnostics and data diagnostics data structure initialization, reading IRQ clocks, initializing signal events, starting interrupt service routines, and memory diagnostics management.
The memory diagnosis management mainly comprises the steps of obtaining the next physical memory address and outputting a diagnosis result through an interface.
(3) The interrupt service program adopts assembly language to execute memory address line diagnosis and data diagnosis, and can be triggered once every 1 ms.
And under a real-time operating system, performing memory diagnosis by using an interrupt service program. All interrupts of the system are closed before the memory diagnosis is finished, and all interrupts of the system are opened after the memory diagnosis is finished, so that the possibility that other processes or threads operate the same memory address at the same time during the memory diagnosis is avoided. The interrupt interval is 1ms, and the interrupt is too frequent, which affects the system operation efficiency, so the interrupt interval setting and the diagnostic size can be set according to the application requirement, for example, the memory diagnosis is set to be executed once in 100ms, and the diagnostic size is 128 bytes. And realizing the mapping of the virtual memory to the physical memory by calling the kernel interface, and realizing the access of the physical memory.
The main flow of RAM diagnostics can be as shown in fig. 6.
S601, starting a RAM diagnosis process.
S602, starting the RAM diagnosis instruction.
And S603, outputting the state.
S604, starting the interrupt processing function. (interrupt service routine)
And S605, starting a diagnosis thread.
S606, outputting the RAM diagnosis state.
The functions of the functional modules are described in detail below.
An initialization module: after starting the RAM diagnosis process, the system enters an initialization state, checks the validity of the memory address range, initializes the interface information state, maps the memory address and maps the physical memory to the process address space. Waiting for an interface message to start the RAM diagnosis instruction, if the RAM diagnosis instruction is received, creating a RAM diagnosis thread, and starting an interrupt service program.
An interface module: adopting a message mechanism to acquire RAM diagnosis state information, wherein the state information comprises: RAM diagnostic status, error code, operating system error code, erroneous memory address, error count, data line diagnostic count, address line diagnostic count, RAM diagnostic percentage, current diagnostic memory address, etc.
A diagnostic run module: specifically, the diagnostic thread and the interrupt service routine can be included, as shown in fig. 7.
The diagnostic thread is mainly responsible for computing the memory diagnostic address. The memory diagnostic address comprises an address line address and a data address.
First, whether address line diagnosis or data diagnosis is performed is checked to determine a diagnosis memory start address. Then, address line addresses are calculated, and address line diagnostic counts are updated. After that, the data address is calculated, and the physical address executed by the assembler part is backed up for data detection. And calculating the next memory virtual address and converting the virtual address into a physical address. Finally, the data diagnosis percentage is updated.
The address line diagnosis execution condition is that the diagnosis address is a base address or a complete RAM diagnosis is completed, and the data diagnosis can be executed only after the address line diagnosis.
The interrupt service routine is described in detail below.
The interrupt service routine is mainly responsible for memory diagnosis, including address line diagnosis and data diagnosis.
Address line diagnosis: starting a RAM base address, accumulating an address space of 256MB every time, executing address line detection by an assembler program part, updating the diagnosis progress, and recording an error code and an internal memory address where the error exists if the detection fails;
and (3) data diagnosis: the assembler program part detects 128 bytes of memory each time according to the mode words, calculates the next detection address, updates the diagnosis progress, and records error codes and the memory address where the error exists if the detection fails.
Specifically, the principles of address line diagnostics are as follows:
and backing up the base address and the test address data, reading the memory address content, and storing the memory address content in a specified register. The base address and the test address are each written to a different specific pattern word (a group of pattern words can cover all bits of 4 bytes of memory). The contents of the memory address in the register are compared to the specific pattern word. If the two are not the same, an error is returned.
And determining that the base address and the test address do not belong to the memory address of the code segment executed by the current application program. The method comprises the following specific steps: and 3 assembly functions with the same diagnostic codes are set for avoiding the condition that the current memory address happens to be in the stack area diagnostic address. They are the same as the currently executed assembler program pointer address, thus realizing address line diagnosis full coverage.
And storing the original data of the diagnosis address line memory. And writing 2 different mode words into the detection address, and detecting whether the written value is correct. Taking the mode words 0xaaaaaa, 0x 555555555555 as an example, first the 0xaaaaaa is written to the test address, and second the test address is written to 0x 55555555. Read the current check address value, check if it is not equal to 0xaaaaaa, and is equal to 0x 555555555555. And after the detection is finished, writing back the backup original data to the test address, reading the numerical value of the current test address, and judging whether the backup original data is the same as the backup original data. If not, the diagnosis is failed, and the fault is returned.
Specifically, the principle of data diagnosis is as follows: 128 bytes are diagnosed each time, 4 bytes are diagnosed each time by the assembly part, the diagnosed 4-byte address original data is saved before diagnosis, and the saved original data is restored after diagnosis. The test address reads and writes a plurality of different bit pattern words and detects whether the reading and writing is correct. And determining that the test address does not belong to the memory address of the code segment executed by the current application program. The method comprises the following specific steps: and 3 assembly functions with the same diagnostic codes are set for avoiding the condition that the current memory address happens to be in the stack area diagnostic address. They are the same as the currently executed assembler program pointer address, thus realizing address line diagnosis full coverage.
And storing the diagnosed memory address data. Take a specific set of mode words (the set of mode words can cover all bits of 4 bytes of memory) as an example. The following values (0xAA000000,0x55000000,0x00AA0000,0x00550000,0x0000AA00,0x00005500,0x000000AA,0x00000055,0xAAFFFFFF,0x55FFFFFF,0 xfffafff, 0 xfffffaaff, 0xFFFFFF55 FF,0 xfffffffffaa, 0 xffffffff 55) are sequentially written and read, and the detection process is as follows: in the assembler program segment, writing 0xAA000000 in the current detection address, then reading the memory data of the current detection address, checking whether the memory data is equal to 0xAA000000, if the diagnosis is failed, returning a fault code, and performing next mode word diagnosis. And after all the pattern words are diagnosed, writing back the backup original data into the current test address, reading the numerical value of the current test address, and judging whether the numerical value is the same as the backup data. If not, the diagnosis is failed, and the fault is returned.
The method for diagnosing the periodic RAM of the real-time operating system uses a high-priority process, and an interrupt service program is created in the process to diagnose the memory. Under the condition that the interrupt is generated, all other interrupts in the system are closed firstly, and after the RAM diagnosis is completed, all the interrupts in the system are opened, so that the problem of concurrent memory access among processes is avoided. The diagnostic result is communicated with external communication through a messaging mechanism.
In addition, the mapping of the virtual memory and the physical memory is realized under a real-time operating system. And mapping the physical memory to an address space of the RAM diagnosis process through kernel interface operation, thereby realizing the access of the physical address and prohibiting the cache.
In addition, 100% coverage (including stack area) of memory diagnostics is also achieved. The 3 assembler codes detected by the memory address line are the same, so that the purpose of avoiding that the RAM diagnosis memory address is the same as the address of the address line diagnosis assembler program segment. The 3 assembler codes of the memory data diagnosis are the same, so that the purpose is to avoid that the memory data address of the diagnosis RAM is the same as the address of the data diagnosis assembler program segment. The RAM diagnosis is carried out by adopting a mode of a group of mode words, the RAM diagnosis efficiency can be improved, and the diagnosis of all data bits can be covered. The set of pattern words are not fixed data, covering all memory data bits.
In order to implement the above embodiments, the present application further provides a device for implementing real-time operating system RAM diagnosis.
Fig. 8 is a schematic structural diagram of a real-time operating system RAM diagnosis implementation apparatus according to an embodiment of the present application.
As shown in fig. 8, the apparatus includes an activation module 81, a reception module 82, a creation module 83, a calculation module 84, and a diagnosis module 85.
A start module 81, configured to start the RAM diagnostic process and enter an initialization state.
The starting module 81 is specifically configured to check validity of a memory address range, initialize an interface information state, map a memory address, and map a physical memory to a process address space.
A receiving module 82, configured to receive a RAM diagnostic turn on instruction.
And the creating module 83 is used for creating a RAM diagnosis thread according to the RAM diagnosis instruction and starting an interrupt service program.
A calculation module 84 for calculating the memory diagnostic address using the RAM diagnostic thread.
The memory diagnostic address comprises an address line address and a data address. A calculation module 84 for: determining the diagnosis type of the current RAM diagnosis, and determining a memory diagnosis initial address according to the diagnosis type, wherein the diagnosis type comprises address line detection and data detection; calculating address lines and updating address line detection counts; calculating a data address; the data detection percentage is updated.
And the diagnosis module 85 is used for diagnosing the RAM by utilizing the interrupt service program according to the memory diagnosis address.
And the diagnosis module 85 is used for performing address line diagnosis and data diagnosis by using an interrupt service program.
The diagnostic module 85 is specifically configured to: backing up base address and test address data, and storing the memory address content to a register; respectively writing specific mode words in the base address and the test address, and acquiring a first test value; writing back the memory address content in the register to the test address, and acquiring a second test value; comparing the first test value with the second test value; if the two are the same, the diagnosis is passed; if not, the diagnosis fails.
The diagnostic module 85 is specifically configured to: backing up the content of the diagnosed data; writing a specific mode word in the test address to diagnose the memory address data and acquiring a third test value; writing back the backup diagnosed data content to the test address, and acquiring a fourth test value; comparing the third test value with the fourth test value; if the two are the same, the diagnosis is passed; if not, the diagnosis fails.
In another embodiment of the present application, as shown in FIG. 9, the apparatus further includes an interrupt control module 86.
An interrupt control module 86 for shutting down all interrupts in the operating system prior to performing RAM diagnostics with the interrupt service routine; after the RAM diagnostics are performed with the interrupt service routine, all interrupts in the operating system are turned on.
It should be understood that the real-time operating system RAM diagnosis implementation apparatus of this embodiment is consistent with the description of the real-time operating system RAM diagnosis implementation method of the first aspect, and is not described herein again.
According to the device for realizing the RAM diagnosis of the real-time operating system, the RAM diagnosis process is started, the RAM diagnosis process enters the initialization state, the RAM diagnosis starting instruction is received, the RAM diagnosis thread is established according to the RAM diagnosis instruction, the interrupt service program is started, the RAM diagnosis address is calculated by using the RAM diagnosis thread, the RAM diagnosis is carried out by using the interrupt service program according to the RAM diagnosis address, the full coverage of the RAM diagnosis can be realized, and the diagnosis efficiency is improved.
In order to implement the above embodiments, the present application also provides a computer device.
The computer device comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, and when the processor executes the computer program, the real-time operating system RAM diagnosis implementation method as the embodiment of the first aspect is implemented.
To implement the above embodiments, the present application also proposes a non-transitory computer-readable storage medium.
The non-transitory computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements a real-time operating system RAM diagnostic implementation method as an embodiment of the first aspect.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It should be noted that in the description of the present specification, reference to the description of the term "one embodiment", "some embodiments", "example", "specific example", or "some examples", etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present application. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
In the description herein, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.

Claims (10)

1. A method for realizing real-time operating system RAM diagnosis is characterized by comprising the following steps:
starting a RAM diagnosis process and entering an initialization state;
receiving a diagnosis instruction for starting the RAM;
creating a RAM diagnosis thread according to the RAM diagnosis instruction, and starting an interrupt service program;
calculating a memory diagnosis address by using the RAM diagnosis thread;
and according to the memory diagnosis address, performing RAM diagnosis by using the interrupt service program.
2. The method of claim 1, further comprising:
shutting down all interrupts in an operating system prior to performing RAM diagnostics with the interrupt service routine;
after RAM diagnostics are performed with the interrupt service routine, all interrupts in the operating system are turned on.
3. The method of claim 1, wherein entering an initialization state comprises:
checking memory address range validity, initializing interface information state, memory address mapping, and mapping physical memory to process address space.
4. The method of claim 1, wherein the memory diagnostic address comprises an address line address and a data address, and wherein computing the memory diagnostic address using the RAM diagnostic thread comprises:
determining the diagnosis type of the current RAM diagnosis, and determining a memory diagnosis initial address according to the diagnosis type, wherein the diagnosis type comprises address line detection and data detection;
calculating address lines and updating address line detection counts;
calculating a data address;
the data detection percentage is updated.
5. The method of claim 1, wherein performing RAM diagnostics with the interrupt service routine based on the memory diagnostic address comprises:
and utilizing the interrupt service program to perform address line diagnosis and data diagnosis.
6. The method of claim 5, wherein utilizing the interrupt service routine for address line diagnostics comprises:
backing up base address and test address data, and storing the memory address content to a register;
respectively writing specific mode words in the base address and the test address, and acquiring a first test value;
writing back the memory address content in the register to the test address, and acquiring a second test value;
comparing the first test value with the second test value;
if the two are the same, the diagnosis is passed;
if not, the diagnosis fails.
7. The method of claim 5, wherein using the interrupt service routine for data diagnostics comprises:
backing up the content of the diagnosed data;
writing a specific mode word in the test address to diagnose the memory address data and acquiring a third test value;
writing back the backup diagnosed data content to the test address, and acquiring a fourth test value;
comparing the third test value with the fourth test value;
if the two are the same, the diagnosis is passed;
if not, the diagnosis fails.
8. A real-time operating system (RAM) diagnosis implementation device is characterized by comprising:
the starting module is used for starting the RAM diagnosis process and entering an initialization state;
the receiving module is used for receiving a diagnosis instruction of starting the RAM;
the creating module is used for creating a RAM diagnosis thread according to the RAM diagnosis instruction and starting an interrupt service program;
the computing module is used for computing a memory diagnostic address by utilizing the RAM diagnostic thread;
and the diagnosis module is used for diagnosing the RAM by utilizing the interrupt service program according to the memory diagnosis address.
9. A computer device comprising a memory, a processor, and a computer program stored on the memory, the computer program when executed by the processor implementing the real-time operating system RAM diagnostic implementation method of any one of claims 1-7.
10. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, implements a real-time operating system, RAM, diagnostic implementation method as claimed in any one of claims 1-7.
CN202010953847.7A 2020-09-11 2020-09-11 Method and device for realizing real-time operating system RAM diagnosis and computer equipment Pending CN114168370A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010953847.7A CN114168370A (en) 2020-09-11 2020-09-11 Method and device for realizing real-time operating system RAM diagnosis and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010953847.7A CN114168370A (en) 2020-09-11 2020-09-11 Method and device for realizing real-time operating system RAM diagnosis and computer equipment

Publications (1)

Publication Number Publication Date
CN114168370A true CN114168370A (en) 2022-03-11

Family

ID=80475446

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010953847.7A Pending CN114168370A (en) 2020-09-11 2020-09-11 Method and device for realizing real-time operating system RAM diagnosis and computer equipment

Country Status (1)

Country Link
CN (1) CN114168370A (en)

Similar Documents

Publication Publication Date Title
US8812931B2 (en) Memory system with ECC-unit and further processing arrangement
US20060107130A1 (en) System and method of reading non-volatile computer memory
CN110375888B (en) Method and apparatus for diagnosing coolant temperature sensor, vehicle, and storage medium
GB2330672A (en) Storing and retrieving data in a control system eg in a motor vehicle
RU2269814C2 (en) Method for reliable recording of pointer for circular memory
US8611165B2 (en) Non-volatile memory device and electronic apparatus
CN114168370A (en) Method and device for realizing real-time operating system RAM diagnosis and computer equipment
US6829739B1 (en) Apparatus and method for data buffering
CN113625957B (en) Method, device and equipment for detecting hard disk faults
US11726853B2 (en) Electronic control device
US20090006893A1 (en) Information processing apparatus, diagnosis method, and computer program product
JP3203884B2 (en) Vehicle diagnostic system
CN113867805B (en) Method and system for constructing measurement chain compatible with trusted root based on firmware
CN113377421B (en) Method, device, equipment and medium for detecting software and hardware version information
US20230350820A1 (en) Systems and methods for concurrent logging and event capture
US8108740B2 (en) Method for operating a memory device
JPH03127241A (en) Memory control method for paging virtual storage system
CN106874161B (en) Method and device for processing cache exception
JPS592585Y2 (en) data processing equipment
CN114780271A (en) Hardware fault processing method and electronic equipment
CN116700224A (en) Method and device for detecting faults of functional safety mechanism of vehicle
CN112562774A (en) Storage device mounting method and device, computer device and storage medium
JPH04106647A (en) Memory diagnostic system
JPH1011317A (en) Digital controller
CN115048317A (en) Test method, test system, and computer-readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination